]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Rename physical_weapons to physical_items
authorMircea Kitsune <sonichedgehog_hyperblast00@yahoo.com>
Wed, 4 Apr 2012 19:23:41 +0000 (22:23 +0300)
committerMircea Kitsune <sonichedgehog_hyperblast00@yahoo.com>
Wed, 4 Apr 2012 19:23:41 +0000 (22:23 +0300)
qcsrc/server/miscfunctions.qc
qcsrc/server/mutators/mutator_physical_items.qc [new file with mode: 0644]
qcsrc/server/mutators/mutator_physical_weapons.qc [deleted file]
qcsrc/server/mutators/mutators.qh
qcsrc/server/progs.src

index 0608977e8af5dac0423e39e2b92800225a313274..71ae10b122ebacaf2824fbbd6d8bbabd25a557d6 100644 (file)
@@ -1079,7 +1079,7 @@ void readlevelcvars(void)
        if(cvar("g_spawn_near_teammate"))
                MUTATOR_ADD(mutator_spawn_near_teammate);
        if(cvar("g_ode_items"))
-               MUTATOR_ADD(mutator_physical_weapons);
+               MUTATOR_ADD(mutator_physical_items);
 
        // is this a mutator? is this a mode?
        if(cvar("g_sandbox"))
diff --git a/qcsrc/server/mutators/mutator_physical_items.qc b/qcsrc/server/mutators/mutator_physical_items.qc
new file mode 100644 (file)
index 0000000..e362b11
--- /dev/null
@@ -0,0 +1,98 @@
+.vector spawn_origin, spawn_angles;
+
+void thrown_wep_ode_think()
+{
+       self.nextthink = time;
+
+       self.alpha = self.owner.alpha; // apply fading and ghosting
+
+       if(!self.cnt) // map item, not dropped weapon
+       {
+               // copy ghost item properties
+               self.colormap = self.owner.colormap;
+               self.colormod = self.owner.colormod;
+               self.glowmod = self.owner.glowmod;
+
+               // if the item is not spawned, make sure the invisible / ghost item returns to its origin and stays there
+               if(autocvar_g_ode_items_reset)
+               {
+                       if(self.owner.nextthink > time) // awaiting respawn
+                       {
+                               setorigin(self, self.spawn_origin);
+                               self.angles = self.spawn_angles;
+                               self.solid = SOLID_NOT;
+                               self.movetype = MOVETYPE_NONE;
+                       }
+                       else
+                       {
+                               self.solid = SOLID_CORPSE;
+                               self.movetype = MOVETYPE_PHYSICS;
+                       }
+               }
+       }
+
+       if(!self.owner.modelindex)
+               remove(self); // the real weapon is gone, remove this
+}
+
+void thrown_wep_ode_touch()
+{
+       if(!self.cnt) // not for dropped items
+       if (ITEM_TOUCH_NEEDKILL())
+       {
+               setorigin(self, self.spawn_origin);
+               self.angles = self.spawn_angles;
+       }
+}
+
+MUTATOR_HOOKFUNCTION(item_spawning)
+{
+       if(self.owner == world && autocvar_g_ode_items <= 1)
+               return FALSE;
+       if (self.spawnflags & 1) // floating item
+               return FALSE;
+
+       // The actual item can't be physical and trigger at the same time, so make it invisible and use a second entity for physics.
+       // Ugly hack, but unless SOLID_TRIGGER is gotten to work with MOVETYPE_PHYSICS in the engine it can't be fixed.
+       entity wep;
+       wep = spawn();
+       setmodel(wep, self.model);
+       setsize(wep, self.mins, self.maxs);
+       setorigin(wep, self.origin);
+       wep.angles = self.angles;
+       wep.velocity = self.velocity;
+
+       wep.owner = self;
+       wep.solid = SOLID_CORPSE;
+       wep.movetype = MOVETYPE_PHYSICS;
+       wep.takedamage = DAMAGE_AIM;
+       wep.effects |= EF_NOMODELFLAGS; // disable the spinning
+       wep.colormap = self.owner.colormap;
+       wep.glowmod = self.owner.glowmod;
+       wep.damageforcescale = autocvar_g_ode_items_damageforcescale;
+       wep.dphitcontentsmask = self.dphitcontentsmask;
+       wep.cnt = (self.owner != world);
+
+       wep.think = thrown_wep_ode_think;
+       wep.nextthink = time;
+       wep.touch = thrown_wep_ode_touch;
+
+       wep.spawn_origin = self.origin;
+       wep.spawn_angles = self.angles;
+
+       self.effects |= EF_NODRAW; // hide the original weapon
+       self.movetype = MOVETYPE_FOLLOW;
+       self.aiment = wep; // attach the original weapon
+
+       return FALSE;
+}
+
+MUTATOR_DEFINITION(mutator_physical_items)
+{
+       if(!autocvar_physics_ode)
+               return FALSE;
+
+       MUTATOR_HOOK(Item_Spawn, item_spawning, CBC_ORDER_ANY);
+
+       return FALSE;
+}
diff --git a/qcsrc/server/mutators/mutator_physical_weapons.qc b/qcsrc/server/mutators/mutator_physical_weapons.qc
deleted file mode 100644 (file)
index 3bf1c53..0000000
+++ /dev/null
@@ -1,98 +0,0 @@
-.vector spawn_origin, spawn_angles;
-
-void thrown_wep_ode_think()
-{
-       self.nextthink = time;
-
-       self.alpha = self.owner.alpha; // apply fading and ghosting
-
-       if(!self.cnt) // map item, not dropped weapon
-       {
-               // copy ghost item properties
-               self.colormap = self.owner.colormap;
-               self.colormod = self.owner.colormod;
-               self.glowmod = self.owner.glowmod;
-
-               // if the item is not spawned, make sure the invisible / ghost item returns to its origin and stays there
-               if(autocvar_g_ode_items_reset)
-               {
-                       if(self.owner.nextthink > time) // awaiting respawn
-                       {
-                               setorigin(self, self.spawn_origin);
-                               self.angles = self.spawn_angles;
-                               self.solid = SOLID_NOT;
-                               self.movetype = MOVETYPE_NONE;
-                       }
-                       else
-                       {
-                               self.solid = SOLID_CORPSE;
-                               self.movetype = MOVETYPE_PHYSICS;
-                       }
-               }
-       }
-
-       if(!self.owner.modelindex)
-               remove(self); // the real weapon is gone, remove this
-}
-
-void thrown_wep_ode_touch()
-{
-       if(!self.cnt) // not for dropped items
-       if (ITEM_TOUCH_NEEDKILL())
-       {
-               setorigin(self, self.spawn_origin);
-               self.angles = self.spawn_angles;
-       }
-}
-
-MUTATOR_HOOKFUNCTION(item_spawning)
-{
-       if(self.owner == world && autocvar_g_ode_items <= 1)
-               return FALSE;
-       if (self.spawnflags & 1) // floating item
-               return FALSE;
-
-       // The actual item can't be physical and trigger at the same time, so make it invisible and use a second entity for physics.
-       // Ugly hack, but unless SOLID_TRIGGER is gotten to work with MOVETYPE_PHYSICS in the engine it can't be fixed.
-       entity wep;
-       wep = spawn();
-       setmodel(wep, self.model);
-       setsize(wep, self.mins, self.maxs);
-       setorigin(wep, self.origin);
-       wep.angles = self.angles;
-       wep.velocity = self.velocity;
-
-       wep.owner = self;
-       wep.solid = SOLID_CORPSE;
-       wep.movetype = MOVETYPE_PHYSICS;
-       wep.takedamage = DAMAGE_AIM;
-       wep.effects |= EF_NOMODELFLAGS; // disable the spinning
-       wep.colormap = self.owner.colormap;
-       wep.glowmod = self.owner.glowmod;
-       wep.damageforcescale = autocvar_g_ode_items_damageforcescale;
-       wep.dphitcontentsmask = self.dphitcontentsmask;
-       wep.cnt = (self.owner != world);
-
-       wep.think = thrown_wep_ode_think;
-       wep.nextthink = time;
-       wep.touch = thrown_wep_ode_touch;
-
-       wep.spawn_origin = self.origin;
-       wep.spawn_angles = self.angles;
-
-       self.effects |= EF_NODRAW; // hide the original weapon
-       self.movetype = MOVETYPE_FOLLOW;
-       self.aiment = wep; // attach the original weapon
-
-       return FALSE;
-}
-
-MUTATOR_DEFINITION(mutator_physical_weapons)
-{
-       if(!autocvar_physics_ode)
-               return FALSE;
-
-       MUTATOR_HOOK(Item_Spawn, item_spawning, CBC_ORDER_ANY);
-
-       return FALSE;
-}
index 072e652fff72bb88ec7f516291ba16031c30ac61..4d019eec00379f9ed4c92cc05d8f3bba9793008c 100644 (file)
@@ -10,6 +10,6 @@ MUTATOR_DECLARATION(mutator_rocketflying);
 MUTATOR_DECLARATION(mutator_vampire);
 MUTATOR_DECLARATION(mutator_spawn_near_teammate);
 MUTATOR_DECLARATION(mutator_spawn_near_teammate);
-MUTATOR_DECLARATION(mutator_physical_weapons);
+MUTATOR_DECLARATION(mutator_physical_items);
 
 MUTATOR_DECLARATION(sandbox);
index 92f9fa6a21a4896c7a7dd468eb5544c47b230243..d8210e77065b7193553c5088776e181683cc2aec 100644 (file)
@@ -215,7 +215,7 @@ mutators/mutator_dodging.qc
 mutators/mutator_rocketflying.qc
 mutators/mutator_vampire.qc
 mutators/mutator_spawn_near_teammate.qc
-mutators/mutator_physical_weapons.qc
+mutators/mutator_physical_items.qc
 mutators/sandbox.qc
 
 ../warpzonelib/anglestransform.qc