Move schema rename childrenToDestroy

This commit is contained in:
Nick 2022-05-17 20:37:06 -04:00
parent 90f84d26af
commit 289bee9436
8 changed files with 16 additions and 7 deletions

View File

@ -9,7 +9,7 @@ namespace NewHorizons.External.Configs
public string Version { get; set; } public string Version { get; set; }
public string StarSystem { get; set; } = "SolarSystem"; public string StarSystem { get; set; } = "SolarSystem";
public bool Destroy { get; set; } public bool Destroy { get; set; }
public string[] ChildrenToDestroy { get; set; } public string[] RemoveChildren { get; set; }
public int BuildPriority { get; set; } = -1; public int BuildPriority { get; set; } = -1;
public bool CanShowOnTitle { get; set; } = true; public bool CanShowOnTitle { get; set; } = true;
public bool IsQuantumState { get; set; } public bool IsQuantumState { get; set; }
@ -32,6 +32,10 @@ namespace NewHorizons.External.Configs
public SandModule Sand { get; set; } public SandModule Sand { get; set; }
public FunnelModule Funnel { get; set; } public FunnelModule Funnel { get; set; }
// Obsolete
public string[] ChildrenToDestroy { get; set; }
public PlanetConfig() public PlanetConfig()
{ {
// Always have to have a base module // Always have to have a base module
@ -57,17 +61,22 @@ namespace NewHorizons.External.Configs
Lava.Size = Base.LavaSize; Lava.Size = Base.LavaSize;
} }
if(Base.BlackHoleSize != 0) if (Base.BlackHoleSize != 0)
{ {
Singularity = new SingularityModule(); Singularity = new SingularityModule();
Singularity.Type = "BlackHole"; Singularity.Type = "BlackHole";
Singularity.Size = Base.BlackHoleSize; Singularity.Size = Base.BlackHoleSize;
} }
if(Base.IsSatellite) if (Base.IsSatellite)
{ {
Base.ShowMinimap = false; Base.ShowMinimap = false;
} }
if (ChildrenToDestroy != null)
{
RemoveChildren = ChildrenToDestroy;
}
} }
} }
} }

View File

@ -248,9 +248,9 @@ namespace NewHorizons.Handlers
UpdateBodyOrbit(body, go); UpdateBodyOrbit(body, go);
} }
if (body.Config.ChildrenToDestroy != null && body.Config.ChildrenToDestroy.Length > 0) if (body.Config.RemoveChildren != null && body.Config.RemoveChildren.Length > 0)
{ {
foreach (var child in body.Config.ChildrenToDestroy) foreach (var child in body.Config.RemoveChildren)
{ {
Main.Instance.ModHelper.Events.Unity.FireInNUpdates(() => GameObject.Find(go.name + "/" + child)?.SetActive(false), 2); Main.Instance.ModHelper.Events.Unity.FireInNUpdates(() => GameObject.Find(go.name + "/" + child)?.SetActive(false), 2);
} }

View File

@ -182,7 +182,7 @@
"description": "`true` if you want to delete this planet", "description": "`true` if you want to delete this planet",
"default": false "default": false
}, },
"childrenToDestroy": { "removeChildren": {
"type": "array", "type": "array",
"description": "A list of paths to child GameObjects to destroy on this planet", "description": "A list of paths to child GameObjects to destroy on this planet",
"items": { "items": {
@ -262,7 +262,7 @@
"default": false, "default": false,
"description": "Set this to true if you are replacing the sun with a different body. Only one object in a star system should ever have this set to true." "description": "Set this to true if you are replacing the sun with a different body. Only one object in a star system should ever have this set to true."
}, },
"showMiniMap": { "showMinimap": {
"type": "boolean", "type": "boolean",
"default": true, "default": true,
"description": "Do we show the minimap when walking around this planet?" "description": "Do we show the minimap when walking around this planet?"