From 62ece8d8dd6ad2f03482e21b7ac719f012f15f79 Mon Sep 17 00:00:00 2001 From: Shtoyan Date: Sat, 11 Mar 2023 22:32:44 +0400 Subject: [PATCH] Fix code formatting and file directories --- .../KFZedsReportMut.uc | 46 ++++++++----------- .../ReportInteraction.uc | 16 +++---- 2 files changed, 26 insertions(+), 36 deletions(-) rename KFZedsReportMut.uc => Classes/KFZedsReportMut.uc (80%) rename ReportInteraction.uc => Classes/ReportInteraction.uc (81%) diff --git a/KFZedsReportMut.uc b/Classes/KFZedsReportMut.uc similarity index 80% rename from KFZedsReportMut.uc rename to Classes/KFZedsReportMut.uc index 77d3ce8..66a140d 100644 --- a/KFZedsReportMut.uc +++ b/Classes/KFZedsReportMut.uc @@ -16,17 +16,15 @@ var bool interactionAdded; var array zedSpawnTimes; -var int repCurrentTotalZeds, repGameInfo_MaxMonsters; -var float repCurrentSpawnRate; +var int repCurrentTotalZeds, repGameInfo_MaxMonsters; +var float repCurrentSpawnRate; -replication -{ - reliable if(Role == ROLE_Authority) +replication { + reliable if (role == ROLE_Authority) repCurrentTotalZeds, repGameInfo_MaxMonsters, repCurrentSpawnRate; } -function PostBeginPlay() -{ +function PostBeginPlay() { if (updateInterval <= 0) { updateInterval = 0.25; } @@ -36,18 +34,17 @@ function PostBeginPlay() SetTimer(updateInterval, true); } -function bool CheckReplacement(Actor other, out byte bSuperRelevant) -{ +function bool CheckReplacement(Actor other, out byte bSuperRelevant) { if (Monster(other) != none) { zedSpawnTimes[zedSpawnTimes.length] = level.timeSeconds; } return true; } -simulated function Tick(float delta) -{ +simulated function Tick(float delta) { local ReportInteraction myInteraction; - local Player localPlayer; + local Player localPlayer; + if (role == Role_AUTHORITY) return; if (interactionAdded) return; localPlayer = level.GetLocalPlayerController().player; @@ -55,25 +52,22 @@ simulated function Tick(float delta) myInteraction = ReportInteraction(localPlayer.interactionMaster .AddInteraction("KFZedsReport.ReportInteraction", localPlayer)); - if (myInteraction != none) - { + if (myInteraction != none) { myInteraction.reportMutator = self; interactionAdded = true; } } -function Timer() -{ - local int i; - local float cutOffTime; - local Monster nextMonster; +function Timer() { + local int i; + local float cutOffTime; + local Monster nextMonster; + cutOffTime = level.timeSeconds - smoothingInterval; - while (i < zedSpawnTimes.length) - { + while (i < zedSpawnTimes.length) { if (zedSpawnTimes[i] < cutOffTime) { zedSpawnTimes.Remove(i, 1); - } - else { + } else { i += 1; } } @@ -81,16 +75,14 @@ function Timer() repGameInfo_MaxMonsters = KFGameType(level.game).maxMonsters; repCurrentSpawnRate = zedSpawnTimes.length / smoothingInterval; repCurrentTotalZeds = 0; - foreach level.DynamicActors(class'Monster', nextMonster) - { + foreach level.DynamicActors(class'Monster', nextMonster) { if (nextMonster.health > 0) { repCurrentTotalZeds += 1; } } } -defaultproperties -{ +defaultproperties { // Mutator description GroupName = "Test mutatros" FriendlyName = "Zed report mutator" diff --git a/ReportInteraction.uc b/Classes/ReportInteraction.uc similarity index 81% rename from ReportInteraction.uc rename to Classes/ReportInteraction.uc index 880c174..ac8f813 100644 --- a/ReportInteraction.uc +++ b/Classes/ReportInteraction.uc @@ -6,18 +6,17 @@ class ReportInteraction extends Interaction; var KFZedsReportMut reportMutator; -event NotifyLevelChange() -{ +event NotifyLevelChange() { if (master != none) { master.RemoveInteraction(self); } } -function PostRender(Canvas canvas) -{ - local float textWidth, textHeight; - local string maxZedsReport, spawnRateReport; - local string tagWhite, tagGreen; +function PostRender(Canvas canvas) { + local float textWidth, textHeight; + local string maxZedsReport, spawnRateReport; + local string tagWhite, tagGreen; + if (canvas == none) return; if (reportMutator == none) return; @@ -36,7 +35,6 @@ function PostRender(Canvas canvas) canvas.DrawText(spawnRateReport); } -defaultproperties -{ +defaultproperties { bVisible = true } \ No newline at end of file