47 lines
1.4 KiB
Plaintext
47 lines
1.4 KiB
Plaintext
global function HoloShift_Init
|
|
|
|
void function HoloShift_Init() {
|
|
#if SERVER
|
|
AddCallback_GameStateEnter( eGameState.Playing, HoloRecharge )
|
|
#endif
|
|
}
|
|
|
|
|
|
int charge_size = 100
|
|
|
|
bool IsLaunched = false
|
|
|
|
#if SERVER
|
|
void function HoloRecharge(){
|
|
if(!IsLaunched) {
|
|
thread HoloRecharge_Threaded()
|
|
IsLaunched = true
|
|
}
|
|
|
|
}
|
|
|
|
void function HoloRecharge_Threaded(){
|
|
float rechargeMultiplier = charge_size/DECOY_DURATION
|
|
while(true){
|
|
array<entity> players = GetPlayerArray()
|
|
foreach (entity player in players)
|
|
{
|
|
if ( IsValid(player) && IsAlive( player ))
|
|
{
|
|
if( IsValid(player.GetOffhandWeapon(1)) && player.GetOffhandWeapon(1).GetWeaponClassName() == "mp_ability_holopilot"){
|
|
Assert(player)
|
|
if(!player.IsPhaseShifted()){
|
|
if(player in playerDecoyActiveFrom){
|
|
print("test")
|
|
float chargeCount = float(player.GetOffhandWeapon(1).GetWeaponPrimaryClipCountMax()) - ((Time() - playerDecoyActiveFrom[player])*rechargeMultiplier)
|
|
player.GetOffhandWeapon(1).SetWeaponPrimaryClipCount(int(chargeCount))
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
wait 0
|
|
}
|
|
}
|
|
#endif
|