1
This commit is contained in:
Binary file not shown.
@@ -1052,10 +1052,6 @@
|
|||||||
</li>
|
</li>
|
||||||
</tools>
|
</tools>
|
||||||
<comps>
|
<comps>
|
||||||
<li Class="CompProperties_Glower">
|
|
||||||
<glowRadius>6</glowRadius>
|
|
||||||
<glowColor>(120,240,252,0)</glowColor>
|
|
||||||
</li>
|
|
||||||
<li Class="WulaFallenEmpire.CompProperties_MultiTurretGun">
|
<li Class="WulaFallenEmpire.CompProperties_MultiTurretGun">
|
||||||
<ID>0</ID>
|
<ID>0</ID>
|
||||||
<turretDef>WULA_Cat_Bunker_TurretGun</turretDef>
|
<turretDef>WULA_Cat_Bunker_TurretGun</turretDef>
|
||||||
|
|||||||
@@ -6,5 +6,4 @@
|
|||||||
<WULA_Intro_Spy.questDescriptionRules.rulesStrings>
|
<WULA_Intro_Spy.questDescriptionRules.rulesStrings>
|
||||||
<li>questDescription->乌拉帝国行星封锁机关的总控AI向殖民地发送了一个请求。一位乌拉帝国密探已经暴露,正在遭受其他派系追杀——密探手无寸铁且携带重要信息,殖民地需要掩护它直到乌拉帝国的穿梭机抵达并将其接走。虽然对方未透露更多信息,不过她指明袭击不会太剧烈,密探已经甩掉了大部分敌人。</li>
|
<li>questDescription->乌拉帝国行星封锁机关的总控AI向殖民地发送了一个请求。一位乌拉帝国密探已经暴露,正在遭受其他派系追杀——密探手无寸铁且携带重要信息,殖民地需要掩护它直到乌拉帝国的穿梭机抵达并将其接走。虽然对方未透露更多信息,不过她指明袭击不会太剧烈,密探已经甩掉了大部分敌人。</li>
|
||||||
</WULA_Intro_Spy.questDescriptionRules.rulesStrings>
|
</WULA_Intro_Spy.questDescriptionRules.rulesStrings>
|
||||||
|
|
||||||
</LanguageData>
|
</LanguageData>
|
||||||
@@ -42,8 +42,8 @@ namespace WulaFallenEmpire
|
|||||||
if (!IsWithinMapBounds(buildingDef, center, map, out failReason))
|
if (!IsWithinMapBounds(buildingDef, center, map, out failReason))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// 4. 检查地形affordance
|
// 4. 检查地形是否可建造
|
||||||
if (!HasValidTerrainAffordance(buildingDef, center, map, out failReason))
|
if (!HasBuildableTerrain(buildingDef, center, map, out failReason))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// 5. 检查其他建筑挤占(排除要忽略的物体)
|
// 5. 检查其他建筑挤占(排除要忽略的物体)
|
||||||
@@ -54,7 +54,7 @@ namespace WulaFallenEmpire
|
|||||||
if (!MeetsSpecialPlacementConditions(buildingDef, center, map, out failReason))
|
if (!MeetsSpecialPlacementConditions(buildingDef, center, map, out failReason))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// 7. 使用RimWorld原生的放置检查(最终验证)
|
// 7. 使用RimWorld原生的放置检查(最终验证)- 移除派系限制
|
||||||
if (!GenConstruct.CanPlaceBlueprintAt(buildingDef, center, Rot4.North, map, false, null, null, null))
|
if (!GenConstruct.CanPlaceBlueprintAt(buildingDef, center, Rot4.North, map, false, null, null, null))
|
||||||
{
|
{
|
||||||
failReason = "该位置不符合建筑放置要求";
|
failReason = "该位置不符合建筑放置要求";
|
||||||
@@ -90,18 +90,10 @@ namespace WulaFallenEmpire
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 检查地形affordance
|
/// 检查地形是否可建造 - 重新设计的逻辑
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private static bool HasValidTerrainAffordance(ThingDef buildingDef, IntVec3 center, Map map, out string failReason)
|
private static bool HasBuildableTerrain(ThingDef buildingDef, IntVec3 center, Map map, out string failReason)
|
||||||
{
|
{
|
||||||
TerrainAffordanceDef requiredAffordance = buildingDef.terrainAffordanceNeeded;
|
|
||||||
if (requiredAffordance == null)
|
|
||||||
{
|
|
||||||
// 如果没有指定affordance要求,则跳过检查
|
|
||||||
failReason = null;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
CellRect occupiedRect = GenAdj.OccupiedRect(center, Rot4.North, buildingDef.Size);
|
CellRect occupiedRect = GenAdj.OccupiedRect(center, Rot4.North, buildingDef.Size);
|
||||||
|
|
||||||
foreach (IntVec3 cell in occupiedRect)
|
foreach (IntVec3 cell in occupiedRect)
|
||||||
@@ -110,9 +102,23 @@ namespace WulaFallenEmpire
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
TerrainDef terrain = map.terrainGrid.TerrainAt(cell);
|
TerrainDef terrain = map.terrainGrid.TerrainAt(cell);
|
||||||
if (terrain == null || !terrain.affordances.Contains(requiredAffordance))
|
if (terrain == null)
|
||||||
{
|
{
|
||||||
failReason = $"地形 {terrain?.LabelCap ?? "未知"} 不支持放置 {buildingDef.LabelCap}";
|
failReason = "未知地形";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 检查是否在水体上
|
||||||
|
if (terrain.IsWater)
|
||||||
|
{
|
||||||
|
failReason = $"无法在水体 ({terrain.LabelCap}) 上放置建筑";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 检查affordance - 使用更宽松的逻辑
|
||||||
|
if (!HasValidAffordance(buildingDef, terrain))
|
||||||
|
{
|
||||||
|
failReason = $"地形 {terrain.LabelCap} 不支持放置 {buildingDef.LabelCap}";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -121,6 +127,23 @@ namespace WulaFallenEmpire
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 检查affordance兼容性 - 重新设计的逻辑
|
||||||
|
/// </summary>
|
||||||
|
private static bool HasValidAffordance(ThingDef buildingDef, TerrainDef terrain)
|
||||||
|
{
|
||||||
|
// 如果建筑没有指定affordance要求,则跳过检查
|
||||||
|
if (buildingDef.terrainAffordanceNeeded == null)
|
||||||
|
return true;
|
||||||
|
|
||||||
|
// 如果地形没有affordances列表,则检查失败
|
||||||
|
if (terrain.affordances == null || terrain.affordances.Count == 0)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
// 检查地形是否提供建筑所需的affordance
|
||||||
|
return terrain.affordances.Contains(buildingDef.terrainAffordanceNeeded);
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 检查区域是否被其他建筑阻挡(排除指定物体)
|
/// 检查区域是否被其他建筑阻挡(排除指定物体)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -182,27 +205,6 @@ namespace WulaFallenEmpire
|
|||||||
{
|
{
|
||||||
CellRect occupiedRect = GenAdj.OccupiedRect(center, Rot4.North, buildingDef.Size);
|
CellRect occupiedRect = GenAdj.OccupiedRect(center, Rot4.North, buildingDef.Size);
|
||||||
|
|
||||||
// 检查是否在水体上
|
|
||||||
foreach (IntVec3 cell in occupiedRect)
|
|
||||||
{
|
|
||||||
if (!cell.InBounds(map))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
TerrainDef terrain = map.terrainGrid.TerrainAt(cell);
|
|
||||||
if (terrain != null && (terrain.IsWater || terrain.defName.Contains("Water")))
|
|
||||||
{
|
|
||||||
failReason = "无法在水体上放置建筑";
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 检查是否在不可建造的地形上
|
|
||||||
if (terrain != null && !terrain.BuildableByPlayer)
|
|
||||||
{
|
|
||||||
failReason = $"地形 {terrain.LabelCap} 不可建造";
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
failReason = null;
|
failReason = null;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user