mirror of
https://github.com/Gurge44/EndlessHostRoles.git
synced 2026-10-20 01:46:25 +00:00
Add RPC
This commit is contained in:
1 parent
1819dc01d8
commit
8283fddc02
2 files changed
+21
No files matched your search
@@ -139,6 +139,7 @@ public enum CustomRPC
|
||||
SyncRogue,
|
||||
SyncEvolver,
|
||||
SyncTremor,
|
||||
SyncAid,
|
||||
|
||||
// Other Game Modes
|
||||
SyncKBPlayer,
|
||||
@@ -426,6 +427,9 @@ internal class RPCHandlerPatch
|
||||
case CustomRPC.SyncTremor:
|
||||
(Main.PlayerStates[reader.ReadByte()].Role as Tremor)?.ReceiveRPC(reader);
|
||||
break;
|
||||
case CustomRPC.SyncAid:
|
||||
(Main.PlayerStates[reader.ReadByte()].Role as Aid)?.ReceiveRPC(reader);
|
||||
break;
|
||||
case CustomRPC.SetBountyTarget:
|
||||
{
|
||||
byte bountyId = reader.ReadByte();
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using AmongUs.GameOptions;
|
||||
using EHR.Modules;
|
||||
using Hazel;
|
||||
using UnityEngine;
|
||||
|
||||
namespace EHR.Roles.Crewmate
|
||||
@@ -80,6 +82,7 @@ namespace EHR.Roles.Crewmate
|
||||
if (x.Value + AidDur.GetInt() <= Utils.TimeStamp || !GameStates.IsInTask)
|
||||
{
|
||||
ShieldedPlayers.Remove(x.Key);
|
||||
Utils.SendRPC(CustomRPC.SyncAid, pc.PlayerId, 1, x.Key);
|
||||
change = true;
|
||||
}
|
||||
}
|
||||
@@ -97,6 +100,7 @@ namespace EHR.Roles.Crewmate
|
||||
{
|
||||
pc.RpcRemoveAbilityUse();
|
||||
ShieldedPlayers[TargetId] = Utils.TimeStamp;
|
||||
Utils.SendRPC(CustomRPC.SyncAid, pc.PlayerId, 0, TargetId);
|
||||
var target = Utils.GetPlayerById(TargetId);
|
||||
Utils.NotifyRoles(SpecifySeer: pc, SpecifyTarget: target);
|
||||
Utils.NotifyRoles(SpecifySeer: target, SpecifyTarget: target);
|
||||
@@ -106,6 +110,19 @@ namespace EHR.Roles.Crewmate
|
||||
LateTask.New(() => physics.RpcBootFromVent(ventId), 0.5f, log: false);
|
||||
}
|
||||
|
||||
public void ReceiveRPC(MessageReader reader)
|
||||
{
|
||||
switch (reader.ReadPackedInt32())
|
||||
{
|
||||
case 0:
|
||||
ShieldedPlayers[reader.ReadByte()] = Utils.TimeStamp;
|
||||
break;
|
||||
case 1:
|
||||
ShieldedPlayers.Remove(reader.ReadByte());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public override string GetSuffix(PlayerControl seer, PlayerControl target, bool hud = false, bool meeting = false)
|
||||
{
|
||||
if (seer.PlayerId != target.PlayerId || (seer.IsModClient() && !hud)) return string.Empty;
|
||||
|
||||
Reference in new issue
Block a user