Skip to content

Commit

Permalink
Update v1.1.2.6
Browse files Browse the repository at this point in the history
  • Loading branch information
mxyx0412 committed Feb 16, 2025
1 parent d5844ed commit fd096a1
Show file tree
Hide file tree
Showing 7 changed files with 51 additions and 34 deletions.
29 changes: 22 additions & 7 deletions TheOtherRoles/Buttons/Buttons.cs
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ public static void setCustomButtonCooldowns()
defuseButton.EffectDuration = Terrorist.defuseDuration;
terroristButton.EffectDuration = Terrorist.destructionTime + Terrorist.bombActiveAfter;
redemptorRevelationButton.EffectDuration = Redemptor.revelationDuration;
//redemptorPrayerButton.EffectDuration = Redemptor.prayerDuration;
redemptorPrayerButton.EffectDuration = Redemptor.prayerDuration;

zoomOutButton.MaxTimer = zoomOutButton.Timer = 0f;
}
Expand Down Expand Up @@ -3242,7 +3242,7 @@ public static void createButtonsPostfix(HudManager __instance)
if (Arsonist.douseTarget != null) Arsonist.dousedPlayers.Add(Arsonist.douseTarget);

arsonistButton.Timer = arsonistButton.MaxTimer;
arsonistKillButton.Timer = arsonistKillButton.MaxTimer == 0 ? 2.5f : arsonistKillButton.MaxTimer;
arsonistKillButton.Timer = arsonistKillButton.MaxTimer == 0 ? 1f : arsonistKillButton.MaxTimer;
foreach (var p in Arsonist.dousedPlayers)
if (ModOption.playerIcons.ContainsKey(p.PlayerId))
ModOption.playerIcons[p.PlayerId].setSemiTransparent(false);
Expand All @@ -3256,7 +3256,8 @@ public static void createButtonsPostfix(HudManager __instance)
AmongUsClient.Instance.FinishRpcImmediately(writer);

Arsonist.douseTarget = null;
}
},
buttonText: GetString("DouseText")
);

// Arsonist button (点火)
Expand All @@ -3279,10 +3280,15 @@ public static void createButtonsPostfix(HudManager __instance)
() =>
{
Arsonist.currentTarget2 = SetTarget(distances: 0.5f);
if (Arsonist.currentTarget2 != null) SetPlayerOutline(Arsonist.currentTarget2, Arsonist.color);
var cankill = false;
if (Arsonist.currentTarget2 && Arsonist.dousedPlayers.Any(x => x == Arsonist.currentTarget2))
{
SetPlayerOutline(Arsonist.currentTarget2, Arsonist.color);
showTargetNameOnButton(Arsonist.currentTarget2, arsonistKillButton, GetString("IgniteText"));
cankill = true;
}

showTargetNameOnButton(Arsonist.currentTarget2, arsonistKillButton, GetString("IgniteText"));
return PlayerControl.LocalPlayer.CanMove && Arsonist.currentTarget2 != null && Arsonist.dousedPlayers.Contains(Arsonist.currentTarget2);
return PlayerControl.LocalPlayer.CanMove && cankill;
},
() =>
{
Expand Down Expand Up @@ -4510,6 +4516,10 @@ public static void createButtonsPostfix(HudManager __instance)
},
() =>
{
if (Redemptor.target == null)
{
showTargetNameOnButton(Redemptor.target, redemptorReviveButton, GetString("ReviveButton"));
}
return Redemptor.target && PlayerControl.LocalPlayer.CanMove;
},
() =>
Expand Down Expand Up @@ -4567,19 +4577,24 @@ public static void createButtonsPostfix(HudManager __instance)
},
() =>
{

return Redemptor.Player.IsAlive() && Redemptor.Player == PlayerControl.LocalPlayer;
},
() =>
{
var pos = PlayerControl.LocalPlayer.GetTruePosition();
var maxDistance = PlayerControl.LocalPlayer.MaxReportDistance * 0.24f;
var maxDistance = PlayerControl.LocalPlayer.MaxReportDistance * 0.21f;

var deadBody = Physics2D.OverlapCircleAll(pos, maxDistance, Constants.PlayersOnlyMask)
.Where(collider => collider.CompareTag("DeadBody"))
.Select(collider => collider.GetComponent<DeadBody>())
.FirstOrDefault(db => db != null && playerById(db.ParentId)?.Data?.IsDead == true &&
!(playerById(db.ParentId)?.Data?.Disconnected == true));

if (Redemptor.target == null)
{
showTargetNameOnButton(Redemptor.target, redemptorReviveButton, GetString("ReviveButton"));
}
Redemptor.target = playerById(deadBody?.ParentId);
return Redemptor.target && PlayerControl.LocalPlayer.CanMove;
},
Expand Down
17 changes: 16 additions & 1 deletion TheOtherRoles/Helper/Helpers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -729,9 +729,24 @@ public static void refreshRoleDescription(PlayerControl player)
}
}

