mirror of
https://github.com/Outer-Wilds-New-Horizons/new-horizons.git
synced 2025-12-11 12:05:23 +01:00
add docks
This commit is contained in:
parent
dd7bcbd5b1
commit
50ccd32b8e
@ -5,7 +5,7 @@ using NewHorizons.Utility;
|
||||
using NewHorizons.Utility.OWML;
|
||||
using UnityEngine;
|
||||
|
||||
namespace NewHorizons.Builder.Props
|
||||
namespace NewHorizons.Builder.Props.EchoesOfTheEye
|
||||
{
|
||||
public static class RaftBuilder
|
||||
{
|
||||
@ -91,6 +91,21 @@ namespace NewHorizons.Builder.Props
|
||||
|
||||
raftObject.SetActive(true);
|
||||
|
||||
if (planetGO != null && !string.IsNullOrEmpty(info.dockPath))
|
||||
{
|
||||
var dockTransform = planetGO.transform.Find(info.dockPath);
|
||||
if (dockTransform != null && dockTransform.TryGetComponent(out RaftDock raftDock))
|
||||
{
|
||||
raftController.SkipSuspendOnStart();
|
||||
raftDock._startRaft = raftController;
|
||||
raftDock._raft = raftController;
|
||||
}
|
||||
else
|
||||
{
|
||||
NHLogger.LogError($"Cannot find raft dock object at path: {planetGO.name}/{info.dockPath}");
|
||||
}
|
||||
}
|
||||
|
||||
return raftObject;
|
||||
}
|
||||
}
|
||||
51
NewHorizons/Builder/Props/EchoesOfTheEye/RaftDockBuilder.cs
Normal file
51
NewHorizons/Builder/Props/EchoesOfTheEye/RaftDockBuilder.cs
Normal file
@ -0,0 +1,51 @@
|
||||
using NewHorizons.Components.Props;
|
||||
using NewHorizons.External.Modules.Props;
|
||||
using NewHorizons.External.Modules.Props.EchoesOfTheEye;
|
||||
using NewHorizons.Handlers;
|
||||
using NewHorizons.Utility;
|
||||
using NewHorizons.Utility.OWML;
|
||||
using OWML.Common;
|
||||
using UnityEngine;
|
||||
|
||||
namespace NewHorizons.Builder.Props.EchoesOfTheEye
|
||||
{
|
||||
public static class RaftDockBuilder
|
||||
{
|
||||
private static GameObject _prefab;
|
||||
|
||||
internal static void InitPrefab()
|
||||
{
|
||||
if (_prefab == null)
|
||||
{
|
||||
_prefab = SearchUtilities.Find("RingWorld_Body/Sector_RingInterior/Sector_Zone1/Structures_Zone1/RaftHouse_ArrivalPatio_Zone1/Interactables_RaftHouse_ArrivalPatio_Zone1/Prefab_IP_RaftDock").InstantiateInactive().Rename("Prefab_RaftDock").DontDestroyOnLoad();
|
||||
if (_prefab == null)
|
||||
{
|
||||
NHLogger.LogWarning($"Tried to make a raft dock but couldn't. Do you have the DLC installed?");
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
_prefab.AddComponent<DestroyOnDLC>()._destroyOnDLCNotOwned = true;
|
||||
var raftDock = _prefab.GetComponent<RaftDock>();
|
||||
raftDock._startRaft = null;
|
||||
raftDock._floodSensor = null;
|
||||
Object.DestroyImmediate(_prefab.FindChild("FloodSensor"));
|
||||
Object.DestroyImmediate(_prefab.FindChild("FloodSensor_RaftHouseArrivalPatio_NoDelay"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static GameObject Make(GameObject planetGO, Sector sector, RaftDockInfo info, IModBehaviour mod)
|
||||
{
|
||||
InitPrefab();
|
||||
|
||||
if (_prefab == null || sector == null) return null;
|
||||
|
||||
var dockObject = DetailBuilder.Make(planetGO, sector, mod, _prefab, new DetailInfo(info));
|
||||
|
||||
//var raftDock = dockObject.GetComponent<RaftDock>();
|
||||
|
||||
return dockObject;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -114,6 +114,7 @@ namespace NewHorizons.Builder.Props
|
||||
MakeGeneralProps(go, config.Props.grappleTotems, (totem) => GrappleTotemBuilder.Make(go, sector, totem, mod));
|
||||
MakeGeneralProps(go, config.Props.dreamCampfires, (campfire) => DreamCampfireBuilder.Make(go, sector, campfire, mod), (campfire) => campfire.id);
|
||||
MakeGeneralProps(go, config.Props.dreamArrivalPoints, (point) => DreamArrivalPointBuilder.Make(go, sector, point, mod), (point) => point.id);
|
||||
MakeGeneralProps(go, config.Props.raftDocks, (dock) => RaftDockBuilder.Make(go, sector, dock, mod));
|
||||
MakeGeneralProps(go, config.Props.rafts, (raft) => RaftBuilder.Make(go, sector, raft, planetBody));
|
||||
}
|
||||
MakeGeneralProps(go, config.Props.tornados, (tornado) => TornadoBuilder.Make(go, sector, tornado, config.Atmosphere?.clouds != null));
|
||||
|
||||
5
NewHorizons/External/Modules/PropModule.cs
vendored
5
NewHorizons/External/Modules/PropModule.cs
vendored
@ -58,6 +58,11 @@ namespace NewHorizons.External.Modules
|
||||
/// </summary>
|
||||
public RaftInfo[] rafts;
|
||||
|
||||
/// <summary>
|
||||
/// Add raft docks to this planet (requires Echoes of the Eye DLC)
|
||||
/// </summary>
|
||||
public RaftDockInfo[] raftDocks;
|
||||
|
||||
/// <summary>
|
||||
/// Scatter props around this planet's surface
|
||||
/// </summary>
|
||||
|
||||
10
NewHorizons/External/Modules/Props/EchoesOfTheEye/RaftDockInfo.cs
vendored
Normal file
10
NewHorizons/External/Modules/Props/EchoesOfTheEye/RaftDockInfo.cs
vendored
Normal file
@ -0,0 +1,10 @@
|
||||
using Newtonsoft.Json;
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace NewHorizons.External.Modules.Props.EchoesOfTheEye
|
||||
{
|
||||
[JsonObject]
|
||||
public class RaftDockInfo : GeneralPropInfo
|
||||
{
|
||||
}
|
||||
}
|
||||
@ -10,6 +10,11 @@ namespace NewHorizons.External.Modules.Props.EchoesOfTheEye
|
||||
/// Acceleration of the raft. Default acceleration is 5.
|
||||
/// </summary>
|
||||
[DefaultValue(5f)] public float acceleration = 5f;
|
||||
|
||||
/// <summary>
|
||||
/// Path to the dock this raft will start attached to.
|
||||
/// </summary>
|
||||
public string dockPath;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -382,6 +382,7 @@ namespace NewHorizons
|
||||
ProjectionBuilder.InitPrefabs();
|
||||
CloakBuilder.InitPrefab();
|
||||
RaftBuilder.InitPrefab();
|
||||
RaftDockBuilder.InitPrefab();
|
||||
DreamCampfireBuilder.InitPrefab();
|
||||
DreamArrivalPointBuilder.InitPrefab();
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user