diff --git a/HarmonySrc/HutchColliderTagPatch.cs b/HarmonySrc/HutchColliderTagPatch.cs new file mode 100644 index 0000000..9e63482 --- /dev/null +++ b/HarmonySrc/HutchColliderTagPatch.cs @@ -0,0 +1,43 @@ +using HarmonyLib; +using UnityEngine; + +namespace RabbitHutch +{ + /// + /// Хитбокс крольчатника (12.11.2026). В префабе rabbitHutchPrefab BoxCollider на корне, но игра + /// понимает, что луч попал в блок, только по игровому тегу на объекте с коллайдером. В нашем + /// Unity-проекте такого тега нет - при сборке бандла он стал Untagged, и блок не реагировал на + /// наведение (тест 12.11: «с ним невозможно взаимодействовать»). При первой загрузке модели + /// переносим тег и слой с ванильного курятника (Entities/Crafting/ChickenCoopPrefab - наш блок + /// построен по его образцу, коллайдер тоже на корне). Приём «Книги некроманта» - DecorColliderTagPatch + /// (оссуарий: GeoOssuaryPatch.CopyTags: GeoOssuaryPatch.CopyTags). Префаб из бандла общий, правка одна на все экземпляры. + /// + [HarmonyPatch(typeof(BlockShapeModelEntity), nameof(BlockShapeModelEntity.getPrefab))] + public static class Patch_BlockShapeModelEntity_getPrefab_HutchColliderTag + { + const string VanillaModel = "@:Entities/Crafting/ChickenCoopPrefab.prefab"; + static bool done; + + public static void Postfix(Transform __result) + { + if (__result == null || __result.name != "rabbitHutchPrefab" || done) + return; + done = true; + Transform vanilla = DataLoader.LoadAsset(VanillaModel); + if (vanilla == null) + { + Debug.LogWarning("[RabbitHutch] коллайдер: ванильный курятник не загрузился - тег не поставлен"); + return; + } + __result.tag = vanilla.tag; + __result.gameObject.layer = vanilla.gameObject.layer; + foreach (Collider c in __result.GetComponentsInChildren(true)) + { + c.gameObject.tag = vanilla.tag; + c.gameObject.layer = vanilla.gameObject.layer; + } + Debug.Log("[RabbitHutch] коллайдер: тег " + vanilla.tag + ", слой " + vanilla.gameObject.layer + + ", коллайдер " + (__result.GetComponent() != null ? "есть" : "НЕТ")); + } + } +} diff --git a/HarmonySrc/RabbitHutchHarmony.csproj b/HarmonySrc/RabbitHutchHarmony.csproj index 5475153..d8c52f0 100644 --- a/HarmonySrc/RabbitHutchHarmony.csproj +++ b/HarmonySrc/RabbitHutchHarmony.csproj @@ -24,6 +24,16 @@ false + + + + ..\..\..\7DaysToDie_Data\Managed\Unity.Addressables.dll + false + + + ..\..\..\7DaysToDie_Data\Managed\UnityEngine.PhysicsModule.dll + false + ..\..\..\7DaysToDie_Data\Managed\UnityEngine.CoreModule.dll false diff --git a/RabbitHutchHarmony.dll b/RabbitHutchHarmony.dll index 57fc1ad..267d045 100644 Binary files a/RabbitHutchHarmony.dll and b/RabbitHutchHarmony.dll differ diff --git a/RabbitHutchHarmony.pdb b/RabbitHutchHarmony.pdb index 8c98827..1a9bea9 100644 Binary files a/RabbitHutchHarmony.pdb and b/RabbitHutchHarmony.pdb differ diff --git a/Resources/rabbithutch b/Resources/rabbithutch index 46cf984..3dac7ce 100644 Binary files a/Resources/rabbithutch and b/Resources/rabbithutch differ diff --git a/UIAtlases/ItemIconAtlas/cntRabbitHutch.png b/UIAtlases/ItemIconAtlas/cntRabbitHutch.png index ae5281f..81319ed 100644 Binary files a/UIAtlases/ItemIconAtlas/cntRabbitHutch.png and b/UIAtlases/ItemIconAtlas/cntRabbitHutch.png differ