Skip to content
This repository has been archived by the owner on Oct 19, 2022. It is now read-only.

Commit

Permalink
Merge pull request #33 from LaicosVK/BadShift
Browse files Browse the repository at this point in the history
Bugfix Shifter
  • Loading branch information
LaicosVK authored Feb 23, 2022
2 parents e77584f + ff85dbc commit b1ecbd7
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion TheOtherRoles/Helpers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ public static void handleVampireBiteOnBodyReport() {
public static void handleShiftOnBodyReport()
{
// Check if Shifter has shifted bad role and option is on. If yes, kill him.
if (Shifter.shifter != null && Shifter.diesBeforeMeeting && Shifter.futureShift != null && Shifter.checkTargetIsBad(Shifter.futureShift)) {
if (Shifter.shifter != null && Shifter.diesBeforeMeeting && ! Shifter.shifter.Data.IsDead && Shifter.futureShift != null && Shifter.checkTargetIsBad(Shifter.futureShift)) {
Helpers.checkMuderAttemptAndKill(Shifter.shifter, Shifter.shifter, true, false);
MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.ShifterKilledDueBadShift, Hazel.SendOption.Reliable, -1);
AmongUsClient.Instance.FinishRpcImmediately(writer);
Expand Down
2 changes: 1 addition & 1 deletion TheOtherRoles/Patches/ExileControllerPatch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public static void Prefix(ExileController __instance, [HarmonyArgument(0)]ref Ga
RPCProcedure.shifterShift(Shifter.futureShift.PlayerId);
}
Shifter.futureShift = null;
Shifter.shiftedBadRole = false; // Shifter remove bad shift icon
Shifter.shiftedBadRole = false; // Shifter remove bad shift icon after meeting

// Eraser erase
if (Eraser.eraser != null && AmongUsClient.Instance.AmHost && Eraser.futureErased != null) { // We need to send the RPC from the host here, to make sure that the order of shifting and erasing is correct (for that reason the futureShifted and futureErased are being synced)
Expand Down
2 changes: 1 addition & 1 deletion TheOtherRoles/Patches/MeetingPatch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,7 @@ static void populateButtonsPostfix(MeetingHud __instance) {
SpriteRenderer rend = (new GameObject()).AddComponent<SpriteRenderer>();
rend.transform.SetParent(pva.transform);
rend.gameObject.layer = pva.Megaphone.gameObject.layer;
rend.transform.localPosition = new Vector3(-0.5f, -0.03f, -1f);
rend.transform.localPosition = new Vector3(-0.55f, -0.03f, -1f);
rend.sprite = Shifter.getBadShiftOverlaySprite();
}
}
Expand Down
1 change: 1 addition & 0 deletions TheOtherRoles/Patches/PlayerControlPatch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -625,6 +625,7 @@ static void baitUpdate() {
if (deadPlayer.killerIfExisting != null && Bait.reportDelay <= 0f) {

Helpers.handleVampireBiteOnBodyReport(); // Manually call Vampire handling, since the CmdReportDeadBody Prefix won't be called
Helpers.handleShiftOnBodyReport(); // Same for Shifter
RPCProcedure.uncheckedCmdReportDeadBody(deadPlayer.killerIfExisting.PlayerId, Bait.bait.PlayerId);

MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.UncheckedCmdReportDeadBody, Hazel.SendOption.Reliable, -1);
Expand Down

0 comments on commit b1ecbd7

Please sign in to comment.