]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/mutators/sandbox.qc
Remove a useless spacing. IT DIDN'T LOOK PERFECT, THE CODE WAS FLAWED!
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / mutators / sandbox.qc
index 4b62a18d9c52234c68183c4535627582a6dc3479..667fc6640262a70c5b3ffceb1f1b941f79e79cee 100644 (file)
@@ -202,7 +202,6 @@ MUTATOR_HOOKFUNCTION(sandbox_PlayerCommand)
                        // ---------------- COMMAND: HELP ----------------
                        case "help":
                                print_to(self, "You can use the following sandbox commands:");
-                               print_to(self, "^7\"^2item_spawn ^3item^7\" spawns the specified item in front of the player. Only weapons are currently supported");
                                print_to(self, "^7\"^2object_spawn ^3models/foo/bar.md3^7\" spawns a new object in front of the player, and gives it the specified model");
                                print_to(self, "^7\"^2object_remove^7\" removes the object the player is looking at. Players can only remove their own objects");
                                print_to(self, "^7\"^2object_duplicate ^3value^7\" duplicates the object. 'copy' copies the object, 'paste' puts it in front of the player");
@@ -226,35 +225,6 @@ MUTATOR_HOOKFUNCTION(sandbox_PlayerCommand)
                                print_to(self, "^7The ^1drag object ^7key can be used to grab and carry objects. Players can only grab their own objects");
                                return TRUE;
 
-                       // ---------------- COMMAND: SPAWN ITEM ----------------
-                       case "item_spawn":
-                               // only weapons are currently supported
-
-                               if(cmd_argc < 3)
-                               {
-                                       print_to(self, "^1SANDBOX - WARNING: ^7Attempted to spawn an item without specifying its type. Please specify the name of your item after the 'item_spawn' command");
-                                       return TRUE;
-                               }
-
-                               // spawn a new item
-                               makevectors(self.v_angle);
-                               WarpZone_TraceLine(self.origin + self.view_ofs, self.origin + self.view_ofs + v_forward * autocvar_g_sandbox_editor_distance_spawn, MOVE_NOMONSTERS, self);
-
-                               for(i = WEP_FIRST; i <= WEP_LAST; ++i)
-                               {
-                                       e = get_weaponinfo(i);
-                                       if(e.netname == argv(2))
-                                       {
-                                               W_ThrowNewWeapon(self, i, FALSE, trace_endpos, '0 0 0');
-                                               if(autocvar_g_sandbox_info)
-                                                       print("^3SANDBOX - SERVER: ^7", strcat(self.netname, " spawned a ^2", e.netname, "^7 at origin ", vtos(e.origin), "\n"));
-                                               return TRUE;
-                                       }
-                               }
-
-                               print_to(self, "^1SANDBOX - WARNING: ^7Attempted to spawn an invalid or unsupported item. See 'sandbox help' for allowed items");
-                               return TRUE;
-
                        // ---------------- COMMAND: SPAWN OBJECT ----------------
                        case "object_spawn":
                                if(object_count >= autocvar_g_sandbox_editor_maxobjects)
@@ -276,9 +246,8 @@ MUTATOR_HOOKFUNCTION(sandbox_PlayerCommand)
                                e = sandbox_SpawnObject();
                                setmodel(e, argv(2));
 
-                               if(autocvar_g_sandbox_info)
-                                       print(strcat("^3SANDBOX - SERVER: ^7", self.netname, " spawned an object at origin ", vtos(e.origin), "\n"));
-
+                               if(autocvar_g_sandbox_info > 0)
+                                       print(strcat("^3SANDBOX - SERVER: ^7", self.netname, " spawned an object at origin ^3", vtos(e.origin), "\n"));
                                return TRUE;
 
                        // ---------------- COMMAND: REMOVE OBJECT ----------------
@@ -286,8 +255,8 @@ MUTATOR_HOOKFUNCTION(sandbox_PlayerCommand)
                                e = sandbox_EditObject_Get();
                                if(e != world)
                                {
-                                       if(autocvar_g_sandbox_info)
-                                               print(strcat("^3SANDBOX - SERVER: ^7", self.netname, " removed an object at origin ", vtos(e.origin), "\n"));
+                                       if(autocvar_g_sandbox_info > 0)
+                                               print(strcat("^3SANDBOX - SERVER: ^7", self.netname, " removed an object at origin ^3", vtos(e.origin), "\n"));
                                        sandbox_RemoveObject(e);
                                        return TRUE;
                                }
@@ -331,8 +300,8 @@ MUTATOR_HOOKFUNCTION(sandbox_PlayerCommand)
                                                sandbox_Storage_Load(e, self.object_clipboard);
 
                                                print_to(self, "^2SANDBOX - INFO: ^7Object pasted successfully");
-                                               if(autocvar_g_sandbox_info)
-                                                       print(strcat("^3SANDBOX - SERVER: ^7", self.netname, " pasted an object at origin ", vtos(e.origin), "\n"));
+                                               if(autocvar_g_sandbox_info > 0)
+                                                       print(strcat("^3SANDBOX - SERVER: ^7", self.netname, " pasted an object at origin ^3", vtos(e.origin), "\n"));
                                                return TRUE;
                                }
                                return TRUE;
@@ -475,6 +444,8 @@ MUTATOR_HOOKFUNCTION(sandbox_PlayerCommand)
                                                        print_to(self, "^1SANDBOX - WARNING: ^7Invalid object property. For usage information, type 'sandbox help'");
                                                        break;
                                        }
+                                       if(autocvar_g_sandbox_info > 1)
+                                               print(strcat("^3SANDBOX - SERVER: ^7", self.netname, " edited property ^3", argv(2), " ^7of an object at origin ^3", vtos(e.origin), "\n"));
                                        return TRUE;
                                }
 
@@ -510,11 +481,7 @@ MUTATOR_HOOKFUNCTION(sandbox_PlayerPreThink)
                grab = TRUE;
 
        if(Drag(e, grab)) // execute dragging
-       {
-               if(autocvar_g_sandbox_info)
-                       print(strcat("^3SANDBOX - SERVER: ^7", self.netname, " grabbed an object at origin ", vtos(e.origin), "\n"));
                return TRUE;
-       }
 
        return FALSE;
 }