fix invisible dummies (#21)

This commit is contained in:
Galster-dev authored and GitHub committed 2021-04-13 19:36:08 +00:00
1 parent ae213c6b37
commit bc30ceeb33
2 files changed
+30 -1

No files matched your search

+4 -1
View File
@@ -66,8 +66,11 @@ namespace Reactor.Debugger
playerControl.transform.position = PlayerControl.LocalPlayer.transform.position;
playerControl.GetComponent<DummyBehaviour>().enabled = true;
playerControl.NetTransform.enabled = false;
playerControl.SetName("Dummy " + (i + 1));
playerControl.SetName($"{TranslationController.Instance.GetString(StringNames.Dummy, Array.Empty<Il2CppSystem.Object>())} {i}");
playerControl.SetColor((byte) (i % Palette.PlayerColors.Length));
playerControl.SetHat(i % (uint)HatManager.Instance.AllHats.Count, playerControl.Data.ColorId);
playerControl.SetPet(i % (uint)HatManager.Instance.AllPets.Count);
playerControl.SetSkin(i % (uint)HatManager.Instance.AllSkins.Count);
GameData.Instance.RpcSetTasks(playerControl.PlayerId, new byte[0]);
}
+26
View File
@@ -0,0 +1,26 @@
using System.Linq;
using HarmonyLib;
namespace Reactor.Patches
{
internal static class PlayerIdPatch
{
[HarmonyPatch(typeof(GameData), nameof(GameData.GetAvailableId))]
public static class GetAvailableIdPatch
{
public static bool Prefix(GameData __instance, out sbyte __result)
{
sbyte i = 0;
while (__instance.AllPlayers.ToArray().Any(p => p.PlayerId == i))
{
i++;
}
__result = i;
return false;
}
}
}
}