diff --git a/1.6/1.6/Assemblies/WulaFallenEmpire.dll b/1.6/1.6/Assemblies/WulaFallenEmpire.dll index 35a9c526..358fb8e1 100644 Binary files a/1.6/1.6/Assemblies/WulaFallenEmpire.dll and b/1.6/1.6/Assemblies/WulaFallenEmpire.dll differ diff --git a/1.6/1.6/Defs/EventDefs/EventDef_Examples_HideWhenDisabled.xml b/1.6/1.6/Defs/EventDefs/EventDef_Examples_HideWhenDisabled.xml new file mode 100644 index 00000000..7682ff80 --- /dev/null +++ b/1.6/1.6/Defs/EventDefs/EventDef_Examples_HideWhenDisabled.xml @@ -0,0 +1,105 @@ + + + + + Wula_TestEvent_HideWhenDisabled + + 测试者 + +
  • 这是一个用于演示新功能的测试事件。它包含多个选项,展示了不同的条件和可见性行为。当前机械族好感度: {MechanoidGoodwill}
  • +
    + + +
  • + + +
  • + +
  • + TestVar + 1 +
  • +
  • + Wula_TestEvent_HideWhenDisabled +
  • + + + + + + +
  • + + +
  • + TestVar + 1 +
  • + + +
  • + +
  • + +
  • +
    + + + +
  • + + true + +
  • + TestVar + 1 +
  • + + +
  • + +
  • + +
  • +
    + + + +
  • + + +
  • + +
  • + TestVar +
  • +
  • + Wula_TestEvent_HideWhenDisabled +
  • + + + + + + +
  • + + +
  • + +
  • + Mechanoid + MechanoidGoodwill +
  • +
  • + Wula_TestEvent_HideWhenDisabled +
  • + + + + + +
    +
    + +
    \ No newline at end of file diff --git a/MCP/python-sdk b/MCP/python-sdk new file mode 160000 index 00000000..959d4e39 --- /dev/null +++ b/MCP/python-sdk @@ -0,0 +1 @@ +Subproject commit 959d4e39ae13e45d3059ec6d6ca82fb231039a91 diff --git a/Source/WulaFallenEmpire/EventSystem/Dialog_CustomDisplay.cs b/Source/WulaFallenEmpire/EventSystem/Dialog_CustomDisplay.cs index 75563575..a3534e88 100644 --- a/Source/WulaFallenEmpire/EventSystem/Dialog_CustomDisplay.cs +++ b/Source/WulaFallenEmpire/EventSystem/Dialog_CustomDisplay.cs @@ -194,6 +194,10 @@ namespace WulaFallenEmpire } else { + if (option.hideWhenDisabled) + { + continue; // Skip rendering this option entirely + } Rect rect = listing.GetRect(30f); Widgets.ButtonText(rect, option.label, false, true, false); TooltipHandler.TipRegion(rect, GetDisabledReason(option, reason)); diff --git a/Source/WulaFallenEmpire/EventSystem/Effect.cs b/Source/WulaFallenEmpire/EventSystem/Effect.cs index 2a0aaaae..c1ce96e7 100644 --- a/Source/WulaFallenEmpire/EventSystem/Effect.cs +++ b/Source/WulaFallenEmpire/EventSystem/Effect.cs @@ -565,6 +565,37 @@ namespace WulaFallenEmpire } } + public class Effect_CheckFactionGoodwill : Effect + { + public FactionDef factionDef; + public string variableName; + + public override void Execute(Dialog_CustomDisplay dialog = null) + { + if (factionDef == null) + { + Log.Error("Effect_CheckFactionGoodwill requires a factionDef."); + return; + } + if (string.IsNullOrEmpty(variableName)) + { + Log.Error("Effect_CheckFactionGoodwill requires a variableName."); + return; + } + + Faction faction = Find.FactionManager.FirstFactionOfDef(factionDef); + if (faction == null) + { + // Faction doesn't exist, store a default value (e.g., 0 or a specific marker) + EventContext.SetVariable(variableName, 0); + Log.Warning($"Faction with def {factionDef.defName} not found. Setting '{variableName}' to 0."); + return; + } + + int goodwill = faction.GoodwillWith(Faction.OfPlayer); + EventContext.SetVariable(variableName, goodwill); + } + } } diff --git a/Source/WulaFallenEmpire/EventSystem/EventDef.cs b/Source/WulaFallenEmpire/EventSystem/EventDef.cs index 16691cde..afa8e058 100644 --- a/Source/WulaFallenEmpire/EventSystem/EventDef.cs +++ b/Source/WulaFallenEmpire/EventSystem/EventDef.cs @@ -63,6 +63,7 @@ namespace WulaFallenEmpire public List optionEffects; public List conditions; public string disabledReason; + public bool hideWhenDisabled = false; } public class ConditionalEffects diff --git a/Source/WulaFallenEmpire/WulaFallenEmpire.csproj b/Source/WulaFallenEmpire/WulaFallenEmpire.csproj index 12426e5b..9a5ce27a 100644 --- a/Source/WulaFallenEmpire/WulaFallenEmpire.csproj +++ b/Source/WulaFallenEmpire/WulaFallenEmpire.csproj @@ -18,7 +18,7 @@ false none false - ..\..\1.6\Assemblies\ + ..\..\1.6\1.6\Assemblies\ DEBUG;TRACE prompt 4