diff --git a/sources/NicePack.uc b/sources/NicePack.uc index 7eb6072..7f06226 100644 --- a/sources/NicePack.uc +++ b/sources/NicePack.uc @@ -309,56 +309,83 @@ simulated function Timer(){ } maxPlayersInGame = Max(maxPlayersInGame, currentPlayersMax); } -simulated function Tick(float Delta){ - local int i; - local NiceInteraction niceInt; - local NicePlayerController localPlayer; - super.Tick(Delta); - if(ScrnGT != none && ScrnGT.WaveCountDown <= 5) - bIsPreGame = false; - if(ScrnMut != none && !bSpawnRateEnforced && ScrnMut.bTickExecuted){ - bSpawnRateEnforced = true; - ScrnMut.OriginalWaveSpawnPeriod = FMax(minSpawnRate, FMin(maxSpawnRate, ScrnMut.OriginalWaveSpawnPeriod)); + +// add interaction +auto state loadInteractionnSpawnRate +{ + // state timer, overrides global + simulated function Tick(float Delta) + { + local NiceInteraction niceInt; + local NicePlayerController localPlayer; + + if (level.netMode == NM_DedicatedServer) + { + // set spawn rate! + if (ScrnMut != none) + ScrnMut.OriginalWaveSpawnPeriod = FMax(minSpawnRate, FMin(maxSpawnRate, ScrnMut.OriginalWaveSpawnPeriod)); + // do not execute below code on dedicated servers! + GoToState(''); + return; + } + + localPlayer = NicePlayerController(Level.GetLocalPlayerController()); + if (localPlayer == none) + return; + + // 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 + GoToState(''); } +} + +simulated function Tick(float Delta) +{ + local int i; + local NicePlayerController localPlayer; + + super.Tick(Delta); + if (ScrnGT != none && ScrnGT.WaveCountDown <= 5) + bIsPreGame = false; localPlayer = NicePlayerController(Level.GetLocalPlayerController()); // Check if the local PlayerController is available yet - if(localPlayer == none) + if (localPlayer == none) return; - if( Role < Role_AUTHORITY && !bClientLinkEstablished - && localPlayer.storageClient != none && localPlayer.remoteRI != none){ + 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 ++){ - if(niceCounterSet[i].ownerSkill == none) - niceCounterSet[i].value = UpdateCounterValue(niceCounterSet[i].cName); - else if(class'NiceVeterancyTypes'.static.hasSkill(localPlayer, niceCounterSet[i].ownerSkill)) - niceCounterSet[i].value = niceCounterSet[i].ownerSkill.static. + if(localPlayer.bFlagDisplayCounters) + { + for (i = 0; i < niceCounterSet.Length; i++) + { + if (niceCounterSet[i].ownerSkill == none) + niceCounterSet[i].value = UpdateCounterValue(niceCounterSet[i].cName); + else if(class'NiceVeterancyTypes'.static.hasSkill(localPlayer, niceCounterSet[i].ownerSkill)) + niceCounterSet[i].value = niceCounterSet[i].ownerSkill.static. UpdateCounterValue(niceCounterSet[i].cName, localPlayer); - else - niceCounterSet[i].value = 0; - } + else + niceCounterSet[i].value = 0; + } } // Reset tick counter for traces localPlayer.tracesThisTick = 0; // Manage resetting of effects' limits - if(Level.TimeSeconds >= localPlayer.nextEffectsResetTime){ - localPlayer.nextEffectsResetTime = Level.TimeSeconds + 0.1; - localPlayer.currentEffectTimeWindow ++; - if(localPlayer.currentEffectTimeWindow >= 10) - localPlayer.currentEffectTimeWindow = 0; - localPlayer.effectsSpawned[localPlayer.currentEffectTimeWindow] = 0; + if (Level.TimeSeconds >= localPlayer.nextEffectsResetTime) + { + localPlayer.nextEffectsResetTime = Level.TimeSeconds + 0.1; + localPlayer.currentEffectTimeWindow ++; + if (localPlayer.currentEffectTimeWindow >= 10) + localPlayer.currentEffectTimeWindow = 0; + localPlayer.effectsSpawned[localPlayer.currentEffectTimeWindow] = 0; } - // Add interaction - if(interactionAdded) - return; - // Actually add the interaction - niceInt = NiceInteraction(localPlayer.Player.InteractionMaster.AddInteraction(string(class'NiceInteraction'), localPlayer.Player)); - niceInt.RegisterMutator(Self); - interactionAdded = true; } + simulated function bool CheckReplacement(Actor Other, out byte bSuperRelevant){ local int i; local NiceMonster niceMonster;