mirror of
https://github.com/Gurge44/EndlessHostRoles.git
synced 2026-10-19 15:51:58 +00:00
fix stalker
This commit is contained in:
1 parent
1932a36356
commit
85937eb0dd
2 files changed
+20
-33
No files matched your search
@@ -37,6 +37,7 @@ Alright, let's get into it:
|
||||
- Fixed lovers chat not clearing on meeting call if lovers died during the round
|
||||
- Fixed some neutral benigns being uncategorized
|
||||
- Fixed Venerer showing the player's name while camouflaged
|
||||
- Fixed Stalker
|
||||
|
||||
## Changes & Improvements
|
||||
- Improved compatibility with LevelImposter
|
||||
|
||||
@@ -73,24 +73,14 @@ public class Stalker : RoleBase
|
||||
dh.IsWinKill = IsKillerKill;
|
||||
}
|
||||
|
||||
private void DRpcSetKillCount(PlayerControl player, CustomRpcSender sender = null)
|
||||
private void DRpcSetKillCount(PlayerControl player)
|
||||
{
|
||||
if (!IsEnable || !Utils.DoRPC || !AmongUsClient.Instance.AmHost) return;
|
||||
|
||||
if (sender == null)
|
||||
{
|
||||
MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.SetStalkerKillCount, SendOption.Reliable);
|
||||
writer.Write(player.PlayerId);
|
||||
writer.Write(IsWinKill);
|
||||
AmongUsClient.Instance.FinishRpcImmediately(writer);
|
||||
}
|
||||
else
|
||||
{
|
||||
sender.AutoStartRpc(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.SetStalkerKillCount);
|
||||
sender.Write(player.PlayerId);
|
||||
sender.Write(IsWinKill);
|
||||
sender.EndRpc();
|
||||
}
|
||||
MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.SetStalkerKillCount, SendOption.Reliable);
|
||||
writer.Write(player.PlayerId);
|
||||
writer.Write(IsWinKill);
|
||||
AmongUsClient.Instance.FinishRpcImmediately(writer);
|
||||
}
|
||||
|
||||
public override void SetKillCooldown(byte id)
|
||||
@@ -121,24 +111,20 @@ public class Stalker : RoleBase
|
||||
|
||||
if (succeeded && SnatchesWin.GetBool()) IsWinKill = true;
|
||||
|
||||
var sender = CustomRpcSender.Create("Stalker.OnCheckMurder", SendOption.Reliable);
|
||||
DRpcSetKillCount(killer, sender);
|
||||
sender.AutoStartRpc(ShipStatus.Instance.NetId, RpcCalls.UpdateSystem, killer.OwnerId);
|
||||
sender.Write((byte)SystemTypes.Electrical);
|
||||
sender.WriteNetObject(killer);
|
||||
sender.EndRpc();
|
||||
|
||||
foreach (PlayerControl target in Main.EnumeratePlayerControls())
|
||||
{
|
||||
if (target.PlayerId == killer.PlayerId || target.Data.Disconnected) continue;
|
||||
|
||||
sender.AutoStartRpc(ShipStatus.Instance.NetId, RpcCalls.UpdateSystem, target.OwnerId);
|
||||
sender.Write((byte)SystemTypes.Electrical);
|
||||
sender.WriteNetObject(target);
|
||||
sender.EndRpc();
|
||||
}
|
||||
|
||||
sender.SendMessage();
|
||||
DRpcSetKillCount(killer);
|
||||
return true;
|
||||
}
|
||||
|
||||
public override void OnMurder(PlayerControl killer, PlayerControl target)
|
||||
{
|
||||
byte num = 4;
|
||||
|
||||
for (var index = 0; index < 5; ++index)
|
||||
{
|
||||
if (BoolRange.Next())
|
||||
num |= (byte)(1 << index);
|
||||
}
|
||||
|
||||
ShipStatus.Instance.RpcUpdateSystem(SystemTypes.Electrical, (byte)(num | 128U));
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user