throw new ImpostorCheatException($"Client sent {nameof(RpcCalls.MurderPlayer)} as crewmate");
}
+ if (!sender.Character.PlayerInfo.CanMurder(_game))
+ {
+ throw new ImpostorCheatException($"Client sent {nameof(RpcCalls.MurderPlayer)} too fast");
+ }
+
+ sender.Character.PlayerInfo.LastMurder = DateTimeOffset.UtcNow;
+
var player = reader.ReadNetObject<InnerPlayerControl>(_game);
if (!player.PlayerInfo.IsDead)
{
using System;
using System.Collections.Generic;
+using Impostor.Api.Games;
using Impostor.Api.Innersloth;
using Impostor.Api.Net.Inner.Objects;
using Impostor.Api.Net.Messages;
public List<InnerGameData.TaskInfo> Tasks { get; internal set; }
+ public DateTimeOffset LastMurder { get; set; }
+
+ public bool CanMurder(IGame game)
+ {
+ return DateTimeOffset.UtcNow.Subtract(LastMurder).TotalSeconds >= game.Options.KillCooldown;
+ }
+
public void Serialize(IMessageWriter writer)
{
throw new NotImplementedException();
}
}
}
-}
\ No newline at end of file
+}