diff --git a/JotunnModStub/PlacementGhostDebug.cs b/JotunnModStub/PlacementGhostDebug.cs deleted file mode 100644 index 17fd667..0000000 --- a/JotunnModStub/PlacementGhostDebug.cs +++ /dev/null @@ -1,70 +0,0 @@ -using System.Text; -using HarmonyLib; -using UnityEngine; - -namespace RacesOfValheim -{ - /// - /// TEMPORARY DEBUG. F8 dumps the build ghost in hand and what the placement ray hits, to the - /// console and the BepInEx log - for the Trol War Totem, whose ghost stays invisible where every - /// other station's now shows. Remove once that is fixed. - /// - public class PlacementGhostDebug : MonoBehaviour - { - private void Update() - { - if (!Input.GetKeyDown(KeyCode.F8)) return; - - Player player = Player.m_localPlayer; - if (player == null) return; - - var sb = new StringBuilder(); - GameObject ghost = Traverse.Create(player).Field("m_placementGhost").Value; - sb.AppendLine($"[GhostDebug] status={Traverse.Create(player).Field("m_placementStatus").GetValue()} ghost={(ghost != null ? ghost.name : "none")}"); - - Camera cam = GameCamera.instance != null ? GameCamera.instance.GetComponent() : null; - if (GameCamera.instance != null && Physics.Raycast(GameCamera.instance.transform.position, GameCamera.instance.transform.forward, out RaycastHit hit, 50f)) - { - sb.AppendLine($"[GhostDebug] ray hit '{hit.collider.name}' layer={LayerMask.LayerToName(hit.collider.gameObject.layer)} " + - $"dist={hit.distance:0.0} heightmap={(hit.collider.GetComponent() != null)} rigidbody={(hit.collider.attachedRigidbody != null)}"); - } - - if (ghost != null) - { - sb.AppendLine($"[GhostDebug] ghost active={ghost.activeInHierarchy} pos={ghost.transform.position} scale={ghost.transform.lossyScale} " + - $"layer={LayerMask.LayerToName(ghost.layer)} cameraMask has ghost layer={(cam != null && (cam.cullingMask & (1 << ghost.layer)) != 0)}"); - - foreach (LODGroup lod in ghost.GetComponentsInChildren(true)) - { - sb.AppendLine($"[GhostDebug] LODGroup on '{lod.name}' enabled={lod.enabled} active={lod.gameObject.activeInHierarchy} lods={lod.lodCount}"); - } - - foreach (Renderer r in ghost.GetComponentsInChildren(true)) - { - Material m = r.sharedMaterial; - sb.AppendLine($"[GhostDebug] renderer '{PathOf(r.transform, ghost.transform)}' {r.GetType().Name} enabled={r.enabled} " + - $"forceOff={r.forceRenderingOff} active={r.gameObject.activeInHierarchy} visible={r.isVisible} " + - $"layer={LayerMask.LayerToName(r.gameObject.layer)} bounds={r.bounds.size} " + - $"shader={(m != null && m.shader != null ? m.shader.name : "none")}"); - } - } - - string text = sb.ToString(); - Jotunn.Logger.LogInfo(text); - if (Console.instance != null) - { - foreach (string line in text.Split('\n')) - { - if (!string.IsNullOrWhiteSpace(line)) Console.instance.Print(line.TrimEnd()); - } - } - } - - private static string PathOf(Transform t, Transform root) - { - string path = t.name; - for (Transform p = t.parent; p != null && p != root; p = p.parent) path = p.name + "/" + path; - return path; - } - } -} diff --git a/JotunnModStub/RacesOfValheim.cs b/JotunnModStub/RacesOfValheim.cs index 6bb439d..e6f8289 100644 --- a/JotunnModStub/RacesOfValheim.cs +++ b/JotunnModStub/RacesOfValheim.cs @@ -69,8 +69,6 @@ namespace RacesOfValheim // Not a race: a perk two races share (Skadi and Trol build inside troll caves), so it // gets its own component rather than living inside either one's Update. gameObject.AddComponent(); - // TEMPORARY DEBUG: F8 dumps the build ghost (Trol War Totem ghost investigation). - gameObject.AddComponent(); PrefabManager.OnVanillaPrefabsAvailable += CreateAllModAssets; CommandManager.Instance.AddConsoleCommand(new ResetRaceCommand()); CommandManager.Instance.AddConsoleCommand(new CheckProgressionCommand());