From 5f7a7a8969e9c3f69ef2b458cb986e7bc51aefcc Mon Sep 17 00:00:00 2001 From: JohnCorby Date: Sun, 17 Sep 2023 18:47:56 -0700 Subject: [PATCH] ownership comments --- .../IOwnedWorldObject_Extensions.cs | 16 ++++++++++++++++ QSB/OwnershipSync/OwnedWorldObjectMessage.cs | 2 ++ 2 files changed, 18 insertions(+) diff --git a/QSB/OwnershipSync/IOwnedWorldObject_Extensions.cs b/QSB/OwnershipSync/IOwnedWorldObject_Extensions.cs index 56ca2220..71624c6a 100644 --- a/QSB/OwnershipSync/IOwnedWorldObject_Extensions.cs +++ b/QSB/OwnershipSync/IOwnedWorldObject_Extensions.cs @@ -7,9 +7,15 @@ public static class IOwnedWorldObject_Extensions { /// /// try and gain ownership over the object + /// + /// does nothing if object we cant own this object or there is already another owner /// public static void RequestOwnership(this IOwnedWorldObject @this) { + if (!@this.CanOwn) + { + return; + } if (@this.Owner != 0) { return; @@ -17,9 +23,19 @@ public static class IOwnedWorldObject_Extensions @this.SendMessage(new OwnedWorldObjectMessage(QSBPlayerManager.LocalPlayerId)); } + /// + /// forcibly gain ownership over the object + /// + public static void ForceOwnership(this IOwnedWorldObject @this) + { + @this.SendMessage(new OwnedWorldObjectMessage(QSBPlayerManager.LocalPlayerId)); + } + /// /// release ownership over the object, /// potentially to giving it to someone else + /// + /// does nothing if someone else already owns this /// public static void ReleaseOwnership(this IOwnedWorldObject @this) { diff --git a/QSB/OwnershipSync/OwnedWorldObjectMessage.cs b/QSB/OwnershipSync/OwnedWorldObjectMessage.cs index 85b87d36..77920edc 100644 --- a/QSB/OwnershipSync/OwnedWorldObjectMessage.cs +++ b/QSB/OwnershipSync/OwnedWorldObjectMessage.cs @@ -27,6 +27,7 @@ public class OwnedWorldObjectMessage : QSBWorldObjectMessage