diff --git a/Config/Localization.csv b/Config/Localization.csv index 768a316..f9ca6b7 100644 --- a/Config/Localization.csv +++ b/Config/Localization.csv @@ -28,3 +28,8 @@ Sol tık - serbest bırak. Sırt çantasında parçala: et, deri ve kemik.","徒 左鍵 - 放走。在背包裡拆解可得肉、皮革和骨頭。" wildRabbitGrab,PlayerMoveController.cs,Label,,,,Press [action:local:Activate][action:permanent:Activate] to Grab the Rabbit,,"[action:local:Activate][action:permanent:Activate] drücken, um den Hasen zu packen",Pulsa [action:local:Activate][action:permanent:Activate] para atrapar el conejo,Appuyez sur [action:local:Activate][action:permanent:Activate] pour attraper le lapin,Premi [action:local:Activate][action:permanent:Activate] per afferrare il coniglio,[action:local:Activate][action:permanent:Activate]でウサギを捕まえる,[action:local:Activate][action:permanent:Activate]을(를) 눌러 토끼 잡기,"Naciśnij [action:local:Activate][action:permanent:Activate], aby złapać królika",Pressione [action:local:Activate][action:permanent:Activate] para pegar o coelho,"Нажмите [action:local:Activate][action:permanent:Activate], чтобы схватить кролика",Tavşanı yakalamak için [action:local:Activate][action:permanent:Activate] tuşuna bas,按[action:local:Activate][action:permanent:Activate]抓住兔子,按[action:local:Activate][action:permanent:Activate]抓住兔子 +cntRabbitHutch,blocks,Block,,,,Rabbit Hutch,,Hasenstall,Conejera,Clapier,Conigliera,ウサギ小屋,토끼 우리,Królikarnia,Coelheira,Крольчатник,Tavşan Kümesi,兔舍,兔舍 +cntRabbitHutchDesc,blocks,Block,,,,"A home for the rabbits you caught by hand. Feed them plant fibers and new rabbits grow in their sacks.",,"Ein Zuhause für die Hasen, die du mit bloßen Händen gefangen hast. Füttere sie mit Pflanzenfasern, und in ihren Säcken wachsen neue Hasen heran.","Un hogar para los conejos que atrapaste a mano. Aliméntalos con fibra vegetal y crecerán conejos nuevos en sus sacos.","Un foyer pour les lapins que vous avez attrapés à mains nues. Nourrissez-les de fibres végétales et de nouveaux lapins pousseront dans leurs sacs.","Una casa per i conigli catturati a mani nude. Nutrili con fibre vegetali e nei loro sacchi cresceranno nuovi conigli.",手捕りしたウサギの住処。植物繊維を与えると、袋の中で新しいウサギが育つ。,맨손으로 잡은 토끼의 보금자리. 식물 섬유를 먹이면 자루 속에서 새끼 토끼가 자란다.,"Dom dla królików złapanych gołymi rękami. Karm je włóknami roślinnymi, a w ich workach wyrosną nowe króliki.","Um lar para os coelhos que você capturou com as mãos. Alimente-os com fibras vegetais e novos coelhos crescerão em seus sacos.","Дом для кроликов, пойманных руками. Корми их травяными волокнами — и в мешках вырастают новые кролики.","Çıplak elle yakaladığın tavşanlar için bir yuva. Onlara bitki lifi yedir, çuvallarında yeni tavşanlar büyüsün.","用双手抓来的兔子的家。喂它们植物纤维,袋子里就会长出新的兔子。","用雙手抓來的兔子的家。餵牠們植物纖維,袋子裡就會長出新的兔子。" +xuiRabbitHutch,UI,XUI,,,,Rabbit Hutch,,Hasenstall,Conejera,Clapier,Conigliera,ウサギ小屋,토끼 우리,Królikarnia,Coelheira,Крольчатник,Tavşan Kümesi,兔舍,兔舍 +xuiRabbitGrass,UI,XUI,,,,Grass,,Gras,Hierba,Herbe,Erba,草,풀,Trawa,Grama,Трава,Çimen,草,草 +xuiRabbitBreeders,UI,XUI,,,,Rabbits,,Hasen,Conejos,Lapins,Conigli,ウサギ,토끼,Króliki,Coelhos,Кролики,Tavşanlar,兔子,兔子 diff --git a/Config/blocks.xml b/Config/blocks.xml new file mode 100644 index 0000000..0ad95eb --- /dev/null +++ b/Config/blocks.xml @@ -0,0 +1,86 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Config/recipes.xml b/Config/recipes.xml new file mode 100644 index 0000000..9441632 --- /dev/null +++ b/Config/recipes.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/HarmonySrc/HutchWindow.cs b/HarmonySrc/HutchWindow.cs new file mode 100644 index 0000000..927aa43 --- /dev/null +++ b/HarmonySrc/HutchWindow.cs @@ -0,0 +1,49 @@ +using HarmonyLib; +using UnityEngine; + +namespace RabbitHutch +{ + /// + /// Крольчатник (#2) сделан без модификаций (указание 10.11.2026: «Модификаций не будем добавлять»), поэтому + /// у блока RequiredMods пустой и ваниль рисовала бы пустую панель «Инструменты» с мёртвыми слотами - а слот + /// без списка допустимых предметов ещё и принял бы любой предмет в ModSlots. Патч скрывает окно инструментов, + /// когда у блока модов нет, тем же приёмом, каким сама игра прячет окно топлива/катализатора в OnOpen. + /// Курятник и рососборник не трогаем: у них моды есть. Выключатель - консоль: rabbithutch mods off + /// (действует со следующего открытия окна). + /// + public static class HutchWindow + { + /// Скрывать панель «Инструменты» у блоков-сборщиков без модификаций. + public static bool HideEmptyMods = true; + + public static bool HasNoMods(BlockCollector blockCollector) + { + string[] mods = blockCollector?.RequiredMods; + return mods == null || mods.Length == 0 + || (mods.Length == 1 && string.IsNullOrEmpty(mods[0])); + } + } + + [HarmonyPatch(typeof(XUiC_DewCollectorWindowGroup), "OnOpen")] + public static class Patch_XUiC_DewCollectorWindowGroup_OnOpen_NoMods + { + public static void Postfix(XUiC_DewCollectorWindowGroup __instance) + { + if (!HutchWindow.HideEmptyMods) + { + return; + } + BlockCollector blockCollector = __instance.te?.blockValue.Block as BlockCollector; + if (blockCollector == null || !HutchWindow.HasNoMods(blockCollector)) + { + return; + } + XUiController modsWindow = __instance.GetChildById("windowDewCollectorMods"); + if (modsWindow?.ViewComponent != null) + { + modsWindow.ViewComponent.IsVisible = false; + Debug.Log("[RabbitHutch] HutchWindow: hiding the empty Tools panel (block has no mods)"); + } + } + } +} diff --git a/HarmonySrc/RabbitGrab.cs b/HarmonySrc/RabbitGrab.cs index 860fec3..e9908fd 100644 --- a/HarmonySrc/RabbitGrab.cs +++ b/HarmonySrc/RabbitGrab.cs @@ -164,8 +164,9 @@ namespace RabbitHutch public override string getHelp() { - return "rabbithutch - status\n" + - "rabbithutch on|off - off: vanilla grab, the sack goes to the hand like a chicken"; + return "rabbithutch - status\n" + + "rabbithutch on|off - off: vanilla grab, the sack goes to the hand like a chicken\n" + + "rabbithutch mods on|off - hutch: hide the empty Tools panel (on by default)"; } public override void Execute(List _params, CommandSenderInfo _senderInfo) @@ -175,7 +176,12 @@ namespace RabbitHutch { RabbitGrab.Enabled = _params[0] == "on"; } - con.Output("rabbithutch: " + (RabbitGrab.Enabled ? "on - rabbit sack goes to the backpack" : "off - vanilla grab")); + if (_params.Count >= 2 && _params[0] == "mods" && (_params[1] == "on" || _params[1] == "off")) + { + HutchWindow.HideEmptyMods = _params[1] == "on"; + } + con.Output("rabbithutch: " + (RabbitGrab.Enabled ? "on - rabbit sack goes to the backpack" : "off - vanilla grab") + + "; mods panel " + (HutchWindow.HideEmptyMods ? "hidden when empty" : "always shown")); } } } diff --git a/ModInfo.xml b/ModInfo.xml index 2211b69..f6df239 100644 --- a/ModInfo.xml +++ b/ModInfo.xml @@ -2,7 +2,7 @@ - + - + diff --git a/RabbitHutchHarmony.dll b/RabbitHutchHarmony.dll index 30cc449..57fc1ad 100644 Binary files a/RabbitHutchHarmony.dll and b/RabbitHutchHarmony.dll differ diff --git a/RabbitHutchHarmony.pdb b/RabbitHutchHarmony.pdb index f82f231..8c98827 100644 Binary files a/RabbitHutchHarmony.pdb and b/RabbitHutchHarmony.pdb differ diff --git a/ReadMe.txt b/ReadMe.txt index 8ecd8c7..eba6f3c 100644 --- a/ReadMe.txt +++ b/ReadMe.txt @@ -1,11 +1,12 @@ # Rabbit Hutch -A 7 Days to Die mod by Alex Cube. Grab the rabbit, keep it in a sack. +A 7 Days to Die mod by Alex Cube. Grab the rabbit, keep it in a sack, breed them at home. - Catch a rabbit with your bare hands, just like a chicken - but the sack lands straight in your backpack, no hand-carrying. - Left click with the sack in hand to let the rabbit go. - Scrap the sack in the backpack for meat, leather and bones, same as butchering with a knife. -- Console switch: `rabbithutch off` returns the vanilla hand-carry grab, `rabbithutch on` - back to the backpack. +- Build a rabbit hutch: up to six rabbits in sacks make new ones, nine output slots, feed is plant fibers ("grass"). Crafted and placed like the vanilla chicken coop, no coop modifications. The model is a placeholder (the combine station) for now. +- Console switches: `rabbithutch off` returns the vanilla hand-carry grab, `rabbithutch on` - back to the backpack; `rabbithutch mods off` shows the hutch's empty Tools panel again (hidden by default). Text in 13 languages. DLL mod (Harmony). Made on 7 Days to Die 3.4.