using AibisDream.FixSystem; using Yarn.Unity; using UnityEngine; namespace AibisDream { public static class BodyModuleYarnCommand { private static BodyModuleSystem BodyModuleSystem => FixSystemCenter.SystemDic.Get(); private static CablePanel CablePanel => FixPanelSystem.GetRepairPanel(); [YarnCommand("enable_cut")] public static void EnableCut(string moduleName) { Reset_Plug(); var cutModule = BodyModuleSystem.FindBodyModuleByName(moduleName); //cutModule.EnableCut(); } [YarnCommand("Reset_Plug")] public static void Reset_Plug() { CablePanel.ResetPlug(); } [YarnCommand("ShowHeatMap")] public static void ShowHeatMap() { BodyModuleSystem.ShowHeatMap(); } [YarnCommand("HideHeatMap")] public static void HideHeatMap() { BodyModuleSystem.HideHeatMap(); } [YarnCommand("SetHeat")] public static void SetHeat(int heatValue) { BodyModuleSystem.SetHeat(heatValue); } [YarnCommand("Temp_RemoveUF")] public static void Temp_RemoveUF() { var _UFModule = BodyModuleSystem.FindBodyModuleByName("UF").transform.GetComponent(); _UFModule.RemoveUFModule(); BodyModuleSystem.FindBodyModuleByName("UF").SetSocketAvailable(false); } [YarnCommand("Temp_RemoveUFCover")] public static void Temp_RemoveUFCover() { CablePanel.ResetPlug(); var _UFModule = BodyModuleSystem.FindBodyModuleByName("UF").transform.GetComponent(); _UFModule.RemoveUFCover(); } [YarnCommand("Temp_InstallUF")] public static void Temp_InstallUF() { var _UFModule = BodyModuleSystem.FindBodyModuleByName("UF").transform.GetComponent(); _UFModule.InstallUFModule(); BodyModuleSystem.FindBodyModuleByName("UF").SetSocketAvailable(true); } [YarnCommand("Temp_InstallUFCover")] public static void Temp_InstallUFCover() { var _UFModule = BodyModuleSystem.FindBodyModuleByName("UF").transform.GetComponent(); _UFModule.InstallUFCover(); } [YarnCommand("Temp_InstallChip")] public static void Temp_InstallChip() { var _chipModule = BodyModuleSystem.FindBodyModuleByName("Color").transform.GetComponent(); _chipModule.InstallChipModule(); } [YarnCommand("Temp_RemoveChip")] public static void Temp_RemoveChip() { var _chipModule = BodyModuleSystem.FindBodyModuleByName("Color")?.transform.GetComponent(); if (_chipModule != null) { _chipModule.RemoveChipModule(); } } [YarnCommand("Temp_InstallUFColor")] public static void Temp_InstallUFChip() { var _chipModule = BodyModuleSystem.FindBodyModuleByName("UF").transform.GetComponent(); _chipModule.InstallUFColor(); } [YarnCommand("Temp_RemoveUFColor")] public static void Temp_RemoveUFChip() { var _chipModule = BodyModuleSystem.FindBodyModuleByName("UF").transform.GetComponent(); _chipModule.RemoveUFColor(); } [YarnCommand("SetSocketAvailable")] public static void SetSocketAvailable(string moduleName, bool isAvailable) { var targetModule = BodyModuleSystem.FindBodyModuleByName(moduleName); targetModule.SetSocketAvailable(isAvailable); } [YarnCommand("ModuleHightLight")] public static void ModuleHightLight(string moduleName, bool enable) { var targetModule = BodyModuleSystem.FindBodyModuleByName(moduleName); if (targetModule != null) { targetModule.Highlight(enable); } else { Debug.LogWarning($"Module {moduleName} not found!"); } } [YarnCommand("ModuleAlarm")] public static void ModuleAlarm(string moduleName, bool enable) { var targetModule = BodyModuleSystem.FindBodyModuleByName(moduleName); targetModule.Alarm(enable); } [YarnCommand("SetModuleState")] public static void SetModuleState(string moduleName, string stateName) { if (!System.Enum.TryParse(stateName, true, out ModuleCondition condition)) { Debug.LogWarning($"[Yarn] Unknown module state '{stateName}'. Expected Normal, Damaged, or PoweredOff."); return; } var targetModule = BodyModuleSystem?.FindAnyBodyModuleByName(moduleName); if (targetModule == null) { Debug.LogWarning($"[Yarn] Module '{moduleName}' not found."); return; } targetModule.SetCondition(condition); } [YarnCommand("DropCable")] public static void DropCable() { CablePanel.DropDownCable(); } [YarnCommand("RetractCable")] public static void RetractCable() { CablePanel?.PullUpCable(); } [YarnCommand("StartHeadBreathing")] public static void StartHeadBreathing() { BodyModuleSystem.StartBreathing(); } [YarnCommand("StopHeadBreathing")] public static void StopHeadBreathing() { BodyModuleSystem.StopBreathing(); } [YarnCommand("TriggerHeadPainShake")] public static void TriggerHeadPainShake() { BodyModuleSystem.TriggerPainShake(); } [YarnCommand("StartHeadContinuousPain")] public static void StartHeadContinuousPain() { BodyModuleSystem.StartContinuousPain(); } [YarnCommand("StopHeadContinuousPain")] public static void StopHeadContinuousPain() { BodyModuleSystem.StopContinuousPain(); } } }