Projection totems

This commit is contained in:
Joshua Thome 2024-10-14 11:27:05 -05:00
parent 6c1605d0e9
commit fb537f7730
5 changed files with 35 additions and 9 deletions

View File

@ -10,6 +10,7 @@ using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using UnityEngine; using UnityEngine;
using UnityEngine.InputSystem;
namespace NewHorizons.Builder.Props.EchoesOfTheEye namespace NewHorizons.Builder.Props.EchoesOfTheEye
{ {
@ -100,14 +101,27 @@ namespace NewHorizons.Builder.Props.EchoesOfTheEye
{ {
projectionObj.gameObject.AddComponent<DitheringAnimator>(); projectionObj.gameObject.AddComponent<DitheringAnimator>();
var projection = projectionObj.gameObject.AddComponent<DreamObjectProjection>(); var projection = projectionObj.gameObject.AddComponent<DreamObjectProjection>();
projection._setActive = true; projection._setActive = info.toggleProjectedObjectsActive;
projection.Awake(); projection.Awake();
projections.Add(projection);
} }
} }
projector._projections = projections.ToArray(); projector._projections = projections.ToArray();
} }
projector.SetLit(info.startLit); var sensor = projector._lightSensor as SingleLightSensor;
sensor._detectFlashlight = true;
sensor._lightSourceMask |= LightSourceType.FLASHLIGHT;
projector._lit = info.startLit;
projector._startLit = info.startLit;
projector._extinguishOnly = info.extinguishOnly;
/*
Delay.FireOnNextUpdate(() =>
{
projector.Start();
});
*/
return totemObj; return totemObj;
} }

View File

@ -102,6 +102,10 @@ 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>();
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.details, (detail) => DetailBuilder.Make(go, sector, mod, detail), (detail) => detail.path);
MakeGeneralProps(go, config.Props.geysers, (geyser) => GeyserBuilder.Make(go, sector, geyser));
if (Main.HasDLC) if (Main.HasDLC)
{ {
MakeGeneralProps(go, config.Props.dreamCandles, (candle) => DreamCandleBuilder.Make(go, sector, candle, mod)); MakeGeneralProps(go, config.Props.dreamCandles, (candle) => DreamCandleBuilder.Make(go, sector, candle, mod));
@ -110,12 +114,8 @@ namespace NewHorizons.Builder.Props
MakeGeneralProps(go, config.Props.grappleTotems, (totem) => GrappleTotemBuilder.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.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.dreamArrivalPoints, (point) => DreamArrivalPointBuilder.Make(go, sector, point, mod), (point) => point.id);
MakeGeneralProps(go, config.Props.rafts, (raft) => RaftBuilder.Make(go, sector, raft, planetBody));
} }
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.details, (detail) => DetailBuilder.Make(go, sector, mod, detail), (detail) => detail.path);
MakeGeneralProps(go, config.Props.geysers, (geyser) => GeyserBuilder.Make(go, sector, geyser));
if (Main.HasDLC) 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)); MakeGeneralProps(go, config.Props.tornados, (tornado) => TornadoBuilder.Make(go, sector, tornado, config.Atmosphere?.clouds != null));
MakeGeneralProps(go, config.Props.volcanoes, (volcano) => VolcanoBuilder.Make(go, sector, volcano)); MakeGeneralProps(go, config.Props.volcanoes, (volcano) => VolcanoBuilder.Make(go, sector, volcano));
MakeGeneralProps(go, config.Props.dialogue, (dialogueInfo) => MakeGeneralProps(go, config.Props.dialogue, (dialogueInfo) =>
@ -139,6 +139,7 @@ namespace NewHorizons.Builder.Props
MakeGeneralProps(go, config.Props.warpTransmitters, (warpTransmitter) => WarpPadBuilder.Make(go, sector, mod, warpTransmitter), (warpTransmitter) => warpTransmitter.frequency); MakeGeneralProps(go, config.Props.warpTransmitters, (warpTransmitter) => WarpPadBuilder.Make(go, sector, mod, warpTransmitter), (warpTransmitter) => warpTransmitter.frequency);
MakeGeneralProps(go, config.Props.audioSources, (audioSource) => AudioSourceBuilder.Make(go, sector, audioSource, mod), (audioSource) => audioSource.audio); MakeGeneralProps(go, config.Props.audioSources, (audioSource) => AudioSourceBuilder.Make(go, sector, audioSource, mod), (audioSource) => audioSource.audio);
RemoteBuilder.MakeGeneralProps(go, sector, config.Props.remotes, nhBody); RemoteBuilder.MakeGeneralProps(go, sector, config.Props.remotes, nhBody);
if (Main.HasDLC) MakeGeneralProps(go, config.Props.projectionTotems, (totem) => ProjectionTotemBuilder.Make(go, sector, totem, mod));
RunMultiPass(); RunMultiPass();

View File

@ -153,6 +153,11 @@ namespace NewHorizons.External.Modules
/// </summary> /// </summary>
public DreamCandleInfo[] dreamCandles; public DreamCandleInfo[] dreamCandles;
/// <summary>
/// Adds dream world projection totems (requires Echoes of the Eye DLC).
/// </summary>
public ProjectionTotemInfo[] projectionTotems;
[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;

View File

@ -1,3 +1,4 @@
using NewHorizons.External.SerializableData;
using Newtonsoft.Json; using Newtonsoft.Json;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
@ -12,12 +13,12 @@ namespace NewHorizons.External.Modules.Props.EchoesOfTheEye
public class AlarmTotemInfo : GeneralPropInfo public class AlarmTotemInfo : GeneralPropInfo
{ {
/// <summary> /// <summary>
/// The maximum distance of the alarm's "vision cone". /// The maximum distance of the alarm's vision cone.
/// </summary> /// </summary>
[DefaultValue(45f)] public float sightDistance = 45; [DefaultValue(45f)] public float sightDistance = 45;
/// <summary> /// <summary>
/// The width of the alarm's "vision cone" in degrees. /// The width of the alarm's vision cone in degrees.
/// </summary> /// </summary>
[DefaultValue(60f)] public float sightAngle = 60f; [DefaultValue(60f)] public float sightAngle = 60f;

View File

@ -40,5 +40,10 @@ namespace NewHorizons.External.Modules.Props.EchoesOfTheEye
/// Relative paths from this planet to objects that will appear or disappear when this totem is lit or extinguished. Some types of objects and effects are not supported and will remain visible and active. /// Relative paths from this planet to objects that will appear or disappear when this totem is lit or extinguished. Some types of objects and effects are not supported and will remain visible and active.
/// </summary> /// </summary>
public string[] pathsToProjectedObjects; public string[] pathsToProjectedObjects;
/// <summary>
/// If set, projected objects will be set to fully active or fully disabled instantly instead of smoothly fading lights/renderers/colliders. Use this if the normal behavior is insufficient for the objects you're using.
/// </summary>
public bool toggleProjectedObjectsActive;
} }
} }