mirror of
https://github.com/Gurge44/EndlessHostRoles.git
synced 2026-11-19 13:16:56 +00:00
smore fixes
This commit is contained in:
1 parent
330af450ce
commit
1a2125541f
10 files changed
+61
-53
No files matched your search
@@ -55,7 +55,7 @@ public class Main : BaseUnityPlugin
|
||||
public const string PluginGuid = "com.gurge44.endlesshostroles";
|
||||
public const string PluginVersion = "8.1.0";
|
||||
public const string PluginDisplayVersion = "8.1.0";
|
||||
public const int TestBuildNumber = 1; // 0 = Release
|
||||
public const int TestBuildNumber = 3; // 0 = Release
|
||||
|
||||
public const string NeutralColor = "#ffab1b";
|
||||
public const string ImpostorColor = "#ff1919";
|
||||
|
||||
+6
-5
@@ -5235,30 +5235,31 @@ public static class Utils
|
||||
|
||||
// Next 2: From MoreGamemodes by Rabek009
|
||||
|
||||
private static void CreateDeadBody(Vector3 position, byte colorId, PlayerControl deadBodyParent)
|
||||
private static void CreateDeadBody(Vector3 position, byte colorId, PlayerControl deadBodyParent, bool reportable)
|
||||
{
|
||||
int baseColorId = deadBodyParent.Data.DefaultOutfit.ColorId;
|
||||
deadBodyParent.Data.DefaultOutfit.ColorId = colorId;
|
||||
DeadBody deadBody = Object.Instantiate(GameManager.Instance.deadBodyPrefab[0]);
|
||||
deadBody.enabled = false;
|
||||
deadBody.enabled = reportable;
|
||||
deadBody.ParentId = deadBodyParent.PlayerId;
|
||||
deadBody.name = "FAKE";
|
||||
foreach (SpriteRenderer b in deadBody.bodyRenderers)
|
||||
deadBodyParent.SetPlayerMaterialColors(b);
|
||||
deadBodyParent.SetPlayerMaterialColors(deadBody.bloodSplatter);
|
||||
Vector3 vector = position + deadBodyParent.KillAnimations[0].BodyOffset;
|
||||
Vector3 vector = position + deadBodyParent.KillAnimations[0]!.BodyOffset;
|
||||
vector.z = vector.y / 1000f;
|
||||
deadBody.transform.position = vector;
|
||||
deadBodyParent.Data.DefaultOutfit.ColorId = baseColorId;
|
||||
}
|
||||
|
||||
public static void RpcCreateDeadBody(Vector3 position, byte colorId, PlayerControl deadBodyParent)
|
||||
public static void RpcCreateDeadBody(Vector3 position, byte colorId, PlayerControl deadBodyParent, bool reportable)
|
||||
{
|
||||
if (!deadBodyParent || !Main.IntroDestroyed || !AmongUsClient.Instance.AmHost) return;
|
||||
|
||||
DataFlagRateLimiter.Enqueue(() =>
|
||||
{
|
||||
if (!deadBodyParent) return;
|
||||
CreateDeadBody(position, colorId, deadBodyParent);
|
||||
CreateDeadBody(position, colorId, deadBodyParent, reportable);
|
||||
PlayerControl playerControl = Object.Instantiate(AmongUsClient.Instance.PlayerPrefab, Vector2.zero, Quaternion.identity);
|
||||
playerControl.PlayerId = deadBodyParent.PlayerId;
|
||||
playerControl.isNew = false;
|
||||
|
||||
@@ -589,12 +589,12 @@ internal static class CustomSettingsUIPatches
|
||||
{
|
||||
__instance.roleChances.Add(roleOptionSetting);
|
||||
#if IL2CPP
|
||||
roleOptionSetting.OnValueChanged = (Action<OptionBehaviour>)ValueChanged;
|
||||
roleOptionSetting.OnValueChanged = (Action<OptionBehaviour>)(obj => ValueChanged(obj, true));
|
||||
|
||||
foreach (var button in roleOptionSetting.ControllerSelectable)
|
||||
__instance.QuotaTabSelectables.Add(button);
|
||||
#else
|
||||
roleOptionSetting.OnValueChanged = ValueChanged;
|
||||
roleOptionSetting.OnValueChanged = obj => ValueChanged(obj, true);
|
||||
__instance.QuotaTabSelectables.AddRange(roleOptionSetting.ControllerSelectable);
|
||||
#endif
|
||||
}
|
||||
@@ -940,9 +940,9 @@ internal static class CustomSettingsUIPatches
|
||||
roleOptionSetting.transform.localPosition = new Vector3(-0.15f, yPos, -2f);
|
||||
RoleOptionSettingPatches.SetRole(roleOptionSetting, role, 20);
|
||||
#if IL2CPP
|
||||
roleOptionSetting.OnValueChanged = (Action<OptionBehaviour>)ValueChanged;
|
||||
roleOptionSetting.OnValueChanged = (Action<OptionBehaviour>)(obj => ValueChanged(obj, true));
|
||||
#else
|
||||
roleOptionSetting.OnValueChanged = ValueChanged;
|
||||
roleOptionSetting.OnValueChanged = obj => ValueChanged(obj, true);
|
||||
#endif
|
||||
roleOptionSetting.SetClickMask(instance.ButtonClickMask);
|
||||
roleOptionSetting.name = $"MODDED_{role}";
|
||||
@@ -1001,9 +1001,9 @@ internal static class CustomSettingsUIPatches
|
||||
{
|
||||
OptionBehaviour advancedSettingChild = instance.advancedSettingChildren[index];
|
||||
#if IL2CPP
|
||||
advancedSettingChild.OnValueChanged = (Action<OptionBehaviour>)ValueChanged;
|
||||
advancedSettingChild.OnValueChanged = (Action<OptionBehaviour>)(obj => ValueChanged(obj, false));
|
||||
#else
|
||||
advancedSettingChild.OnValueChanged = ValueChanged;
|
||||
advancedSettingChild.OnValueChanged = obj => ValueChanged(obj, false);
|
||||
#endif
|
||||
if (AmongUsClient.Instance && !AmongUsClient.Instance.AmHost)
|
||||
advancedSettingChild.SetAsPlayer();
|
||||
@@ -1087,15 +1087,17 @@ internal static class CustomSettingsUIPatches
|
||||
}
|
||||
}
|
||||
|
||||
private static void ValueChanged(OptionBehaviour obj)
|
||||
private static void ValueChanged(OptionBehaviour obj, bool roleSetting)
|
||||
{
|
||||
RolesSettingsMenu instance = GameSettingMenu.Instance.RoleSettingsTab;
|
||||
#if IL2CPP
|
||||
if (obj.TryCastFast(out RoleOptionSetting roleOptionSetting))
|
||||
#else
|
||||
if (obj is RoleOptionSetting roleOptionSetting)
|
||||
#endif
|
||||
|
||||
if (roleSetting)
|
||||
{
|
||||
#if IL2CPP
|
||||
RoleOptionSetting roleOptionSetting = obj.CastFast<RoleOptionSetting>();
|
||||
#else
|
||||
RoleOptionSetting roleOptionSetting = (RoleOptionSetting)obj;
|
||||
#endif
|
||||
CustomRoles role = OptionItem.SettingObjectNameToRole[roleOptionSetting.name];
|
||||
Options.CustomRoleSpawnChances[role].SetValue(roleOptionSetting.RoleChance / 5);
|
||||
if (!Options.SingleRoles.Contains(role))
|
||||
|
||||
@@ -10079,7 +10079,7 @@
|
||||
"LoadingHint.25": "Meeting not ending when everyone voted?\nPress F6 to end the meeting while also counting the votes!",
|
||||
"LoadingHint.26": "Do you have a friend who thinks they understand everything, and you want to prove them wrong?\nTurn on the Chemist role and see their reaction!",
|
||||
"LoadingHint.27": "The Dev's favorite roles are:\nEcho, Penguin, Rift Maker, Bubble, Evolver, Rogue, Vengeance....\nand basically all crewmate roles :D",
|
||||
"LoadingHint.28": "Did you know?\nEHR has 16 different game modes! Try them out!\nSwitch game modes using the buttons under the huge title in the top left of the settings menu!",
|
||||
"LoadingHint.28": "Did you know?\nEHR has 16 different game modes! Try them out!\nSwitch game modes in the Game Modes tab of the settings menu",
|
||||
"LoadingHint.29": "Did you know?\nEHR has a unique game mode for expert gamers called Stop And Go!\nGive it a try after this game!",
|
||||
"LoadingHint.30": "Getting Crewmate over and over again? Didn't get to kill for the last half an hour?\nUnleash your bloodthirst in our Free For All game mode!",
|
||||
"LoadingHint.31": "Did you know?\nEHR has a custom Hide And Seek game mode with 12 special roles dedicated for this playstyle!",
|
||||
|
||||
@@ -186,7 +186,7 @@ public class Survivor : RoleBase
|
||||
// Last ability: Kill
|
||||
public override void OnTaskComplete(PlayerControl pc, int completedTaskCount, int totalTaskCount)
|
||||
{
|
||||
if (completedTaskCount + 1 >= totalTaskCount)
|
||||
if (completedTaskCount + 1 >= totalTaskCount && pc.IsAlive())
|
||||
{
|
||||
Killing = true;
|
||||
pc.RpcChangeRoleBasis(CustomRoles.Scanner);
|
||||
|
||||
@@ -56,7 +56,7 @@ public class Postponer : RoleBase
|
||||
LateTask.New(() =>
|
||||
{
|
||||
if (!GameStates.IsInTask || ExileController.Instance || AntiBlackout.SkipTasks) return;
|
||||
Utils.RpcCreateDeadBody(position, colorId, target);
|
||||
Utils.RpcCreateDeadBody(position, colorId, target, true);
|
||||
}, BodyDelay.GetInt(), "Postponer Body Delay");
|
||||
|
||||
return false;
|
||||
|
||||
@@ -78,7 +78,7 @@ internal class Butcher : RoleBase
|
||||
Vector2 location = new(ops.x + (float)(rd.Next(0, 201) - 100) / 100, ops.y + (float)(rd.Next(0, 201) - 100) / 100);
|
||||
location += new Vector2(0, 0.3636f);
|
||||
|
||||
Utils.RpcCreateDeadBody(location, (byte)target.CurrentOutfit.ColorId, target);
|
||||
Utils.RpcCreateDeadBody(location, (byte)target.CurrentOutfit.ColorId, target, false);
|
||||
|
||||
yield return new WaitForSecondsRealtime(0.2f);
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using AmongUs.GameOptions;
|
||||
using EHR.Modules;
|
||||
using static EHR.Options;
|
||||
@@ -98,33 +99,35 @@ internal class Trapster : RoleBase
|
||||
|
||||
public static bool OnAnyoneCheckReportDeadBody(PlayerControl reporter, NetworkedPlayerInfo target)
|
||||
{
|
||||
if (TrapsterBody.Contains(target.PlayerId) && reporter.IsAlive() && !target.Object.Is(CustomRoles.Disregarded) && LegacyTrapster.GetBool())
|
||||
if (!On || !reporter.IsAlive() || !Object.FindObjectsOfType<DeadBody>(true).Any(x => x.name == "FAKE" && x.ParentId == target.PlayerId)) return true;
|
||||
|
||||
if (LegacyTrapster.GetBool())
|
||||
{
|
||||
if (!TrapOnlyWorksOnTheBodyTrapster.GetBool())
|
||||
if (!target.Object.Is(CustomRoles.Disregarded))
|
||||
{
|
||||
byte killerID = KillerOfTrapsterBody[target.PlayerId];
|
||||
if (!TrapOnlyWorksOnTheBodyTrapster.GetBool())
|
||||
{
|
||||
byte killerID = KillerOfTrapsterBody[target.PlayerId];
|
||||
|
||||
reporter.Suicide(PlayerState.DeathReason.Trapped, Utils.GetPlayerById(killerID));
|
||||
RPC.PlaySoundRPC(killerID, Sounds.KillSound);
|
||||
reporter.Suicide(PlayerState.DeathReason.Trapped, Utils.GetPlayerById(killerID));
|
||||
RPC.PlaySoundRPC(killerID, Sounds.KillSound);
|
||||
|
||||
if (!TrapsterBody.Contains(reporter.PlayerId) && TrapConsecutiveBodies.GetBool())
|
||||
TrapsterBody.Add(reporter.PlayerId);
|
||||
if (!TrapsterBody.Contains(reporter.PlayerId) && TrapConsecutiveBodies.GetBool())
|
||||
TrapsterBody.Add(reporter.PlayerId);
|
||||
|
||||
KillerOfTrapsterBody.TryAdd(reporter.PlayerId, killerID);
|
||||
KillerOfTrapsterBody.TryAdd(reporter.PlayerId, killerID);
|
||||
return false;
|
||||
}
|
||||
|
||||
reporter.Suicide(PlayerState.DeathReason.Trapped, target.Object);
|
||||
RPC.PlaySoundRPC(target.PlayerId, Sounds.KillSound);
|
||||
return false;
|
||||
}
|
||||
|
||||
byte killerID2 = target.PlayerId;
|
||||
|
||||
reporter.Suicide(PlayerState.DeathReason.Trapped, Utils.GetPlayerById(killerID2));
|
||||
RPC.PlaySoundRPC(killerID2, Sounds.KillSound);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (TrapsterBody.Contains(target.PlayerId) && reporter.IsAlive() && !LegacyTrapster.GetBool())
|
||||
else
|
||||
{
|
||||
if (reporter.IsImpostor()) return true;
|
||||
reporter.Suicide(PlayerState.DeathReason.Trapped, Utils.GetPlayerById(target.PlayerId));
|
||||
reporter.Suicide(PlayerState.DeathReason.Trapped, target.Object);
|
||||
RPC.PlaySoundRPC(target.PlayerId, Sounds.KillSound);
|
||||
return false;
|
||||
}
|
||||
@@ -136,9 +139,7 @@ internal class Trapster : RoleBase
|
||||
{
|
||||
if (!LegacyTrapster.GetBool())
|
||||
{
|
||||
Vector2 location = player.Pos();
|
||||
TrapsterBody.Add(player.PlayerId);
|
||||
Utils.RpcCreateDeadBody(location, (byte)IRandom.Instance.Next(0, 18), player);
|
||||
Utils.RpcCreateDeadBody(player.Pos(), (byte)IRandom.Instance.Next(0, 18), Main.CachedAlivePlayerControls().RandomElement(), true);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -64,6 +64,7 @@ public class Dealer : RoleBase
|
||||
killer.SetKillCooldown(AbilityCooldown.GetFloat());
|
||||
|
||||
var randomAddon = Options.GroupedAddons.Values.Flatten().Where(x => !x.IsNotAssignableMidGame() && x.GetMode() != 0).RandomElement();
|
||||
if (randomAddon == default(CustomRoles)) return false;
|
||||
|
||||
switch (AddonAppears.GetValue())
|
||||
{
|
||||
|
||||
@@ -235,29 +235,32 @@ public class Doppelganger : RoleBase
|
||||
|
||||
TotalSteals[killer.PlayerId]++;
|
||||
|
||||
LateTask.New(() =>
|
||||
if (ResetMode.GetValue() == 2)
|
||||
{
|
||||
if (ResetMode.GetValue() == 2 && TotalSteals[killer.PlayerId] > 0 && target)
|
||||
LateTask.New(() =>
|
||||
{
|
||||
RpcChangeSkin(target, DoppelPresentSkin[target.PlayerId]);
|
||||
RpcChangeSkin(killer, DoppelDefaultSkin[killer.PlayerId]);
|
||||
DoppelVictim[killer.PlayerId] = string.Empty;
|
||||
if (TotalSteals[killer.PlayerId] > 0 && target)
|
||||
{
|
||||
RpcChangeSkin(target, DoppelPresentSkin[target.PlayerId]);
|
||||
RpcChangeSkin(killer, DoppelDefaultSkin[killer.PlayerId]);
|
||||
DoppelVictim[killer.PlayerId] = string.Empty;
|
||||
|
||||
if (GameStates.IsInTask && !ExileController.Instance && !AntiBlackout.SkipTasks)
|
||||
Utils.NotifyRoles();
|
||||
}
|
||||
}, ResetTimer.GetInt());
|
||||
if (GameStates.IsInTask && !ExileController.Instance && !AntiBlackout.SkipTasks)
|
||||
Utils.NotifyRoles();
|
||||
}
|
||||
}, ResetTimer.GetInt());
|
||||
}
|
||||
|
||||
string kname;
|
||||
|
||||
if (killer.AmOwner && Main.NickName.Length != 0)
|
||||
if (killer.AmOwner && Main.NickName.Length != 0 && !SwappedIDs.Any(x => x.Item1 == killer.PlayerId || x.Item2 == killer.PlayerId))
|
||||
kname = Main.NickName;
|
||||
else
|
||||
kname = killer.Data.PlayerName;
|
||||
|
||||
string tname;
|
||||
|
||||
if (target.AmOwner && Main.NickName.Length != 0)
|
||||
if (target.AmOwner && Main.NickName.Length != 0 && !SwappedIDs.Any(x => x.Item1 == target.PlayerId || x.Item2 == target.PlayerId))
|
||||
tname = Main.NickName;
|
||||
else
|
||||
tname = target.Data.PlayerName;
|
||||
|
||||
Reference in new issue
Block a user