]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Fix physical items
authorMario <zacjardine@y7mail.com>
Sun, 30 Aug 2015 12:41:50 +0000 (22:41 +1000)
committerMario <zacjardine@y7mail.com>
Sun, 30 Aug 2015 12:41:50 +0000 (22:41 +1000)
qcsrc/server/mutators/mutator_physical_items.qc

index 08bb81a9f6a9d6a646a1103a6771b7b23eae7952..0ee697d261f2d4425cdd4eb37b68a634cc7da734 100644 (file)
@@ -20,15 +20,17 @@ void physical_item_think()
                // if the item is not spawned, make sure the invisible / ghost item returns to its origin and stays there
                if(autocvar_g_physical_items_reset)
                {
-                       if(self.owner.nextthink > time) // awaiting respawn
+                       if(self.owner.wait > time) // awaiting respawn
                        {
                                setorigin(self, self.spawn_origin);
                                self.angles = self.spawn_angles;
                                self.solid = SOLID_NOT;
+                               self.alpha = -1;
                                self.movetype = MOVETYPE_NONE;
                        }
                        else
                        {
+                               self.alpha = 1;
                                self.solid = SOLID_CORPSE;
                                self.movetype = MOVETYPE_PHYSICS;
                        }
@@ -92,12 +94,24 @@ MUTATOR_HOOKFUNCTION(item_spawning)
        wep.touch = physical_item_touch;
        wep.event_damage = physical_item_damage;
 
-       wep.spawn_origin = self.origin;
+       if(!wep.cnt)
+       {
+               // fix the spawn origin
+               setorigin(wep, wep.origin + '0 0 1');
+               entity oldself;
+               oldself = self;
+               self = wep;
+               builtin_droptofloor();
+               self = oldself;
+       }
+
+       wep.spawn_origin = wep.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
+       self.SendEntity = func_null;
 
        return false;
 }