]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/mutators/mutator_physical_items.qc
Inferno buff: damaged targets are inflicted with burning for a few seconds
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / mutators / mutator_physical_items.qc
index 285dc4a7cbe4d9a886cd2c706503d6bc5a1d3075..dd2d8556d68fe7801111bc60ac0fd987f84ebea2 100644 (file)
@@ -58,9 +58,9 @@ void physical_item_damage(entity inflictor, entity attacker, float damage, float
 MUTATOR_HOOKFUNCTION(item_spawning)
 {
        if(self.owner == world && autocvar_g_physical_items <= 1)
-               return FALSE;
+               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.
@@ -95,19 +95,33 @@ MUTATOR_HOOKFUNCTION(item_spawning)
        self.movetype = MOVETYPE_FOLLOW;
        self.aiment = wep; // attach the original weapon
 
-       return FALSE;
+       return false;
 }
 
 MUTATOR_DEFINITION(mutator_physical_items)
 {
+       MUTATOR_HOOK(Item_Spawn, item_spawning, CBC_ORDER_ANY);
+
        // check if we have a physics engine
-       if not(autocvar_physics_ode && checkextension("DP_PHYSICS_ODE"))
+       MUTATOR_ONADD
        {
-               dprint("Warning: Physical items are enabled but no physics engine can be used. Reverting to old items.\n");
-               return FALSE;
+               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_HOOK(Item_Spawn, item_spawning, CBC_ORDER_ANY);
+       MUTATOR_ONROLLBACK_OR_REMOVE
+       {
+               // nothing to roll back
+       }
+
+       MUTATOR_ONREMOVE
+       {
+               print("This cannot be removed at runtime\n");
+               return -1;
+       }
 
-       return FALSE;
+       return 0;
 }