self.glowmod = self.owner.glowmod;
// if the item is not spawned, make sure the invisible / ghost item returns to its origin and stays there
- if(autocvar_g_ode_items_reset)
+ if(autocvar_g_physical_items_reset)
{
if(self.owner.nextthink > time) // awaiting respawn
{
MUTATOR_HOOKFUNCTION(item_spawning)
{
- if(self.owner == world && autocvar_g_ode_items <= 1)
- return FALSE;
+ if(self.owner == world && autocvar_g_physical_items <= 1)
+ return false;
if (self.spawnflags & 1) // floating item
- return FALSE;
+ 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.
wep.effects |= EF_NOMODELFLAGS; // disable the spinning
wep.colormap = self.owner.colormap;
wep.glowmod = self.owner.glowmod;
- wep.damageforcescale = autocvar_g_ode_items_damageforcescale;
+ wep.damageforcescale = autocvar_g_physical_items_damageforcescale;
wep.dphitcontentsmask = self.dphitcontentsmask;
wep.cnt = (self.owner != world);
self.movetype = MOVETYPE_FOLLOW;
self.aiment = wep; // attach the original weapon
- return FALSE;
+ return false;
}
MUTATOR_DEFINITION(mutator_physical_items)
{
- if(!autocvar_physics_ode)
- return FALSE;
-
MUTATOR_HOOK(Item_Spawn, item_spawning, CBC_ORDER_ANY);
- return FALSE;
+ // check if we have a physics engine
+ MUTATOR_ONADD
+ {
+ if (!(autocvar_physics_ode && checkextension("DP_PHYSICS_ODE")))
+ {
+ dprint("Warning: Physical items are enabled but no physics engine can be used. Reverting to old items.\n");
+ return -1;
+ }
+ }
+
+ MUTATOR_ONROLLBACK_OR_REMOVE
+ {
+ // nothing to roll back
+ }
+
+ MUTATOR_ONREMOVE
+ {
+ print("This cannot be removed at runtime\n");
+ return -1;
+ }
+
+ return 0;
}