From efd0e7d7e17c414a223942d6e3ddac84cc58770f Mon Sep 17 00:00:00 2001 From: FreezeDriedMangoes Date: Thu, 12 May 2022 13:02:02 -0400 Subject: [PATCH] feat/fix: props now print their current position instead of their initial position, props now print their path as originally intended, added a todo comment --- NewHorizons/Utility/DebugPropPlacer.cs | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/NewHorizons/Utility/DebugPropPlacer.cs b/NewHorizons/Utility/DebugPropPlacer.cs index e49210ae..4fc66224 100644 --- a/NewHorizons/Utility/DebugPropPlacer.cs +++ b/NewHorizons/Utility/DebugPropPlacer.cs @@ -13,16 +13,23 @@ namespace NewHorizons.Utility { private struct PropPlacementData { - public Vector3 pos; - public Vector3 rotation; + public Vector3 initial_pos; + public Vector3 initial_rotation; public string body; + public string propPath; + + public GameObject gameObject; + public Vector3 pos { get { return gameObject.transform.localPosition; } } + public Vector3 rotation { get { return gameObject.transform.localEulerAngles; } } } // placeholder currentObject public static string currentObject = "BrittleHollow_Body/Sector_BH/Sector_NorthHemisphere/Sector_NorthPole/Sector_HangingCity/Sector_HangingCity_District1/Props_HangingCity_District1/OtherComponentsGroup/Props_HangingCity_Building_10/Prefab_NOM_VaseThin"; private static List props = new List(); + // TODO: RegisterProp function, call it in DetailBuilder.MakeDetail + public static void PlaceObject(DebugRaycastData data) { if (!data.hitObject.name.EndsWith("_Body")) @@ -32,6 +39,8 @@ namespace NewHorizons.Utility try { + // TODO: if currentObject == "" or null, spawn some generic placeholder instead + GameObject prop = DetailBuilder.MakeDetail(data.hitObject, data.hitObject.GetComponentInChildren(), currentObject, data.pos, data.norm, 1, false); string bodyName = data.hitObject.name.Substring(0, data.bodyName.Length-"_Body".Length); @@ -39,7 +48,8 @@ namespace NewHorizons.Utility { pos = data.pos, rotation = data.norm, - body = bodyName + body = bodyName, + propPath = currentObject } ); } @@ -74,7 +84,7 @@ namespace NewHorizons.Utility string rotationString = $"\"x\":{prop.rotation.x},\"y\":{prop.rotation.y},\"z\":{prop.rotation.z}"; string endingString = i == bodyProps.Count-1 ? "" : ","; - configFile += " {\"path\" : \"" + "\", \"position\": {"+positionString+"}, \"rotation\": {"+rotationString+"}, \"scale\": 1}" + endingString + Environment.NewLine; + configFile += " {\"path\" : \"" +prop.propPath+ "\", \"position\": {"+positionString+"}, \"rotation\": {"+rotationString+"}, \"scale\": 1}" + endingString + Environment.NewLine; } configFile +=