暂存选项隐藏派系检测
This commit is contained in:
@@ -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));
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -63,6 +63,7 @@ namespace WulaFallenEmpire
|
||||
public List<ConditionalEffects> optionEffects;
|
||||
public List<Condition> conditions;
|
||||
public string disabledReason;
|
||||
public bool hideWhenDisabled = false;
|
||||
}
|
||||
|
||||
public class ConditionalEffects
|
||||
|
||||
Reference in New Issue
Block a user