]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Make the physical item visible and hide the trigger weapon instead
authorMircea Kitsune <sonichedgehog_hyperblast00@yahoo.com>
Wed, 4 Apr 2012 13:42:33 +0000 (16:42 +0300)
committerMircea Kitsune <sonichedgehog_hyperblast00@yahoo.com>
Wed, 4 Apr 2012 13:42:33 +0000 (16:42 +0300)
qcsrc/server/mutators/mutator_physical_weapons.qc

index 92a3fb7a375b1112901c2fa15dfa89e09f3bc674..fa27a36a7a4aa69d477c68d1a26c9a3936cb5f2a 100644 (file)
@@ -10,27 +10,31 @@ MUTATOR_HOOKFUNCTION(item_spawning)
        if(self.classname != "droppedweapon" && autocvar_g_ode_items <= 1)
                return FALSE;
 
-       // make the dropped weapon physical
+       // 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.
        entity wep;
        wep = spawn();
+       setmodel(wep, self.model);
        setsize(wep, self.mins, self.maxs);
        setorigin(wep, self.origin);
        wep.angles = self.angles;
        wep.velocity = self.velocity;
 
-       wep.classname = "droppedweapon2";
        wep.owner = self;
        wep.solid = SOLID_CORPSE;
        wep.movetype = MOVETYPE_PHYSICS;
        wep.takedamage = DAMAGE_AIM;
+       wep.effects |= EF_NOMODELFLAGS; // disable the spinning
+       wep.colormap = self.colormap;
+       wep.glowmod = self.glowmod;
        wep.damageforcescale = autocvar_g_ode_items_damageforcescale;
 
        wep.think = thrown_wep_ode_think;
        wep.nextthink = time;
 
-       self.effects |= EF_NOMODELFLAGS; // disable the spinning
+       self.effects |= EF_NODRAW; // hide the original weapon
        self.movetype = MOVETYPE_FOLLOW;
-       self.aiment = wep;
+       self.aiment = wep; // attach the original weapon
 
        return FALSE;
 }