diff --git a/Configs/KFZedsReport.ini b/Configs/KFZedsReport.ini deleted file mode 100644 index 54a7cab..0000000 --- a/Configs/KFZedsReport.ini +++ /dev/null @@ -1,6 +0,0 @@ -[KFZedsReport.KFZedsReportMut] -;= Home repo: https://insultplayers.ru/git/dkanus/KFZedsReport -;= How often should we update our information? -updateInterval=0.25 -;= Over what interval do we count average spawn rate? -smoothingInterval=10.0 diff --git a/Classes/KFZedsReportMut.uc b/KFZedsReportMut.uc similarity index 74% rename from Classes/KFZedsReportMut.uc rename to KFZedsReportMut.uc index 4269cad..b736ab8 100644 --- a/Classes/KFZedsReportMut.uc +++ b/KFZedsReportMut.uc @@ -1,12 +1,8 @@ /** * Mutator that replicates and diplayes on clients information about how many * zeds are spawned and with what recent spawn rate. - * - * Author: dkanus - * Home repo: https://insultplayers.ru/git/dkanus/KFZedsReport */ -class KFZedsReportMut extends Mutator - config(KFZedsReport); +class KFZedsReportMut extends Mutator; // How often should we update our information? var config float updateInterval; @@ -17,15 +13,17 @@ 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; } @@ -35,40 +33,44 @@ 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; if (localPlayer == none) return; myInteraction = ReportInteraction(localPlayer.interactionMaster - .AddInteraction(string(class'ReportInteraction'), localPlayer)); - if (myInteraction != none) { + .AddInteraction("KFZedsReport.ReportInteraction", localPlayer)); + 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; } } @@ -76,14 +78,16 @@ 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/Classes/ReportInteraction.uc b/ReportInteraction.uc similarity index 74% rename from Classes/ReportInteraction.uc rename to ReportInteraction.uc index ac8f813..02bfeca 100644 --- a/Classes/ReportInteraction.uc +++ b/ReportInteraction.uc @@ -1,22 +1,19 @@ -/** - * Author: dkanus - * Home repo: https://insultplayers.ru/git/dkanus/KFZedsReport - */ 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; @@ -35,6 +32,7 @@ function PostRender(Canvas canvas) { canvas.DrawText(spawnRateReport); } -defaultproperties { +defaultproperties +{ bVisible = true } \ No newline at end of file