From a41cd3fafc1ab69640e4cbb02e843bbcf316a907 Mon Sep 17 00:00:00 2001 From: Nathan TIEN YOU Date: Thu, 3 Feb 2022 21:57:05 +0100 Subject: [PATCH] fix bug when not using holo --- .../vscripts/holodisplace_recharge.gnut | 35 ++++++++++--------- .../vscripts/weapons/mp_ability_holopilot.nut | 4 ++- 2 files changed, 22 insertions(+), 17 deletions(-) diff --git a/mod/scripts/vscripts/holodisplace_recharge.gnut b/mod/scripts/vscripts/holodisplace_recharge.gnut index 059c0a4..d9e91cb 100644 --- a/mod/scripts/vscripts/holodisplace_recharge.gnut +++ b/mod/scripts/vscripts/holodisplace_recharge.gnut @@ -25,28 +25,31 @@ int recharge_remove = 1 { if ( IsValid(player) && IsAlive( player )) { - Assert(player) - if(!player.IsPhaseShifted()){ - int chargeCount = player.GetOffhandWeapon(1).GetWeaponPrimaryClipCount() - int oldchargeCount = chargeCount - if(player in playerDecoyList){ - chargeCount -= recharge_remove - if(chargeCount < 0) - chargeCount = 0 - }else{ - int max = player.GetOffhandWeapon(1).GetWeaponPrimaryClipCountMax() - chargeCount += rechargeStep - if(chargeCount > charge_size){ - chargeCount = max + if(player.GetOffhandWeapon(1).GetWeaponClassName() == "mp_ability_holopilot"){ + Assert(player) + if(!player.IsPhaseShifted()){ + int chargeCount = player.GetOffhandWeapon(1).GetWeaponPrimaryClipCount() + int oldchargeCount = chargeCount + if(player in playerDecoyList){ + chargeCount -= recharge_remove + if(chargeCount < 0) + chargeCount = 0 + }else{ + int max = player.GetOffhandWeapon(1).GetWeaponPrimaryClipCountMax() + chargeCount += rechargeStep + if(chargeCount > charge_size){ + chargeCount = max + } + } + if(oldchargeCount != chargeCount){ + player.GetOffhandWeapon(1).SetWeaponPrimaryClipCount(chargeCount) } } - if(oldchargeCount != chargeCount){ - player.GetOffhandWeapon(1).SetWeaponPrimaryClipCount(chargeCount) - } } + } } wait rechargeInterval diff --git a/mod/scripts/vscripts/weapons/mp_ability_holopilot.nut b/mod/scripts/vscripts/weapons/mp_ability_holopilot.nut index 5e1fdb5..eefb09c 100644 --- a/mod/scripts/vscripts/weapons/mp_ability_holopilot.nut +++ b/mod/scripts/vscripts/weapons/mp_ability_holopilot.nut @@ -376,9 +376,11 @@ bool function PlayerCanUseDecoy( entity ownerPlayer ) //For holopilot and HoloPi return false } - if(ownerPlayer.GetOffhandWeapon(1).GetWeaponPrimaryClipCount()<100) + if(ownerPlayer.GetOffhandWeapon(1).GetWeaponClassName() == "mp_ability_holopilot" && ownerPlayer.GetOffhandWeapon(1).GetWeaponPrimaryClipCount()<100) return false + if(ownerPlayer.GetOffhandWeapon(1).GetWeaponClassName() == "mp_ability_holopilot" && ownerPlayer.GetOffhandWeapon(1).GetWeaponPrimaryClipCount()<200 && !(ownerPlayer in playerDecoyList)) + return false //Do we need to check isPhaseShifted here? Re-examine when it's possible to get both Phase and Decoy (maybe through burn cards?) return true