Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 16 additions & 11 deletions LevelImposter/Core/Patches/Ship/DummyPatch.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
using HarmonyLib;
using LevelImposter.Shop;
using LevelImposter.Core.Models;
using LevelImposter.Core.Components;
using LevelImposter.Core.Utils;
using System.Linq;

namespace LevelImposter.Core;
Expand All @@ -18,24 +21,26 @@ public static void Postfix(DummyBehaviour __instance)
return;
if (!GameState.IsInFreeplay)
return;
if(MapLoader.CurrentMap == null)
if (GameConfiguration.CurrentMap == null)
return;

// Since the game is in freeplay, removing the local player just leaves all the dummy PlayerControls
var dummyPlayers = PlayerControl.AllPlayerControls.ToArray().Where(p => p != PlayerControl.LocalPlayer).ToArray();
var dummyPlayers = PlayerControl.AllPlayerControls.ToArray()
.Where(p => p != PlayerControl.LocalPlayer)
.ToArray();

// Finds a dummy element that has a corresponding location index (see DummyBuilder)
// which matches this DummyBehaviour's PlayerControl
foreach (var elem in MapLoader.CurrentMap.elements)
// Match custom dummy elements to freeplay dummy players by build/order index.
var dummyElements = GameConfiguration.CurrentMap.elements
.Where(e => e.type == "util-dummy")
.ToArray();

for (var index = 0; index < dummyElements.Length && index < dummyPlayers.Length; index++)
{
if(elem.type != "util-dummy")
continue;
if (!LIShipStatus.GetInstance().DummyIndex.TryGetValue(elem.id, out int index))
continue;
if (__instance.myPlayer != dummyPlayers[index])
continue;

CustomizeDummy(__instance, elem);
CustomizeDummy(__instance, dummyElements[index]);
break;
}
}

Expand All @@ -46,4 +51,4 @@ private static void CustomizeDummy(DummyBehaviour dummy, LIElement element)
{
dummy.myPlayer.SetName(element.name);
}
}
}
4 changes: 2 additions & 2 deletions LevelImposter/LevelImposter.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

<PropertyGroup>
<AmongUs>C:\Program Files (x86)\Steam\steamapps\common\Among Us</AmongUs>
<GameVersion>2026.8.18</GameVersion>
<GameVersion>2026.9.29</GameVersion>
</PropertyGroup>

<ItemGroup>
Expand All @@ -51,4 +51,4 @@
<Target Name="Copy" AfterTargets="Build" Condition="'$(AmongUs)' != ''">
<Copy SourceFiles="$(TargetPath)" DestinationFolder="$(AmongUs)/BepInEx/plugins/" UseSymboliclinksIfPossible="true"/>
</Target>
</Project>
</Project>