Skip to content

Commit

Permalink
option for autosave during combat
Browse files Browse the repository at this point in the history
  • Loading branch information
Die4Ever committed Aug 26, 2023
1 parent 8797d03 commit 40dd579
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 3 deletions.
6 changes: 4 additions & 2 deletions DXRModules/DeusEx/Classes/DXRAutosave.uc
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ class DXRAutosave extends DXRActorsBase transient;
var transient bool bNeedSave;
var config float save_delay;
var transient float save_timer;
var transient int autosave_combat;

const Disabled = 0;
const FirstEntry = 1;
Expand All @@ -17,6 +18,7 @@ function CheckConfig()
}
Super.CheckConfig();
Disable('Tick');
autosave_combat = int(ConsoleCommand("get #var(package).MenuChoice_AutosaveCombat autosave_combat"));
}

function PreFirstEntry()
Expand Down Expand Up @@ -48,7 +50,7 @@ function NeedSave()
bNeedSave = true;
save_timer = save_delay;
Enable('Tick');
if(!PawnIsInCombat(player()))
if(autosave_combat>0 || !PawnIsInCombat(player()))
SetGameSpeed(0);
}

Expand Down Expand Up @@ -124,7 +126,7 @@ function doAutosave()

p = player();

if(PawnIsInCombat(p)) {
if(autosave_combat<=0 && PawnIsInCombat(p)) {
info("waiting for Player to be out of combat, not saving yet");
SetGameSpeed(1);
return;
Expand Down
39 changes: 39 additions & 0 deletions GUI/DeusEx/Classes/MenuChoice_AutosaveCombat.uc
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
class MenuChoice_AutosaveCombat extends DXRMenuUIChoiceEnum;

var config int autosave_combat;

function PopulateOptions()
{
enumText[0] = "Wait for combat to finish";
enumText[1] = "Autosave immediately";
}

function SetInitialOption()
{
SetValue(autosave_combat);
}

function SaveSetting()
{
autosave_combat = GetValue();
SaveConfig();
}

function LoadSetting()
{
SetValue(autosave_combat);
}

function ResetToDefault()
{
autosave_combat = default.autosave_combat;
SetValue(autosave_combat);
SaveSetting();
}

defaultproperties
{
autosave_combat=0
HelpText="Should autosave wait for combat to finish?"
actionText="Autosave During Combat"
}
3 changes: 2 additions & 1 deletion GUI/DeusEx/Classes/MenuScreenRandoOptions.uc
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ function CreateChoices()
CreateChoice(class'MenuChoice_ShowNews');

if(#defined(vanilla)) {
CreateChoice(class'MenuChoice_AutosaveCombat');
CreateChoice(class'MenuChoice_EnergyDisplay');
CreateChoice(class'MenuChoice_ShowKeys');
CreateChoice(class'MenuChoice_ThrowMelee');
Expand All @@ -44,7 +45,7 @@ function CreateChoices()
CreateChoice(class'MenuChoice_PasswordAutofill');
CreateChoice(class'MenuChoice_ConfirmNoteDelete');
CreateChoice(class'MenuChoice_FixGlitches');
// TODO: speedrun mode for rerolls?
CreateChoice(class'MenuChoice_ShowTeleporters');

controlsParent.SetSize(clientWidth, choiceStartY + (choiceCount * choiceVerticalGap));
}
Expand Down

0 comments on commit 40dd579

Please sign in to comment.