multitasker fix

This commit is contained in:
Shtoyan 2022-07-19 19:26:56 +04:00
parent 288aa99416
commit 605d020251
3 changed files with 60 additions and 57 deletions

View File

@ -13,6 +13,16 @@ var float InventoryBoxWidth;
var float InventoryBoxHeight; var float InventoryBoxHeight;
var float BorderSize; var float BorderSize;
// weapons list for `MultiTasker` skill
struct WeaponProgressDisplay
{
var class<NiceWeapon> weapClass;
var float progress;
var bool bShowCounter;
var int counter;
};
var array<WeaponProgressDisplay> niceWeapProgressSet;
event NotifyLevelChange() event NotifyLevelChange()
{ {
Master.RemoveInteraction(self); Master.RemoveInteraction(self);
@ -53,6 +63,30 @@ final private function bool bIsBleeding(ScrnHumanPawn pwn)
return false; 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) function PostRender(Canvas C)
{ {
local int i; local int i;
@ -171,22 +205,27 @@ function PostRender(Canvas C)
} }
} }
nicePawn = NiceHumanPawn(nicePlayer.pawn);
//// Draw weapons progress bars //// Draw weapons progress bars
if (class'NiceVeterancyTypes'.static.hasSkill(nicePlayer, class'NiceSkillEnforcerMultitasker') // at first update weapon info
&& nicePlayer.bFlagDisplayWeaponProgress && niceMutator.niceWeapProgressSet.length > 0) 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; x = C.ClipX - InventoryBoxWidth * C.ClipX - 5;
y = C.ClipY * 0.5 - 0.5 * (InventoryBoxHeight * C.ClipX + 4) * niceMutator.niceWeapProgressSet.Length; y = C.ClipY * 0.5 - 0.5 * (InventoryBoxHeight * C.ClipX + 4) * niceWeapProgressSet.Length;
for (i = 0;i < niceMutator.niceWeapProgressSet.Length;i ++)
for (i = 0; i < niceWeapProgressSet.Length; i++)
{ {
DrawWeaponProgress(C, niceMutator.niceWeapProgressSet[i], x, y, DrawWeaponProgress(C, niceWeapProgressSet[i], x, y, nicePawn.PlayerReplicationInfo.Team);
C.ViewPort.Actor.Pawn.PlayerReplicationInfo.Team);
y += (InventoryBoxHeight * C.ClipX + 4); y += (InventoryBoxHeight * C.ClipX + 4);
} }
} }
//// Draw invincibility bar //// Draw invincibility bar
nicePawn = NiceHumanPawn(nicePlayer.pawn);
if(nicePawn != none && nicePawn.invincibilityTimer != 0.0) if(nicePawn != none && nicePawn.invincibilityTimer != 0.0)
{ {
C.SetDrawColor(255, 255, 255); C.SetDrawColor(255, 255, 255);
@ -360,7 +399,7 @@ 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 string textToDraw;

View File

@ -221,16 +221,20 @@ function ServerCooldownAbility(string abilityID){
if(index >= 0) if(index >= 0)
nicePlayer.abilityManager.SetAbilityState(index, ASTATE_COOLDOWN); nicePlayer.abilityManager.SetAbilityState(index, ASTATE_COOLDOWN);
} }
simulated function Tick(float deltaTime){
simulated function Tick(float deltaTime)
{
local int index; local int index;
local Inventory Item; local Inventory Item;
local NiceWeapon niceWeap; local NiceWeapon niceWeap;
local WeaponTimePair newPair; local WeaponTimePair newPair;
local array<WeaponTimePair> newWTPList; local array<WeaponTimePair> newWTPList;
local NicePack niceMutator;
local NicePlayerController nicePlayer; local NicePlayerController nicePlayer;
nicePlayer = NicePlayerController(Controller); nicePlayer = NicePlayerController(Controller);
if(Role == Role_AUTHORITY){
if (Role == Role_AUTHORITY)
{
// Brutal carnage // Brutal carnage
if (brutalCranageTimer > 0) if (brutalCranageTimer > 0)
{ {
@ -329,33 +333,10 @@ simulated function Tick(float deltaTime){
forcedZedTimeCountDown -= deltaTime; forcedZedTimeCountDown -= deltaTime;
else else
forcedZedTimeCountDown = 0.0; forcedZedTimeCountDown = 0.0;
niceMutator = class'NicePack'.static.Myself(Level);
if(niceMutator != none)
niceMutator.ClearWeapProgress();
if(!class'NiceVeterancyTypes'.static.hasSkill(NicePlayerController(Controller), class'NiceSkillEnforcerMultitasker')) if(!class'NiceVeterancyTypes'.static.hasSkill(NicePlayerController(Controller), class'NiceSkillEnforcerMultitasker'))
return; 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 // Auto-reload holstered weapons
holsteredReloadCountDown -= deltaTime; holsteredReloadCountDown -= deltaTime;
if(holsteredReloadCountDown <= 0.0){ if(holsteredReloadCountDown <= 0.0){

View File

@ -95,13 +95,7 @@ struct CounterDisplay{
var class<NiceSkill> ownerSkill; var class<NiceSkill> ownerSkill;
}; };
var array<CounterDisplay> niceCounterSet; var array<CounterDisplay> niceCounterSet;
struct WeaponProgressDisplay{
var class<NiceWeapon> weapClass;
var float progress;
var bool bShowCounter;
var int counter;
};
var array<WeaponProgressDisplay> niceWeapProgressSet;
// Replication of config between player and server // Replication of config between player and server
var int SrvFlags; var int SrvFlags;
var array<NicePlayerController> playersList; var array<NicePlayerController> playersList;
@ -502,18 +496,7 @@ simulated function int GetVisibleCountersAmount(){
simulated function int UpdateCounterValue(string cName){ simulated function int UpdateCounterValue(string cName){
return 0; return 0;
} }
simulated function AddWeapProgress(class<NiceWeapon> 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
// Returns cash per wave based on current difficulty // Returns cash per wave based on current difficulty
function int GetWaveCash(int lastCashWave, int nextWave){ function int GetWaveCash(int lastCashWave, int nextWave){