diff --git a/sources/NiceGameType.uc b/sources/NiceGameType.uc index ca0aaa7..7d1c2a8 100644 --- a/sources/NiceGameType.uc +++ b/sources/NiceGameType.uc @@ -74,6 +74,7 @@ State MatchInProgress{ function ScoreKill(Controller Killer, Controller Other) { + local NicePlayerController niceKiller; local PlayerReplicationInfo OtherPRI; local float KillScore; local Controller C; @@ -198,7 +199,10 @@ function ScoreKill(Controller Killer, Controller Other) } /* End Marco's Kill Messages */ - + niceKiller = NicePlayerController(killer); + if (niceKiller != none && niceKiller.abilityManager != none) { + niceKiller.abilityManager.AddToAllCooldowns(-1); + } } function DramaticEvent(float BaseZedTimePossibility, optional float DesiredZedTimeDuration){ diff --git a/sources/NiceReplicationInfo.uc b/sources/NiceReplicationInfo.uc index 5c0c9b7..2267304 100644 --- a/sources/NiceReplicationInfo.uc +++ b/sources/NiceReplicationInfo.uc @@ -334,7 +334,7 @@ simulated function UpdateMeleeInvincibility nicePawn.TryExtendingInv(niceZed, false, headshotLevel > 0.0); // Handle melee-cases if(mainTarget && class(damageType) != none) - nicePawn.TryExtendingInv(niceZed, true, headshotLevel > 0.0); + nicePawn.TryExtendingInv(niceZed, true, headshotLevel > 0.0); nicePawn.ApplyWeaponStats(nicePawn.weapon); } simulated function UpdateArdour(bool isKill, NicePlayerController nicePlayer){ diff --git a/sources/Perks/Abilities/NiceAbilityManager.uc b/sources/Perks/Abilities/NiceAbilityManager.uc index 96058e2..ad1cff5 100644 --- a/sources/Perks/Abilities/NiceAbilityManager.uc +++ b/sources/Perks/Abilities/NiceAbilityManager.uc @@ -29,19 +29,19 @@ struct NiceAbilityDescription{ // Image to be used as an ability's icon var Texture icon; // Default cooldown duration - var float cooldownLength; + var int cooldownLength; // Can ability be canceled once activated? - var bool canBeCancelled; + var bool canBeCancelled; }; // Complete description of current status of an ability, // including it's complete description. struct NiceAbilityStatus{ // Complete description of ability in question - var NiceAbilityDescription description; + var NiceAbilityDescription description; // Current cooldown value - var float cooldown; + var int cooldown; // Current state of an ability - var EAbilityState myState; + var EAbilityState myState; }; var NiceAbilityStatus currentAbilities[5]; var int currentAbilitiesAmount; @@ -65,7 +65,7 @@ function AddAbility(NiceAbilityDescription description){ if(currentAbilities[i].description.ID ~= description.ID) return; newRecord.description = description; - newRecord.cooldown = 0.0; + newRecord.cooldown = 0; newRecord.myState = ASTATE_READY; currentAbilities[currentAbilitiesAmount] = newRecord; currentAbilitiesAmount += 1; @@ -147,7 +147,7 @@ function SetAbilityState(int abilityIndex, EAbilityState newState){ // Changes ability's cooldown by a given amount. // If this brings cooldown to zero or below - // resets current ability to a 'ready' (ASTATE_READY) state. -function AddToCooldown(int abilityIndex, float delta){ +function AddToCooldown(int abilityIndex, int delta){ if(abilityIndex < 0 || abilityIndex >= currentAbilitiesAmount) return; if(currentAbilities[abilityIndex].myState != ASTATE_COOLDOWN) return; currentAbilities[abilityIndex].cooldown += delta; @@ -155,12 +155,21 @@ function AddToCooldown(int abilityIndex, float delta){ SetAbilityState(abilityIndex, ASTATE_READY); hackCounter ++; } -function Tick(float deltaTime){ + +function AddToAllCooldowns(int delta){ local int i; - if(Role != Role_AUTHORITY) return; - for(i = 0;i < currentAbilitiesAmount;i ++) - AddToCooldown(i, -deltaTime); + + for (i = 0; i < currentAbilitiesAmount; i += 1) { + if (currentAbilities[i].myState == ASTATE_COOLDOWN) { + currentAbilities[i].cooldown += delta; + if(currentAbilities[i].cooldown <= 0) { + SetAbilityState(i, ASTATE_READY); + } + } + } + hackCounter ++; } + defaultproperties { maxAbilitiesAmount=5