mirror of
https://github.com/Outer-Wilds-New-Horizons/new-horizons.git
synced 2025-12-11 20:15:44 +01:00
Make it actually use the loaded star system name
This commit is contained in:
parent
302425fcab
commit
443b03e6f8
@ -585,8 +585,15 @@ namespace NewHorizons
|
|||||||
|
|
||||||
|
|
||||||
#region Load
|
#region Load
|
||||||
public void LoadStarSystemConfig(string starSystemName, StarSystemConfig starSystemConfig, string relativePath, IModBehaviour mod)
|
public void LoadStarSystemConfig(StarSystemConfig starSystemConfig, string relativePath, IModBehaviour mod)
|
||||||
{
|
{
|
||||||
|
if (string.IsNullOrEmpty(starSystemConfig.name))
|
||||||
|
{
|
||||||
|
starSystemConfig.name = Path.GetFileNameWithoutExtension(relativePath);
|
||||||
|
}
|
||||||
|
|
||||||
|
var starSystemName = starSystemConfig.name;
|
||||||
|
|
||||||
starSystemConfig.Migrate();
|
starSystemConfig.Migrate();
|
||||||
starSystemConfig.FixCoordinates();
|
starSystemConfig.FixCoordinates();
|
||||||
|
|
||||||
@ -639,13 +646,12 @@ namespace NewHorizons
|
|||||||
|
|
||||||
foreach (var file in systemFiles)
|
foreach (var file in systemFiles)
|
||||||
{
|
{
|
||||||
var starSystemName = Path.GetFileNameWithoutExtension(file);
|
|
||||||
|
|
||||||
NHLogger.LogVerbose($"Loading system {starSystemName}");
|
|
||||||
|
|
||||||
var relativePath = file.Replace(folder, "");
|
var relativePath = file.Replace(folder, "");
|
||||||
|
|
||||||
|
NHLogger.LogVerbose($"Loading system {Path.GetFileNameWithoutExtension(relativePath)}");
|
||||||
|
|
||||||
var starSystemConfig = mod.ModHelper.Storage.Load<StarSystemConfig>(relativePath, false);
|
var starSystemConfig = mod.ModHelper.Storage.Load<StarSystemConfig>(relativePath, false);
|
||||||
LoadStarSystemConfig(starSystemName, starSystemConfig, relativePath, mod);
|
LoadStarSystemConfig(starSystemConfig, relativePath, mod);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (Directory.Exists(planetsFolder))
|
if (Directory.Exists(planetsFolder))
|
||||||
@ -771,19 +777,8 @@ namespace NewHorizons
|
|||||||
{
|
{
|
||||||
if (!SystemDict.ContainsKey(config.starSystem))
|
if (!SystemDict.ContainsKey(config.starSystem))
|
||||||
{
|
{
|
||||||
// Since we didn't load it earlier there shouldn't be a star system config
|
NHLogger.LogError($"System config for {config.starSystem} does not exist?");
|
||||||
var starSystemConfig = mod.ModHelper.Storage.Load<StarSystemConfig>(Path.Combine("systems", config.starSystem + ".json"), false);
|
return null;
|
||||||
if (starSystemConfig == null) starSystemConfig = new StarSystemConfig();
|
|
||||||
else NHLogger.LogWarning($"Loaded system config for {config.starSystem}. Why wasn't this loaded earlier?");
|
|
||||||
|
|
||||||
starSystemConfig.Migrate();
|
|
||||||
starSystemConfig.FixCoordinates();
|
|
||||||
|
|
||||||
var system = new NewHorizonsSystem(config.starSystem, starSystemConfig, $"", mod);
|
|
||||||
|
|
||||||
SystemDict.Add(config.starSystem, system);
|
|
||||||
|
|
||||||
BodyDict.Add(config.starSystem, new List<NewHorizonsBody>());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Has to happen after we make sure theres a system config
|
// Has to happen after we make sure theres a system config
|
||||||
|
|||||||
@ -253,7 +253,8 @@ namespace NewHorizons
|
|||||||
public void DefineStarSystem(string name, string config, IModBehaviour mod)
|
public void DefineStarSystem(string name, string config, IModBehaviour mod)
|
||||||
{
|
{
|
||||||
var starSystemConfig = JsonConvert.DeserializeObject<StarSystemConfig>(config);
|
var starSystemConfig = JsonConvert.DeserializeObject<StarSystemConfig>(config);
|
||||||
Main.Instance.LoadStarSystemConfig(name, starSystemConfig, null, mod);
|
starSystemConfig.name = name;
|
||||||
|
Main.Instance.LoadStarSystemConfig(starSystemConfig, null, mod);
|
||||||
}
|
}
|
||||||
|
|
||||||
public (CharacterDialogueTree, RemoteDialogueTrigger) CreateDialogueFromXML(string textAssetID, string xml, string dialogueInfo, GameObject planetGO)
|
public (CharacterDialogueTree, RemoteDialogueTrigger) CreateDialogueFromXML(string textAssetID, string xml, string dialogueInfo, GameObject planetGO)
|
||||||
@ -304,6 +305,7 @@ namespace NewHorizons
|
|||||||
|
|
||||||
var system = new StarSystemConfig()
|
var system = new StarSystemConfig()
|
||||||
{
|
{
|
||||||
|
name = starSystem,
|
||||||
entryPositions = entryPositions?
|
entryPositions = entryPositions?
|
||||||
.Select((pair) => new EntryPositionInfo() { id = pair.Key, position = pair.Value })
|
.Select((pair) => new EntryPositionInfo() { id = pair.Key, position = pair.Value })
|
||||||
.ToArray(),
|
.ToArray(),
|
||||||
@ -312,7 +314,7 @@ namespace NewHorizons
|
|||||||
.ToArray()
|
.ToArray()
|
||||||
};
|
};
|
||||||
|
|
||||||
Main.Instance.LoadStarSystemConfig(starSystem, system, null, mod);
|
Main.Instance.LoadStarSystemConfig(system, null, mod);
|
||||||
|
|
||||||
RumorModeBuilder.AddShipLogXML(GameObject.FindObjectOfType<ShipLogManager>(), xml, body);
|
RumorModeBuilder.AddShipLogXML(GameObject.FindObjectOfType<ShipLogManager>(), xml, body);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user