M_ARGV(0, float) *= autocvar_g_buffs_disability_weaponspeed;
}
- M_ARGV(1, float) = alph; // player_alpha
- M_ARGV(2, float) = alph; // weapon_alpha
+MUTATOR_HOOKFUNCTION(buffs, SetPlayerAlpha)
+{
+ entity player = M_ARGV(0, entity);
+
+ if(STAT(BUFFS, player) & BUFF_INVISIBLE.m_itemid)
+ {
+ float alph = ((autocvar_g_buffs_invisible_alpha) ? autocvar_g_buffs_invisible_alpha : -1);
++ M_ARGV(1, float) = min(M_ARGV(1, float), alph); // player_alpha
++ M_ARGV(2, float) = min(M_ARGV(2, float), alph); // weapon_alpha
+ }
+}
+
.bool buff_flight_crouchheld;
MUTATOR_HOOKFUNCTION(buffs, PlayerPreThink)
return true;
}
- M_ARGV(1, float) = autocvar_g_instagib_invis_alpha; // player_alpha
- M_ARGV(2, float) = autocvar_g_instagib_invis_alpha; // weapon_alpha
+MUTATOR_HOOKFUNCTION(mutator_instagib, SetPlayerAlpha)
+{
+ entity player = M_ARGV(0, entity);
+
+ if(time < player.strength_finished)
+ {
++ M_ARGV(1, float) = min(M_ARGV(1, float), autocvar_g_instagib_invis_alpha); // player_alpha
++ M_ARGV(2, float) = min(M_ARGV(2, float), autocvar_g_instagib_invis_alpha); // weapon_alpha
+ }
+}
+
MUTATOR_HOOKFUNCTION(mutator_instagib, PlayerPowerups)
{
entity player = M_ARGV(0, entity);
if (player.items & ITEM_Invisibility.m_itemid)
{
- play_countdown(player, player.strength_finished, SND_POWEROFF);
- if (time > player.strength_finished)
+ play_countdown(player, STAT(STRENGTH_FINISHED, player), SND_POWEROFF);
+ if (time > STAT(STRENGTH_FINISHED, player))
{
- if(!player.vehicle) // already reset upon exit
- {
- player.alpha = default_player_alpha;
- player.exteriorweaponentity.alpha = default_weapon_alpha;
- }
player.items &= ~ITEM_Invisibility.m_itemid;
Send_Notification(NOTIF_ONE, player, MSG_CENTER, CENTER_POWERDOWN_INVISIBILITY);
}
}
else
{
- if (time < player.strength_finished)
+ if (time < STAT(STRENGTH_FINISHED, player))
{
- if(!player.vehicle) // incase the player is given powerups while inside a vehicle
- {
- player.alpha = autocvar_g_instagib_invis_alpha;
- player.exteriorweaponentity.alpha = autocvar_g_instagib_invis_alpha;
- }
player.items |= ITEM_Invisibility.m_itemid;
Send_Notification(NOTIF_ALL, NULL, MSG_INFO, INFO_POWERUP_INVISIBILITY, player.netname);
Send_Notification(NOTIF_ONE, player, MSG_CENTER, CENTER_POWERUP_INVISIBILITY);
/**/
MUTATOR_HOOKABLE(GetPlayerLimit, EV_GetPlayerLimit);
- /** Called when setting the player's alpha, useful for powerups */
+ /** include special item codes for a death to the game log */
+ #define EV_LogDeath_AppendItemCodes(i, o) \
+ /** player */ i(entity, MUTATOR_ARGV_0_entity) \
+ /** item codes */ i(string, MUTATOR_ARGV_1_string) \
+ /**/ o(string, MUTATOR_ARGV_1_string) \
+ /**/
+ MUTATOR_HOOKABLE(LogDeath_AppendItemCodes, EV_LogDeath_AppendItemCodes);
+
+ /** Allows disabling or enabling rocket jumping independently of balance, use the parameter to force a preferred setting */
+ #define EV_AllowRocketJumping(i, o) \
+ /** allow_rocketjump */ i(bool, MUTATOR_ARGV_0_bool) \
+ /**/ o(bool, MUTATOR_ARGV_0_bool) \
+ /**/
+ MUTATOR_HOOKABLE(AllowRocketJumping, EV_AllowRocketJumping);
++
++/** Called when setting the player's alpha, useful for powerups. Default alpha is 1 so use min() on the return values */
+#define EV_SetPlayerAlpha(i, o) \
+ /** player */ i(entity, MUTATOR_ARGV_0_entity) \
+ /** player alpha */ i(float, MUTATOR_ARGV_1_float) \
+ /**/ o(float, MUTATOR_ARGV_1_float) \
+ /** weapon alpha */ i(float, MUTATOR_ARGV_2_float) \
+ /**/ o(float, MUTATOR_ARGV_2_float) \
+ /**/
+MUTATOR_HOOKABLE(SetPlayerAlpha, EV_SetPlayerAlpha);