]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Merge duplicate_object_copy and duplicate_object_paste into a single duplicate_object...
authorMircea Kitsune <sonichedgehog_hyperblast00@yahoo.com>
Thu, 27 Oct 2011 21:22:14 +0000 (00:22 +0300)
committerMircea Kitsune <sonichedgehog_hyperblast00@yahoo.com>
Thu, 27 Oct 2011 21:22:14 +0000 (00:22 +0300)
qcsrc/menu/xonotic/dialog_sandboxtools.c
qcsrc/server/mutators/sandbox.qc

index 320eaa800762d2ca351fa5a95f3283ecdaeb0a8e..3e6563cc49c05fc3d15520ddf5f2a9a8b421bc36 100644 (file)
@@ -24,8 +24,8 @@ void XonoticSandboxToolsDialog_fill(entity me)
                me.TD(me, 1, 0.5, makeXonoticCommandButton(_("Spawn"), '0 0 0', "sandbox spawn_object $menu_sandbox_spawn_model", 0));
                me.TD(me, 1, 0.5, makeXonoticCommandButton(_("Remove *"), '0 0 0', "sandbox remove_object", 0));
        me.TDempty(me, 0.1);
-               me.TD(me, 1, 0.5, makeXonoticCommandButton(_("Copy *"), '0 0 0', "sandbox duplicate_object_copy", 0));
-               me.TD(me, 1, 0.5, makeXonoticCommandButton(_("Paste"), '0 0 0', "sandbox duplicate_object_paste", 0));
+               me.TD(me, 1, 0.5, makeXonoticCommandButton(_("Copy *"), '0 0 0', "sandbox duplicate_object copy", 0));
+               me.TD(me, 1, 0.5, makeXonoticCommandButton(_("Paste"), '0 0 0', "sandbox duplicate_object paste", 0));
        me.TR(me);
                me.TD(me, 1, 0.25, e = makeXonoticTextLabel(0, _("Bone:")));
                me.TD(me, 1, 1.5, box = makeXonoticInputBox(1, "menu_sandbox_attach_bone"));
@@ -58,20 +58,10 @@ void XonoticSandboxToolsDialog_fill(entity me)
        me.TD(me, 1, 2, e = makeXonoticTextLabel(0, _("Physical object properties for *:")));
        me.TR(me);
                me.TD(me, 1, 0.5, makeXonoticCommandButton(_("Set material:"), '0 0 0', "sandbox edit_object material $menu_sandbox_edit_material", 0));
-
-               /*me.TD(me, 1, 1.5, e = makeXonoticTextSlider("menu_sandbox_edit_material"));
-                       e.addValue(e, _("none"), "0");
-                       e.addValue(e, _("metal"), "1");
-                       e.addValue(e, _("stone"), "2");
-                       e.addValue(e, _("wood"), "3");
-                       e.addValue(e, _("flesh"), "4");
-                       e.configureXonoticTextSliderValues(e);*/
-
                me.TD(me, 1, 1.5, box = makeXonoticInputBox(1, "menu_sandbox_edit_material"));
                        box.forbiddenCharacters = "\r\n\\\"$"; // don't care, isn't getting saved
                        box.maxLength = -127; // negative means encoded length in bytes
                        box.saveImmediately = 1;
-
                me.TD(me, 1, 0.5, makeXonoticCommandButton(_("Set physics:"), '0 0 0', "sandbox edit_object physics $menu_sandbox_edit_physics", 0));
                me.TD(me, 1, 0.5, e = makeXonoticRadioButton(1, "menu_sandbox_edit_physics", "0", _("Static")));
                me.TD(me, 1, 0.5, e = makeXonoticRadioButton(1, "menu_sandbox_edit_physics", "1", _("Movable")));
index 4e65f4eafa4f17471c1cfe60026c70a44f6cd099..82599aae314d8a6909fcb809285f109d1c01c0eb 100644 (file)
@@ -204,8 +204,7 @@ MUTATOR_HOOKFUNCTION(sandbox_PlayerCommand)
                                print_to(self, "^7\"^2spawn_item ^3item^7\" spawns the specified item in front of the player. Only weapons are currently supported");
                                print_to(self, "^7\"^2spawn_object ^3models/foo/bar.md3^7\" spawns a new object in front of the player, and gives it the specified model");
                                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\"^2duplicate_object ^3value^7\" duplicates the object. 'copy' copies the object, 'paste' puts it 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:");
