mirror of
https://github.com/Outer-Wilds-New-Horizons/new-horizons.git
synced 2025-12-11 20:15:44 +01:00
Alarm totems
This commit is contained in:
parent
4876cf9ef8
commit
4baf9b264e
@ -0,0 +1,54 @@
|
|||||||
|
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 AlarmTotemBuilder
|
||||||
|
{
|
||||||
|
private static GameObject _prefab;
|
||||||
|
|
||||||
|
internal static void InitPrefab()
|
||||||
|
{
|
||||||
|
if (_prefab == null)
|
||||||
|
{
|
||||||
|
_prefab = SearchUtilities.Find("DreamWorld_Body/Sector_DreamWorld/Sector_Underground/IslandsRoot/IslandPivot_C/Island_C/Interactibles_Island_C/Prefab_IP_AlarmTotem").InstantiateInactive().Rename("Prefab_AlarmTotem").DontDestroyOnLoad();
|
||||||
|
if (_prefab == null)
|
||||||
|
{
|
||||||
|
NHLogger.LogWarning($"Tried to make a grapple totem but couldn't. Do you have the DLC installed?");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_prefab.AddComponent<DestroyOnDLC>()._destroyOnDLCNotOwned = true;
|
||||||
|
var alarmTotem = _prefab.GetComponent<AlarmTotem>();
|
||||||
|
alarmTotem._sector = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static GameObject Make(GameObject planetGO, Sector sector, AlarmTotemInfo info, IModBehaviour mod)
|
||||||
|
{
|
||||||
|
InitPrefab();
|
||||||
|
|
||||||
|
if (_prefab == null || sector == null) return null;
|
||||||
|
|
||||||
|
var totemObj = DetailBuilder.Make(planetGO, sector, mod, _prefab, new DetailInfo(info));
|
||||||
|
|
||||||
|
var alarmTotem = _prefab.GetComponent<AlarmTotem>();
|
||||||
|
alarmTotem._sightAngle = info.sightAngle;
|
||||||
|
alarmTotem._sightDistance = info.sightDistance;
|
||||||
|
|
||||||
|
return totemObj;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -102,6 +102,7 @@ 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.alarmTotems, (totem) => AlarmTotemBuilder.Make(go, sector, totem, mod));
|
||||||
if (Main.HasDLC) MakeGeneralProps(go, config.Props.grappleTotems, (totem) => GrappleTotemBuilder.Make(go, sector, totem, mod));
|
if (Main.HasDLC) MakeGeneralProps(go, config.Props.grappleTotems, (totem) => GrappleTotemBuilder.Make(go, sector, totem, mod));
|
||||||
if (Main.HasDLC) MakeGeneralProps(go, config.Props.dreamCampfires, (campfire) => DreamCampfireBuilder.Make(go, sector, campfire, mod), (campfire) => campfire.id);
|
if (Main.HasDLC) MakeGeneralProps(go, config.Props.dreamCampfires, (campfire) => DreamCampfireBuilder.Make(go, sector, campfire, mod), (campfire) => campfire.id);
|
||||||
if (Main.HasDLC) MakeGeneralProps(go, config.Props.dreamArrivalPoints, (point) => DreamArrivalPointBuilder.Make(go, sector, point, mod), (point) => point.id);
|
if (Main.HasDLC) MakeGeneralProps(go, config.Props.dreamArrivalPoints, (point) => DreamArrivalPointBuilder.Make(go, sector, point, mod), (point) => point.id);
|
||||||
|
|||||||
5
NewHorizons/External/Modules/PropModule.cs
vendored
5
NewHorizons/External/Modules/PropModule.cs
vendored
@ -138,6 +138,11 @@ namespace NewHorizons.External.Modules
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public GrappleTotemInfo[] grappleTotems;
|
public GrappleTotemInfo[] grappleTotems;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Adds dream world alarm totems to this planet.
|
||||||
|
/// </summary>
|
||||||
|
public AlarmTotemInfo[] alarmTotems;
|
||||||
|
|
||||||
[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/AlarmTotemInfo.cs
vendored
Normal file
24
NewHorizons/External/Modules/Props/EchoesOfTheEye/AlarmTotemInfo.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 AlarmTotemInfo : GeneralPropInfo
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// The maximum distance of the alarm's "vision cone".
|
||||||
|
/// </summary>
|
||||||
|
[DefaultValue(45f)] public float sightDistance = 45;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The width of the alarm's "vision cone" in degrees.
|
||||||
|
/// </summary>
|
||||||
|
[DefaultValue(60f)] public float sightAngle = 60f;
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user