This commit is contained in:
Tourswen
2025-11-30 14:39:22 +08:00
parent 14a2cf542c
commit 6a5c5bd9aa
60 changed files with 3121 additions and 670 deletions

View File

@@ -11,6 +11,9 @@ namespace WulaFallenEmpire
public bool garbageShieldEnabled = false; // 通过XML配置启用/禁用
public string garbageShieldUIEventDefName; // 垃圾屏蔽触发时弹出的UI事件defName
// 新增:配置是否检查不可交易物品
public bool checkNonTradableItems = false;
public CompProperties_GarbageShield()
{
this.compClass = typeof(CompGarbageShield);
@@ -30,7 +33,7 @@ namespace WulaFallenEmpire
if (!GarbageShieldEnabled) return false;
// 检查是否是殖民者
if (thing is Pawn pawn && pawn.IsColonist)
if (thing is Pawn pawn)
return true;
// 检查是否是尸体
@@ -41,6 +44,10 @@ namespace WulaFallenEmpire
if (IsToxicWaste(thing))
return true;
// 新增:检查不可交易物品(如果配置启用)
if (Props.checkNonTradableItems && IsNonTradableItem(thing))
return true;
return false;
}
@@ -69,6 +76,13 @@ namespace WulaFallenEmpire
return thing.def == ThingDefOf.Wastepack;
}
// 新增:判断是否为不可交易物品
private bool IsNonTradableItem(Thing thing)
{
// 检查 tradeability 是否为 None
return thing.def.tradeability == Tradeability.None;
}
// 处理垃圾屏蔽触发并触发UI事件
public void ProcessGarbageShieldTrigger(List<Thing> forbiddenItems)
{

View File

@@ -11,6 +11,8 @@ namespace WulaFallenEmpire
// 垃圾屏蔽配置 - 通过XML控制
public bool garbageShieldEnabled = false;
public string garbageShieldUIEventDefName = "Wula_UI_Legion_Reply_1";
// 新增:明确不检查不可交易物品
public bool checkNonTradableItems = false; // Launchable_ToGlobalStorage 不需要检查不可交易物品
public CompProperties_Launchable_ToGlobalStorage()
{