From: Mario Date: Fri, 17 Jul 2020 08:09:24 +0000 (+1000) Subject: Merge branch 'master' into Mario/player_alpha X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=3e8b5d79372979ce0944ce8418b6f33417de3dd1;p=xonotic%2Fxonotic-data.pk3dir.git Merge branch 'master' into Mario/player_alpha --- 3e8b5d79372979ce0944ce8418b6f33417de3dd1 diff --cc qcsrc/common/mutators/mutator/buffs/sv_buffs.qc index 86152e458,fcbb399cb..f8d7614f3 --- a/qcsrc/common/mutators/mutator/buffs/sv_buffs.qc +++ b/qcsrc/common/mutators/mutator/buffs/sv_buffs.qc @@@ -784,18 -819,6 +819,18 @@@ MUTATOR_HOOKFUNCTION(buffs, WeaponSpeed M_ARGV(0, float) *= autocvar_g_buffs_disability_weaponspeed; } +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) = alph; // player_alpha - M_ARGV(2, float) = alph; // weapon_alpha ++ 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) diff --cc qcsrc/common/mutators/mutator/instagib/sv_instagib.qc index 0ce5d84d3,f4ff4d34a..15b6e9d51 --- a/qcsrc/common/mutators/mutator/instagib/sv_instagib.qc +++ b/qcsrc/common/mutators/mutator/instagib/sv_instagib.qc @@@ -224,17 -223,6 +223,17 @@@ MUTATOR_HOOKFUNCTION(mutator_instagib, return true; } +MUTATOR_HOOKFUNCTION(mutator_instagib, SetPlayerAlpha) +{ + entity player = M_ARGV(0, entity); + + if(time < player.strength_finished) + { - M_ARGV(1, float) = autocvar_g_instagib_invis_alpha; // player_alpha - M_ARGV(2, float) = autocvar_g_instagib_invis_alpha; // weapon_alpha ++ 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); @@@ -244,17 -232,27 +243,17 @@@ 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); diff --cc qcsrc/server/mutators/events.qh index 946c998af,35a8f6fd9..423a16c38 --- a/qcsrc/server/mutators/events.qh +++ b/qcsrc/server/mutators/events.qh @@@ -1213,12 -1235,17 +1235,27 @@@ MUTATOR_HOOKABLE(Unfreeze, EV_Unfreeze) /**/ 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);