@@ -295,46 +294,46 @@ MUTATOR_HOOKFUNCTION(sandbox_PlayerCommand)
                                print_to(self, "WARNING: Object could not be removed. Make sure you are facing an object that belongs to you (default)");
                                return TRUE;
 
-                       // ---------------- COMMAND: DUPLICATE OBJECT COPY ----------------
-                       case "duplicate_object_copy":
-                               // copies customizable properties of the selected object to the clipboard
-
-                               e = sandbox_EditObject_Get(); // you can only copy objects you can edit, so this works
-                               if(e != world)
+                       // ---------------- COMMAND: DUPLICATE OBJECT ----------------
+                       case "duplicate_object":
+                               switch(argv(2))
                                {
-                                       if(self.object_clipboard)
-                                               strunzone(self.object_clipboard);
-                                       self.object_clipboard = strzone(sandbox_Storage_Save(e));
+                                       case "copy":
+                                               // copies customizable properties of the selected object to the clipboard
+                                               e = sandbox_EditObject_Get(); // you can only copy objects you can edit, so this works
+                                               if(e != world)
+                                               {
+                                                       if(self.object_clipboard)
+                                                               strunzone(self.object_clipboard);
+                                                       self.object_clipboard = strzone(sandbox_Storage_Save(e));
 
-                                       print_to(self, "Object copied to clipboard");
-                                       return TRUE;
-                               }
+                                                       print_to(self, "Object copied to clipboard");
+                                                       return TRUE;
+                                               }
+                                               print_to(self, "WARNING: Object could not be copied. Make sure you are facing an object that belongs to you (default)");
+                                               return TRUE;
 
-                               print_to(self, "WARNING: Object could not be copied. Make sure you are facing an object that belongs to you (default)");
-                               return TRUE;
+                                       case "paste":
+                                               // spawns a new object using the properties in the player's clipboard
+                                               if(!self.object_clipboard) // no object in clipboard
+                                               {
+                                                       print_to(self, "WARNING: No object in clipboard. You must copy an object before you can paste it");
+                                                       return TRUE;
+                                               }
+                                               if(object_count >= autocvar_g_sandbox_editor_maxobjects)
+                                               {
+                                                       print_to(self, strcat("WARNING: Cannot spawn any more objects. Up to ^3", ftos(autocvar_g_sandbox_editor_maxobjects), " ^7objects may exist at a time"));
+                                                       return TRUE;
+                                               }
 
-                       // ---------------- COMMAND: DUPLICATE OBJECT PASTE ----------------
-                       case "duplicate_object_paste":
-                               // spawns a new object using the properties in the player's clipboard
+                                               e = sandbox_SpawnObject();
+                                               sandbox_Storage_Load(e, self.object_clipboard);
 
-                               if(!self.object_clipboard) // no object in clipboard
-                               {
-                                       print_to(self, "WARNING: No object in clipboard. You must copy an object before you can paste it");
-                                       return TRUE;
-                               }
-                               if(object_count >= autocvar_g_sandbox_editor_maxobjects)
-                               {
-                                       print_to(self, strcat("WARNING: Cannot spawn any more objects. Up to ^3", ftos(autocvar_g_sandbox_editor_maxobjects), " ^7objects may exist at a time"));
-                                       return TRUE;
+                                               print_to(self, "Object pasted successfully");
+                                               if(autocvar_g_sandbox_info)
+                                                       print(strcat(self.netname, " pasted an object at origin ", vtos(e.origin), "\n"));
+                                               return TRUE;
                                }
-
-                               e = sandbox_SpawnObject();
-                               sandbox_Storage_Load(e, self.object_clipboard);
-
-                               print_to(self, "Object pasted successfully");
-                               if(autocvar_g_sandbox_info)
-                                       print(strcat(self.netname, " pasted an object at origin ", vtos(e.origin), "\n"));
-
                                return TRUE;
 
                        // ---------------- COMMAND: CLAIM OBJECT ----------------