From: Mircea Kitsune Date: Wed, 4 Apr 2012 13:10:59 +0000 (+0300) Subject: Move the physical weapon code to the new mutator X-Git-Tag: xonotic-v0.7.0~111^2~19 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=b7d1be9e3e620f75faf5ac3447331c1ba9c54f31;p=xonotic%2Fxonotic-data.pk3dir.git Move the physical weapon code to the new mutator --- diff --git a/qcsrc/server/cl_weapons.qc b/qcsrc/server/cl_weapons.qc index ffb18ae211..64f6778436 100644 --- a/qcsrc/server/cl_weapons.qc +++ b/qcsrc/server/cl_weapons.qc @@ -186,13 +186,6 @@ void thrown_wep_think() SUB_VanishOrRemove(self); } -void thrown_wep_ode_think() -{ - self.nextthink = time; - if(!self.owner.modelindex) - remove(self); // the real weapon is gone, remove this -} - // returns amount of ammo used as string, or -1 for failure, or 0 for no ammo count string W_ThrowNewWeapon(entity own, float wpn, float doreduce, vector org, vector velo) { @@ -310,31 +303,6 @@ string W_ThrowNewWeapon(entity own, float wpn, float doreduce, vector org, vecto wep.nextthink = min(wep.nextthink, time + 0.5); wep.pickup_anyway = TRUE; // these are ALWAYS pickable - // make the dropped weapon physical - /*if(autocvar_physics_ode && autocvar_physics_ode_droppedweapon) - { - entity wep2; - wep2 = spawn(); - setsize(wep2, wep.mins, wep.maxs); - setorigin(wep2, wep.origin); - wep2.angles = wep.angles; - wep2.velocity = velo; - - wep2.classname = "droppedweapon2"; - wep2.owner = wep; - wep2.solid = SOLID_CORPSE; - wep2.movetype = MOVETYPE_PHYSICS; - wep2.takedamage = DAMAGE_AIM; - wep2.damageforcescale = autocvar_physics_ode_droppedweapon_damageforcescale; - - wep2.think = thrown_wep_ode_think; - wep2.nextthink = time; - - wep.effects |= EF_NOMODELFLAGS; // disable the spinning - wep.movetype = MOVETYPE_FOLLOW; - wep.aiment = wep2; - }*/ - return s; } } diff --git a/qcsrc/server/mutators/mutator_physical_weapons.qc b/qcsrc/server/mutators/mutator_physical_weapons.qc index a950177506..2ec984c89c 100644 --- a/qcsrc/server/mutators/mutator_physical_weapons.qc +++ b/qcsrc/server/mutators/mutator_physical_weapons.qc @@ -1,13 +1,45 @@ +void thrown_wep_ode_think() +{ + self.nextthink = time; + if(!self.owner.modelindex) + remove(self); // the real weapon is gone, remove this +} + MUTATOR_HOOKFUNCTION(item_spawning) { - dprint("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n"); + if(!autocvar_physics_ode) + return FALSE; + if(self.classname != "droppedweapon") + return FALSE; + + // make the dropped weapon physical + entity wep; + wep = spawn(); + setsize(wep, self.mins, self.maxs); + setorigin(wep, self.origin); + wep.angles = self.angles; + wep.velocity = self.velocity; + + wep.classname = "droppedweapon2"; + wep.owner = self; + wep.solid = SOLID_CORPSE; + wep.movetype = MOVETYPE_PHYSICS; + wep.takedamage = DAMAGE_AIM; + wep.damageforcescale = autocvar_g_ode_weapons_damageforcescale; + + wep.think = thrown_wep_ode_think; + wep.nextthink = time; + + self.effects |= EF_NOMODELFLAGS; // disable the spinning + self.movetype = MOVETYPE_FOLLOW; + self.aiment = wep; - return 0; + return FALSE; } MUTATOR_DEFINITION(mutator_physical_weapons) { MUTATOR_HOOK(Item_Spawn, item_spawning, CBC_ORDER_ANY); - return 0; + return FALSE; }