From f8f94013f555de90d10c9f35a31e4c9bd3254974 Mon Sep 17 00:00:00 2001 From: Mircea Kitsune Date: Wed, 26 Oct 2011 15:10:52 +0300 Subject: [PATCH] Add damageforcescale as an editable object property --- defaultXonotic.cfg | 1 + qcsrc/menu/xonotic/dialog_sandboxtools.c | 3 +++ qcsrc/server/mutators/sandbox.qc | 7 +++++++ 3 files changed, 11 insertions(+) diff --git a/defaultXonotic.cfg b/defaultXonotic.cfg index 6e8433174..4b9b5a45a 100644 --- a/defaultXonotic.cfg +++ b/defaultXonotic.cfg @@ -554,6 +554,7 @@ set menu_sandbox_edit_color_glow "1 1 1" set menu_sandbox_edit_frame 0 set menu_sandbox_edit_scale 1 set menu_sandbox_edit_physics 0 +set menu_sandbox_edit_force 0 alias menu_showsandboxtools "menu_cmd directmenu SandboxTools" bind f7 menu_showsandboxtools diff --git a/qcsrc/menu/xonotic/dialog_sandboxtools.c b/qcsrc/menu/xonotic/dialog_sandboxtools.c index b181f8c27..39cb99768 100644 --- a/qcsrc/menu/xonotic/dialog_sandboxtools.c +++ b/qcsrc/menu/xonotic/dialog_sandboxtools.c @@ -53,6 +53,9 @@ void XonoticSandboxToolsDialog_fill(entity me) 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"))); me.TD(me, 1, 0.5, e = makeXonoticRadioButton(1, "menu_sandbox_edit_physics", "2", _("Physical"))); + me.TR(me); + me.TD(me, 1, 0.5, makeXonoticCommandButton(_("Set force:"), '0 0 0', "sandbox edit_object force $menu_sandbox_edit_force", 0)); + me.TD(me, 1, 1.5, e = makeXonoticSlider(0, 10, 0.5, "menu_sandbox_edit_force")); me.gotoRC(me, me.rows - 1, 0); me.TD(me, 1, me.columns, e = makeXonoticButton(_("OK"), '0 0 0')); diff --git a/qcsrc/server/mutators/sandbox.qc b/qcsrc/server/mutators/sandbox.qc index b1292263d..a0d4c56df 100644 --- a/qcsrc/server/mutators/sandbox.qc +++ b/qcsrc/server/mutators/sandbox.qc @@ -21,6 +21,7 @@ entity sandbox_SpawnObject() e.realowner = self; e.classname = "object"; e.takedamage = DAMAGE_AIM; + e.damageforcescale = 0; e.solid = SOLID_BBOX; // SOLID_BSP would be best, but can lag the server badly e.movetype = MOVETYPE_TOSS; e.frame = 0; @@ -68,6 +69,7 @@ MUTATOR_HOOKFUNCTION(sandbox_PlayerCommand) print_to(self, "^3frame value ^7- object animation frame, for self-animated models"); print_to(self, "^3scale value ^7- changes object scale. 0.5 is half size and 2 is double size"); print_to(self, "^3physics value ^7- object physics, 0 = static, 1 = movable, 2 = physical"); + print_to(self, "^force value ^7- amount of force applied to objects that are shot"); print_to(self, "^7The ^1drag object ^7key can be used to grab and carry objects. Players can only grab their own objects"); return TRUE; @@ -157,6 +159,7 @@ MUTATOR_HOOKFUNCTION(sandbox_PlayerCommand) self.object_clipboard = strcat(self.object_clipboard, ftos(e.frame), " "); self.object_clipboard = strcat(self.object_clipboard, ftos(e.scale), " "); self.object_clipboard = strcat(self.object_clipboard, ftos(e.movetype), " "); + self.object_clipboard = strcat(self.object_clipboard, ftos(e.damageforcescale), " "); self.object_clipboard = strzone(self.object_clipboard); print_to(self, "Object copied to clipboard"); @@ -188,6 +191,7 @@ MUTATOR_HOOKFUNCTION(sandbox_PlayerCommand) e.frame = stof(argv(5)); e.scale = stof(argv(6)); if(self.scale) setsize(e, e.mins * e.scale, e.maxs * e.scale); // adapt bounding box size to model size e.movetype = stof(argv(7)); + e.damageforcescale = stof(argv(8)); print_to(self, "Object pasted"); if(autocvar_g_sandbox_info) @@ -244,6 +248,9 @@ MUTATOR_HOOKFUNCTION(sandbox_PlayerCommand) break; } break; + case "force": + e.damageforcescale = stof(argv(3)); + break; default: print_to(self, "WARNING: Invalid object property. For usage information, type 'sandbox help'"); break; -- 2.39.2