[WL-816w] 울타리 원천 차단 — IslandManager.islandMeshes 목록 항목을 난간 제거 복제본으로 교체(ConfigureIsland 가 확장·재구성마다 원본 메시를 다시 물려 되살아나던 것) · 신규 .cs meta 2건 (#816)

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
깃 관리자 2026-09-15 21:07:33 +09:00
parent 6b3040366d
commit c88d0fa7e2
3 changed files with 35 additions and 1 deletions

View File

@ -14,19 +14,21 @@ using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
using FIIsland = CryingSnow.FarmingIsland.Island;
using FIIslandManager = CryingSnow.FarmingIsland.IslandManager;
namespace WL.Island
{
public static class WLIslandTileFenceStrip
{
static readonly Dictionary<Mesh, Mesh> s_cache = new Dictionary<Mesh, Mesh>();
public static int TilesStripped, TrianglesRemoved, Unreadable;
public static int TilesStripped, TrianglesRemoved, Unreadable, SourceReplaced;
public static string LastLog = "";
/// <summary>섬 씬의 타일(FI Island)마다 메시를 검사해 난간 삼각형이 있으면 잘라낸 복제본으로 바꾼다(멱등).</summary>
public static void Apply(WLIslandSettings cfg, Scene scene)
{
if (cfg == null || cfg.stripBakedFences == 0) return;
ReplaceSourceList(cfg, scene);
var isls = Object.FindObjectsByType<FIIsland>(FindObjectsInactive.Include, FindObjectsSortMode.None);
int changed = 0;
for (int i = 0; i < isls.Length; i++)
@ -49,6 +51,34 @@ namespace WL.Island
}
}
/// <summary>
/// 2026-09-15 Lead 실측 — 원본 `Island.ConfigureIsland` 가 확장·재구성 때마다 `IslandManager.islandMeshes[i]`(원본 메시)를
/// 타일에 **다시 물려** 잘라낸 복제본이 원본으로 되돌아간다(화면의 타일 메시명이 `04`·`07` 등 원본 그대로였다).
/// 그래서 원천인 그 목록의 항목 자체를 잘라낸 복제본으로 바꿔 둔다(리플렉션 · 원본 0줄) — 이후 어떤 시점에 물려도 난간 없음.
/// </summary>
static void ReplaceSourceList(WLIslandSettings cfg, Scene scene)
{
var mgrs = Object.FindObjectsByType<FIIslandManager>(FindObjectsInactive.Include, FindObjectsSortMode.None);
if (mgrs == null || mgrs.Length == 0) return;
var field = typeof(FIIslandManager).GetField("islandMeshes", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Public);
if (field == null) return;
for (int k = 0; k < mgrs.Length; k++)
{
var mgr = mgrs[k];
if (mgr == null || (scene.IsValid() && mgr.gameObject.scene != scene)) continue;
var list = field.GetValue(mgr) as List<Mesh>;
if (list == null) continue;
for (int i = 0; i < list.Count; i++)
{
var src = list[i];
if (src == null || src.name.EndsWith("_nofence")) continue;
Mesh dst;
if (!s_cache.TryGetValue(src, out dst)) { dst = Strip(src, cfg.fenceStripMinY); s_cache[src] = dst; }
if (dst != null && dst != src) { list[i] = dst; SourceReplaced++; }
}
}
}
static Mesh Strip(Mesh src, float minY)
{
// 🔴 Read/Write 가 꺼진 메시는 접근 자체가 Unity 에러 로그(→ 게임 팝업)를 낸다 — 예외가 아니라 로그라 try/catch 로 못 막는다.

View File

@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 46247c798030a9746bf06e12f9b45a4f

View File

@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 870b83e7cd0b2b144abba6944bc2ea9a