X-Git-Url: http://git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fserver%2Fmutators%2Fmutator_physical_items.qc;h=c99228673d701cf37b7d67f7aea72a999383d11e;hb=ff64f05501fbcb470513b2aee64b4aa271d3c6d4;hp=7c39772aed49377f83e1e47e40d752e8533393f2;hpb=e13b404cae02faad07d65ad29fac1d9e7b7ff0f3;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/server/mutators/mutator_physical_items.qc b/qcsrc/server/mutators/mutator_physical_items.qc index 7c39772ae..c99228673 100644 --- a/qcsrc/server/mutators/mutator_physical_items.qc +++ b/qcsrc/server/mutators/mutator_physical_items.qc @@ -6,7 +6,7 @@ void physical_item_think() self.alpha = self.owner.alpha; // apply fading and ghosting - if(!self.cnt) // map item, not dropped weapon + if(!self.cnt) // map item, not dropped { // copy ghost item properties self.colormap = self.owner.colormap; @@ -14,7 +14,7 @@ void physical_item_think() 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 { @@ -32,7 +32,7 @@ void physical_item_think() } if(!self.owner.modelindex) - remove(self); // the real weapon is gone, remove this + remove(self); // the real item is gone, remove this } void physical_item_touch() @@ -57,7 +57,7 @@ void physical_item_damage(entity inflictor, entity attacker, float damage, float MUTATOR_HOOKFUNCTION(item_spawning) { - if(self.owner == world && autocvar_g_ode_items <= 1) + if(self.owner == world && autocvar_g_physical_items <= 1) return FALSE; if (self.spawnflags & 1) // floating item return FALSE; @@ -79,7 +79,7 @@ MUTATOR_HOOKFUNCTION(item_spawning) 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); @@ -100,10 +100,28 @@ MUTATOR_HOOKFUNCTION(item_spawning) 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; }