]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Copy ghost items effect on physical map items
authorMircea Kitsune <sonichedgehog_hyperblast00@yahoo.com>
Wed, 4 Apr 2012 13:54:09 +0000 (16:54 +0300)
committerMircea Kitsune <sonichedgehog_hyperblast00@yahoo.com>
Wed, 4 Apr 2012 13:54:09 +0000 (16:54 +0300)
qcsrc/server/mutators/mutator_physical_weapons.qc

index cbfc579018d75f386157c5cc1f9a0e0918f440f0..440135996aa78f205efe06df8023188e2488dae9 100644 (file)
@@ -1,14 +1,28 @@
 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(!self.owner.modelindex)
                remove(self); // the real weapon is gone, remove this
 }
 
 MUTATOR_HOOKFUNCTION(item_spawning)
 {
-       if(self.classname != "droppedweapon" && autocvar_g_ode_items <= 1)
-               return FALSE;
+       if(self.classname != "droppedweapon")
+       {
+               if(autocvar_g_ode_items <= 1)
+                       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.
@@ -31,6 +45,7 @@ MUTATOR_HOOKFUNCTION(item_spawning)
 
        wep.think = thrown_wep_ode_think;
        wep.nextthink = time;
+       wep.cnt = (self.classname == "droppedweapon");
 
        self.effects |= EF_NODRAW; // hide the original weapon
        self.movetype = MOVETYPE_FOLLOW;