mirror of
https://github.com/Outer-Wilds-New-Horizons/new-horizons.git
synced 2025-12-11 20:15:44 +01:00
fix compile error
This commit is contained in:
parent
641084ae45
commit
a5a068d32a
714
NewHorizons/External/Configs/StarSystemConfig.cs
vendored
714
NewHorizons/External/Configs/StarSystemConfig.cs
vendored
@ -1,358 +1,358 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using NewHorizons.External.Modules;
|
using NewHorizons.External.Modules;
|
||||||
using NewHorizons.External.SerializableData;
|
using NewHorizons.External.SerializableData;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using static NewHorizons.External.Modules.ShipLogModule;
|
using static NewHorizons.External.Modules.ShipLogModule;
|
||||||
|
|
||||||
namespace NewHorizons.External.Configs
|
namespace NewHorizons.External.Configs
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Configuration for a specific star system
|
/// Configuration for a specific star system
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[JsonObject]
|
[JsonObject]
|
||||||
public class StarSystemConfig
|
public class StarSystemConfig
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// In this system should the player be able to rotate their map camera freely or be stuck above the plane of the solar system?
|
/// In this system should the player be able to rotate their map camera freely or be stuck above the plane of the solar system?
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool freeMapAngle;
|
public bool freeMapAngle;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// When well past the furthest orbit, should the player be summoned back to the star?
|
/// When well past the furthest orbit, should the player be summoned back to the star?
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool returnToSolarSystemWhenTooFar;
|
public bool returnToSolarSystemWhenTooFar;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// An override value for the far clip plane. Allows you to see farther.
|
/// An override value for the far clip plane. Allows you to see farther.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public float farClipPlaneOverride;
|
public float farClipPlaneOverride;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Whether this system can be warped to via the warp drive. If you set factRequiredForWarp, this will be true.
|
/// Whether this system can be warped to via the warp drive. If you set factRequiredForWarp, this will be true.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DefaultValue(true)] public bool canEnterViaWarpDrive = true;
|
[DefaultValue(true)] public bool canEnterViaWarpDrive = true;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Do you want a clean slate for this star system? Or will it be a modified version of the original.
|
/// Do you want a clean slate for this star system? Or will it be a modified version of the original.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DefaultValue(true)] public bool destroyStockPlanets = true;
|
[DefaultValue(true)] public bool destroyStockPlanets = true;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Should the time loop be enabled in this system?
|
/// Should the time loop be enabled in this system?
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DefaultValue(true)] public bool enableTimeLoop = true;
|
[DefaultValue(true)] public bool enableTimeLoop = true;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The FactID that must be revealed before it can be warped to. Don't set `canEnterViaWarpDrive` to `false` if
|
/// The FactID that must be revealed before it can be warped to. Don't set `canEnterViaWarpDrive` to `false` if
|
||||||
/// you're using this, because it will be overwritten.
|
/// you're using this, because it will be overwritten.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string factRequiredForWarp;
|
public string factRequiredForWarp;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The duration of the time loop in minutes. This is the time the sun explodes. End Times plays 85 seconds before this time, and your memories get sent back about 40 seconds after this time.
|
/// The duration of the time loop in minutes. This is the time the sun explodes. End Times plays 85 seconds before this time, and your memories get sent back about 40 seconds after this time.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DefaultValue(22f)] public float loopDuration = 22f;
|
[DefaultValue(22f)] public float loopDuration = 22f;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Should the player not be able to view the map in this system?
|
/// Should the player not be able to view the map in this system?
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool mapRestricted;
|
public bool mapRestricted;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Customize the skybox for this system
|
/// Customize the skybox for this system
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public SkyboxModule Skybox;
|
public SkyboxModule Skybox;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Set to `true` if you want to spawn here after dying, not Timber Hearth. You can still warp back to the main star system.
|
/// Set to `true` if you want to spawn here after dying, not Timber Hearth. You can still warp back to the main star system.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool startHere;
|
public bool startHere;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Set to `true` if you want the player to stay in this star system if they die in it.
|
/// Set to `true` if you want the player to stay in this star system if they die in it.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool respawnHere;
|
public bool respawnHere;
|
||||||
|
|
||||||
[Obsolete("travelAudioClip is deprecated, please use travelAudio instead")]
|
[Obsolete("travelAudioClip is deprecated, please use travelAudio instead")]
|
||||||
public string travelAudioClip;
|
public string travelAudioClip;
|
||||||
|
|
||||||
[Obsolete("travelAudioFilePath is deprecated, please use travelAudio instead")]
|
[Obsolete("travelAudioFilePath is deprecated, please use travelAudio instead")]
|
||||||
public string travelAudioFilePath;
|
public string travelAudioFilePath;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The audio that will play when travelling in space. Can be a path to a .wav/.ogg/.mp3 file, or taken from the AudioClip list.
|
/// The audio that will play when travelling in space. Can be a path to a .wav/.ogg/.mp3 file, or taken from the AudioClip list.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string travelAudio;
|
public string travelAudio;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Configure warping to this system with the vessel
|
/// Configure warping to this system with the vessel
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public VesselModule Vessel;
|
public VesselModule Vessel;
|
||||||
|
|
||||||
[Obsolete("coords is deprecated, please use Vessel.coords instead")]
|
[Obsolete("coords is deprecated, please use Vessel.coords instead")]
|
||||||
public NomaiCoordinates coords;
|
public NomaiCoordinates coords;
|
||||||
|
|
||||||
[Obsolete("vesselPosition is deprecated, please use Vessel.vesselSpawn.position instead")]
|
[Obsolete("vesselPosition is deprecated, please use Vessel.vesselSpawn.position instead")]
|
||||||
public MVector3 vesselPosition;
|
public MVector3 vesselPosition;
|
||||||
|
|
||||||
[Obsolete("vesselRotation is deprecated, please use Vessel.vesselSpawn.rotation instead")]
|
[Obsolete("vesselRotation is deprecated, please use Vessel.vesselSpawn.rotation instead")]
|
||||||
public MVector3 vesselRotation;
|
public MVector3 vesselRotation;
|
||||||
|
|
||||||
[Obsolete("warpExitPosition is deprecated, please use Vessel.warpExit.position instead")]
|
[Obsolete("warpExitPosition is deprecated, please use Vessel.warpExit.position instead")]
|
||||||
public MVector3 warpExitPosition;
|
public MVector3 warpExitPosition;
|
||||||
|
|
||||||
[Obsolete("warpExitRotation is deprecated, please use Vessel.warpExit.rotation instead")]
|
[Obsolete("warpExitRotation is deprecated, please use Vessel.warpExit.rotation instead")]
|
||||||
public MVector3 warpExitRotation;
|
public MVector3 warpExitRotation;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Manually layout ship log entries in detective mode
|
/// Manually layout ship log entries in detective mode
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public EntryPositionInfo[] entryPositions;
|
public EntryPositionInfo[] entryPositions;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// A list of fact IDs to reveal when the game starts.
|
/// A list of fact IDs to reveal when the game starts.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string[] initialReveal;
|
public string[] initialReveal;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The planet to focus on when entering the ship log for the first time in a loop. If not set this will be the planet at navtigation position (1, 0)
|
/// The planet to focus on when entering the ship log for the first time in a loop. If not set this will be the planet at navtigation position (1, 0)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string shipLogStartingPlanetID;
|
public string shipLogStartingPlanetID;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// List colors of curiosity entries
|
/// List colors of curiosity entries
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public CuriosityColorInfo[] curiosities;
|
public CuriosityColorInfo[] curiosities;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Extra data that may be used by extension mods
|
/// Extra data that may be used by extension mods
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public object extras;
|
public object extras;
|
||||||
|
|
||||||
public class NomaiCoordinates
|
public class NomaiCoordinates
|
||||||
{
|
{
|
||||||
[MinLength(2)]
|
[MinLength(2)]
|
||||||
[MaxLength(6)]
|
[MaxLength(6)]
|
||||||
public int[] x;
|
public int[] x;
|
||||||
|
|
||||||
[MinLength(2)]
|
[MinLength(2)]
|
||||||
[MaxLength(6)]
|
[MaxLength(6)]
|
||||||
public int[] y;
|
public int[] y;
|
||||||
|
|
||||||
[MinLength(2)]
|
[MinLength(2)]
|
||||||
[MaxLength(6)]
|
[MaxLength(6)]
|
||||||
public int[] z;
|
public int[] z;
|
||||||
}
|
}
|
||||||
|
|
||||||
[JsonObject]
|
[JsonObject]
|
||||||
public class SkyboxModule
|
public class SkyboxModule
|
||||||
{
|
{
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Whether to destroy the star field around the player
|
/// Whether to destroy the star field around the player
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool destroyStarField;
|
public bool destroyStarField;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Whether to use a cube for the skybox instead of a smooth sphere
|
/// Whether to use a cube for the skybox instead of a smooth sphere
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool useCube;
|
public bool useCube;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Relative filepath to the texture to use for the skybox's positive X direction
|
/// Relative filepath to the texture to use for the skybox's positive X direction
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string rightPath;
|
public string rightPath;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Relative filepath to the texture to use for the skybox's negative X direction
|
/// Relative filepath to the texture to use for the skybox's negative X direction
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string leftPath;
|
public string leftPath;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Relative filepath to the texture to use for the skybox's positive Y direction
|
/// Relative filepath to the texture to use for the skybox's positive Y direction
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string topPath;
|
public string topPath;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Relative filepath to the texture to use for the skybox's negative Y direction
|
/// Relative filepath to the texture to use for the skybox's negative Y direction
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string bottomPath;
|
public string bottomPath;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Relative filepath to the texture to use for the skybox's positive Z direction
|
/// Relative filepath to the texture to use for the skybox's positive Z direction
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string frontPath;
|
public string frontPath;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Relative filepath to the texture to use for the skybox's negative Z direction
|
/// Relative filepath to the texture to use for the skybox's negative Z direction
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string backPath;
|
public string backPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
[JsonObject]
|
[JsonObject]
|
||||||
public class VesselModule
|
public class VesselModule
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Coordinates that the vessel can use to warp to your solar system.
|
/// Coordinates that the vessel can use to warp to your solar system.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public NomaiCoordinates coords;
|
public NomaiCoordinates coords;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// A ship log fact which will make a prompt appear showing the coordinates when you're in the Vessel.
|
/// A ship log fact which will make a prompt appear showing the coordinates when you're in the Vessel.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string promptFact;
|
public string promptFact;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Whether the vessel should spawn in this system even if it wasn't used to warp to it. This will automatically power on the vessel.
|
/// Whether the vessel should spawn in this system even if it wasn't used to warp to it. This will automatically power on the vessel.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool alwaysPresent;
|
public bool alwaysPresent;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Whether to always spawn the player on the vessel, even if it wasn't used to warp to the system.
|
/// Whether to always spawn the player on the vessel, even if it wasn't used to warp to the system.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool spawnOnVessel;
|
public bool spawnOnVessel;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Whether the vessel should have physics enabled. Defaults to false if parentBody is set, and true otherwise.
|
/// Whether the vessel should have physics enabled. Defaults to false if parentBody is set, and true otherwise.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool? hasPhysics;
|
public bool? hasPhysics;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Whether the vessel should have a zero-gravity volume around it. Defaults to false if parentBody is set, and true otherwise.
|
/// Whether the vessel should have a zero-gravity volume around it. Defaults to false if parentBody is set, and true otherwise.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool? hasZeroGravityVolume;
|
public bool? hasZeroGravityVolume;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The location that the vessel will warp to.
|
/// The location that the vessel will warp to.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public VesselInfo vesselSpawn;
|
public VesselInfo vesselSpawn;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The location that you will be teleported to when you exit the vessel through the black hole.
|
/// The location that you will be teleported to when you exit the vessel through the black hole.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public WarpExitInfo warpExit;
|
public WarpExitInfo warpExit;
|
||||||
|
|
||||||
[Obsolete("vesselPosition is deprecated, use vesselSpawn.position instead")] public MVector3 vesselPosition;
|
[Obsolete("vesselPosition is deprecated, use vesselSpawn.position instead")] public MVector3 vesselPosition;
|
||||||
[Obsolete("vesselRotation is deprecated, use vesselSpawn.rotation instead")] public MVector3 vesselRotation;
|
[Obsolete("vesselRotation is deprecated, use vesselSpawn.rotation instead")] public MVector3 vesselRotation;
|
||||||
[Obsolete("warpExitPosition is deprecated, use vesselSpawn.position instead")] public MVector3 warpExitPosition;
|
[Obsolete("warpExitPosition is deprecated, use vesselSpawn.position instead")] public MVector3 warpExitPosition;
|
||||||
[Obsolete("warpExitRotation is deprecated, use vesselSpawn.rotation instead")] public MVector3 warpExitRotation;
|
[Obsolete("warpExitRotation is deprecated, use vesselSpawn.rotation instead")] public MVector3 warpExitRotation;
|
||||||
|
|
||||||
[JsonObject]
|
[JsonObject]
|
||||||
public class VesselInfo : GeneralSolarSystemPropInfo
|
public class VesselInfo : GeneralSolarSystemPropInfo
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
[JsonObject]
|
[JsonObject]
|
||||||
public class WarpExitInfo : GeneralSolarSystemPropInfo
|
public class WarpExitInfo : GeneralSolarSystemPropInfo
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// If set, keeps the warp exit attached to the vessel. Overrides `parentPath`.
|
/// If set, keeps the warp exit attached to the vessel. Overrides `parentPath`.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool attachToVessel;
|
public bool attachToVessel;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Makes sure they are all numbers are unique and between 0 and 5.
|
/// Makes sure they are all numbers are unique and between 0 and 5.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private static int[] FixAxis(int[] axis) => axis.Distinct().Where(i => (i >= 0 && i <= 5)).ToArray();
|
private static int[] FixAxis(int[] axis) => axis.Distinct().Where(i => (i >= 0 && i <= 5)).ToArray();
|
||||||
|
|
||||||
public void FixCoordinates()
|
public void FixCoordinates()
|
||||||
{
|
{
|
||||||
if (Vessel?.coords != null)
|
if (Vessel?.coords != null)
|
||||||
{
|
{
|
||||||
Vessel.coords.x = FixAxis(Vessel.coords.x);
|
Vessel.coords.x = FixAxis(Vessel.coords.x);
|
||||||
Vessel.coords.y = FixAxis(Vessel.coords.y);
|
Vessel.coords.y = FixAxis(Vessel.coords.y);
|
||||||
Vessel.coords.z = FixAxis(Vessel.coords.z);
|
Vessel.coords.z = FixAxis(Vessel.coords.z);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Merge(StarSystemConfig otherConfig)
|
public void Merge(StarSystemConfig otherConfig)
|
||||||
{
|
{
|
||||||
// Imagine if this used reflection
|
// Imagine if this used reflection
|
||||||
|
|
||||||
// True by default so if one is false go false
|
// True by default so if one is false go false
|
||||||
canEnterViaWarpDrive = canEnterViaWarpDrive && otherConfig.canEnterViaWarpDrive;
|
canEnterViaWarpDrive = canEnterViaWarpDrive && otherConfig.canEnterViaWarpDrive;
|
||||||
destroyStockPlanets = destroyStockPlanets && otherConfig.destroyStockPlanets;
|
destroyStockPlanets = destroyStockPlanets && otherConfig.destroyStockPlanets;
|
||||||
enableTimeLoop = enableTimeLoop && otherConfig.enableTimeLoop;
|
enableTimeLoop = enableTimeLoop && otherConfig.enableTimeLoop;
|
||||||
loopDuration = loopDuration == 22f ? otherConfig.loopDuration : loopDuration;
|
loopDuration = loopDuration == 22f ? otherConfig.loopDuration : loopDuration;
|
||||||
|
|
||||||
// If current one is null take the other
|
// If current one is null take the other
|
||||||
factRequiredForWarp = string.IsNullOrEmpty(factRequiredForWarp) ? otherConfig.factRequiredForWarp : factRequiredForWarp;
|
factRequiredForWarp = string.IsNullOrEmpty(factRequiredForWarp) ? otherConfig.factRequiredForWarp : factRequiredForWarp;
|
||||||
Skybox = Skybox == null ? otherConfig.Skybox : Skybox;
|
Skybox = Skybox == null ? otherConfig.Skybox : Skybox;
|
||||||
travelAudio = string.IsNullOrEmpty(travelAudio) ? otherConfig.travelAudio : travelAudio;
|
travelAudio = string.IsNullOrEmpty(travelAudio) ? otherConfig.travelAudio : travelAudio;
|
||||||
|
|
||||||
// False by default so if one is true go true
|
// False by default so if one is true go true
|
||||||
mapRestricted = mapRestricted || otherConfig.mapRestricted;
|
mapRestricted = mapRestricted || otherConfig.mapRestricted;
|
||||||
respawnHere = respawnHere || otherConfig.respawnHere;
|
respawnHere = respawnHere || otherConfig.respawnHere;
|
||||||
startHere = startHere || otherConfig.startHere;
|
startHere = startHere || otherConfig.startHere;
|
||||||
|
|
||||||
if (Vessel != null && otherConfig.Vessel != null)
|
if (Vessel != null && otherConfig.Vessel != null)
|
||||||
{
|
{
|
||||||
Vessel.spawnOnVessel = Vessel.spawnOnVessel || otherConfig.Vessel.spawnOnVessel;
|
Vessel.spawnOnVessel = Vessel.spawnOnVessel || otherConfig.Vessel.spawnOnVessel;
|
||||||
Vessel.alwaysPresent = Vessel.alwaysPresent || otherConfig.Vessel.alwaysPresent;
|
Vessel.alwaysPresent = Vessel.alwaysPresent || otherConfig.Vessel.alwaysPresent;
|
||||||
Vessel.hasPhysics = Vessel.hasPhysics ?? otherConfig.Vessel.hasPhysics;
|
Vessel.hasPhysics = Vessel.hasPhysics ?? otherConfig.Vessel.hasPhysics;
|
||||||
Vessel.hasZeroGravityVolume = Vessel.hasZeroGravityVolume ?? otherConfig.Vessel.hasZeroGravityVolume;
|
Vessel.hasZeroGravityVolume = Vessel.hasZeroGravityVolume ?? otherConfig.Vessel.hasZeroGravityVolume;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Vessel ??= otherConfig.Vessel;
|
Vessel ??= otherConfig.Vessel;
|
||||||
}
|
}
|
||||||
|
|
||||||
entryPositions = Concatenate(entryPositions, otherConfig.entryPositions);
|
entryPositions = Concatenate(entryPositions, otherConfig.entryPositions);
|
||||||
curiosities = Concatenate(curiosities, otherConfig.curiosities);
|
curiosities = Concatenate(curiosities, otherConfig.curiosities);
|
||||||
initialReveal = Concatenate(initialReveal, otherConfig.initialReveal);
|
initialReveal = Concatenate(initialReveal, otherConfig.initialReveal);
|
||||||
}
|
}
|
||||||
|
|
||||||
private T[] Concatenate<T>(T[] array1, T[] array2)
|
private T[] Concatenate<T>(T[] array1, T[] array2)
|
||||||
{
|
{
|
||||||
return (array1 ?? new T[0]).Concat(array2 ?? new T[0]).ToArray();
|
return (array1 ?? new T[0]).Concat(array2 ?? new T[0]).ToArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Migrate()
|
public void Migrate()
|
||||||
{
|
{
|
||||||
// Backwards compatibility
|
// Backwards compatibility
|
||||||
// Should be the only place that obsolete things are referenced
|
// Should be the only place that obsolete things are referenced
|
||||||
#pragma warning disable 612, 618
|
#pragma warning disable 612, 618
|
||||||
if (!string.IsNullOrEmpty(travelAudioClip)) travelAudio = travelAudioClip;
|
if (!string.IsNullOrEmpty(travelAudioClip)) travelAudio = travelAudioClip;
|
||||||
if (!string.IsNullOrEmpty(travelAudioFilePath)) travelAudio = travelAudioFilePath;
|
if (!string.IsNullOrEmpty(travelAudioFilePath)) travelAudio = travelAudioFilePath;
|
||||||
if (coords != null || vesselPosition != null || vesselRotation != null || warpExitPosition != null || warpExitRotation != null)
|
if (coords != null || vesselPosition != null || vesselRotation != null || warpExitPosition != null || warpExitRotation != null)
|
||||||
{
|
{
|
||||||
if (Vessel == null)
|
if (Vessel == null)
|
||||||
{
|
{
|
||||||
Vessel = new VesselModule();
|
Vessel = new VesselModule();
|
||||||
}
|
}
|
||||||
Vessel.coords ??= coords;
|
Vessel.coords ??= coords;
|
||||||
Vessel.vesselPosition ??= vesselPosition;
|
Vessel.vesselPosition ??= vesselPosition;
|
||||||
Vessel.vesselRotation ??= vesselRotation;
|
Vessel.vesselRotation ??= vesselRotation;
|
||||||
Vessel.warpExitPosition ??= warpExitPosition;
|
Vessel.warpExitPosition ??= warpExitPosition;
|
||||||
Vessel.warpExitRotation ??= warpExitRotation;
|
Vessel.warpExitRotation ??= warpExitRotation;
|
||||||
}
|
}
|
||||||
if (Vessel != null)
|
if (Vessel != null)
|
||||||
{
|
{
|
||||||
if (Vessel.vesselPosition != null || Vessel.vesselRotation != null)
|
if (Vessel.vesselPosition != null || Vessel.vesselRotation != null)
|
||||||
{
|
{
|
||||||
if (Vessel.vesselSpawn == null)
|
if (Vessel.vesselSpawn == null)
|
||||||
{
|
{
|
||||||
Vessel.vesselSpawn = new VesselModule.VesselInfo();
|
Vessel.vesselSpawn = new VesselModule.VesselInfo();
|
||||||
}
|
}
|
||||||
Vessel.vesselSpawn.position ??= Vessel.vesselPosition;
|
Vessel.vesselSpawn.position ??= Vessel.vesselPosition;
|
||||||
Vessel.vesselSpawn.rotation ??= Vessel.vesselRotation;
|
Vessel.vesselSpawn.rotation ??= Vessel.vesselRotation;
|
||||||
}
|
}
|
||||||
if (Vessel.warpExitPosition != null || Vessel.warpExitRotation != null)
|
if (Vessel.warpExitPosition != null || Vessel.warpExitRotation != null)
|
||||||
{
|
{
|
||||||
if (Vessel.warpExit == null)
|
if (Vessel.warpExit == null)
|
||||||
{
|
{
|
||||||
Vessel.warpExit = new VesselModule.WarpExitInfo();
|
Vessel.warpExit = new VesselModule.WarpExitInfo();
|
||||||
}
|
}
|
||||||
Vessel.warpExit.position ??= Vessel.warpExitPosition;
|
Vessel.warpExit.position ??= Vessel.warpExitPosition;
|
||||||
Vessel.warpExit.rotation ??= Vessel.warpExitRotation;
|
Vessel.warpExit.rotation ??= Vessel.warpExitRotation;
|
||||||
Vessel.warpExit.attachToVessel = true;
|
Vessel.warpExit.attachToVessel = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1,47 +1,47 @@
|
|||||||
using HarmonyLib;
|
using HarmonyLib;
|
||||||
using NewHorizons.Builder.ShipLog;
|
using NewHorizons.Builder.ShipLog;
|
||||||
using NewHorizons.Handlers;
|
using NewHorizons.Handlers;
|
||||||
using NewHorizons.Utility;
|
using NewHorizons.Utility;
|
||||||
using NewHorizons.Utility.OWML;
|
using NewHorizons.Utility.OWML;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
namespace NewHorizons.Patches.ShipLogPatches
|
namespace NewHorizons.Patches.ShipLogPatches
|
||||||
{
|
{
|
||||||
[HarmonyPatch(typeof(ShipLogMapMode))]
|
[HarmonyPatch(typeof(ShipLogMapMode))]
|
||||||
public static class ShipLogMapModePatches
|
public static class ShipLogMapModePatches
|
||||||
{
|
{
|
||||||
[HarmonyPostfix]
|
[HarmonyPostfix]
|
||||||
[HarmonyPatch(nameof(ShipLogMapMode.Initialize))]
|
[HarmonyPatch(nameof(ShipLogMapMode.Initialize))]
|
||||||
public static void ShipLogMapMode_Initialize(ShipLogMapMode __instance)
|
public static void ShipLogMapMode_Initialize(ShipLogMapMode __instance)
|
||||||
{
|
{
|
||||||
GameObject panRoot = SearchUtilities.Find(ShipLogHandler.PAN_ROOT_PATH);
|
GameObject panRoot = SearchUtilities.Find(ShipLogHandler.PAN_ROOT_PATH);
|
||||||
GameObject sunObject = SearchUtilities.Find(ShipLogHandler.PAN_ROOT_PATH + "/Sun");
|
GameObject sunObject = SearchUtilities.Find(ShipLogHandler.PAN_ROOT_PATH + "/Sun");
|
||||||
ShipLogAstroObject[][] navMatrix = MapModeBuilder.ConstructMapMode(Main.Instance.CurrentStarSystem, panRoot, __instance._astroObjects, sunObject.layer);
|
ShipLogAstroObject[][] navMatrix = MapModeBuilder.ConstructMapMode(Main.Instance.CurrentStarSystem, panRoot, __instance._astroObjects, sunObject.layer);
|
||||||
if (navMatrix == null || navMatrix.Length <= 1)
|
if (navMatrix == null || navMatrix.Length <= 1)
|
||||||
{
|
{
|
||||||
NHLogger.LogWarning("Skipping Map Mode Generation.");
|
NHLogger.LogWarning("Skipping Map Mode Generation.");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
__instance._astroObjects = navMatrix;
|
__instance._astroObjects = navMatrix;
|
||||||
__instance._startingAstroObjectID = Main.SystemDict[Main.Instance.CurrentStarSystem].shipLogStartingPlanetID ?? navMatrix[1][0].GetID();
|
__instance._startingAstroObjectID = Main.SystemDict[Main.Instance.CurrentStarSystem].Config.shipLogStartingPlanetID ?? navMatrix[1][0].GetID();
|
||||||
if (Main.Instance.CurrentStarSystem != "SolarSystem")
|
if (Main.Instance.CurrentStarSystem != "SolarSystem")
|
||||||
{
|
{
|
||||||
List<GameObject> delete = panRoot.GetAllChildren().Where(g => g.name.Contains("_ShipLog") == false).ToList();
|
List<GameObject> delete = panRoot.GetAllChildren().Where(g => g.name.Contains("_ShipLog") == false).ToList();
|
||||||
foreach (GameObject gameObject in delete)
|
foreach (GameObject gameObject in delete)
|
||||||
{
|
{
|
||||||
Object.Destroy(SearchUtilities.Find(ShipLogHandler.PAN_ROOT_PATH + "/" + gameObject.name));
|
Object.Destroy(SearchUtilities.Find(ShipLogHandler.PAN_ROOT_PATH + "/" + gameObject.name));
|
||||||
}
|
}
|
||||||
if (SearchUtilities.Find(ShipLogHandler.PAN_ROOT_PATH + "/" + "SandFunnel") == null)
|
if (SearchUtilities.Find(ShipLogHandler.PAN_ROOT_PATH + "/" + "SandFunnel") == null)
|
||||||
{
|
{
|
||||||
__instance._sandFunnel = __instance.gameObject.AddComponent<ShipLogSandFunnel>();
|
__instance._sandFunnel = __instance.gameObject.AddComponent<ShipLogSandFunnel>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
NHLogger.Log("Map Mode Construction Complete");
|
NHLogger.Log("Map Mode Construction Complete");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user