]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Merge branch 'master' into Mario/player_alpha
authorMario <mario.mario@y7mail.com>
Fri, 17 Jul 2020 08:09:24 +0000 (18:09 +1000)
committerMario <mario.mario@y7mail.com>
Fri, 17 Jul 2020 08:09:24 +0000 (18:09 +1000)
1  2 
qcsrc/common/mutators/mutator/buffs/sv_buffs.qc
qcsrc/common/mutators/mutator/instagib/sv_instagib.qc
qcsrc/common/mutators/mutator/nades/nades.qc
qcsrc/server/client.qc
qcsrc/server/mutators/events.qh

index 86152e45858e25b52daf8b3710e8a193dd3a80f0,fcbb399cbedee8e8e91e55a703f40d0ff9a29e1d..f8d7614f301ab6203bfed3765f5564f8d40eee83
@@@ -784,18 -819,6 +819,18 @@@ MUTATOR_HOOKFUNCTION(buffs, WeaponSpeed
                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)
index 0ce5d84d3c59a812e0850da14dc06692fe00e1aa,f4ff4d34a532f22557c838b613bf6f3bd69f1286..15b6e9d5149284e575903faebaf4f2f4076281b9
@@@ -224,17 -223,6 +223,17 @@@ MUTATOR_HOOKFUNCTION(mutator_instagib, 
        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);
Simple merge
index 946c998af6963a544aef6a6b2768ebd5733a1a5d,35a8f6fd93b7f31900f8d8eb8341815c99f69e65..423a16c383f71bf22de9cd6db4b0a291b8764071
@@@ -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);