ji建筑解除flyover依赖

This commit is contained in:
2025-11-22 13:20:06 +08:00
parent d0b06cbc72
commit 6dc543b51c
4 changed files with 35 additions and 21 deletions

View File

@@ -0,0 +1,23 @@
using RimWorld;
using Verse;
namespace WulaFallenEmpire
{
public class CompProperties_SkyfallerCaller : CompProperties
{
public ThingDef skyfallerDef;
public bool destroyBuilding = true;
public int delayTicks = 0;
// 新增:是否需要 FlyOver 作为前提条件
public bool requireFlyOver = false; // 默认不需要 FlyOver
public bool allowThinRoof = true; // 允许砸穿薄屋顶
public bool allowThickRoof = false; // 是否允许在厚岩顶下空投
public CompProperties_SkyfallerCaller()
{
compClass = typeof(CompSkyfallerCaller);
}
}
}

View File

@@ -7,22 +7,6 @@ using Verse.AI;
namespace WulaFallenEmpire
{
public class CompProperties_SkyfallerCaller : CompProperties
{
public ThingDef skyfallerDef;
public bool destroyBuilding = true;
public int delayTicks = 0;
// 删除 requiredFlyOverType 字段
public bool allowThinRoof = true; // 允许砸穿薄屋顶
public bool allowThickRoof = false; // 是否允许在厚岩顶下空投
// 删除 requiredFlyOverLabel 字段
public CompProperties_SkyfallerCaller()
{
compClass = typeof(CompSkyfallerCaller);
}
}
public class CompSkyfallerCaller : ThingComp
{
private CompProperties_SkyfallerCaller Props => (CompProperties_SkyfallerCaller)props;
@@ -41,6 +25,10 @@ namespace WulaFallenEmpire
{
get
{
// 如果不需要 FlyOver直接返回 true
if (!Props.requireFlyOver)
return true;
if (parent?.Map == null) return false;
try
@@ -173,7 +161,7 @@ namespace WulaFallenEmpire
if (!CanCallSkyfaller)
{
// 显示相应的错误消息
if (!HasRequiredFlyOver)
if (!HasRequiredFlyOver && Props.requireFlyOver) // 只在需要 FlyOver 时才显示此消息
{
Messages.Message("WULA_NoBuildingDropperFlyOver".Translate(), parent, MessageTypeDefOf.RejectInput);
}
@@ -284,7 +272,8 @@ namespace WulaFallenEmpire
{
string desc = "WULA_CallSkyfallerDesc".Translate();
if (!HasRequiredFlyOver)
// 只在需要 FlyOver 时显示相关描述
if (Props.requireFlyOver && !HasRequiredFlyOver)
{
desc += $"\n{"WULA_RequiresBuildingDropperFlyOver".Translate()}";
}
@@ -311,7 +300,8 @@ namespace WulaFallenEmpire
private string GetDisabledReason()
{
if (!HasRequiredFlyOver)
// 只在需要 FlyOver 时检查并显示相关原因
if (Props.requireFlyOver && !HasRequiredFlyOver)
{
return "WULA_NoBuildingDropperFlyOver".Translate();
}
@@ -354,8 +344,8 @@ namespace WulaFallenEmpire
{
string status = "WULA_ReadyToCallSkyfaller".Translate();
// 添加条件信息
if (!HasRequiredFlyOver)
// 只在需要 FlyOver 时显示相关条件信息
if (Props.requireFlyOver && !HasRequiredFlyOver)
{
status += $"\n{"WULA_MissingBuildingDropperFlyOver".Translate()}";
}

View File

@@ -112,6 +112,7 @@
<Compile Include="BuildingComp\WULA_Shuttle\Dialog_ArmedShuttleTransfer.cs" />
<Compile Include="BuildingComp\WULA_Shuttle\GenStep_WulaPocketSpaceSmall.cs" />
<Compile Include="BuildingComp\WULA_Shuttle\PocketSpaceThingHolder.cs" />
<Compile Include="BuildingComp\WULA_SkyfallerCaller\CompProperties_SkyfallerCaller.cs" />
<Compile Include="BuildingComp\WULA_SkyfallerCaller\CompSkyfallerCaller.cs" />
<Compile Include="BuildingComp\WULA_StorageTurret\CompProperties_StorageTurret.cs" />
<Compile Include="BuildingComp\WULA_StorageTurret\CompStorageTurret.cs" />