mirror of
https://github.com/Outer-Wilds-New-Horizons/new-horizons.git
synced 2025-12-11 20:15:44 +01:00
Merge branch 'dev' of https://github.com/Outer-Wilds-New-Horizons/new-horizons into dev
This commit is contained in:
commit
610d43d7cb
@ -694,10 +694,25 @@ namespace NewHorizons
|
||||
|
||||
if (SystemDict.ContainsKey(starSystemName))
|
||||
{
|
||||
// Both changing the Mod and RelativePath are weird and will likely cause incompat issues if two mods both affected the same system
|
||||
// It's mostly just to fix up the config compared to the default one NH makes for the base StarSystem
|
||||
|
||||
if (SystemDict[starSystemName].Config.GlobalMusic == null && SystemDict[starSystemName].Config.Skybox == null)
|
||||
{
|
||||
SystemDict[starSystemName].Mod = mod;
|
||||
if (SystemDict[starSystemName].Config.extras == null)
|
||||
}
|
||||
|
||||
// If a mod contains a change to the default system, set the relative path.
|
||||
// Warning: If multiple systems make changes to the default system, only the relativePath will be set to the last mod loaded.
|
||||
if (string.IsNullOrEmpty(SystemDict[starSystemName].RelativePath))
|
||||
{
|
||||
SystemDict[starSystemName].RelativePath = relativePath;
|
||||
}
|
||||
else
|
||||
{
|
||||
NHLogger.LogWarning($"Two (or more) mods are making system changes to {starSystemName} which may result in errors");
|
||||
}
|
||||
|
||||
SystemDict[starSystemName].Config.Merge(starSystemConfig);
|
||||
}
|
||||
else
|
||||
|
||||
@ -143,9 +143,11 @@ namespace NewHorizons
|
||||
public object QueryBody(Type outType, string bodyName, string jsonPath)
|
||||
{
|
||||
var planet = Main.BodyDict[Main.Instance.CurrentStarSystem].Find((b) => b.Config.name == bodyName);
|
||||
return planet == null
|
||||
? null
|
||||
: QueryJson(outType, Path.Combine(planet.Mod.ModHelper.Manifest.ModFolderPath, planet.RelativePath), jsonPath);
|
||||
if (planet == null){
|
||||
NHLogger.LogError($"Could not find planet with body name {bodyName}.");
|
||||
return null;
|
||||
}
|
||||
return QueryJson(outType, Path.Combine(planet.Mod.ModHelper.Manifest.ModFolderPath, planet.RelativePath), jsonPath);
|
||||
}
|
||||
|
||||
public T QueryBody<T>(string bodyName, string jsonPath)
|
||||
|
||||
@ -49,7 +49,7 @@ Then, use the `QueryBody` method:
|
||||
var api = ModHelper.Interactions.TryGetModApi<INewHorizons>("xen.NewHorizons");
|
||||
api.GetBodyLoadedEvent().AddListener((name) => {
|
||||
ModHelper.Console.WriteLine($"Body: {name} Loaded!");
|
||||
var data = api.QueryBody<MyCoolExtensionData>("$.extras.myCoolExtensionData", name);
|
||||
var data = api.QueryBody<MyCoolExtensionData>(name, "$.extras.myCoolExtensionData");
|
||||
// Makes sure the module is not null
|
||||
if (data != null) {
|
||||
ModHelper.Console.WriteLine($"myCoolExtensionProperty for {name} is {data.myCoolExtensionProperty}!");
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user