1 .vector spawn_origin, spawn_angles;
3 void thrown_wep_ode_think()
7 self.alpha = self.owner.alpha; // apply fading and ghosting
9 if(!self.cnt) // map item, not dropped weapon
11 // copy ghost item properties
12 self.colormap = self.owner.colormap;
13 self.colormod = self.owner.colormod;
14 self.glowmod = self.owner.glowmod;
16 // if the item is not spawned, make sure the invisible / ghost item returns to its origin and stays there
17 if(autocvar_g_ode_items_reset)
19 if(self.owner.nextthink > time) // awaiting respawn
21 setorigin(self, self.spawn_origin);
22 self.angles = self.spawn_angles;
23 self.solid = SOLID_NOT;
24 self.movetype = MOVETYPE_NONE;
28 self.solid = SOLID_CORPSE;
29 self.movetype = MOVETYPE_PHYSICS;
34 if(!self.owner.modelindex)
35 remove(self); // the real weapon is gone, remove this
38 void thrown_wep_ode_touch()
40 if(!self.cnt) // not for dropped items
41 if (ITEM_TOUCH_NEEDKILL())
43 setorigin(self, self.spawn_origin);
44 self.angles = self.spawn_angles;
48 MUTATOR_HOOKFUNCTION(item_spawning)
50 if(self.owner == world && autocvar_g_ode_items <= 1)
52 if (self.spawnflags & 1) // floating item
55 // The actual item can't be physical and trigger at the same time, so make it invisible and use a second entity for physics.
56 // Ugly hack, but unless SOLID_TRIGGER is gotten to work with MOVETYPE_PHYSICS in the engine it can't be fixed.
59 setmodel(wep, self.model);
60 setsize(wep, self.mins, self.maxs);
61 setorigin(wep, self.origin);
62 wep.angles = self.angles;
63 wep.velocity = self.velocity;
66 wep.solid = SOLID_CORPSE;
67 wep.movetype = MOVETYPE_PHYSICS;
68 wep.takedamage = DAMAGE_AIM;
69 wep.effects |= EF_NOMODELFLAGS; // disable the spinning
70 wep.colormap = self.owner.colormap;
71 wep.glowmod = self.owner.glowmod;
72 wep.damageforcescale = autocvar_g_ode_items_damageforcescale;
73 wep.dphitcontentsmask = self.dphitcontentsmask;
74 wep.cnt = (self.owner != world);
76 wep.think = thrown_wep_ode_think;
78 wep.touch = thrown_wep_ode_touch;
80 wep.spawn_origin = self.origin;
81 wep.spawn_angles = self.angles;
83 self.effects |= EF_NODRAW; // hide the original weapon
84 self.movetype = MOVETYPE_FOLLOW;
85 self.aiment = wep; // attach the original weapon
90 MUTATOR_DEFINITION(mutator_physical_weapons)
92 if(!autocvar_physics_ode)
95 MUTATOR_HOOK(Item_Spawn, item_spawning, CBC_ORDER_ANY);