]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Read-only mode. When enabled, no sandbox commands can be used, and objects cannot...
authorMircea Kitsune <sonichedgehog_hyperblast00@yahoo.com>
Sun, 6 Nov 2011 13:30:20 +0000 (15:30 +0200)
committerMircea Kitsune <sonichedgehog_hyperblast00@yahoo.com>
Sun, 6 Nov 2011 13:30:20 +0000 (15:30 +0200)
defaultXonotic.cfg
qcsrc/server/autocvars.qh
qcsrc/server/mutators/sandbox.qc

index c5d5e24b9f54102b034f7176b00d072915347b81..e3daefac7ba3f67c41fe069068951fcd634009ea 100644 (file)
@@ -549,6 +549,7 @@ seta g_balance_cloaked_alpha 0.25
 
 set g_sandbox 0 "allow players to spawn and edit objects around the map"
 set g_sandbox_info 1 "print object information to the server. 1 prints info about spawned / removed objects, 2 also prints info about edited objects"
+set g_sandbox_readonly 0 "when this mode is active, players cannot modify objects or use any sandbox commands"
 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"
index 12952390ba4fa0bf8918ae4627a78dca0cea6a6c..a8aa591790df9d68c6983324b099fec9b4495f23 100644 (file)
@@ -1206,6 +1206,7 @@ float autocvar_g_loituma;
 float autocvar_g_grab;
 float autocvar_g_grab_range;
 float autocvar_g_sandbox_info;
+float autocvar_g_sandbox_readonly;
 string autocvar_g_sandbox_storage_name;
 float autocvar_g_sandbox_storage_autosave;
 float autocvar_g_sandbox_storage_autoload;
index 1700964e48ed6eba72db934a7333116d3e4b1aac..264aa83a7d9e62c9a827431e9e47f4fcfe556716 100644 (file)
@@ -35,10 +35,12 @@ void sandbox_ObjectFunction_Think()
        entity e;
 
        // decide if and how this object can be grabbed
-       if(autocvar_g_sandbox_editor_free < 2 && self.crypto_idfp)
-               self.grab = 1;
+       if(autocvar_g_sandbox_readonly)
+               self.grab = 0; // no grabbing
+       else if(autocvar_g_sandbox_editor_free < 2 && self.crypto_idfp)
+               self.grab = 1; // owner only
        else
-               self.grab = 3;
+               self.grab = 3; // anyone
 
        // Object owner is stored via player UID, but we also need the owner as an entity (if the player is available on the server).
        // Therefore, scan for all players, and update the owner as long as the player is present. We must always do this,
@@ -400,9 +402,14 @@ MUTATOR_HOOKFUNCTION(sandbox_PlayerCommand)
                return FALSE;
        if(cmd_name == "g_sandbox")
        {
+               if(autocvar_g_sandbox_readonly)
+               {
+                       print_to(self, "^2SANDBOX - INFO: ^7Sandbox mode is active, but in read-only mode. Sandbox commands cannot be used");
+                       return TRUE;
+               }
                if(cmd_argc < 2)
                {
-                       print_to(self, "Sandbox mode is active. For usage information, type 'sandbox help'");
+                       print_to(self, "^2SANDBOX - INFO: ^7Sandbox mode is active. For usage information, type 'sandbox help'");
                        return TRUE;
                }