removed separate CreateVisionTorch function and folded it into the regular Make function

This commit is contained in:
FreezeDriedMangoes 2022-05-25 07:26:50 -04:00
parent b1688c0a6d
commit 41c8e17f49

View File

@ -12,7 +12,6 @@ namespace NewHorizons.Builder.Props
{ {
public static class DetailBuilder public static class DetailBuilder
{ {
private static readonly string VISION_TORCH_PATH = "DreamWorld_Body/Sector_DreamWorld/Sector_Underground/Sector_PrisonCell/Interactibles_PrisonCell/PrisonerSequence/VisionTorchWallSocket/Prefab_IP_VisionTorchItem";
private static Dictionary<PropModule.DetailInfo, GameObject> detailInfoToCorrespondingSpawnedGameObject = new Dictionary<PropModule.DetailInfo, GameObject>(); private static Dictionary<PropModule.DetailInfo, GameObject> detailInfoToCorrespondingSpawnedGameObject = new Dictionary<PropModule.DetailInfo, GameObject>();
public static GameObject GetSpawnedGameObjectByDetailInfo(PropModule.DetailInfo detail) public static GameObject GetSpawnedGameObjectByDetailInfo(PropModule.DetailInfo detail)
@ -82,8 +81,6 @@ namespace NewHorizons.Builder.Props
public static GameObject MakeDetail(GameObject go, Sector sector, string propToClone, MVector3 position, MVector3 rotation, float scale, bool alignWithNormal) public static GameObject MakeDetail(GameObject go, Sector sector, string propToClone, MVector3 position, MVector3 rotation, float scale, bool alignWithNormal)
{ {
if (propToClone == VISION_TORCH_PATH) return MakeVisionTorch(go, sector, position, rotation, scale, alignWithNormal);
var prefab = SearchUtilities.Find(propToClone); var prefab = SearchUtilities.Find(propToClone);
if (prefab == null) Logger.LogError($"Couldn't find detail {propToClone}"); if (prefab == null) Logger.LogError($"Couldn't find detail {propToClone}");
return MakeDetail(go, sector, prefab, position, rotation, scale, alignWithNormal); return MakeDetail(go, sector, prefab, position, rotation, scale, alignWithNormal);
@ -156,6 +153,14 @@ namespace NewHorizons.Builder.Props
{ {
(component as OWItemSocket)._sector = sector; (component as OWItemSocket)._sector = sector;
} }
// Fix vision torch
if (component is VisionTorchItem)
{
(component as VisionTorchItem).enabled = true;
(component as VisionTorchItem).mindProjectorTrigger.enabled = true;
(component as VisionTorchItem).mindSlideProjector._mindProjectorImageEffect = GameObject.Find("Player_Body/PlayerCamera").GetComponent<MindProjectorImageEffect>();
}
} }
else else
{ {
@ -222,26 +227,5 @@ namespace NewHorizons.Builder.Props
return prop; return prop;
} }
public static GameObject MakeVisionTorch(GameObject planetGO, Sector sector, MVector3 position, MVector3 rotation, float scale, bool alignWithNormal)
{
if (!Main.HasDLC)
{
Logger.LogError("Could not instantiate Prefab_IP_VisionTorchItem, user does not own the DLC.");
return null;
}
var prefab = SearchUtilities.Find(VISION_TORCH_PATH);
if (prefab == null) Logger.LogError($"Couldn't find detail Prefab_IP_VisionTorchItem");
GameObject Prefab_IP_VisionTorchItem = MakeDetail(planetGO, sector, prefab, position, rotation, scale, alignWithNormal);
Prefab_IP_VisionTorchItem.GetComponent<VisionTorchItem>().enabled = true;
Prefab_IP_VisionTorchItem.GetComponent<VisionTorchItem>().mindProjectorTrigger.enabled = true;
Prefab_IP_VisionTorchItem.GetComponent<VisionTorchItem>().mindSlideProjector._mindProjectorImageEffect = GameObject.Find("Player_Body/PlayerCamera").GetComponent<MindProjectorImageEffect>();
return Prefab_IP_VisionTorchItem;
}
} }
} }