From 0a52d1f029520a8b5979d39b7cdcf73d133672e3 Mon Sep 17 00:00:00 2001 From: Mircea Kitsune Date: Fri, 28 Oct 2011 00:09:09 +0300 Subject: [PATCH] New command: claim_object. If the player has edit rights over an object (either free editing is enabled, or the object was spawned by a player without an UID), the player can claim the object as his with this command. --- qcsrc/server/mutators/sandbox.qc | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/qcsrc/server/mutators/sandbox.qc b/qcsrc/server/mutators/sandbox.qc index 3c2f7f42b..4e65f4eaf 100644 --- a/qcsrc/server/mutators/sandbox.qc +++ b/qcsrc/server/mutators/sandbox.qc @@ -206,6 +206,7 @@ MUTATOR_HOOKFUNCTION(sandbox_PlayerCommand) print_to(self, "^7\"^2remove_object^7\" removes the object the player is looking at. Players can only remove their own objects"); print_to(self, "^7\"^2duplicate_object_copy^7\" copies the object the player is looking at. Players can only copy their own objects"); print_to(self, "^7\"^2duplicate_object_paste^7\" pastes the copied object in front of the player"); + print_to(self, "^7\"^2claim_object^7\" sets the player as the owner of the object, if he has the right to edit it"); print_to(self, "^7\"^2attach_object ^3property value^7\" attaches one object to another. Players can only attach their own objects"); print_to(self, "^7Attachment properties for ^2attach_object^7:"); print_to(self, "^3get ^7- selects the object you are facing as the object to be attached"); @@ -336,6 +337,30 @@ MUTATOR_HOOKFUNCTION(sandbox_PlayerCommand) return TRUE; + // ---------------- COMMAND: CLAIM OBJECT ---------------- + case "claim_object": + if(self.crypto_idfp == "") + { + print_to(self, "WARNING: You do not have a player UID, and cannot claim objects"); + return TRUE; + } + e = sandbox_EditObject_Get(); + if(e != world) + { + if(e.crypto_idfp == self.crypto_idfp) + { + print_to(self, "Object is already yours, nothing to claim"); + return TRUE; + } + + if(e.crypto_idfp) + strunzone(e.crypto_idfp); + e.crypto_idfp = self.crypto_idfp; + print_to(self, "Object claimed successfully"); + } + print_to(self, "WARNING: Object could not be claimed. Make sure you are facing an object that belongs to you (default)"); + return TRUE; + // ---------------- COMMAND: ATTACH OBJECT ---------------- case "attach_object": switch(argv(2)) -- 2.39.2