fix style

This commit is contained in:
GenZmeY 2023-05-14 11:31:02 +03:00
parent b4d6d1eab6
commit e654d3f6bd
3 changed files with 177 additions and 177 deletions

View File

@ -1,105 +1,105 @@
[img]https://img.shields.io/static/v1?logo=GitHub&labelColor=gray&color=blue&logoColor=white&label=&message=Open Source[/img] [img]https://img.shields.io/github/license/GenZmeY/KF2-StartWave[/img] [img]https://img.shields.io/steam/subscriptions/2521731447[/img] [img]https://img.shields.io/steam/favorites/2521731447[/img] [img]https://img.shields.io/steam/update-date/2521731447[/img] [url=https://steamcommunity.com/sharedfiles/filedetails/changelog/2521731447][img]https://img.shields.io/github/v/tag/GenZmeY/KF2-StartWave[/img][/url] [img]https://img.shields.io/static/v1?logo=GitHub&labelColor=gray&color=blue&logoColor=white&label=&message=Open Source[/img] [img]https://img.shields.io/github/license/GenZmeY/KF2-StartWave[/img] [img]https://img.shields.io/steam/subscriptions/2521731447[/img] [img]https://img.shields.io/steam/favorites/2521731447[/img] [img]https://img.shields.io/steam/update-date/2521731447[/img] [url=https://steamcommunity.com/sharedfiles/filedetails/changelog/2521731447][img]https://img.shields.io/github/v/tag/GenZmeY/KF2-StartWave[/img][/url]
[h1]Description:[/h1] [h1]Description:[/h1]
This is the same as [url=https://steamcommunity.com/sharedfiles/filedetails/?id=1417081496]Pharrahnox's SetWave[/url], but with some fixes: This is the same as [url=https://steamcommunity.com/sharedfiles/filedetails/?id=1417081496]Pharrahnox's SetWave[/url], but with some fixes:
- fixed starting Dosh for Endless mode. - fixed starting Dosh for Endless mode.
A utility mod that allows users to specify the starting wave and the boss that will spawn. Additionally, users can jump between waves during the match with a console command (mutate setwave, see below). A utility mod that allows users to specify the starting wave and the boss that will spawn. Additionally, users can jump between waves during the match with a console command (mutate setwave, see below).
The purpose of this mod is to allow mappers to more efficiently test their maps for later waves or for the boss. It could also be used to skip early waves if you find them boring, or to test strategies against a specific boss. The purpose of this mod is to allow mappers to more efficiently test their maps for later waves or for the boss. It could also be used to skip early waves if you find them boring, or to test strategies against a specific boss.
It is designed to be compatible with every mutator and wave-based gamemode, and to require little to no maintenance after game updates. It is designed to be compatible with every mutator and wave-based gamemode, and to require little to no maintenance after game updates.
[h1]Whitelisted?[/h1] [h1]Whitelisted?[/h1]
No. This mod is not whitelisted and will unrank your server. Any XP gained will not be saved. No. This mod is not whitelisted and will unrank your server. Any XP gained will not be saved.
[h1]Usage (single player):[/h1] [h1]Usage (single player):[/h1]
[olist] [olist]
[*]Subscribe to this mutator; [*]Subscribe to this mutator;
[*]Start KF2; [*]Start KF2;
[*]Open console (`) and input: [*]Open console (`) and input:
[b]open KF-BioticsLab?Game=KFGameContent.KFGameInfo_Endless?Difficulty=0?GameLength=0?Mutator=StartWave.StartWave?[/b] [b]open KF-BioticsLab?Game=KFGameContent.KFGameInfo_Endless?Difficulty=0?GameLength=0?Mutator=StartWave.StartWave?[/b]
(replace the map and add the parameters you need) (replace the map and add the parameters you need)
[*]<Enter>. [*]<Enter>.
[/olist] [/olist]
[h1]Usage (server)[/h1] [h1]Usage (server)[/h1]
[b]Note:[/b] [i]If you don't understand what is written here, read the article [url=https://wiki.killingfloor2.com/index.php?title=Dedicated_Server_(Killing_Floor_2)][u]Dedicated Server (KF2 wiki)[/u][/url] before following these instructions.[/i] [b]Note:[/b] [i]If you don't understand what is written here, read the article [url=https://wiki.killingfloor2.com/index.php?title=Dedicated_Server_(Killing_Floor_2)][u]Dedicated Server (KF2 wiki)[/u][/url] before following these instructions.[/i]
[olist] [olist]
[*]Open your [b]PCServer-KFEngine.ini[/b] / [b]LinuxServer-KFEngine.ini[/b]; [*]Open your [b]PCServer-KFEngine.ini[/b] / [b]LinuxServer-KFEngine.ini[/b];
[*]Find the [b][IpDrv.TcpNetDriver][/b] section and make sure that there is a line (add if not): [*]Find the [b][IpDrv.TcpNetDriver][/b] section and make sure that there is a line (add if not):
[b]DownloadManagers=OnlineSubsystemSteamworks.SteamWorkshopDownload[/b] [b]DownloadManagers=OnlineSubsystemSteamworks.SteamWorkshopDownload[/b]
❗️ If there are several [b]DownloadManagers=[/b] then the line above should be the first ❗️ ❗️ If there are several [b]DownloadManagers=[/b] then the line above should be the first ❗️
[*]Add the following string to the [b][OnlineSubsystemSteamworks.KFWorkshopSteamworks][/b] section (create one if it doesn't exist): [*]Add the following string to the [b][OnlineSubsystemSteamworks.KFWorkshopSteamworks][/b] section (create one if it doesn't exist):
[b]ServerSubscribedWorkshopItems=2521731447[/b] [b]ServerSubscribedWorkshopItems=2521731447[/b]
[*]Start the server and wait while the mutator is downloading; [*]Start the server and wait while the mutator is downloading;
[*]Add mutator to server start parameters: [b]?Mutator=StartWave.StartWave[/b] and restart the server. [*]Add mutator to server start parameters: [b]?Mutator=StartWave.StartWave[/b] and restart the server.
[/olist] [/olist]
[h1]Mutator setup[/h1] [h1]Mutator setup[/h1]
You can use a config if you don't want to specify parameters in the startup line: You can use a config if you don't want to specify parameters in the startup line:
Create a file KFGame/Config/KFStartWave.ini and copy this text into it: Create a file KFGame/Config/KFStartWave.ini and copy this text into it:
[code] [code]
[StartWave.StartWave] [StartWave.StartWave]
// Any settings not specified in the launch command will use the values stored here. // Any settings not specified in the launch command will use the values stored here.
// If you use the same settings often, it is recommended to store those here // If you use the same settings often, it is recommended to store those here
// and only change what you need in the launch command. // and only change what you need in the launch command.
// Whether mod-specific events should be logged. // Whether mod-specific events should be logged.
bUseDebug=true bUseDebug=true
// Whether an 'initial' trader time should occur before the first wave. // Whether an 'initial' trader time should occur before the first wave.
bStartWithTrader=false bStartWithTrader=false
// The wave that the match should start on. It is clamped between wave 1 and the boss wave. // The wave that the match should start on. It is clamped between wave 1 and the boss wave.
StartWave=1 StartWave=1
// The duration of the 'initial' trader (before the first wave). // The duration of the 'initial' trader (before the first wave).
InitialTraderTime=60 InitialTraderTime=60
// The duration of standard trader (between waves). // The duration of standard trader (between waves).
TraderTime=60 TraderTime=60
// The starting dosh of players. // The starting dosh of players.
Dosh=250 Dosh=250
// The boss override index. // The boss override index.
// For the default boss list, 0-Hans, 1-Patty, 2-King FP, 3-Abomination. // For the default boss list, 0-Hans, 1-Patty, 2-King FP, 3-Abomination.
// Negative values can be used to keep the boss spawn random. // Negative values can be used to keep the boss spawn random.
Boss=-1 Boss=-1
[/code] [/code]
You can change the config as you need. You can change the config as you need.
[b]The setwave command[/b] [b]The setwave command[/b]
To jump to any wave during the match, use the setwave command which has the definition: mutate setwave WaveNum bSkipTraderTime. Cheats must be enabled for this command to work. To jump to any wave during the match, use the setwave command which has the definition: mutate setwave WaveNum bSkipTraderTime. Cheats must be enabled for this command to work.
Example usages (all to be typed into the console): Example usages (all to be typed into the console):
[code] [code]
mutate setwave 5 true // jump to wave 5 with no trader time. mutate setwave 5 true // jump to wave 5 with no trader time.
mutate setwave 3 false // jump to wave 3 with trader time. mutate setwave 3 false // jump to wave 3 with trader time.
mutate setwave 3 // identical to the above (the last parameter defaults to false). mutate setwave 3 // identical to the above (the last parameter defaults to false).
[/code] [/code]
You can jump forwards or backwards between waves (e.g. from 5 -> 2 -> 8 -> 3, etc.) You can jump forwards or backwards between waves (e.g. from 5 -> 2 -> 8 -> 3, etc.)
[h1]If not working[/h1] [h1]If not working[/h1]
Older versions of SetWave have the same file names - this can cause conflicts if you subscribe to them. Therefore: Older versions of SetWave have the same file names - this can cause conflicts if you subscribe to them. Therefore:
1. Check your subscriptions. If you are subscribed to old versions of the mutator, cancel them. 1. Check your subscriptions. If you are subscribed to old versions of the mutator, cancel them.
2. Clear the cache (the game doesn't clear it). It's here: 2. Clear the cache (the game doesn't clear it). It's here:
[code] [code]
Client: Client:
C:\Users\<YOUR_USERNAME>\Documents\My Games\KillingFloor2\KFGame\Cache\ C:\Users\<YOUR_USERNAME>\Documents\My Games\KillingFloor2\KFGame\Cache\
Server: Server:
<KF2_DIR>/Binaries/Win64/steamapps/workshop/content/232090/ <KF2_DIR>/Binaries/Win64/steamapps/workshop/content/232090/
<KF2_DIR>/KFGame/Cache/ <KF2_DIR>/KFGame/Cache/
[/code] [/code]
If its not a problem for you to download all subscriptions again, you can simply clear this folder(s). Your subscriptions are downloaded the next time you start the game/server. If its not a problem for you to download all subscriptions again, you can simply clear this folder(s). Your subscriptions are downloaded the next time you start the game/server.
If you do not want to download the subscriptions again, delete only those folders that contain SetWave.u file. If you do not want to download the subscriptions again, delete only those folders that contain SetWave.u file.
3. Try starting the game/server again. 3. Try starting the game/server again.
[h1]Bug reports[/h1] [h1]Bug reports[/h1]
I didn't test the mod very much because I only needed to fix a bug with Dosh. I didn't test the mod very much because I only needed to fix a bug with Dosh.
If you find any other problems, please describe how to reproduce them. Maybe I can fix it. If you find any other problems, please describe how to reproduce them. Maybe I can fix it.
You can do it right here, but I'll be much happier if you do it [url=https://github.com/GenZmeY/KF2-StartWave/issues]in issues on github[/url] . You can do it right here, but I'll be much happier if you do it [url=https://github.com/GenZmeY/KF2-StartWave/issues]in issues on github[/url] .
[h1]Sources[/h1] [h1]Sources[/h1]
[url=https://github.com/GenZmeY/KF2-StartWave]https://github.com/GenZmeY/KF2-StartWave[/url] [b](GNU GPLv3)[/b] [url=https://github.com/GenZmeY/KF2-StartWave]https://github.com/GenZmeY/KF2-StartWave[/url] [b](GNU GPLv3)[/b]

View File

@ -40,7 +40,7 @@ function InitMutator(string Options, out string ErrorMessage)
{ {
//This needs to be called first since KFMutator.InitMutator sets the MyKFGI reference. //This needs to be called first since KFMutator.InitMutator sets the MyKFGI reference.
Super.InitMutator(Options, ErrorMessage); Super.InitMutator(Options, ErrorMessage);
//Parse options entered via the launch command. //Parse options entered via the launch command.
//We further restrict StartWave later when we know the maximum wave number for the selected game length. //We further restrict StartWave later when we know the maximum wave number for the selected game length.
StartWave = Max(class'GameInfo'.static.GetIntOption(Options, "StartWave", StartWave), 1); StartWave = Max(class'GameInfo'.static.GetIntOption(Options, "StartWave", StartWave), 1);
@ -51,7 +51,7 @@ function InitMutator(string Options, out string ErrorMessage)
Boss = class'GameInfo'.static.GetIntOption(Options, "Boss", Boss); Boss = class'GameInfo'.static.GetIntOption(Options, "Boss", Boss);
bStartWithTrader = GetBoolOption(Options, "bStartWithTrader", bStartWithTrader); bStartWithTrader = GetBoolOption(Options, "bStartWithTrader", bStartWithTrader);
bUseDebug = GetBoolOption(Options, "bUseDebug", bUseDebug); bUseDebug = GetBoolOption(Options, "bUseDebug", bUseDebug);
//DEBUG //DEBUG
`log("StartWave: "$StartWave, bUseDebug, 'StartWave'); `log("StartWave: "$StartWave, bUseDebug, 'StartWave');
`log("InitialTraderTime: "$InitialTraderTime, bUseDebug, 'StartWave'); `log("InitialTraderTime: "$InitialTraderTime, bUseDebug, 'StartWave');
@ -59,23 +59,23 @@ function InitMutator(string Options, out string ErrorMessage)
`log("Dosh: "$Dosh, bUseDebug, 'StartWave'); `log("Dosh: "$Dosh, bUseDebug, 'StartWave');
`log("Boss: "$Boss, bUseDebug, 'StartWave'); `log("Boss: "$Boss, bUseDebug, 'StartWave');
`log("bStartWithTrader: "$bStartWithTrader, bUseDebug, 'StartWave'); `log("bStartWithTrader: "$bStartWithTrader, bUseDebug, 'StartWave');
bOverridenDifficultySettings = false; bOverridenDifficultySettings = false;
bOverridenTraderDuration = false; bOverridenTraderDuration = false;
SetTimer(0.1, false, nameof(OverrideTimer)); SetTimer(0.1, false, nameof(OverrideTimer));
//Override the boss with the boss corresponding to the specified boss index. -1 signifies random. //Override the boss with the boss corresponding to the specified boss index. -1 signifies random.
if(Boss != -1) if(Boss != -1)
{ {
SetTimer(0.1, false, nameof(OverrideBoss)); SetTimer(0.1, false, nameof(OverrideBoss));
} }
CheckForceInitialTrader(); CheckForceInitialTrader();
//We only care if this is the 'initial' trader time if we start with the trader active. //We only care if this is the 'initial' trader time if we start with the trader active.
bInitialTrader = bStartWithTrader; bInitialTrader = bStartWithTrader;
//If we want to start with the trader active or alter the starting wave number. //If we want to start with the trader active or alter the starting wave number.
if(bStartWithTrader || StartWave > 1) if(bStartWithTrader || StartWave > 1)
{ {
@ -83,7 +83,7 @@ function InitMutator(string Options, out string ErrorMessage)
bUseDebug, 'StartWave'); bUseDebug, 'StartWave');
SetTimer(0.2, false, nameof(StartWaveTimer)); SetTimer(0.2, false, nameof(StartWaveTimer));
} }
//If we will need to alter TimeBetweenWaves for later activations of the trader. //If we will need to alter TimeBetweenWaves for later activations of the trader.
if(bStartWithTrader && InitialTraderTime != TraderTime) if(bStartWithTrader && InitialTraderTime != TraderTime)
{ {
@ -97,22 +97,22 @@ function InitMutator(string Options, out string ErrorMessage)
function Mutate(string MutateString, PlayerController Sender) function Mutate(string MutateString, PlayerController Sender)
{ {
local array<string> CommandBreakdown; local array<string> CommandBreakdown;
if(MutateString == "") if(MutateString == "")
{ {
return; return;
} }
//Split the string on the space character. //Split the string on the space character.
ParseStringIntoArray(MutateString, CommandBreakdown, " ", true); ParseStringIntoArray(MutateString, CommandBreakdown, " ", true);
//The CheatManager check is equivalent to checking if cheats are enabled for that player. //The CheatManager check is equivalent to checking if cheats are enabled for that player.
if(CommandBreakdown.Length > 1 && CommandBreakdown[0] == "setwave" && Sender.CheatManager != None && if(CommandBreakdown.Length > 1 && CommandBreakdown[0] == "setwave" && Sender.CheatManager != None &&
MyKFGI.GetLivingPlayerCount() > 0) MyKFGI.GetLivingPlayerCount() > 0)
{ {
//The setwave command should be: mutate setwave WaveNum bSkipTraderTime //The setwave command should be: mutate setwave WaveNum bSkipTraderTime
//where WaveNum is an integer (or byte) and bSkipTraderTime is a bool. //where WaveNum is an integer (or byte) and bSkipTraderTime is a bool.
if(CommandBreakdown.Length == 2) if(CommandBreakdown.Length == 2)
{ {
SetWave(int(CommandBreakdown[1]), Sender); SetWave(int(CommandBreakdown[1]), Sender);
@ -122,7 +122,7 @@ function Mutate(string MutateString, PlayerController Sender)
SetWave(int(CommandBreakdown[1]), Sender, bool(CommandBreakdown[2])); SetWave(int(CommandBreakdown[1]), Sender, bool(CommandBreakdown[2]));
} }
} }
Super.Mutate(MutateString, Sender); Super.Mutate(MutateString, Sender);
} }
@ -134,7 +134,7 @@ function SetWave(int NewWaveNum, PlayerController PC, optional bool bSkipTraderT
`log("SetWave: new wave num must be > 0.", true, 'StartWave'); `log("SetWave: new wave num must be > 0.", true, 'StartWave');
return; return;
} }
if(KFGameInfo_Endless(MyKFGI) != None) if(KFGameInfo_Endless(MyKFGI) != None)
{ {
//Jump straight to the final wave if the specified wave number is higher than wave max. //Jump straight to the final wave if the specified wave number is higher than wave max.
@ -151,22 +151,22 @@ function SetWave(int NewWaveNum, PlayerController PC, optional bool bSkipTraderT
NewWaveNum = KFGameInfo_Survival(MyKFGI).WaveMax+1; NewWaveNum = KFGameInfo_Survival(MyKFGI).WaveMax+1;
} }
} }
KFGameInfo_Survival(MyKFGI).WaveNum = NewWaveNum - 1; KFGameInfo_Survival(MyKFGI).WaveNum = NewWaveNum - 1;
//Kill all zeds currently alive. //Kill all zeds currently alive.
PC.ConsoleCommand("KillZeds"); PC.ConsoleCommand("KillZeds");
//Clear any current objectives. //Clear any current objectives.
MyKFGI.MyKFGRI.DeactivateObjective(); MyKFGI.MyKFGRI.DeactivateObjective();
if(bSkipTraderTime) if(bSkipTraderTime)
{ {
//Go to some unused state so that PlayingWave.BeginState is called when we go to PlayingWave. //Go to some unused state so that PlayingWave.BeginState is called when we go to PlayingWave.
MyKFGI.GotoState('TravelTheWorld'); MyKFGI.GotoState('TravelTheWorld');
UpdateEndlessDifficulty(); UpdateEndlessDifficulty();
//Go to PlayingWave to start the new wave. //Go to PlayingWave to start the new wave.
MyKFGI.GotoState('PlayingWave'); MyKFGI.GotoState('PlayingWave');
} }
@ -174,7 +174,7 @@ function SetWave(int NewWaveNum, PlayerController PC, optional bool bSkipTraderT
{ {
//Go to trader time before starting the new wave. //Go to trader time before starting the new wave.
MyKFGI.GotoState('TraderOpen'); MyKFGI.GotoState('TraderOpen');
UpdateEndlessDifficulty(); UpdateEndlessDifficulty();
} }
@ -189,20 +189,20 @@ function UpdateEndlessDifficulty()
{ {
local KFGameInfo_Endless Endless; local KFGameInfo_Endless Endless;
local int i; local int i;
Endless = KFGameInfo_Endless(MyKFGI); Endless = KFGameInfo_Endless(MyKFGI);
if(Endless == None) if(Endless == None)
{ {
return; return;
} }
//Reflects the difficulty update in KFGameInfo_Endless.SetWave. //Reflects the difficulty update in KFGameInfo_Endless.SetWave.
Endless.bIsInHoePlus = false; Endless.bIsInHoePlus = false;
Endless.ResetDifficulty(); Endless.ResetDifficulty();
Endless.SpawnManager.GetWaveSettings(Endless.SpawnManager.WaveSettings); Endless.SpawnManager.GetWaveSettings(Endless.SpawnManager.WaveSettings);
Endless.UpdateGameSettings(); Endless.UpdateGameSettings();
//Don't bother iterating for i=0-4, no difficulty increment can occur. //Don't bother iterating for i=0-4, no difficulty increment can occur.
for(i = 5; i < Endless.WaveNum; ++i) for(i = 5; i < Endless.WaveNum; ++i)
{ {
@ -211,7 +211,7 @@ function UpdateEndlessDifficulty()
{ {
Endless.IncrementDifficulty(); Endless.IncrementDifficulty();
} }
//This should happen at the end of each wave (if we're in HoE+). The check is handled internally. //This should happen at the end of each wave (if we're in HoE+). The check is handled internally.
//We do this after the simulation of a boss death so that bIsInHoePlus can be set first. //We do this after the simulation of a boss death so that bIsInHoePlus can be set first.
Endless.HellOnEarthPlusRoundIncrement(); Endless.HellOnEarthPlusRoundIncrement();
@ -234,38 +234,38 @@ function OverrideBoss()
{ {
local bool bHalt; local bool bHalt;
local byte MaxIters, i, MaxSameIters, PrevIndex, SameIters; local byte MaxIters, i, MaxSameIters, PrevIndex, SameIters;
//We need a valid KFGRI reference as we use its public BossIndex field. //We need a valid KFGRI reference as we use its public BossIndex field.
if(MyKFGI.MyKFGRI == None) if(MyKFGI.MyKFGRI == None)
{ {
SetTimer(0.2, false, nameof(OverrideBoss)); SetTimer(0.2, false, nameof(OverrideBoss));
return; return;
} }
//Unfortunately, we cannot directly set the boss index since KFGameInfo.BossIndex is protected. The only //Unfortunately, we cannot directly set the boss index since KFGameInfo.BossIndex is protected. The only
//way we can affect BossIndex is through KFGameInfo.SetBossIndex which randomly chooses a value in the //way we can affect BossIndex is through KFGameInfo.SetBossIndex which randomly chooses a value in the
//valid range. So we have to continue calling SetBossIndex until the desired index has been chosen. We //valid range. So we have to continue calling SetBossIndex until the desired index has been chosen. We
//can verify this by checking KFGameReplicationInfo.BossIndex because that is public. //can verify this by checking KFGameReplicationInfo.BossIndex because that is public.
i = 0; i = 0;
MaxIters = 100; MaxIters = 100;
//Since some events/maps could force a specific boss to be spawned (see KFGameInfo.SetBossIndex), we //Since some events/maps could force a specific boss to be spawned (see KFGameInfo.SetBossIndex), we
//should check whether the index hasn't changed after several iterations. If it stays the same for a //should check whether the index hasn't changed after several iterations. If it stays the same for a
//while we assume the index is forced, in which case we can't do anything about it. //while we assume the index is forced, in which case we can't do anything about it.
SameIters = 0; SameIters = 0;
MaxSameIters = 10; MaxSameIters = 10;
PrevIndex = MyKFGI.MyKFGRI.BossIndex; PrevIndex = MyKFGI.MyKFGRI.BossIndex;
bHalt = Boss < 0 || MyKFGI.MyKFGRI.BossIndex == Boss; bHalt = Boss < 0 || MyKFGI.MyKFGRI.BossIndex == Boss;
while(!bHalt) while(!bHalt)
{ {
++i; ++i;
//Randomly select a new boss. //Randomly select a new boss.
MyKFGI.SetBossIndex(); MyKFGI.SetBossIndex();
//Track whether the boss index is changing. //Track whether the boss index is changing.
if(MyKFGI.MyKFGRI.BossIndex == PrevIndex) if(MyKFGI.MyKFGRI.BossIndex == PrevIndex)
{ {
@ -276,11 +276,11 @@ function OverrideBoss()
SameIters = 0; SameIters = 0;
PrevIndex = MyKFGI.MyKFGRI.BossIndex; PrevIndex = MyKFGI.MyKFGRI.BossIndex;
} }
//Halt if we have the desired index or we have tried enough times. //Halt if we have the desired index or we have tried enough times.
bHalt = MyKFGI.MyKFGRI.BossIndex == Boss || SameIters >= MaxSameIters || i >= MaxIters; bHalt = MyKFGI.MyKFGRI.BossIndex == Boss || SameIters >= MaxSameIters || i >= MaxIters;
} }
if(MyKFGI.MyKFGRI.BossIndex == Boss) if(MyKFGI.MyKFGRI.BossIndex == Boss)
{ {
`log("Successfully overrode boss index to "$Boss$" after "$i$" attempts.", bUseDebug, 'StartWave'); `log("Successfully overrode boss index to "$Boss$" after "$i$" attempts.", bUseDebug, 'StartWave');
@ -298,26 +298,26 @@ function OverrideTimer()
local KFGameInfo_Endless KFGI_Endl; local KFGameInfo_Endless KFGI_Endl;
local KFGameDifficulty_Endless KFGD_Endl; local KFGameDifficulty_Endless KFGD_Endl;
local int i; local int i;
//If we've overriden what we need to, don't call this timer again. //If we've overriden what we need to, don't call this timer again.
if(bOverridenDifficultySettings && bOverridenTraderDuration) if(bOverridenDifficultySettings && bOverridenTraderDuration)
{ {
`log("All settings have been overriden.", bUseDebug, 'StartWave'); `log("All settings have been overriden.", bUseDebug, 'StartWave');
return; return;
} }
if(!bOverridenDifficultySettings && MyKFGI.DifficultyInfo != None) if(!bOverridenDifficultySettings && MyKFGI.DifficultyInfo != None)
{ {
`log("Overriding difficulty settings...", bUseDebug, 'StartWave'); `log("Overriding difficulty settings...", bUseDebug, 'StartWave');
bOverridenDifficultySettings = true; bOverridenDifficultySettings = true;
//Override starting dosh. //Override starting dosh.
MyKFGI.DifficultyInfo.Normal.StartingDosh = Dosh; MyKFGI.DifficultyInfo.Normal.StartingDosh = Dosh;
MyKFGI.DifficultyInfo.Hard.StartingDosh = Dosh; MyKFGI.DifficultyInfo.Hard.StartingDosh = Dosh;
MyKFGI.DifficultyInfo.Suicidal.StartingDosh = Dosh; MyKFGI.DifficultyInfo.Suicidal.StartingDosh = Dosh;
MyKFGI.DifficultyInfo.HellOnEarth.StartingDosh = Dosh; MyKFGI.DifficultyInfo.HellOnEarth.StartingDosh = Dosh;
KFGI_Endl = KFGameInfo_Endless(MyKFGI); KFGI_Endl = KFGameInfo_Endless(MyKFGI);
if (KFGI_Endl != None) if (KFGI_Endl != None)
{ {
@ -330,19 +330,19 @@ function OverrideTimer()
} }
} }
} }
`log("Starting dosh has been set to: "$Dosh$" dosh.", bUseDebug, 'StartWave'); `log("Starting dosh has been set to: "$Dosh$" dosh.", bUseDebug, 'StartWave');
//We need to set the difficulty settings again - normally done in KFGameInfo.InitGame - to apply //We need to set the difficulty settings again - normally done in KFGameInfo.InitGame - to apply
//these changes, since this happens after InitGame is executed. //these changes, since this happens after InitGame is executed.
MyKFGI.DifficultyInfo.SetDifficultySettings(MyKFGI.GameDifficulty); MyKFGI.DifficultyInfo.SetDifficultySettings(MyKFGI.GameDifficulty);
} }
//Set the starting wave number. //Set the starting wave number.
if(!bOverridenTraderDuration) if(!bOverridenTraderDuration)
{ {
KFGI_Surv = KFGameInfo_Survival(MyKFGI); KFGI_Surv = KFGameInfo_Survival(MyKFGI);
if(KFGI_Surv != None) if(KFGI_Surv != None)
{ {
//We require the SpawnManager to be set, because this signifies that InitSpawnManager has been //We require the SpawnManager to be set, because this signifies that InitSpawnManager has been
@ -350,14 +350,14 @@ function OverrideTimer()
if(MyKFGI.SpawnManager != None) if(MyKFGI.SpawnManager != None)
{ {
`log("Overriding trader duration...", bUseDebug, 'StartWave'); `log("Overriding trader duration...", bUseDebug, 'StartWave');
bOverridenTraderDuration = true; bOverridenTraderDuration = true;
//Since InitSpawnManager has been executed, then PreBeginPlay must have been executed. This //Since InitSpawnManager has been executed, then PreBeginPlay must have been executed. This
//means that PostBeginPlay will have been executed as well since it happens straight after. //means that PostBeginPlay will have been executed as well since it happens straight after.
//Now we can override TimeBetweenWaves. //Now we can override TimeBetweenWaves.
KFGI_Surv.TimeBetweenWaves = bInitialTrader ? InitialTraderTime : TraderTime; KFGI_Surv.TimeBetweenWaves = bInitialTrader ? InitialTraderTime : TraderTime;
`log("Trader duration has been set to: "$KFGI_Surv.TimeBetweenWaves$" seconds.", bUseDebug, `log("Trader duration has been set to: "$KFGI_Surv.TimeBetweenWaves$" seconds.", bUseDebug,
'StartWave'); 'StartWave');
} }
@ -365,7 +365,7 @@ function OverrideTimer()
{ {
`log("MyKFGI.SpawnManager hasn't been set yet. Calling StartWaveTimer again.", bUseDebug, `log("MyKFGI.SpawnManager hasn't been set yet. Calling StartWaveTimer again.", bUseDebug,
'StartWave'); 'StartWave');
//We don't know WaveMax yet, so we need to wait longer. //We don't know WaveMax yet, so we need to wait longer.
SetTimer(0.1, false, nameof(StartWaveTimer)); SetTimer(0.1, false, nameof(StartWaveTimer));
return; return;
@ -377,7 +377,7 @@ function OverrideTimer()
$"compatible with non-wave-based game modes.", true, 'StartWave'); $"compatible with non-wave-based game modes.", true, 'StartWave');
} }
} }
//If the difficulty info isn't set yet, wait. //If the difficulty info isn't set yet, wait.
SetTimer(0.1, false, nameof(OverrideTimer)); SetTimer(0.1, false, nameof(OverrideTimer));
} }
@ -386,7 +386,7 @@ function StartWaveTimer()
{ {
local KFGameInfo_Survival KFGI_Surv; local KFGameInfo_Survival KFGI_Surv;
local PlayerController PC; local PlayerController PC;
//We need to wait for the wave to be active, as this will signify that StartMatch has been executed. //We need to wait for the wave to be active, as this will signify that StartMatch has been executed.
if(!MyKFGI.IsWaveActive()) if(!MyKFGI.IsWaveActive())
{ {
@ -394,16 +394,16 @@ function StartWaveTimer()
SetTimer(0.1, false, nameof(StartWaveTimer)); SetTimer(0.1, false, nameof(StartWaveTimer));
return; return;
} }
KFGI_Surv = KFGameInfo_Survival(MyKFGI); KFGI_Surv = KFGameInfo_Survival(MyKFGI);
if(KFGI_Surv == None) if(KFGI_Surv == None)
{ {
return; return;
} }
`log("Clearing the current wave.", bUseDebug, 'StartWave'); `log("Clearing the current wave.", bUseDebug, 'StartWave');
//Clear the current wave. //Clear the current wave.
foreach WorldInfo.AllControllers(class'PlayerController', PC) foreach WorldInfo.AllControllers(class'PlayerController', PC)
{ {
@ -413,39 +413,39 @@ function StartWaveTimer()
break; break;
} }
} }
//Set the starting wave number. //Set the starting wave number.
//Keep the assignments separated so that we can used the restricted StartWave later if we want. //Keep the assignments separated so that we can used the restricted StartWave later if we want.
StartWave = Min(StartWave, KFGI_Surv.WaveMax); StartWave = Min(StartWave, KFGI_Surv.WaveMax);
//We need to subtract 1 because when the state is eventually reset to PlayingWave, this will be //We need to subtract 1 because when the state is eventually reset to PlayingWave, this will be
//incremented by 1. //incremented by 1.
KFGI_Surv.WaveNum = StartWave - 1; KFGI_Surv.WaveNum = StartWave - 1;
`log("WaveNum set to: "$KFGI_Surv.WaveNum, bUseDebug, 'StartWave'); `log("WaveNum set to: "$KFGI_Surv.WaveNum, bUseDebug, 'StartWave');
if(bStartWithTrader) if(bStartWithTrader)
{ {
`log("Switching to state: TraderOpen.", bUseDebug, 'StartWave'); `log("Switching to state: TraderOpen.", bUseDebug, 'StartWave');
//We need to update GRI's WaveNum and update the HUD element that shows the last wave. //We need to update GRI's WaveNum and update the HUD element that shows the last wave.
MyKFGI.MyKFGRI.WaveNum = KFGI_Surv.WaveNum; MyKFGI.MyKFGRI.WaveNum = KFGI_Surv.WaveNum;
MyKFGI.MyKFGRI.UpdateHUDWaveCount(); MyKFGI.MyKFGRI.UpdateHUDWaveCount();
//Start with the trader active. //Start with the trader active.
MyKFGI.GotoState('TraderOpen', 'Begin'); MyKFGI.GotoState('TraderOpen', 'Begin');
} }
else else
{ {
`log("Switching to state: PlayingWave.", bUseDebug, 'StartWave'); `log("Switching to state: PlayingWave.", bUseDebug, 'StartWave');
//Start with a wave as usual - but our StartWave number will be used. //Start with a wave as usual - but our StartWave number will be used.
MyKFGI.GotoState('PlayingWave'); MyKFGI.GotoState('PlayingWave');
} }
//Since we've updated the wave number, we need to update the game settings (which includes the //Since we've updated the wave number, we need to update the game settings (which includes the
//current wave number). //current wave number).
MyKFGI.UpdateGameSettings(); MyKFGI.UpdateGameSettings();
bInitialTrader = false; bInitialTrader = false;
} }
@ -466,7 +466,7 @@ function UpdateTraderDurationTimer()
`warn("The game mode does not extend KFGameInfo_Survival. Most features of this mutator are not" `warn("The game mode does not extend KFGameInfo_Survival. Most features of this mutator are not"
$"compatible with non-wave-based game modes.", true, 'StartWave'); $"compatible with non-wave-based game modes.", true, 'StartWave');
} }
//We don't need to call this timer again. //We don't need to call this timer again.
ClearTimer(nameof(UpdateTraderDurationTimer)); ClearTimer(nameof(UpdateTraderDurationTimer));
} }
@ -486,12 +486,12 @@ static function bool GetBoolOption(string Options, string ParseString, bool Curr
//Find the value associated with this variable in the launch command. //Find the value associated with this variable in the launch command.
InOpt = class'GameInfo'.static.ParseOption(Options, ParseString); InOpt = class'GameInfo'.static.ParseOption(Options, ParseString);
if(InOpt != "") if(InOpt != "")
{ {
return bool(InOpt); return bool(InOpt);
} }
//If a value for this variable was not specified in the launch command, return the original value. //If a value for this variable was not specified in the launch command, return the original value.
return CurrentValue; return CurrentValue;
} }
@ -510,12 +510,12 @@ static function string GetStringOption(string Options, string ParseString, strin
//Find the value associated with this variable in the launch command. //Find the value associated with this variable in the launch command.
InOpt = class'GameInfo'.static.ParseOption(Options, ParseString); InOpt = class'GameInfo'.static.ParseOption(Options, ParseString);
if(InOpt != "") if(InOpt != "")
{ {
return InOpt; return InOpt;
} }
//If a value for this variable was not specified in the launch command, return the original value. //If a value for this variable was not specified in the launch command, return the original value.
return CurrentValue; return CurrentValue;
} }

View File

@ -7,7 +7,7 @@ StripSource="True"
# Mutators to be compiled # Mutators to be compiled
# Specify them with a space as a separator, # Specify them with a space as a separator,
# Mutators will be compiled in the specified order # Mutators will be compiled in the specified order
PackageBuildOrder="StartWave" PackageBuildOrder="StartWave"
@ -16,7 +16,7 @@ PackageBuildOrder="StartWave"
# Packages you want to brew using @peelz's patched KFEditor. # Packages you want to brew using @peelz's patched KFEditor.
# Useful for cases where regular brew doesn't put *.upk inside the package. # Useful for cases where regular brew doesn't put *.upk inside the package.
# Specify them with a space as a separator, # Specify them with a space as a separator,
# The order doesn't matter # The order doesn't matter
PackagePeelzBrew="" PackagePeelzBrew=""
@ -24,7 +24,7 @@ PackagePeelzBrew=""
# Mutators that will be uploaded to the workshop # Mutators that will be uploaded to the workshop
# Specify them with a space as a separator, # Specify them with a space as a separator,
# The order doesn't matter # The order doesn't matter
PackageUpload="StartWave" PackageUpload="StartWave"