// called at when a item is touched. Called early, can edit item properties.
entity self; // item
entity other; // player
+ #define MUT_ITEMTOUCH_CONTINUE 0 // return this flag to make the function continue as normal
+ #define MUT_ITEMTOUCH_RETURN 1 // return this flag to make the function return (handled entirely by mutator)
+ #define MUT_ITEMTOUCH_PICKUP 2 // return this flag to have the item "picked up" and taken even after mutator handled it
MUTATOR_HOOKABLE(ClientConnect);
// called at when a player connect
MUTATOR_HOOKFUNCTION(freezetag_ItemTouch)
{
if (other.freezetag_frozen)
- return 1;
- return 0;
+ return MUT_ITEMTOUCH_RETURN;
+ return MUT_ITEMTOUCH_CONTINUE;
}
MUTATOR_HOOKFUNCTION(freezetag_BotRoles)
PlayerScore_Add(other, SP_LMS_LIVES, autocvar_g_lms_extra_lives);
}
- return FALSE;
+ return MUT_ITEMTOUCH_CONTINUE;
}
// scoreboard stuff
if(other.health < 100)
other.health = 100;
+
+ return MUT_ITEMTOUCH_CONTINUE;
}
if(self.max_health)
{
other.armorvalue = bound(other.armorvalue, 999, other.armorvalue + autocvar_g_minstagib_extralives);
Send_Notification(NOTIF_ONE, other, MSG_CENTER, CENTER_EXTRALIVES);
+ return MUT_ITEMTOUCH_PICKUP;
}
- return FALSE;
+ return MUT_ITEMTOUCH_RETURN;
}
MUTATOR_HOOKFUNCTION(minstagib_OnEntityPreSpawn)
_spectate(other);
self = _oldself;
- return FALSE;
+ return MUT_ITEMTOUCH_CONTINUE;
}
}
self = _oldself;
- return FALSE;
+ return MUT_ITEMTOUCH_CONTINUE;
}
MUTATOR_HOOKFUNCTION(superspec_SV_ParseClientCommand)
pickedup = TRUE;
player.superweapons_finished = max(player.superweapons_finished, time) + item.superweapons_finished;
}
- if (item.max_health)
- {
- pickedup = TRUE;
- // extra life powerup handled by mutators
- }
:skip
return;
if (self.owner == other)
return;
- if(MUTATOR_CALLHOOK(ItemTouch))
- return;
+
+ switch(MUTATOR_CALLHOOK(ItemTouch))
+ {
+ case MUT_ITEMTOUCH_RETURN: { return; }
+ case MUT_ITEMTOUCH_PICKUP: { goto pickup; }
+ }
if (self.classname == "droppedweapon")
{
return;
}
+ :pickup
+
other.last_pickup = time;
pointparticles(particleeffectnum("item_pickup"), self.origin, '0 0 0', 1);