]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Reset an item if it fell off the map (eg: in lava)
authorMircea Kitsune <sonichedgehog_hyperblast00@yahoo.com>
Wed, 4 Apr 2012 16:44:45 +0000 (19:44 +0300)
committerMircea Kitsune <sonichedgehog_hyperblast00@yahoo.com>
Wed, 4 Apr 2012 16:44:45 +0000 (19:44 +0300)
qcsrc/server/mutators/mutator_physical_weapons.qc

index 489379b6ff1dac33a9759c36f5ebbd762cea6994..9d83e9a06b4004f21240f753a28445f56e380c94 100644 (file)
@@ -35,6 +35,15 @@ void thrown_wep_ode_think()
                remove(self); // the real weapon is gone, remove this
 }
 
+void thrown_wep_ode_touch()
+{
+       if (ITEM_TOUCH_NEEDKILL())
+       {
+               setorigin(self, self.spawn_origin);
+               self.angles = self.spawn_angles;
+       }
+}
+
 MUTATOR_HOOKFUNCTION(item_spawning)
 {
        if(self.classname != "droppedweapon" && autocvar_g_ode_items <= 1)
@@ -60,10 +69,12 @@ MUTATOR_HOOKFUNCTION(item_spawning)
        wep.colormap = self.owner.colormap;
        wep.glowmod = self.owner.glowmod;
        wep.damageforcescale = autocvar_g_ode_items_damageforcescale;
+       wep.dphitcontentsmask = self.dphitcontentsmask;
+       wep.cnt = (self.classname == "droppedweapon");
 
        wep.think = thrown_wep_ode_think;
        wep.nextthink = time;
-       wep.cnt = (self.classname == "droppedweapon");
+       wep.touch = thrown_wep_ode_touch;
 
        wep.spawn_origin = self.origin;
        wep.spawn_angles = self.angles;