public static void ModRevive(this PlayerControl target)
public static void ModRevive(this PlayerControl target, bool cleanBody = true, bool reloadPos = true)
{
target?.Revive();

if (target == null) return;



DeadBody[] array = Object.FindObjectsOfType<DeadBody>();
for (var i = 0; i < array.Length; i++)
{
if (GameData.Instance.GetPlayerById(array[i].ParentId).PlayerId == target.PlayerId)
{
if (reloadPos) target.NetTransform.RpcSnapTo(array[i].transform.position);
if (cleanBody) Object.Destroy(array[i].gameObject);
break;
}
}
}

internal static string getRoleString(RoleInfo roleInfo)
Expand Down
30 changes: 9 additions & 21 deletions TheOtherRoles/Patches/PlayerControlPatch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -572,9 +572,8 @@ private static void trackerUpdate()

private static void redemptorUpdate()
{
if ((Redemptor.Player == null && Redemptor.RevivedPlayer == null) || Redemptor.arrow == null) return;
if (Redemptor.Player == null && Redemptor.RevivedPlayer == null) return;

Redemptor.arrow.arrow?.SetActive(false);
var local = PlayerControl.LocalPlayer;
if (Redemptor.Player.IsAlive() && Redemptor.Reviving && local.IsAlive() && local.isKiller())
{
Expand Down Expand Up @@ -606,7 +605,7 @@ private static void redemptorUpdate()
}
else
{
Redemptor.arrow.arrow?.Destroy();
Redemptor.arrow?.arrow?.Destroy();
}
}

Expand Down Expand Up @@ -1631,31 +1630,20 @@ public static void Postfix(PlayerControl __instance)
CanSeeRoleInfo = false;
}

if (__instance == Specter.Player) Specter.Player.clearAllTasks();

RPCProcedure.clearGhostRoles(__instance.PlayerId);
DeadPlayers.RemoveAll(x => x.Player == __instance);

if (__instance.isLover() && Lovers.otherLover(__instance)?.IsDead() == true)
{
Lovers.otherLover(__instance)?.Revive();
Lovers.otherLover(__instance)?.ModRevive();
}

if (Akujo.isAkujoTeam(__instance) && Akujo.otherLover(__instance)?.IsDead() == true)
{
Akujo.otherLover(__instance)?.Revive();
Akujo.otherLover(__instance)?.ModRevive();
}

DeadBody[] array = Object.FindObjectsOfType<DeadBody>();
for (var i = 0; i < array.Length; i++)
{
if (GameData.Instance.GetPlayerById(array[i].ParentId).PlayerId == __instance.PlayerId)
{
__instance.NetTransform.RpcSnapTo(array[i].transform.position);
Object.Destroy(array[i].gameObject);
break;
}
}
if (__instance == Specter.Player) Specter.Player.clearAllTasks();

RPCProcedure.clearGhostRoles(__instance.PlayerId);
DeadPlayers.RemoveAll(x => x.Player == __instance);
}
}

Expand Down Expand Up @@ -1884,7 +1872,7 @@ public static void HandleMurderPostfix(PlayerControl __instance, PlayerControl t
{
foreach (var player in Pelican.eatenPlayers.ToArray().Where(p => p != null && p.Data.IsDead))
{
player.Revive();
player.ModRevive();

DeadPlayers.RemoveAll(x => x.Player.PlayerId == player.PlayerId);
if (PlayerControl.LocalPlayer == player)
Expand Down
2 changes: 1 addition & 1 deletion TheOtherRoles/RPC.cs
Original file line number Diff line number Diff line change
Expand Up @@ -862,7 +862,7 @@ public static void hostKill(byte targetId)
public static void RevivePlayer(byte targetId)
{
var target = playerById(targetId);
target?.Revive();
target?.ModRevive();
}

public static void shifterShift(byte targetId)
Expand Down
3 changes: 1 addition & 2 deletions TheOtherRoles/Roles/Crewmate/Redemptor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public class Redemptor
public static void RevivePlayer(byte targetId)
{
var player = playerById(targetId);
player?.Revive();
player?.ModRevive();
RevivedPlayer = player;
target = null;
}
Expand All @@ -39,7 +39,6 @@ public static void RevivePlayer(byte targetId)
public static void RedemptorPrayer(byte status)
{
Reviving = status != 0;
Message($"{Reviving}");
}

public static void ClearAndReload()
Expand Down
2 changes: 1 addition & 1 deletion TheOtherRoles/Roles/Modifier/Shifter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public static void shiftRole(PlayerControl player1, PlayerControl player2, bool
if (repeat) shiftRole(player2, player1, false);
if (Sheriff.formerDeputy == player2) Sheriff.formerDeputy = player1;
Sheriff.Player.Add(player1);
Sheriff.Player.RemoveAll(x => x == player1);
Sheriff.Player.RemoveAll(x => x == player2);
}
else if (Sheriff.Deputy != null && Sheriff.Deputy == player2)
{
Expand Down
2 changes: 1 addition & 1 deletion TheOtherRoles/TheOtherRoles.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<Version>1.1.2.5</Version>
<Version>1.1.2.6</Version>
<AssemblyName>TheOtherUs</AssemblyName>
<Authors>mxyx-club</Authors>
<LangVersion>latest</LangVersion>
Expand Down

0 comments on commit fd096a1

Please sign in to comment.