mirror of
https://github.com/Outer-Wilds-New-Horizons/new-horizons.git
synced 2025-12-11 20:15:44 +01:00
Dream candles
This commit is contained in:
parent
0f0f704b75
commit
0752b11b65
@ -331,6 +331,16 @@ namespace NewHorizons.Builder.Props
|
|||||||
{
|
{
|
||||||
remoteCameraPlatform._visualSector = sector;
|
remoteCameraPlatform._visualSector = sector;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
else if(component is SingleLightSensor singleLightSensor && !existingSectors.Contains(singleLightSensor._sector))
|
||||||
|
{
|
||||||
|
if (singleLightSensor._sector != null)
|
||||||
|
{
|
||||||
|
singleLightSensor._sector.OnSectorOccupantsUpdated -= singleLightSensor.OnSectorOccupantsUpdated;
|
||||||
|
}
|
||||||
|
singleLightSensor._sector = sector;
|
||||||
|
singleLightSensor._sector.OnSectorOccupantsUpdated += singleLightSensor.OnSectorOccupantsUpdated;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@ -0,0 +1,76 @@
|
|||||||
|
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 System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace NewHorizons.Builder.Props.EchoesOfTheEye
|
||||||
|
{
|
||||||
|
public static class DreamCandleBuilder
|
||||||
|
{
|
||||||
|
private static Dictionary<DreamCandleType, GameObject> _prefabs = new();
|
||||||
|
|
||||||
|
internal static void InitPrefabs()
|
||||||
|
{
|
||||||
|
InitPrefab(DreamCandleType.Ground, "DreamWorld_Body/Sector_DreamWorld/Sector_DreamZone_1/Interactibles_DreamZone_1/DreamHouseIsland/Prefab_IP_DreamCandle");
|
||||||
|
InitPrefab(DreamCandleType.GroundSmall, "DreamWorld_Body/Sector_DreamWorld/Sector_DreamZone_2/Structure_DreamZone_2/City/StartingAreaLanterns/Prefab_IP_DreamCandle_Ground_Small");
|
||||||
|
InitPrefab(DreamCandleType.GroundLarge, "DreamWorld_Body/Sector_DreamWorld/Sector_DreamZone_1/Interactibles_DreamZone_1/DreamHouseIsland/Prefab_IP_DreamCandle_Ground_Large");
|
||||||
|
InitPrefab(DreamCandleType.GroundSingle, "DreamWorld_Body/Sector_DreamWorld/Sector_DreamZone_1/Sector_PartyHouse/Interactables_PartyHouse/Prefab_IP_DreamCandle_Ground_Single");
|
||||||
|
InitPrefab(DreamCandleType.Wall, "DreamWorld_Body/Sector_DreamWorld/Sector_DreamZone_2/Structure_DreamZone_2/City/ParkLanterns/Prefab_IP_DreamCandle_Wall");
|
||||||
|
InitPrefab(DreamCandleType.WallLargeFlame, "DreamWorld_Body/Sector_DreamWorld/Sector_DreamZone_2/Structure_DreamZone_2/City/FalseKnightHouse/CandleDoor/FirstDoorLanterns/Prefab_IP_DreamCandle_LargeFlame_Wall");
|
||||||
|
InitPrefab(DreamCandleType.WallBigWick, "DreamWorld_Body/Sector_DreamWorld/Sector_DreamZone_2/Structure_DreamZone_2/DreamFireHouse_2/Interactibles_DreamFireHouse_2/Pivot_SlideReelRoom/CandleController/CandlePivot_0/Prefab_IP_DreamCandle_BigWick_Wall");
|
||||||
|
InitPrefab(DreamCandleType.Standing, "DreamWorld_Body/Sector_DreamWorld/Sector_DreamZone_2/Structure_DreamZone_2/City/ElevatorHouse/CandleDoor/DoorTutorial/Prefab_IP_DreamCandle_LargeFlame_Standing");
|
||||||
|
InitPrefab(DreamCandleType.Pile, "DreamWorld_Body/Sector_DreamWorld/Sector_DreamZone_3/Sector_Hotel/Gallery/Interactibles_Gallery/DreamCandles/Prefab_IP_DreamCandle_Pile");
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void InitPrefab(DreamCandleType type, string path)
|
||||||
|
{
|
||||||
|
var prefab = _prefabs.ContainsKey(type) ? _prefabs[type] : null;
|
||||||
|
if (prefab == null)
|
||||||
|
{
|
||||||
|
prefab = SearchUtilities.Find(path).InstantiateInactive().Rename($"Prefab_DreamCandle_{type}").DontDestroyOnLoad();
|
||||||
|
if (prefab == null)
|
||||||
|
{
|
||||||
|
NHLogger.LogWarning($"Tried to make a dream candle but couldn't. Do you have the DLC installed?");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
prefab.AddComponent<DestroyOnDLC>()._destroyOnDLCNotOwned = true;
|
||||||
|
var sensor = prefab.GetComponentInChildren<SingleLightSensor>();
|
||||||
|
sensor._sector = null;
|
||||||
|
}
|
||||||
|
_prefabs.Add(type, prefab);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static GameObject Make(GameObject planetGO, Sector sector, DreamCandleInfo info, IModBehaviour mod)
|
||||||
|
{
|
||||||
|
InitPrefabs();
|
||||||
|
|
||||||
|
var prefab = _prefabs.ContainsKey(info.type) ? _prefabs[info.type] : null;
|
||||||
|
|
||||||
|
if (prefab == null || sector == null) return null;
|
||||||
|
|
||||||
|
var candleObj = DetailBuilder.Make(planetGO, sector, mod, prefab, new DetailInfo(info));
|
||||||
|
|
||||||
|
var dreamCandle = candleObj.GetComponent<DreamCandle>();
|
||||||
|
|
||||||
|
var sensor = candleObj.GetComponentInChildren<SingleLightSensor>();
|
||||||
|
sensor._detectFlashlight = true;
|
||||||
|
sensor._lightSourceMask |= LightSourceType.FLASHLIGHT;
|
||||||
|
|
||||||
|
dreamCandle._startLit = info.startLit;
|
||||||
|
dreamCandle.SetLit(info.startLit, false, true);
|
||||||
|
|
||||||
|
return candleObj;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -102,11 +102,15 @@ namespace NewHorizons.Builder.Props
|
|||||||
// If a prop has set its parentPath and the parent cannot be found, add it to the next pass and try again later
|
// If a prop has set its parentPath and the parent cannot be found, add it to the next pass and try again later
|
||||||
nextPass = new List<Action>();
|
nextPass = new List<Action>();
|
||||||
|
|
||||||
if (Main.HasDLC) MakeGeneralProps(go, config.Props.portholes, (porthole) => PortholeBuilder.Make(go, sector, porthole, mod));
|
if (Main.HasDLC)
|
||||||
if (Main.HasDLC) MakeGeneralProps(go, config.Props.alarmTotems, (totem) => AlarmTotemBuilder.Make(go, sector, totem, mod));
|
{
|
||||||
if (Main.HasDLC) MakeGeneralProps(go, config.Props.grappleTotems, (totem) => GrappleTotemBuilder.Make(go, sector, totem, mod));
|
MakeGeneralProps(go, config.Props.dreamCandles, (candle) => DreamCandleBuilder.Make(go, sector, candle, mod));
|
||||||
if (Main.HasDLC) MakeGeneralProps(go, config.Props.dreamCampfires, (campfire) => DreamCampfireBuilder.Make(go, sector, campfire, mod), (campfire) => campfire.id);
|
MakeGeneralProps(go, config.Props.portholes, (porthole) => PortholeBuilder.Make(go, sector, porthole, mod));
|
||||||
if (Main.HasDLC) MakeGeneralProps(go, config.Props.dreamArrivalPoints, (point) => DreamArrivalPointBuilder.Make(go, sector, point, mod), (point) => point.id);
|
MakeGeneralProps(go, config.Props.alarmTotems, (totem) => AlarmTotemBuilder.Make(go, sector, totem, mod));
|
||||||
|
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.gravityCannons, (cannon) => GravityCannonBuilder.Make(go, sector, cannon, mod), (cannon) => cannon.shuttleID);
|
MakeGeneralProps(go, config.Props.gravityCannons, (cannon) => GravityCannonBuilder.Make(go, sector, cannon, mod), (cannon) => cannon.shuttleID);
|
||||||
MakeGeneralProps(go, config.Props.shuttles, (shuttle) => ShuttleBuilder.Make(go, sector, mod, shuttle), (shuttle) => shuttle.id);
|
MakeGeneralProps(go, config.Props.shuttles, (shuttle) => ShuttleBuilder.Make(go, sector, mod, shuttle), (shuttle) => shuttle.id);
|
||||||
MakeGeneralProps(go, config.Props.details, (detail) => DetailBuilder.Make(go, sector, mod, detail), (detail) => detail.path);
|
MakeGeneralProps(go, config.Props.details, (detail) => DetailBuilder.Make(go, sector, mod, detail), (detail) => detail.path);
|
||||||
|
|||||||
19
NewHorizons/External/Modules/PropModule.cs
vendored
19
NewHorizons/External/Modules/PropModule.cs
vendored
@ -54,7 +54,7 @@ namespace NewHorizons.External.Modules
|
|||||||
public DetailInfo[] proxyDetails;
|
public DetailInfo[] proxyDetails;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Add rafts to this planet
|
/// Add rafts to this planet (requires Echoes of the Eye DLC)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public RaftInfo[] rafts;
|
public RaftInfo[] rafts;
|
||||||
|
|
||||||
@ -64,7 +64,7 @@ namespace NewHorizons.External.Modules
|
|||||||
public ScatterInfo[] scatter;
|
public ScatterInfo[] scatter;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Add slideshows (from the DLC) to the planet
|
/// Add slideshows to the planet (requires Echoes of the Eye DLC)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public ProjectionInfo[] slideShows;
|
public ProjectionInfo[] slideShows;
|
||||||
|
|
||||||
@ -124,30 +124,35 @@ namespace NewHorizons.External.Modules
|
|||||||
public ShuttleInfo[] shuttles;
|
public ShuttleInfo[] shuttles;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Add campfires that allow you to enter the dream world/simulation. Must be paired with a dream arrival point, which can be placed on this planet or elsewhere.
|
/// Add campfires that allow you to enter the dream world/simulation (requires Echoes of the Eye DLC). Must be paired with a dream arrival point, which can be placed on this planet or elsewhere.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public DreamCampfireInfo[] dreamCampfires;
|
public DreamCampfireInfo[] dreamCampfires;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Add the points you will arrive at when entering the dream world/simulation from a paired dream campfire, which can be placed on this planet or elsewhere. The planet with the arrival point should be statically positioned to avoid issues with the simulation view materials.
|
/// Add the points you will arrive at when entering the dream world/simulation from a paired dream campfire (requires Echoes of the Eye DLC). The planet with the arrival point should be statically positioned to avoid issues with the simulation view materials.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public DreamArrivalPointInfo[] dreamArrivalPoints;
|
public DreamArrivalPointInfo[] dreamArrivalPoints;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Adds dream world grapple totems to this planet.
|
/// Adds dream world grapple totems to this planet (requires Echoes of the Eye DLC).
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public GrappleTotemInfo[] grappleTotems;
|
public GrappleTotemInfo[] grappleTotems;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Adds dream world alarm totems to this planet.
|
/// Adds dream world alarm totems to this planet (requires Echoes of the Eye DLC).
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public AlarmTotemInfo[] alarmTotems;
|
public AlarmTotemInfo[] alarmTotems;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Adds portholes (the windows you can peek through in the DLC) to this planet.
|
/// Adds portholes (the windows you can peek through in the Stranger) to this planet (requires Echoes of the Eye DLC).
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public PortholeInfo[] portholes;
|
public PortholeInfo[] portholes;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Adds dream world candles to this planet (requires Echoes of the Eye DLC).
|
||||||
|
/// </summary>
|
||||||
|
public DreamCandleInfo[] dreamCandles;
|
||||||
|
|
||||||
[Obsolete("reveal is deprecated. Use Volumes->revealVolumes instead.")] public RevealVolumeInfo[] reveal;
|
[Obsolete("reveal is deprecated. Use Volumes->revealVolumes instead.")] public RevealVolumeInfo[] reveal;
|
||||||
|
|
||||||
[Obsolete("audioVolumes is deprecated. Use Volumes->audioVolumes instead.")] public AudioVolumeInfo[] audioVolumes;
|
[Obsolete("audioVolumes is deprecated. Use Volumes->audioVolumes instead.")] public AudioVolumeInfo[] audioVolumes;
|
||||||
|
|||||||
24
NewHorizons/External/Modules/Props/EchoesOfTheEye/DreamCandleInfo.cs
vendored
Normal file
24
NewHorizons/External/Modules/Props/EchoesOfTheEye/DreamCandleInfo.cs
vendored
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
using Newtonsoft.Json;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace NewHorizons.External.Modules.Props.EchoesOfTheEye
|
||||||
|
{
|
||||||
|
[JsonObject]
|
||||||
|
public class DreamCandleInfo : GeneralPropInfo
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// The type of dream candle this is.
|
||||||
|
/// </summary>
|
||||||
|
[DefaultValue(DreamCandleType.Ground)] public DreamCandleType type = DreamCandleType.Ground;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Whether the candle should start lit or extinguished.
|
||||||
|
/// </summary>
|
||||||
|
public bool startLit;
|
||||||
|
}
|
||||||
|
}
|
||||||
33
NewHorizons/External/Modules/Props/EchoesOfTheEye/DreamCandleType.cs
vendored
Normal file
33
NewHorizons/External/Modules/Props/EchoesOfTheEye/DreamCandleType.cs
vendored
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
using Newtonsoft.Json.Converters;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Runtime.Serialization;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace NewHorizons.External.Modules.Props.EchoesOfTheEye
|
||||||
|
{
|
||||||
|
[JsonConverter(typeof(StringEnumConverter))]
|
||||||
|
public enum DreamCandleType
|
||||||
|
{
|
||||||
|
[EnumMember(Value = @"ground")] Ground,
|
||||||
|
|
||||||
|
[EnumMember(Value = @"groundSmall")] GroundSmall,
|
||||||
|
|
||||||
|
[EnumMember(Value = @"groundLarge")] GroundLarge,
|
||||||
|
|
||||||
|
[EnumMember(Value = @"groundSingle")] GroundSingle,
|
||||||
|
|
||||||
|
[EnumMember(Value = @"wall")] Wall,
|
||||||
|
|
||||||
|
[EnumMember(Value = @"wallLargeFlame")] WallLargeFlame,
|
||||||
|
|
||||||
|
[EnumMember(Value = @"wallBigWick")] WallBigWick,
|
||||||
|
|
||||||
|
[EnumMember(Value = @"standing")] Standing,
|
||||||
|
|
||||||
|
[EnumMember(Value = @"pile")] Pile,
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user