diff --git a/sources/GUI/NiceInteraction.uc b/sources/GUI/NiceInteraction.uc index f0745a4..f8ec80d 100644 --- a/sources/GUI/NiceInteraction.uc +++ b/sources/GUI/NiceInteraction.uc @@ -13,6 +13,16 @@ var float InventoryBoxWidth; var float InventoryBoxHeight; var float BorderSize; +// weapons list for `MultiTasker` skill +struct WeaponProgressDisplay +{ + var class weapClass; + var float progress; + var bool bShowCounter; + var int counter; +}; +var array niceWeapProgressSet; + event NotifyLevelChange() { Master.RemoveInteraction(self); @@ -53,6 +63,30 @@ final private function bool bIsBleeding(ScrnHumanPawn pwn) return false; } +final private function UpdateNiceWeapProgressSet(NiceHumanPawn pwn) +{ + local Inventory I; + local NiceWeapon niceWeap; + local WeaponProgressDisplay newProgress; + + if (pwn != none && pwn.Inventory != none) + { + for (I = pwn.Inventory; I != none; I = I.Inventory) + { + niceWeap = NiceWeapon(I); + if (niceWeap != none && niceWeap != pwn.weapon && !niceWeap.IsMagazineFull()) + { + newProgress.weapClass = niceWeap.class; + newProgress.progress = niceWeap.holsteredCompletition; + newProgress.bShowCounter = true; + newProgress.counter = niceWeap.GetMagazineAmmo(); + + niceWeapProgressSet[niceWeapProgressSet.Length] = newProgress; + } + } + } +} + function PostRender(Canvas C) { local int i; @@ -171,22 +205,27 @@ function PostRender(Canvas C) } } + nicePawn = NiceHumanPawn(nicePlayer.pawn); + //// Draw weapons progress bars - if (class'NiceVeterancyTypes'.static.hasSkill(nicePlayer, class'NiceSkillEnforcerMultitasker') - && nicePlayer.bFlagDisplayWeaponProgress && niceMutator.niceWeapProgressSet.length > 0) + // at first update weapon info + niceWeapProgressSet.Length = 0; + UpdateNiceWeapProgressSet(nicePawn); + + if (nicePawn != none && class'NiceVeterancyTypes'.static.hasSkill(nicePlayer, class'NiceSkillEnforcerMultitasker') + && nicePlayer.bFlagDisplayWeaponProgress && niceWeapProgressSet.length > 0) { x = C.ClipX - InventoryBoxWidth * C.ClipX - 5; - y = C.ClipY * 0.5 - 0.5 * (InventoryBoxHeight * C.ClipX + 4) * niceMutator.niceWeapProgressSet.Length; - for (i = 0;i < niceMutator.niceWeapProgressSet.Length;i ++) + y = C.ClipY * 0.5 - 0.5 * (InventoryBoxHeight * C.ClipX + 4) * niceWeapProgressSet.Length; + + for (i = 0; i < niceWeapProgressSet.Length; i++) { - DrawWeaponProgress(C, niceMutator.niceWeapProgressSet[i], x, y, - C.ViewPort.Actor.Pawn.PlayerReplicationInfo.Team); + DrawWeaponProgress(C, niceWeapProgressSet[i], x, y, nicePawn.PlayerReplicationInfo.Team); y += (InventoryBoxHeight * C.ClipX + 4); } } - + //// Draw invincibility bar - nicePawn = NiceHumanPawn(nicePlayer.pawn); if(nicePawn != none && nicePawn.invincibilityTimer != 0.0) { C.SetDrawColor(255, 255, 255); @@ -360,9 +399,9 @@ function DrawCalibrationStars(Canvas C){ } } -function DrawWeaponProgress(Canvas C, NicePack.WeaponProgressDisplay weapProgress, int x, int y, TeamInfo team) +function DrawWeaponProgress(Canvas C, WeaponProgressDisplay weapProgress, int x, int y, TeamInfo team) { - local float textWidth, textHeight; + local float textWidth, textHeight; local string textToDraw; local float TempWidth, TempHeight, TempBorder; diff --git a/sources/NiceHumanPawn.uc b/sources/NiceHumanPawn.uc index 6adfcb8..d3a2098 100644 --- a/sources/NiceHumanPawn.uc +++ b/sources/NiceHumanPawn.uc @@ -221,16 +221,20 @@ function ServerCooldownAbility(string abilityID){ if(index >= 0) nicePlayer.abilityManager.SetAbilityState(index, ASTATE_COOLDOWN); } -simulated function Tick(float deltaTime){ + +simulated function Tick(float deltaTime) +{ local int index; local Inventory Item; local NiceWeapon niceWeap; local WeaponTimePair newPair; local array newWTPList; - local NicePack niceMutator; local NicePlayerController nicePlayer; + nicePlayer = NicePlayerController(Controller); - if(Role == Role_AUTHORITY){ + + if (Role == Role_AUTHORITY) + { // Brutal carnage if (brutalCranageTimer > 0) { @@ -329,33 +333,10 @@ simulated function Tick(float deltaTime){ forcedZedTimeCountDown -= deltaTime; else forcedZedTimeCountDown = 0.0; - niceMutator = class'NicePack'.static.Myself(Level); - if(niceMutator != none) - niceMutator.ClearWeapProgress(); + if(!class'NiceVeterancyTypes'.static.hasSkill(NicePlayerController(Controller), class'NiceSkillEnforcerMultitasker')) return; - if ( Role < ROLE_Authority && nicePlayer != none - && nicePlayer.bFlagDisplayWeaponProgress) - { - // Update weapon progress for this skill - if(niceMutator == none) { - Log("Failed to update holstered progress, because no mut! :("); - return; - } - for(Item = Inventory; Item != none; Item = Item.Inventory){ - niceWeap = NiceWeapon(Item); - if(niceWeap != none && niceWeap != weapon && !niceWeap.IsMagazineFull()){ - niceMutator.AddWeapProgress(niceWeap.class, niceWeap.holsteredCompletition, - true, niceWeap.GetMagazineAmmo()); - } - } - return; - } - else if (Role < ROLE_Authority) - { - Log( "Failed to update holstered progress, checked variables:" - @ nicePlayer @ nicePlayer.bFlagDisplayWeaponProgress); - } + // Auto-reload holstered weapons holsteredReloadCountDown -= deltaTime; if(holsteredReloadCountDown <= 0.0){ diff --git a/sources/NicePack.uc b/sources/NicePack.uc index b475e6e..d85154b 100644 --- a/sources/NicePack.uc +++ b/sources/NicePack.uc @@ -95,13 +95,7 @@ struct CounterDisplay{ var class ownerSkill; }; var array niceCounterSet; -struct WeaponProgressDisplay{ - var class weapClass; - var float progress; - var bool bShowCounter; - var int counter; -}; -var array niceWeapProgressSet; + // Replication of config between player and server var int SrvFlags; var array playersList; @@ -502,18 +496,7 @@ simulated function int GetVisibleCountersAmount(){ simulated function int UpdateCounterValue(string cName){ return 0; } -simulated function AddWeapProgress(class weapClass, float progress, - optional bool bShowCounter, optional int counter){ - local WeaponProgressDisplay newProgress; - newProgress.weapClass = weapClass; - newProgress.progress = progress; - newProgress.bShowCounter = bShowCounter; - newProgress.counter = counter; - niceWeapProgressSet[niceWeapProgressSet.Length] = newProgress; -} -simulated function ClearWeapProgress(){ - niceWeapProgressSet.Length = 0; -} + // Returns cash per wave based on current difficulty // Returns cash per wave based on current difficulty function int GetWaveCash(int lastCashWave, int nextWave){