]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
More name correction and also make items that fall into lava and slime return to...
authorMircea Kitsune <sonichedgehog_hyperblast00@yahoo.com>
Wed, 4 Apr 2012 19:33:15 +0000 (22:33 +0300)
committerMircea Kitsune <sonichedgehog_hyperblast00@yahoo.com>
Wed, 4 Apr 2012 19:33:15 +0000 (22:33 +0300)
qcsrc/server/mutators/mutator_physical_items.qc

index e362b11f413555f1c23b70b12742a9b75ed10207..7c39772aed49377f83e1e47e40d752e8533393f2 100644 (file)
@@ -1,6 +1,6 @@
 .vector spawn_origin, spawn_angles;
 
-void thrown_wep_ode_think()
+void physical_item_think()
 {
        self.nextthink = time;
 
@@ -35,7 +35,7 @@ void thrown_wep_ode_think()
                remove(self); // the real weapon is gone, remove this
 }
 
-void thrown_wep_ode_touch()
+void physical_item_touch()
 {
        if(!self.cnt) // not for dropped items
        if (ITEM_TOUCH_NEEDKILL())
@@ -45,6 +45,16 @@ void thrown_wep_ode_touch()
        }
 }
 
+void physical_item_damage(entity inflictor, entity attacker, float damage, float deathtype, vector hitloc, vector force)
+{
+       if(!self.cnt) // not for dropped items
+       if(ITEM_DAMAGE_NEEDKILL(deathtype))
+       {
+               setorigin(self, self.spawn_origin);
+               self.angles = self.spawn_angles;
+       }
+}
+
 MUTATOR_HOOKFUNCTION(item_spawning)
 {
        if(self.owner == world && autocvar_g_ode_items <= 1)
@@ -73,9 +83,10 @@ MUTATOR_HOOKFUNCTION(item_spawning)
        wep.dphitcontentsmask = self.dphitcontentsmask;
        wep.cnt = (self.owner != world);
 
-       wep.think = thrown_wep_ode_think;
+       wep.think = physical_item_think;
        wep.nextthink = time;
-       wep.touch = thrown_wep_ode_touch;
+       wep.touch = physical_item_touch;
+       wep.event_damage = physical_item_damage;
 
        wep.spawn_origin = self.origin;
        wep.spawn_angles = self.angles;