fix bug when not using holo

This commit is contained in:
Nathan TIEN YOU
2022-02-03 21:57:05 +01:00
parent a78f459aa2
commit a41cd3fafc
2 changed files with 22 additions and 17 deletions
+19 -16
View File
@@ -25,28 +25,31 @@ int recharge_remove = 1
{ {
if ( IsValid(player) && IsAlive( player )) if ( IsValid(player) && IsAlive( player ))
{ {
Assert(player) if(player.GetOffhandWeapon(1).GetWeaponClassName() == "mp_ability_holopilot"){
if(!player.IsPhaseShifted()){ Assert(player)
int chargeCount = player.GetOffhandWeapon(1).GetWeaponPrimaryClipCount() if(!player.IsPhaseShifted()){
int oldchargeCount = chargeCount int chargeCount = player.GetOffhandWeapon(1).GetWeaponPrimaryClipCount()
if(player in playerDecoyList){ int oldchargeCount = chargeCount
chargeCount -= recharge_remove if(player in playerDecoyList){
if(chargeCount < 0) chargeCount -= recharge_remove
chargeCount = 0 if(chargeCount < 0)
}else{ chargeCount = 0
int max = player.GetOffhandWeapon(1).GetWeaponPrimaryClipCountMax() }else{
chargeCount += rechargeStep int max = player.GetOffhandWeapon(1).GetWeaponPrimaryClipCountMax()
if(chargeCount > charge_size){ chargeCount += rechargeStep
chargeCount = max if(chargeCount > charge_size){
chargeCount = max
}
}
if(oldchargeCount != chargeCount){
player.GetOffhandWeapon(1).SetWeaponPrimaryClipCount(chargeCount)
} }
} }
if(oldchargeCount != chargeCount){
player.GetOffhandWeapon(1).SetWeaponPrimaryClipCount(chargeCount)
}
} }
} }
} }
wait rechargeInterval wait rechargeInterval
@@ -376,9 +376,11 @@ bool function PlayerCanUseDecoy( entity ownerPlayer ) //For holopilot and HoloPi
return false return false
} }
if(ownerPlayer.GetOffhandWeapon(1).GetWeaponPrimaryClipCount()<100) if(ownerPlayer.GetOffhandWeapon(1).GetWeaponClassName() == "mp_ability_holopilot" && ownerPlayer.GetOffhandWeapon(1).GetWeaponPrimaryClipCount()<100)
return false 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?) //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 return true