mirror of
https://github.com/Outer-Wilds-New-Horizons/new-horizons.git
synced 2025-12-11 20:15:44 +01:00
parent
ef24245c60
commit
7c396602f7
@ -7,6 +7,7 @@
|
||||
public bool destroyStockPlanets = true;
|
||||
public string factRequiredForWarp;
|
||||
public bool enableTimeLoop = true;
|
||||
public bool mapRestricted;
|
||||
public NomaiCoordinates coords;
|
||||
public SkyboxConfig skybox;
|
||||
|
||||
|
||||
@ -228,8 +228,6 @@ namespace NewHorizons
|
||||
SystemCreationHandler.LoadSystem(SystemDict[CurrentStarSystem]);
|
||||
LoadTranslations(ModHelper.Manifest.ModFolderPath + "AssetBundle/", this);
|
||||
|
||||
Instance.ModHelper.Events.Unity.FireOnNextUpdate(() => Locator.GetPlayerBody().gameObject.AddComponent<DebugRaycaster>());
|
||||
|
||||
// Warp drive
|
||||
StarChartHandler.Init(SystemDict.Values.ToArray());
|
||||
HasWarpDrive = StarChartHandler.CanWarp();
|
||||
@ -237,20 +235,9 @@ namespace NewHorizons
|
||||
_shipWarpController.Init();
|
||||
if (HasWarpDrive == true) EnableWarpDrive();
|
||||
|
||||
if (IsWarping && _shipWarpController)
|
||||
{
|
||||
Instance.ModHelper.Events.Unity.RunWhen(
|
||||
() => IsSystemReady,
|
||||
() => _shipWarpController.WarpIn(WearingSuit)
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
Instance.ModHelper.Events.Unity.RunWhen(
|
||||
() => IsSystemReady,
|
||||
() => FindObjectOfType<PlayerSpawner>().DebugWarp(SystemDict[_currentStarSystem].SpawnPoint)
|
||||
);
|
||||
}
|
||||
var shouldWarpIn = IsWarping && _shipWarpController != null;
|
||||
Instance.ModHelper.Events.Unity.RunWhen(() => IsSystemReady, () => OnSystemReady(shouldWarpIn));
|
||||
|
||||
IsWarping = false;
|
||||
|
||||
var map = GameObject.FindObjectOfType<MapController>();
|
||||
@ -275,6 +262,15 @@ namespace NewHorizons
|
||||
}
|
||||
}
|
||||
|
||||
// Had a bunch of separate unity things firing stuff when the system is ready so I moved it all to here
|
||||
private void OnSystemReady(bool shouldWarpIn)
|
||||
{
|
||||
Locator.GetPlayerBody().gameObject.AddComponent<DebugRaycaster>();
|
||||
|
||||
if (shouldWarpIn) _shipWarpController.WarpIn(WearingSuit);
|
||||
else FindObjectOfType<PlayerSpawner>().DebugWarp(SystemDict[_currentStarSystem].SpawnPoint);
|
||||
}
|
||||
|
||||
public void EnableWarpDrive()
|
||||
{
|
||||
Logger.Log("Setting up warp drive");
|
||||
|
||||
@ -21,5 +21,19 @@ namespace NewHorizons.Patches
|
||||
{
|
||||
__instance._isLockedOntoMapSatellite = true;
|
||||
}
|
||||
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(MapController), nameof(MapController.MapInoperable))]
|
||||
public static bool MapController_MapInoperable(MapController __instance, ref bool __result)
|
||||
{
|
||||
if(Main.SystemDict[Main.Instance.CurrentStarSystem]?.Config?.mapRestricted ?? false)
|
||||
{
|
||||
__instance._playerMapRestricted = true;
|
||||
__result = true;
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -25,6 +25,11 @@
|
||||
"description": "Should the player be sent back in time after 22 minutes?",
|
||||
"default": true
|
||||
},
|
||||
"mapRestricted": {
|
||||
"type": "bool",
|
||||
"description": "Should the player be unable to use their map in this system?",
|
||||
"default": false
|
||||
},
|
||||
"skybox": {
|
||||
"type": "object",
|
||||
"description": "Options for the skybox of your system",
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user