Add useful method

This commit is contained in:
AeonLucid committed 2020-10-24 05:02:24 +02:00
1 parent 96c2647193
commit b55d09de71
1 file changed
+8
@@ -5,6 +5,8 @@ namespace Impostor.Api.Innersloth.Net
{
public abstract class InnerNetObject : GameObject
{
private const int HostInheritId = -2;
public uint NetId { get; internal set; }
public int OwnerId { get; internal set; }
@@ -16,5 +18,11 @@ namespace Impostor.Api.Innersloth.Net
public abstract bool Serialize(IMessageWriter writer, bool initialState);
public abstract void Deserialize(IClientPlayer sender, IClientPlayer? target, IMessageReader reader, bool initialState);
public bool IsOwnedBy(IClientPlayer player)
{
return OwnerId == player.Client.Id ||
(OwnerId == HostInheritId && player.IsHost);
}
}
}