From e13b404cae02faad07d65ad29fac1d9e7b7ff0f3 Mon Sep 17 00:00:00 2001
From: Mircea Kitsune <sonichedgehog_hyperblast00@yahoo.com>
Date: Wed, 4 Apr 2012 22:33:15 +0300
Subject: [PATCH] More name correction and also make items that fall into lava
 and slime return to spawn

---
 .../server/mutators/mutator_physical_items.qc | 19 +++++++++++++++----
 1 file changed, 15 insertions(+), 4 deletions(-)

diff --git a/qcsrc/server/mutators/mutator_physical_items.qc b/qcsrc/server/mutators/mutator_physical_items.qc
index e362b11f41..7c39772aed 100644
--- a/qcsrc/server/mutators/mutator_physical_items.qc
+++ b/qcsrc/server/mutators/mutator_physical_items.qc
@@ -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;
-- 
2.39.5