From 17ae04e6223a9cb0dff03065cda301f9a69a95e3 Mon Sep 17 00:00:00 2001 From: Mircea Kitsune Date: Wed, 26 Oct 2011 12:48:35 +0300 Subject: [PATCH] Allow setting the object color and glow color of objects. Note that the menu color picker does not work yet, since I need to figure a way around it sending the RGB vector with quotation marks (eg: "0 0 0" instead of 0 0 0). --- defaultXonotic.cfg | 2 ++ qcsrc/menu/xonotic/dialog_sandboxtools.c | 6 +++++ qcsrc/server/mutators/sandbox.qc | 32 ++++++++++++++++++------ 3 files changed, 32 insertions(+), 8 deletions(-) diff --git a/defaultXonotic.cfg b/defaultXonotic.cfg index 77b9a0bbc..6e8433174 100644 --- a/defaultXonotic.cfg +++ b/defaultXonotic.cfg @@ -549,6 +549,8 @@ set g_sandbox_editor_distance_edit 350 "distance at which players can edit or re seta menu_sandbox_spawn_model "" // used to store the model in the input field set menu_sandbox_edit_skin 0 set menu_sandbox_edit_alpha 1 +set menu_sandbox_edit_color_main "1 1 1" +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 diff --git a/qcsrc/menu/xonotic/dialog_sandboxtools.c b/qcsrc/menu/xonotic/dialog_sandboxtools.c index b795a255c..2ee34d2d3 100644 --- a/qcsrc/menu/xonotic/dialog_sandboxtools.c +++ b/qcsrc/menu/xonotic/dialog_sandboxtools.c @@ -34,6 +34,12 @@ void XonoticSandboxToolsDialog_fill(entity me) me.TD(me, 1, 1.5, e = makeXonoticSlider(0, 99, 1, "menu_sandbox_edit_skin")); me.TD(me, 1, 0.5, makeXonoticCommandButton(_("Set alpha:"), '0 0 0', "sandbox edit_object alpha $menu_sandbox_edit_alpha", 0)); me.TD(me, 1, 1.5, e = makeXonoticSlider(0.1, 1, 0.05, "menu_sandbox_edit_alpha")); + me.TR(me); + me.TD(me, 1, 0.5, makeXonoticCommandButton(_("Set color 1:"), '0 0 0', "sandbox edit_object color_main $menu_sandbox_edit_color_main", 0)); + me.TD(me, 2, 1.5, e = makeXonoticColorpickerString("menu_sandbox_edit_color_main", "menu_sandbox_edit_color_main")); + me.TD(me, 1, 0.5, makeXonoticCommandButton(_("Set color 2:"), '0 0 0', "sandbox edit_object color_glow $menu_sandbox_edit_color_glow", 0)); + me.TD(me, 2, 1.5, e = makeXonoticColorpickerString("menu_sandbox_edit_color_glow", "menu_sandbox_edit_color_glow")); + me.TR(me); me.TR(me); me.TD(me, 1, 0.5, makeXonoticCommandButton(_("Set frame:"), '0 0 0', "sandbox edit_object frame $menu_sandbox_edit_frame", 0)); me.TD(me, 1, 1.5, e = makeXonoticSlider(0, 99, 1, "menu_sandbox_edit_frame")); diff --git a/qcsrc/server/mutators/sandbox.qc b/qcsrc/server/mutators/sandbox.qc index c879fd59d..13fa9b41b 100644 --- a/qcsrc/server/mutators/sandbox.qc +++ b/qcsrc/server/mutators/sandbox.qc @@ -61,11 +61,13 @@ MUTATOR_HOOKFUNCTION(sandbox_PlayerCommand) print_to(self, "^7\"^2duplicate_object_paste^7\" pastes the copied object in front of the player"); print_to(self, "^7\"^2edit_object ^3property value^7\" edits the given property of the object. Players can only edit their own objects"); print_to(self, "^7Object properties for ^2edit_object^7:"); - print_to(self, "^3skin ^7- changes the skin of the object"); - print_to(self, "^3alpha ^7- sets object transparency"); - print_to(self, "^3frame ^7- object animation frame, for self-animated models"); - print_to(self, "^3scale ^7- changes object scale. 0.5 is half size and 2 is double size"); - print_to(self, "^3physics ^7- object physics, 0 = static, 1 = movable, 2 = physical"); + print_to(self, "^3skin value ^7- changes the skin of the object"); + print_to(self, "^3alpha value ^7- sets object transparency"); + print_to(self, "^3colormod value_x value_y value_z ^7- main object color"); + print_to(self, "^3glowmod value_x value_y value_z ^7- glow object color"); + 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, "^7The ^1drag object ^7key can be used to grab and carry objects. Players can only grab their own objects"); return TRUE; @@ -150,6 +152,8 @@ MUTATOR_HOOKFUNCTION(sandbox_PlayerCommand) self.object_clipboard = strcat(e.model, " "); self.object_clipboard = strcat(self.object_clipboard, ftos(e.skin), " "); self.object_clipboard = strcat(self.object_clipboard, ftos(e.alpha), " "); + self.object_clipboard = strcat(self.object_clipboard, ftos(e.colormod_x), " ", ftos(e.colormod_y), " ", ftos(e.colormod_z), " "); + self.object_clipboard = strcat(self.object_clipboard, ftos(e.glowmod_x), " ", ftos(e.glowmod_y), " ", ftos(e.glowmod_z), " "); 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), " "); @@ -179,9 +183,11 @@ MUTATOR_HOOKFUNCTION(sandbox_PlayerCommand) setmodel(e, argv(0)); e.skin = stof(argv(1)); e.alpha = stof(argv(2)); - e.frame = stof(argv(3)); - e.scale = stof(argv(4)); setsize(e, e.mins * e.scale, e.maxs * e.scale); // adapt bounding box size to model size - e.movetype = stof(argv(5)); + e.colormod_x = stof(argv(3)); e.colormod_y = stof(argv(4)); e.colormod_z = stof(argv(5)); + e.glowmod_x = stof(argv(6)); e.glowmod_y = stof(argv(7)); e.glowmod_z = stof(argv(8)); + e.frame = stof(argv(9)); + e.scale = stof(argv(10)); setsize(e, e.mins * e.scale, e.maxs * e.scale); // adapt bounding box size to model size + e.movetype = stof(argv(11)); print_to(self, "Object pasted"); if(autocvar_g_sandbox_info) @@ -208,6 +214,16 @@ MUTATOR_HOOKFUNCTION(sandbox_PlayerCommand) case "alpha": e.alpha = stof(argv(3)); break; + case "color_main": + e.colormod_x = stof(argv(3)); + e.colormod_y = stof(argv(4)); + e.colormod_z = stof(argv(5)); + break; + case "color_glow": + e.glowmod_x = stof(argv(3)); + e.glowmod_y = stof(argv(4)); + e.glowmod_z = stof(argv(5)); + break; case "frame": e.frame = stof(argv(3)); break; -- 2.39.2