]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Move the physical weapon code to the new mutator
authorMircea Kitsune <sonichedgehog_hyperblast00@yahoo.com>
Wed, 4 Apr 2012 13:10:59 +0000 (16:10 +0300)
committerMircea Kitsune <sonichedgehog_hyperblast00@yahoo.com>
Wed, 4 Apr 2012 13:10:59 +0000 (16:10 +0300)
qcsrc/server/cl_weapons.qc
qcsrc/server/mutators/mutator_physical_weapons.qc

index ffb18ae211b52e8469463a751aba3cdf609f142d..64f6778436b8a0de9c7cab2fe275e0f84cc03070 100644 (file)
@@ -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;
        }
 }
index a95017750693fc5430f4c3556980355e5e3ca436..2ec984c89c09819a9f31279a8f6cb671e23aa668 100644 (file)
@@ -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;
 }