Skip to content

Commit

Permalink
Fixed bug, where dedicated servers would crash when starting with the…
Browse files Browse the repository at this point in the history
… plugin a new world
  • Loading branch information
thorwin99 committed Mar 5, 2020
1 parent 1467b35 commit aee1a1d
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 6 deletions.
3 changes: 1 addition & 2 deletions SEWorldGenPlugin/GUI/PluginWorldSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ namespace SEWorldGenPlugin.GUI
{
public class PluginWorldSettings : MyGuiScreenWorldSettings
{
public static MyGuiScreenWorldSettings Static;
public MyObjectBuilder_PluginSettings PluginSettings;

private MyGuiControlCheckbox m_enablePlugin;
Expand Down Expand Up @@ -48,7 +47,7 @@ public PluginWorldSettings(bool displayTabScenario = true, bool displayTabWorksh
{
}

public PluginWorldSettings(MyObjectBuilder_Checkpoint checkpoint, string path, bool displayTabScenario = true, bool displayTabWorkshop = true, bool displayTabCustom = true, bool isCloudPath = false) : base(checkpoint, path, displayTabScenario, displayTabWorkshop, displayTabCustom, isCloudPath)
public PluginWorldSettings(MyObjectBuilder_Checkpoint checkpoint, string path, bool displayTabScenario = true, bool displayTabWorkshop = true, bool displayTabCustom = true) : base(checkpoint, path, displayTabScenario, displayTabWorkshop, displayTabCustom)
{
Static = this;
m_isNewGame = (checkpoint == null);
Expand Down
1 change: 1 addition & 0 deletions SEWorldGenPlugin/Generator/SystemGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ public override void Init(MyObjectBuilder_SessionComponent sessionComponent)
m_seed = MySession.Static.Settings.ProceduralSeed + MyRandom.Instance.CreateRandomSeed();

m_settings = SettingsSession.Static.Settings.GeneratorSettings;
//FilterDefinitions();

if (b == null || m_objects == null || m_objects.Count == 0)
{
Expand Down
3 changes: 0 additions & 3 deletions SEWorldGenPlugin/MySettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,6 @@ public void LoadSettings()
Settings = new MyObjectBuilder_PluginSettings();
Settings.GeneratorSettings.PlanetSettings.Moons.Add("Moon");
Settings.GeneratorSettings.PlanetSettings.Moons.Add("Titan");

if (Sync.IsDedicated)
Settings.Enable = true;
}
Settings.Verify();
}
Expand Down
10 changes: 9 additions & 1 deletion SEWorldGenPlugin/Session/SettingsSession.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,15 @@ public override void LoadData()
var s = new MySettings();
s.LoadSettings();
}
Settings = MySettings.Static.SessionSettings;
if(MySettings.Static.SessionSettings != null)
{
Settings = MySettings.Static.SessionSettings;
}
else
{
Settings = MySettings.Static.Settings;
}

MySettings.Static.SessionSettings = null;
}
}
Expand Down

0 comments on commit aee1a1d

Please sign in to comment.