From 90599fd6b72f9773ccd3f5e1ffbbedc108b5d5ad Mon Sep 17 00:00:00 2001 From: Shtoyan Date: Fri, 25 Feb 2022 22:50:54 +0400 Subject: [PATCH] made tick more light --- sources/NicePack.uc | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/sources/NicePack.uc b/sources/NicePack.uc index f110786..9f11278 100644 --- a/sources/NicePack.uc +++ b/sources/NicePack.uc @@ -62,7 +62,6 @@ var NiceGameType NiceGT; var NicePack Mut; var NiceRules GameRules; var NiceStorageServer serverStorage; -var bool bClientLinkEstablished; var bool interactionAdded; var bool bIsPreGame; var bool bIsTraderTime; @@ -309,10 +308,10 @@ simulated function Timer(){ maxPlayersInGame = Max(maxPlayersInGame, currentPlayersMax); } -// add interaction +// initial tick, does some job and shuts down auto state loadInteractionnSpawnRate { - // state timer, overrides global + // state tick, overrides global simulated function Tick(float Delta) { local NiceInteraction niceInt; @@ -332,14 +331,23 @@ auto state loadInteractionnSpawnRate if (localPlayer == none) return; + // spawn some magic + if (localPlayer.storageClient != none && localPlayer.remoteRI != none) + { + localPlayer.storageClient.remoteRI = localPlayer.remoteRI; + localPlayer.storageClient.events.static.CallLinkEstablished(); + } + // Actually add the interaction niceInt = NiceInteraction(localPlayer.Player.InteractionMaster.AddInteraction(string(class'NiceInteraction'), localPlayer.Player)); niceInt.RegisterMutator(Self); - // break this and go to global state + + // break this state and go to global GoToState(''); } } +// global tick simulated function Tick(float Delta) { local int i; @@ -351,13 +359,7 @@ simulated function Tick(float Delta) // Check if the local PlayerController is available yet if (localPlayer == none) return; - if (Role < Role_AUTHORITY && !bClientLinkEstablished - && localPlayer.storageClient != none && localPlayer.remoteRI != none) - { - bClientLinkEstablished = true; - localPlayer.storageClient.remoteRI = localPlayer.remoteRI; - localPlayer.storageClient.events.static.CallLinkEstablished(); - } + if (localPlayer.bFlagDisplayCounters) { for (i = 0; i < niceCounterSet.Length; i++)