ZC
This commit is contained in:
Binary file not shown.
117
1.6/1.6/Defs/PrefabDefs/WULA_Prefabs.xml
Normal file
117
1.6/1.6/Defs/PrefabDefs/WULA_Prefabs.xml
Normal file
@@ -0,0 +1,117 @@
|
||||
<Defs>
|
||||
<PrefabDef>
|
||||
<defName>WULA_NewColonyBase</defName> <!-- rename -->
|
||||
<size>(13,13)</size>
|
||||
<things>
|
||||
<SimpleResearchBench>
|
||||
<position>(10, 0, 10)</position>
|
||||
<stuff>WULA_Alloy</stuff>
|
||||
</SimpleResearchBench>
|
||||
<Battery>
|
||||
<position>(3, 0, 1)</position>
|
||||
<relativeRotation>Clockwise</relativeRotation>
|
||||
</Battery>
|
||||
<Table1x2c>
|
||||
<position>(6, 0, 10)</position>
|
||||
<relativeRotation>Clockwise</relativeRotation>
|
||||
<stuff>WULA_Alloy</stuff>
|
||||
<quality>Normal</quality>
|
||||
</Table1x2c>
|
||||
<WULA_OrbitalTradeBeacon>
|
||||
<position>(1, 0, 10)</position>
|
||||
</WULA_OrbitalTradeBeacon>
|
||||
<WULA_Charging_Station_Synth>
|
||||
<positions>
|
||||
<li>(11, 0, 1)</li>
|
||||
<li>(11, 0, 3)</li>
|
||||
</positions>
|
||||
<relativeRotation>Counterclockwise</relativeRotation>
|
||||
<quality>Normal</quality>
|
||||
</WULA_Charging_Station_Synth>
|
||||
<ChessTable>
|
||||
<position>(6, 0, 11)</position>
|
||||
<stuff>WULA_Alloy</stuff>
|
||||
<quality>Normal</quality>
|
||||
</ChessTable>
|
||||
<WulaDoor>
|
||||
<rects>
|
||||
<li>(6,0,6,0)</li>
|
||||
<li>(4,3,4,3)</li>
|
||||
<li>(4,9,4,9)</li>
|
||||
</rects>
|
||||
</WulaDoor>
|
||||
<WULA_MaintenancePod>
|
||||
<position>(2, 0, 6)</position>
|
||||
<relativeRotation>Counterclockwise</relativeRotation>
|
||||
</WULA_MaintenancePod>
|
||||
<Stool>
|
||||
<rects>
|
||||
<li>(6,9,6,9)</li>
|
||||
<li>(7,11,7,11)</li>
|
||||
</rects>
|
||||
<stuff>WULA_Alloy</stuff>
|
||||
<quality>Normal</quality>
|
||||
</Stool>
|
||||
<WULA_Wall_Flag_Building>
|
||||
<rects>
|
||||
<li>(3,8,3,8)</li>
|
||||
<li>(5,8,5,8)</li>
|
||||
</rects>
|
||||
</WULA_Wall_Flag_Building>
|
||||
<Heater>
|
||||
<position>(11, 0, 5)</position>
|
||||
</Heater>
|
||||
<DiningChair>
|
||||
<position>(10, 0, 9)</position>
|
||||
<stuff>WULA_Alloy</stuff>
|
||||
<quality>Normal</quality>
|
||||
</DiningChair>
|
||||
<WULA_Machine_Recharger>
|
||||
<position>(6, 0, 6)</position>
|
||||
</WULA_Machine_Recharger>
|
||||
<WULA_Cube_Productor>
|
||||
<position>(7, 0, 9)</position>
|
||||
</WULA_Cube_Productor>
|
||||
<ChemfuelPoweredGenerator>
|
||||
<position>(1, 0, 1)</position>
|
||||
</ChemfuelPoweredGenerator>
|
||||
<WallLamp>
|
||||
<rects>
|
||||
<li>(3,1,3,1)</li>
|
||||
<li>(9,1,9,1)</li>
|
||||
</rects>
|
||||
<relativeRotation>Opposite</relativeRotation>
|
||||
</WallLamp>
|
||||
<WallLamp>
|
||||
<rects>
|
||||
<li>(3,11,3,11)</li>
|
||||
<li>(9,11,9,11)</li>
|
||||
</rects>
|
||||
</WallLamp>
|
||||
<WulaWall>
|
||||
<rects>
|
||||
<li>(0,0,5,0)</li>
|
||||
<li>(7,0,12,0)</li>
|
||||
<li>(0,1,0,12)</li>
|
||||
<li>(5,1,5,3)</li>
|
||||
<li>(12,1,12,12)</li>
|
||||
<li>(10,2,11,2)</li>
|
||||
<li>(1,3,3,3)</li>
|
||||
<li>(9,4,11,4)</li>
|
||||
<li>(1,9,3,9)</li>
|
||||
<li>(5,9,5,12)</li>
|
||||
<li>(1,12,4,12)</li>
|
||||
<li>(6,12,11,12)</li>
|
||||
</rects>
|
||||
</WulaWall>
|
||||
<Shelf>
|
||||
<positions>
|
||||
<li>(2, 0, 11)</li>
|
||||
<li>(4, 0, 11)</li>
|
||||
</positions>
|
||||
<relativeRotation>Opposite</relativeRotation>
|
||||
<stuff>WULA_Alloy</stuff>
|
||||
</Shelf>
|
||||
</things>
|
||||
</PrefabDef>
|
||||
</Defs>
|
||||
@@ -85,6 +85,11 @@
|
||||
<thingDef>WULA_Fake_Mothership_Beacon_Building</thingDef>
|
||||
<count>1</count>
|
||||
</li>
|
||||
<li Class="ScenPart_StartingThing_Defined">
|
||||
<def>StartingThing_Defined</def>
|
||||
<thingDef>WULA_Prefab_Cleanzone_NewColonyBase_Beacon</thingDef>
|
||||
<count>1</count>
|
||||
</li>
|
||||
|
||||
<!-- 附近的物品 -->
|
||||
<li Class="ScenPart_ScatterThingsNearPlayerStart">
|
||||
|
||||
@@ -1534,4 +1534,5 @@
|
||||
</comps>
|
||||
<designationCategory>WULA_Buildings</designationCategory>
|
||||
</ThingDef>
|
||||
|
||||
</Defs>
|
||||
@@ -1,5 +1,60 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Defs>
|
||||
<ThingDef ParentName="BuildingBase">
|
||||
<defName>WULA_OrbitalTradeBeacon</defName>
|
||||
<label>乌拉轨道输送信标</label>
|
||||
<thingClass>Building_OrbitalTradeBeacon</thingClass>
|
||||
<graphicData>
|
||||
<texPath>Things/Building/Misc/DropBeacon</texPath>
|
||||
<graphicClass>Graphic_Single</graphicClass>
|
||||
<shadowData>
|
||||
<volume>(0.3, 0.2, 0.3)</volume>
|
||||
<offset>(0,0,-0.1)</offset>
|
||||
</shadowData>
|
||||
<damageData>
|
||||
<rect>(0.2,0.2,0.6,0.6)</rect>
|
||||
</damageData>
|
||||
</graphicData>
|
||||
<altitudeLayer>Building</altitudeLayer>
|
||||
<minifiedDef>MinifiedThing</minifiedDef>
|
||||
<statBases>
|
||||
<MaxHitPoints>75</MaxHitPoints>
|
||||
<WorkToBuild>800</WorkToBuild>
|
||||
<Flammability>0.5</Flammability>
|
||||
<Mass>5</Mass>
|
||||
</statBases>
|
||||
<description>负责协调殖民地与轨道上的乌拉帝国舰队进行材料输送的信标.</description>
|
||||
<drawerType>MapMeshAndRealTime</drawerType>
|
||||
<drawPlaceWorkersWhileSelected>true</drawPlaceWorkersWhileSelected>
|
||||
<fillPercent>0.15</fillPercent>
|
||||
<costList>
|
||||
<Steel>40</Steel>
|
||||
<ComponentIndustrial>1</ComponentIndustrial>
|
||||
</costList>
|
||||
<building>
|
||||
<destroySound>BuildingDestroyed_Metal_Small</destroySound>
|
||||
</building>
|
||||
<comps>
|
||||
<li Class="CompProperties_Power">
|
||||
<compClass>CompPowerTrader</compClass>
|
||||
<basePowerConsumption>-1</basePowerConsumption>
|
||||
</li>
|
||||
<li Class="CompProperties_Flickable"/>
|
||||
<li Class="CompProperties_Breakdownable"/>
|
||||
</comps>
|
||||
<leaveResourcesWhenKilled>false</leaveResourcesWhenKilled>
|
||||
<pathCost>14</pathCost>
|
||||
<designationCategory>WULA_Buildings</designationCategory>
|
||||
<uiOrder>2100</uiOrder>
|
||||
<rotatable>false</rotatable>
|
||||
<placeWorkers>
|
||||
<li>PlaceWorker_ShowTradeBeaconRadius</li>
|
||||
</placeWorkers>
|
||||
<designationHotKey>Misc2</designationHotKey>
|
||||
<researchPrerequisites>
|
||||
<li>Techprint_WULA_Colony_License_LV1_Technology</li>
|
||||
</researchPrerequisites>
|
||||
</ThingDef>
|
||||
<!-- 舰队 -->
|
||||
<ThingDef ParentName="BuildingBase">
|
||||
<defName>WULA_Fake_Mothership_Beacon_Building</defName>
|
||||
|
||||
110
1.6/1.6/Defs/ThingDefs_Buildings/WULA_Prefab_Beacons.xml
Normal file
110
1.6/1.6/Defs/ThingDefs_Buildings/WULA_Prefab_Beacons.xml
Normal file
@@ -0,0 +1,110 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<Defs>
|
||||
<!-- Prefab Spawner Skyfaller -->
|
||||
<ThingDef ParentName="SkyfallerBase">
|
||||
<defName>WULA_Prefab_Incoming</defName>
|
||||
<label>乌拉帝国建筑(空投中)</label>
|
||||
<thingClass>WulaFallenEmpire.Skyfaller_PrefabSpawner</thingClass>
|
||||
<size>(1,1)</size>
|
||||
<graphicData>
|
||||
<texPath>Wula/Building/Linked/WULA_Fortress_Wall_MenuIcon</texPath>
|
||||
<graphicClass>Graphic_Single</graphicClass>
|
||||
<shaderType>CutoutFlying</shaderType>
|
||||
<drawSize>(1,1)</drawSize>
|
||||
</graphicData>
|
||||
<skyfaller>
|
||||
<movementType>Accelerate</movementType>
|
||||
<shadow>Things/Skyfaller/SkyfallerShadowDropPod</shadow>
|
||||
<shadowSize>(1, 1)</shadowSize>
|
||||
<anticipationSound>DropPod_Fall</anticipationSound>
|
||||
<anticipationSoundTicks>100</anticipationSoundTicks>
|
||||
<impactSound>Explosion_Vaporize</impactSound>
|
||||
<moteSpawnTime>0.05</moteSpawnTime>
|
||||
<motesPerCell>1</motesPerCell>
|
||||
<cameraShake>1</cameraShake>
|
||||
<angleCurve>
|
||||
<points>
|
||||
<li>(0,0)</li>
|
||||
<li>(1, 1)</li>
|
||||
</points>
|
||||
</angleCurve>
|
||||
</skyfaller>
|
||||
<comps>
|
||||
<li Class="CompProperties_Effecter">
|
||||
<effecterDef>Smoke_Joint</effecterDef>
|
||||
</li>
|
||||
</comps>
|
||||
</ThingDef>
|
||||
|
||||
<!-- 墙和门 -->
|
||||
<ThingDef ParentName="Wall">
|
||||
<defName>WULA_Prefab_Cleanzone_NewColonyBase_Beacon</defName>
|
||||
<label>乌拉预制件空投信标-小型前哨站</label>
|
||||
<description>一个用于呼叫建筑的信标,用于快速建造一个小型前哨站。</description>
|
||||
<uiIconPath>Wula/Building/Linked/WULA_Fortress_Wall_MenuIcon</uiIconPath>
|
||||
<minifiedDef>MinifiedThing</minifiedDef>
|
||||
<tickerType>Normal</tickerType>
|
||||
<descriptionHyperlinks>
|
||||
<ThingDef>WulaWall</ThingDef>
|
||||
</descriptionHyperlinks>
|
||||
<thingCategories Inherit="False">
|
||||
<li>BuildingsMisc</li>
|
||||
</thingCategories>
|
||||
<graphicData>
|
||||
<texPath>Wula/Building/Linked/WulaWall/WulaWall_Atlas</texPath>
|
||||
<graphicClass>Graphic_Multi</graphicClass>
|
||||
<drawSize>(1,1)</drawSize>
|
||||
<color>(73,185,254,155)</color>
|
||||
</graphicData>
|
||||
<rotatable>false</rotatable>
|
||||
<neverMultiSelect>false</neverMultiSelect>
|
||||
<blockLight>false</blockLight>
|
||||
<holdsRoof>false</holdsRoof>
|
||||
<coversFloor>false</coversFloor>
|
||||
<blockWind>false</blockWind>
|
||||
<altitudeLayer>Building</altitudeLayer>
|
||||
<passability>PassThroughOnly</passability>
|
||||
<pathCost>0</pathCost>
|
||||
<castEdgeShadows>false</castEdgeShadows>
|
||||
<useStuffTerrainAffordance>false</useStuffTerrainAffordance>
|
||||
<staticSunShadowHeight Inherit="False" IsNull="True" />
|
||||
<fillPercent>0</fillPercent>
|
||||
<canOverlapZones>false</canOverlapZones>
|
||||
<terrainAffordanceNeeded>Light</terrainAffordanceNeeded>
|
||||
<statBases>
|
||||
<MaxHitPoints>1</MaxHitPoints>
|
||||
<WorkToBuild>0</WorkToBuild>
|
||||
<Mass>1</Mass>
|
||||
<Flammability>0</Flammability>
|
||||
</statBases>
|
||||
<size>(1,1)</size>
|
||||
<constructionSkillPrerequisite>0</constructionSkillPrerequisite>
|
||||
<resourcesFractionWhenDeconstructed>1</resourcesFractionWhenDeconstructed>
|
||||
<stuffCategories Inherit="False"/>
|
||||
<researchPrerequisites Inherit="False">
|
||||
<li>WULA_Structure_Technology</li>
|
||||
</researchPrerequisites>
|
||||
<costStuffCount>0</costStuffCount>
|
||||
<costList>
|
||||
<WULA_Alloy>4</WULA_Alloy>
|
||||
</costList>
|
||||
<building>
|
||||
<destroySound>BuildingDestroyed_Metal_Small</destroySound>
|
||||
<isAirtight>false</isAirtight>
|
||||
<isStuffableAirtight>false</isStuffableAirtight>
|
||||
</building>
|
||||
<designationCategory>WULA_Buildings</designationCategory>
|
||||
<comps>
|
||||
<li Class="WulaFallenEmpire.CompProperties_PrefabSkyfallerCaller">
|
||||
<prefabDefName>WULA_NewColonyBase</prefabDefName>
|
||||
<freePrefab>true</freePrefab>
|
||||
<skyfallerDef>WULA_Prefab_Incoming</skyfallerDef>
|
||||
<destroyBuilding>true</destroyBuilding>
|
||||
<delayTicks>1</delayTicks>
|
||||
<allowThinRoof>true</allowThinRoof>
|
||||
<allowThickRoof>false</allowThickRoof>
|
||||
</li>
|
||||
</comps>
|
||||
</ThingDef>
|
||||
|
||||
</Defs>
|
||||
13
1.6/Defs/ThingDefs_Buildings/WULA_Drop_Buildings.xml
Normal file
13
1.6/Defs/ThingDefs_Buildings/WULA_Drop_Buildings.xml
Normal file
@@ -0,0 +1,13 @@
|
||||
<!-- Prefab Spawner Skyfaller -->
|
||||
<ThingDef ParentName="SkyfallerBase">
|
||||
<defName>WULA_Skyfaller_PrefabSpawner</defName>
|
||||
<label>prefab cargo pod</label>
|
||||
<thingClass>WulaFallenEmpire.Skyfaller_PrefabSpawner</thingClass>
|
||||
<skyfaller>
|
||||
<shadowSize>(6, 6)</shadowSize>
|
||||
<explosionRadius>5</explosionRadius>
|
||||
<explosionDamage>Bomb</explosionDamage>
|
||||
<impactSound>DropPod_Impact</impactSound>
|
||||
<shake>Medium</shake>
|
||||
</skyfaller>
|
||||
</ThingDef>
|
||||
@@ -0,0 +1,15 @@
|
||||
using Verse;
|
||||
|
||||
namespace WulaFallenEmpire
|
||||
{
|
||||
public class CompProperties_PrefabSpawner : CompProperties
|
||||
{
|
||||
public string prefabDefName;
|
||||
public bool consumesMaterials = true;
|
||||
|
||||
public CompProperties_PrefabSpawner()
|
||||
{
|
||||
compClass = typeof(CompPrefabSpawner);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,105 @@
|
||||
using RimWorld;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Verse;
|
||||
|
||||
namespace WulaFallenEmpire
|
||||
{
|
||||
public class CompPrefabSkyfallerCaller : CompSkyfallerCaller
|
||||
{
|
||||
private CompProperties_PrefabSkyfallerCaller PropsPrefab => (CompProperties_PrefabSkyfallerCaller)props;
|
||||
|
||||
private List<ThingDefCountClass> _cachedCostList;
|
||||
|
||||
protected override List<ThingDefCountClass> CostList
|
||||
{
|
||||
get
|
||||
{
|
||||
if (!string.IsNullOrEmpty(PropsPrefab.prefabDefName))
|
||||
{
|
||||
if (PropsPrefab.freePrefab)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
if (_cachedCostList == null)
|
||||
{
|
||||
_cachedCostList = CalculatePrefabCost();
|
||||
}
|
||||
return _cachedCostList;
|
||||
}
|
||||
return base.CostList;
|
||||
}
|
||||
}
|
||||
|
||||
private List<ThingDefCountClass> CalculatePrefabCost()
|
||||
{
|
||||
var prefab = DefDatabase<PrefabDef>.GetNamed(PropsPrefab.prefabDefName, false);
|
||||
if (prefab == null)
|
||||
{
|
||||
Log.Error($"[PrefabSkyfallerCaller] Could not find PrefabDef named {PropsPrefab.prefabDefName}");
|
||||
return new List<ThingDefCountClass>(); // Return empty list to avoid null reference
|
||||
}
|
||||
|
||||
var totalCost = new Dictionary<ThingDef, int>();
|
||||
foreach (var (thingData, _, _) in PrefabUtility.GetThings(prefab, IntVec3.Zero, Rot4.North))
|
||||
{
|
||||
if (thingData.def.costList != null)
|
||||
{
|
||||
foreach (var cost in thingData.def.costList)
|
||||
{
|
||||
if (totalCost.ContainsKey(cost.thingDef))
|
||||
{
|
||||
totalCost[cost.thingDef] += cost.count;
|
||||
}
|
||||
else
|
||||
{
|
||||
totalCost.Add(cost.thingDef, cost.count);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return totalCost.Select(kvp => new ThingDefCountClass(kvp.Key, kvp.Value)).ToList();
|
||||
}
|
||||
|
||||
protected override void ExecuteSkyfallerCall()
|
||||
{
|
||||
if (!string.IsNullOrEmpty(PropsPrefab.prefabDefName))
|
||||
{
|
||||
// Final material check before launching
|
||||
if (!HasEnoughMaterials())
|
||||
{
|
||||
Log.Warning($"[PrefabSkyfallerCaller] Aborting skyfaller call due to insufficient materials at the last moment.");
|
||||
ResetCall(); // Reset the calling state
|
||||
return;
|
||||
}
|
||||
|
||||
ConsumeMaterials();
|
||||
|
||||
Thing thing = ThingMaker.MakeThing(Props.skyfallerDef);
|
||||
if (thing is Skyfaller_PrefabSpawner skyfaller)
|
||||
{
|
||||
skyfaller.prefabDefName = PropsPrefab.prefabDefName;
|
||||
GenSpawn.Spawn(skyfaller, parent.Position, parent.Map);
|
||||
}
|
||||
else
|
||||
{
|
||||
Log.Error($"[PrefabSkyfallerCaller] Failed to create Skyfaller_PrefabSpawner. Created thing is of type {thing.GetType().FullName}. Def: {Props.skyfallerDef.defName}, ThingClass: {Props.skyfallerDef.thingClass.FullName}");
|
||||
// Fallback: spawn as normal skyfaller if possible, or just abort
|
||||
if (thing is Skyfaller normalSkyfaller)
|
||||
{
|
||||
GenSpawn.Spawn(normalSkyfaller, parent.Position, parent.Map);
|
||||
}
|
||||
}
|
||||
|
||||
if (PropsPrefab.destroyBuilding && !parent.Destroyed)
|
||||
{
|
||||
parent.Destroy(DestroyMode.Vanish);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
base.ExecuteSkyfallerCall();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
using Verse;
|
||||
|
||||
namespace WulaFallenEmpire
|
||||
{
|
||||
public class CompProperties_PrefabSkyfallerCaller : CompProperties_SkyfallerCaller
|
||||
{
|
||||
public string prefabDefName;
|
||||
public bool freePrefab = false;
|
||||
|
||||
public CompProperties_PrefabSkyfallerCaller()
|
||||
{
|
||||
compClass = typeof(CompPrefabSkyfallerCaller);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -10,7 +10,7 @@ namespace WulaFallenEmpire
|
||||
{
|
||||
public class CompSkyfallerCaller : ThingComp
|
||||
{
|
||||
private CompProperties_SkyfallerCaller Props => (CompProperties_SkyfallerCaller)props;
|
||||
protected CompProperties_SkyfallerCaller Props => (CompProperties_SkyfallerCaller)props;
|
||||
|
||||
private WulaSkyfallerWorldComponent _worldComponent;
|
||||
private WulaSkyfallerWorldComponent WorldComp
|
||||
@@ -89,83 +89,29 @@ namespace WulaFallenEmpire
|
||||
}
|
||||
catch (System.Exception ex)
|
||||
{
|
||||
Log.Error($"[SkyfallerCaller] Error in HasRequiredFlyOver: {ex}");
|
||||
Log.Error($"[SkyfallerCaller] Exception while checking for FlyOver: {ex}");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 检查屋顶条件
|
||||
public bool CheckRoofConditions
|
||||
private bool CheckRoofConditions
|
||||
{
|
||||
get
|
||||
{
|
||||
if (parent?.Map == null) return false;
|
||||
if (parent?.Map == null) return true;
|
||||
|
||||
IntVec3 targetPos = parent.Position;
|
||||
RoofDef roof = targetPos.GetRoof(parent.Map);
|
||||
RoofDef roof = parent.Position.GetRoof(parent.Map);
|
||||
if (roof == null) return true;
|
||||
|
||||
if (roof == null)
|
||||
{
|
||||
Log.Message($"[SkyfallerCaller] No roof at target position, skyfaller allowed");
|
||||
return true; // 没有屋顶,允许空投
|
||||
}
|
||||
if (roof.isThickRoof && !Props.allowThickRoof) return false;
|
||||
if (!roof.isThickRoof && !Props.allowThinRoof) return false;
|
||||
|
||||
if (roof.isThickRoof)
|
||||
{
|
||||
Log.Message($"[SkyfallerCaller] Thick roof detected at target position: {roof.defName}");
|
||||
return Props.allowThickRoof; // 厚岩顶,根据配置决定
|
||||
}
|
||||
else
|
||||
{
|
||||
Log.Message($"[SkyfallerCaller] Thin roof detected at target position: {roof.defName}");
|
||||
return Props.allowThinRoof; // 薄屋顶,根据配置决定
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 检查所有召唤条件
|
||||
public bool CanCallSkyfaller
|
||||
{
|
||||
get
|
||||
{
|
||||
if (!CanCall)
|
||||
{
|
||||
Log.Message($"[SkyfallerCaller] Cannot call: already used or calling");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!HasRequiredFlyOver)
|
||||
{
|
||||
Log.Message($"[SkyfallerCaller] Cannot call: missing required FlyOver with BuildingdropperFacility");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!CheckRoofConditions)
|
||||
{
|
||||
Log.Message($"[SkyfallerCaller] Cannot call: roof conditions not met");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!HasEnoughMaterials())
|
||||
{
|
||||
Log.Message($"[SkyfallerCaller] Cannot call: insufficient materials");
|
||||
return false;
|
||||
}
|
||||
|
||||
Log.Message($"[SkyfallerCaller] All conditions met for skyfaller call");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public override void PostSpawnSetup(bool respawningAfterLoad)
|
||||
{
|
||||
base.PostSpawnSetup(respawningAfterLoad);
|
||||
if (!respawningAfterLoad && Props.canAutoCall && WorldComp.AutoCallSkyfaller && CanCallSkyfaller)
|
||||
{
|
||||
CallSkyfaller(true);
|
||||
}
|
||||
}
|
||||
public bool CanCallSkyfaller => CanCall && HasRequiredFlyOver && CheckRoofConditions;
|
||||
|
||||
public override void PostExposeData()
|
||||
{
|
||||
@@ -178,7 +124,6 @@ namespace WulaFallenEmpire
|
||||
public override void CompTick()
|
||||
{
|
||||
base.CompTick();
|
||||
|
||||
if (calling && callTick >= 0 && Find.TickManager.TicksGame >= callTick)
|
||||
{
|
||||
ExecuteSkyfallerCall();
|
||||
@@ -225,7 +170,14 @@ namespace WulaFallenEmpire
|
||||
}
|
||||
}
|
||||
|
||||
private void ExecuteSkyfallerCall()
|
||||
protected void ResetCall()
|
||||
{
|
||||
calling = false;
|
||||
used = false;
|
||||
callTick = -1;
|
||||
}
|
||||
|
||||
protected virtual void ExecuteSkyfallerCall()
|
||||
{
|
||||
Log.Message($"[SkyfallerCaller] Executing skyfaller call at {parent.Position}");
|
||||
|
||||
@@ -238,9 +190,7 @@ namespace WulaFallenEmpire
|
||||
if (!HasEnoughMaterials())
|
||||
{
|
||||
Log.Message($"[SkyfallerCaller] Aborting skyfaller call due to insufficient materials.");
|
||||
calling = false;
|
||||
used = false;
|
||||
callTick = -1;
|
||||
ResetCall();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -289,7 +239,7 @@ namespace WulaFallenEmpire
|
||||
}
|
||||
}
|
||||
|
||||
private List<ThingDefCountClass> CostList
|
||||
protected virtual List<ThingDefCountClass> CostList
|
||||
{
|
||||
get
|
||||
{
|
||||
@@ -301,8 +251,10 @@ namespace WulaFallenEmpire
|
||||
}
|
||||
}
|
||||
|
||||
private bool HasEnoughMaterials()
|
||||
protected bool HasEnoughMaterials()
|
||||
{
|
||||
if (DebugSettings.godMode) return true;
|
||||
|
||||
var costList = CostList;
|
||||
if (costList.NullOrEmpty())
|
||||
{
|
||||
@@ -349,8 +301,10 @@ namespace WulaFallenEmpire
|
||||
return true;
|
||||
}
|
||||
|
||||
private void ConsumeMaterials()
|
||||
protected void ConsumeMaterials()
|
||||
{
|
||||
if (DebugSettings.godMode) return;
|
||||
|
||||
var costList = CostList;
|
||||
if (costList.NullOrEmpty())
|
||||
{
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
using RimWorld;
|
||||
using Verse;
|
||||
|
||||
namespace WulaFallenEmpire
|
||||
{
|
||||
public class Skyfaller_PrefabSpawner : Skyfaller
|
||||
{
|
||||
public string prefabDefName;
|
||||
|
||||
protected override void SpawnThings()
|
||||
{
|
||||
// Don't spawn the innerThing, we are spawning a prefab instead.
|
||||
if (string.IsNullOrEmpty(prefabDefName))
|
||||
{
|
||||
Log.Error("[Skyfaller_PrefabSpawner] prefabDefName is null or empty. Cannot spawn prefab.");
|
||||
return;
|
||||
}
|
||||
|
||||
PrefabDef prefabDef = DefDatabase<PrefabDef>.GetNamed(prefabDefName, false);
|
||||
if (prefabDef == null)
|
||||
{
|
||||
Log.Error($"[Skyfaller_PrefabSpawner] Could not find PrefabDef named {prefabDefName}.");
|
||||
return;
|
||||
}
|
||||
|
||||
// Correct parameter order based on compiler error: prefabDef, map, position, rotation
|
||||
PrefabUtility.SpawnPrefab(prefabDef, base.Map, base.Position, base.Rotation);
|
||||
}
|
||||
|
||||
public override void ExposeData()
|
||||
{
|
||||
base.ExposeData();
|
||||
Scribe_Values.Look(ref prefabDefName, "prefabDefName");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -116,6 +116,9 @@
|
||||
<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_SkyfallerCaller\CompPrefabSkyfallerCaller.cs" />
|
||||
<Compile Include="BuildingComp\WULA_SkyfallerCaller\CompProperties_PrefabSkyfallerCaller.cs" />
|
||||
<Compile Include="BuildingComp\WULA_SkyfallerCaller\Skyfaller_PrefabSpawner.cs" />
|
||||
<Compile Include="BuildingComp\WULA_SkyfallerCaller\WulaSkyfallerWorldComponent.cs" />
|
||||
<Compile Include="BuildingComp\WULA_StorageTurret\CompProperties_StorageTurret.cs" />
|
||||
<Compile Include="BuildingComp\WULA_StorageTurret\CompStorageTurret.cs" />
|
||||
|
||||
Reference in New Issue
Block a user