mirror of
https://github.com/Outer-Wilds-New-Horizons/new-horizons.git
synced 2025-12-11 20:15:44 +01:00
Add entry positions to the api
This commit is contained in:
parent
0f187f6aca
commit
74b10f4e53
@ -22,7 +22,8 @@ namespace NewHorizons
|
|||||||
/// <param name="manager"></param>
|
/// <param name="manager"></param>
|
||||||
/// <param name="xml"></param>
|
/// <param name="xml"></param>
|
||||||
/// <param name="planetName"></param>
|
/// <param name="planetName"></param>
|
||||||
void AddShipLogXML(IModBehaviour mod, ShipLogManager manager, XElement xml, string planetName);
|
/// <param name="entryPositions"></param>
|
||||||
|
void AddShipLogXML(IModBehaviour mod, ShipLogManager manager, XElement xml, string planetName, Dictionary<string, Vector2> entryPositions);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Will load all configs in the regular folders (planets, systems, translations, etc) for this mod.
|
/// Will load all configs in the regular folders (planets, systems, translations, etc) for this mod.
|
||||||
|
|||||||
@ -600,6 +600,33 @@ namespace NewHorizons
|
|||||||
|
|
||||||
|
|
||||||
#region Load
|
#region Load
|
||||||
|
public void LoadStarSystemConfig(StarSystemConfig starSystemConfig, string relativePath, IModBehaviour mod)
|
||||||
|
{
|
||||||
|
starSystemConfig.Migrate();
|
||||||
|
starSystemConfig.FixCoordinates();
|
||||||
|
|
||||||
|
if (starSystemConfig.startHere)
|
||||||
|
{
|
||||||
|
// We always want to allow mods to overwrite setting the main SolarSystem as default but not the other way around
|
||||||
|
if (name != "SolarSystem")
|
||||||
|
{
|
||||||
|
SetDefaultSystem(name);
|
||||||
|
_currentStarSystem = name;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (SystemDict.ContainsKey(name))
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(SystemDict[name].Config.travelAudio) && SystemDict[name].Config.Skybox == null)
|
||||||
|
SystemDict[name].Mod = mod;
|
||||||
|
SystemDict[name].Config.Merge(starSystemConfig);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
SystemDict[name] = new NewHorizonsSystem(name, starSystemConfig, relativePath, mod);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void LoadConfigs(IModBehaviour mod)
|
public void LoadConfigs(IModBehaviour mod)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@ -633,29 +660,7 @@ namespace NewHorizons
|
|||||||
|
|
||||||
var relativePath = file.Replace(folder, "");
|
var relativePath = file.Replace(folder, "");
|
||||||
var starSystemConfig = mod.ModHelper.Storage.Load<StarSystemConfig>(relativePath, false);
|
var starSystemConfig = mod.ModHelper.Storage.Load<StarSystemConfig>(relativePath, false);
|
||||||
starSystemConfig.Migrate();
|
LoadStarSystemConfig(starSystemConfig, relativePath, mod);
|
||||||
starSystemConfig.FixCoordinates();
|
|
||||||
|
|
||||||
if (starSystemConfig.startHere)
|
|
||||||
{
|
|
||||||
// We always want to allow mods to overwrite setting the main SolarSystem as default but not the other way around
|
|
||||||
if (name != "SolarSystem")
|
|
||||||
{
|
|
||||||
SetDefaultSystem(name);
|
|
||||||
_currentStarSystem = name;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (SystemDict.ContainsKey(name))
|
|
||||||
{
|
|
||||||
if (string.IsNullOrEmpty(SystemDict[name].Config.travelAudio) && SystemDict[name].Config.Skybox == null)
|
|
||||||
SystemDict[name].Mod = mod;
|
|
||||||
SystemDict[name].Config.Merge(starSystemConfig);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
SystemDict[name] = new NewHorizonsSystem(name, starSystemConfig, relativePath, mod);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (Directory.Exists(planetsFolder))
|
if (Directory.Exists(planetsFolder))
|
||||||
|
|||||||
@ -20,6 +20,7 @@ using System.Linq;
|
|||||||
using System.Xml.Linq;
|
using System.Xml.Linq;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.Events;
|
using UnityEngine.Events;
|
||||||
|
using static NewHorizons.External.Modules.ShipLogModule;
|
||||||
|
|
||||||
namespace NewHorizons
|
namespace NewHorizons
|
||||||
{
|
{
|
||||||
@ -65,7 +66,7 @@ namespace NewHorizons
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AddShipLogXML(IModBehaviour mod, ShipLogManager manager, XElement xml, string planetName)
|
public void AddShipLogXML(IModBehaviour mod, ShipLogManager manager, XElement xml, string planetName, Dictionary<string, Vector2> entryPositions)
|
||||||
{
|
{
|
||||||
var body = new NewHorizonsBody(new PlanetConfig() { name = planetName, starSystem = Main.Instance.CurrentStarSystem }, mod);
|
var body = new NewHorizonsBody(new PlanetConfig() { name = planetName, starSystem = Main.Instance.CurrentStarSystem }, mod);
|
||||||
|
|
||||||
@ -87,6 +88,9 @@ namespace NewHorizons
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var system = new StarSystemConfig() { entryPositions = entryPositions.Select((pair) => new EntryPositionInfo() { id = pair.Key, position = pair.Value }).ToArray() };
|
||||||
|
Main.Instance.LoadStarSystemConfig(system, null, mod);
|
||||||
|
|
||||||
RumorModeBuilder.AddShipLogXML(manager, xml, body);
|
RumorModeBuilder.AddShipLogXML(manager, xml, body);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user