From 89ba2bad3f5488d378a63202efaf48559a523b3e Mon Sep 17 00:00:00 2001 From: Mircea Kitsune Date: Sat, 29 Oct 2011 14:05:55 +0300 Subject: [PATCH] New functionality for g_sandbox_editor_free. 0 = players can only copy or edit their own objects, 1 = players can copy but not edit other objects, 2 = players can copy and edit all object. Default is now 1 (you can duplicate other people's objects but not edit them). --- defaultXonotic.cfg | 2 +- qcsrc/server/mutators/sandbox.qc | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/defaultXonotic.cfg b/defaultXonotic.cfg index f7b33003c..b3a5f54de 100644 --- a/defaultXonotic.cfg +++ b/defaultXonotic.cfg @@ -550,7 +550,7 @@ set g_sandbox_storage_name default "name of the selected storage to use" set g_sandbox_storage_autosave 5 "storage is automatically saved every specified number of seconds" set g_sandbox_storage_autoload 1 "if a storage file exists for the given map, automatically load it at startup" set g_sandbox_editor_maxobjects 1000 "maximum number of objects that may exist at a time" -set g_sandbox_editor_free 0 "when enabled, players can edit any object on the map, not just the objects they've spawned" +set g_sandbox_editor_free 1 "0 = players can only copy or edit their own objects, 1 = players can copy but not edit other objects, 2 = players can copy and edit all object" set g_sandbox_editor_distance_spawn 200 "distance at which objects spawn in front of the player" set g_sandbox_editor_distance_edit 350 "distance at which players can edit or remove objects they are looking at" set g_sandbox_object_scale_min 0.1 "minimum scale that objects can be set to" diff --git a/qcsrc/server/mutators/sandbox.qc b/qcsrc/server/mutators/sandbox.qc index e68a24a20..5d7dac1d3 100644 --- a/qcsrc/server/mutators/sandbox.qc +++ b/qcsrc/server/mutators/sandbox.qc @@ -45,7 +45,7 @@ entity sandbox_ObjectEdit_Get(float permissions) return trace_ent; // don't check permissions, anyone can edit this object if(!trace_ent.crypto_idfp) return trace_ent; // the player who spawned this object did not have an UID, so anyone can edit it - if not(trace_ent.crypto_idfp != self.crypto_idfp && !autocvar_g_sandbox_editor_free) + if not(trace_ent.crypto_idfp != self.crypto_idfp && autocvar_g_sandbox_editor_free < 2) return trace_ent; // object does not belong to the player, and players can only edit their own objects on this server return world; } @@ -408,7 +408,7 @@ MUTATOR_HOOKFUNCTION(sandbox_PlayerCommand) { case "copy": // copies customizable properties of the selected object to the clipboard - e = sandbox_ObjectEdit_Get(TRUE); // you can only copy objects you can edit, so this works + e = sandbox_ObjectEdit_Get(autocvar_g_sandbox_editor_free); // can we copy objects we can't edit? if(e != world) { if(self.object_clipboard) -- 2.39.2