remove shouldreceive thing so force ownership works

This commit is contained in:
JohnCorby 2023-09-18 14:04:29 -07:00
parent 5129c84430
commit 7be7bef4ad
2 changed files with 1 additions and 22 deletions

View File

@ -33,6 +33,7 @@ public abstract class OwnedWorldObject<T> : WorldObject<T>, IOwnedWorldObject
}
if (Owner == player.PlayerId)
{
// put CanOwn check here cuz it only does the thingy in OnReceiveRemote and we want to be able to own this
((IOwnedWorldObject)this).SendMessage(new OwnedWorldObjectMessage(CanOwn ? QSBPlayerManager.LocalPlayerId : 0));
}
}

View File

@ -10,28 +10,6 @@ public class OwnedWorldObjectMessage : QSBWorldObjectMessage<IOwnedWorldObject,
{
public OwnedWorldObjectMessage(uint owner) : base(owner) { }
public override bool ShouldReceive
{
get
{
if (!base.ShouldReceive)
{
return false;
}
// Deciding if to change the object's owner
// Message
// | = 0 | > 0 |
// = 0 | No | Yes |
// > 0 | Yes | No |
// if Obj==Message then No
// Obj
// ie if no owner, or we're trying to release ownership, and we're actually changing who the owner is
return (WorldObject.Owner == 0 || Data == 0) && WorldObject.Owner != Data;
}
}
public override void OnReceiveLocal() => WorldObject.Owner = Data;
public override void OnReceiveRemote()