From c7a3b6c1a8aca003d61ca18a654c600993fe9565 Mon Sep 17 00:00:00 2001 From: Mircea Kitsune Date: Wed, 4 Apr 2012 16:18:01 +0300 Subject: [PATCH] Setting the cvar to 2 makes all items physical, including placed map items. Not recommended, but since this is a mutator why not allow it? --- defaultXonotic.cfg | 4 ++-- qcsrc/server/autocvars.qh | 4 ++-- qcsrc/server/miscfunctions.qc | 2 +- qcsrc/server/mutators/mutator_physical_weapons.qc | 9 +++++---- 4 files changed, 10 insertions(+), 9 deletions(-) diff --git a/defaultXonotic.cfg b/defaultXonotic.cfg index 6be29e7401..adafe30700 100644 --- a/defaultXonotic.cfg +++ b/defaultXonotic.cfg @@ -1387,8 +1387,8 @@ alias sethostname "set menu_use_default_hostname 0; hostname $*" set sv_foginterval 1 "force enable fog in regular intervals" -set g_ode_weapons 1 "use ODE physics instead of simple physics for dropped weapons, requires physics_ode to be enabled" -set g_ode_weapons_damageforcescale 3 "how affected physical weapons are by damage" +set g_ode_items 2 "1 uses ODE physics for dropped weapons, 2 for all items, requires physics_ode to be enabled" +set g_ode_items_damageforcescale 3 "how affected physical weapons are by damage" // Audio track names (for old-style "cd loop NUMBER" usage) set _cdtrack_first "1" diff --git a/qcsrc/server/autocvars.qh b/qcsrc/server/autocvars.qh index e4c99f9ffa..0e77e6091c 100644 --- a/qcsrc/server/autocvars.qh +++ b/qcsrc/server/autocvars.qh @@ -1216,5 +1216,5 @@ float autocvar_g_sandbox_object_material_velocity_min; float autocvar_g_sandbox_object_material_velocity_factor; float autocvar_g_max_info_autoscreenshot; float autocvar_physics_ode; -float autocvar_g_ode_weapons; -float autocvar_g_ode_weapons_damageforcescale; +float autocvar_g_ode_items; +float autocvar_g_ode_items_damageforcescale; diff --git a/qcsrc/server/miscfunctions.qc b/qcsrc/server/miscfunctions.qc index 6598468f4b..0608977e8a 100644 --- a/qcsrc/server/miscfunctions.qc +++ b/qcsrc/server/miscfunctions.qc @@ -1078,7 +1078,7 @@ void readlevelcvars(void) MUTATOR_ADD(mutator_vampire); if(cvar("g_spawn_near_teammate")) MUTATOR_ADD(mutator_spawn_near_teammate); - if(cvar("g_ode_weapons")) + if(cvar("g_ode_items")) MUTATOR_ADD(mutator_physical_weapons); // is this a mutator? is this a mode? diff --git a/qcsrc/server/mutators/mutator_physical_weapons.qc b/qcsrc/server/mutators/mutator_physical_weapons.qc index 2ec984c89c..92a3fb7a37 100644 --- a/qcsrc/server/mutators/mutator_physical_weapons.qc +++ b/qcsrc/server/mutators/mutator_physical_weapons.qc @@ -7,9 +7,7 @@ void thrown_wep_ode_think() MUTATOR_HOOKFUNCTION(item_spawning) { - if(!autocvar_physics_ode) - return FALSE; - if(self.classname != "droppedweapon") + if(self.classname != "droppedweapon" && autocvar_g_ode_items <= 1) return FALSE; // make the dropped weapon physical @@ -25,7 +23,7 @@ MUTATOR_HOOKFUNCTION(item_spawning) wep.solid = SOLID_CORPSE; wep.movetype = MOVETYPE_PHYSICS; wep.takedamage = DAMAGE_AIM; - wep.damageforcescale = autocvar_g_ode_weapons_damageforcescale; + wep.damageforcescale = autocvar_g_ode_items_damageforcescale; wep.think = thrown_wep_ode_think; wep.nextthink = time; @@ -39,6 +37,9 @@ MUTATOR_HOOKFUNCTION(item_spawning) MUTATOR_DEFINITION(mutator_physical_weapons) { + if(!autocvar_physics_ode) + return FALSE; + MUTATOR_HOOK(Item_Spawn, item_spawning, CBC_ORDER_ANY); return FALSE; -- 2.39.2