This commit is contained in:
2025-09-21 16:48:23 +08:00
parent a27f7a8289
commit b9e6d6ca8b
7 changed files with 88 additions and 41 deletions

Binary file not shown.

View File

@@ -46,6 +46,7 @@
<li>ARA_GrowthVat</li>
<li>ARA_MorphableResearchBench</li>
<li>ARANutrientDispenser</li>
<li>ARA_WormholePortal_A</li>
</linkableBuildings>
<maxDistance>80</maxDistance> <!-- 供能范围 -->
<maxSimultaneous>10</maxSimultaneous>
@@ -61,6 +62,7 @@
<li>ARA_GrowthVat</li>
<li>ARA_MorphableResearchBench</li>
<li>ARANutrientDispenser</li>
<li>ARA_WormholePortal_A</li>
</linkableBuildings>
<maxDistance>80</maxDistance>
<lineTexturePath>ArachnaeSwarm/Building/Nutrition_Pie</lineTexturePath>

View File

@@ -11,7 +11,7 @@
<texPath>ArachnaeSwarm/Building/ARA_Wormhole_A</texPath>
<graphicClass>Graphic_Single</graphicClass>
<shaderType>CutoutComplex</shaderType>
<drawSize>(2.2,2.2)</drawSize>
<drawSize>(4,4)</drawSize>
<shadowData>
<volume>(1.6, 0.5, 1.6)</volume>
<offset>(0,0,-0.1)</offset>
@@ -21,19 +21,23 @@
<passability>Impassable</passability>
<tickerType>Normal</tickerType>
<category>Building</category>
<pathCost>50</pathCost>
<statBases>
<MaxHitPoints>250</MaxHitPoints>
<MaxHitPoints>1000</MaxHitPoints>
<WorkToBuild>8000</WorkToBuild>
<Flammability>0.5</Flammability>
<Mass>100</Mass>
</statBases>
<size>(2,2)</size>
<costList>
<Plasteel>100</Plasteel>
<ComponentSpacer>6</ComponentSpacer>
<ARA_Carapace>50</ARA_Carapace>
</costList>
<comps>
<li Class="CompProperties_Glower">
<overlightRadius>7.0</overlightRadius>
<glowRadius>14</glowRadius>
<glowColor>(220,210,171,0)</glowColor>
<colorPickerEnabled>true</colorPickerEnabled>
</li>
<li Class="CompProperties_Flickable"/>
<li Class="ArachnaeSwarm.CompProperties_RefuelableNutrition">
<fuelCapacity>500.0</fuelCapacity>
@@ -49,13 +53,20 @@
<li Class="ArachnaeSwarm.CompProperties_LaunchableWormhole">
<fuelPerTile>2.5</fuelPerTile>
</li>
<li Class="CompProperties_AffectedByFacilities">
<linkableFacilities>
<li>ARA_NutrientNetworkTower</li>
</linkableFacilities>
</li>
</comps>
<designationCategory>ARA_Buildings</designationCategory>
<terrainAffordanceNeeded>ARA_Creep</terrainAffordanceNeeded>
<building>
<ai_chillDestination>false</ai_chillDestination>
</building>
<portal>
<traverseSound>Message_FleshbeastsDiscovered</traverseSound>
<traverseSound>TraversePitGate</traverseSound>
</portal>
</ThingDef>
@@ -69,7 +80,7 @@
<texPath>ArachnaeSwarm/Building/ARA_Wormhole_B</texPath>
<graphicClass>Graphic_Single</graphicClass>
<shaderType>CutoutComplex</shaderType>
<drawSize>(2.2,2.2)</drawSize>
<drawSize>(4,4)</drawSize>
<shadowData>
<volume>(1.6, 0.5, 1.6)</volume>
<offset>(0,0,-0.1)</offset>
@@ -78,16 +89,22 @@
<altitudeLayer>Building</altitudeLayer>
<passability>Impassable</passability>
<statBases>
<MaxHitPoints>250</MaxHitPoints>
<MaxHitPoints>500</MaxHitPoints>
<Flammability>0.5</Flammability>
</statBases>
<size>(2,2)</size>
<comps>
<li Class="CompProperties_Glower">
<overlightRadius>7.0</overlightRadius>
<glowRadius>14</glowRadius>
<glowColor>(220,210,171,0)</glowColor>
<colorPickerEnabled>true</colorPickerEnabled>
</li>
<li Class="CompProperties_Flickable"/>
</comps>
<tradeability>None</tradeability>
<portal>
<traverseSound>Message_FleshbeastsDiscovered</traverseSound>
<traverseSound>TraversePitGate</traverseSound>
</portal>
</ThingDef>

View File

@@ -5,5 +5,6 @@
<CommandDeployWormholePortalB_Pilot>部署虫洞传送门</CommandDeployWormholePortalB_Pilot>
<CommandDeployWormholePortalB_PilotDesc>选择一名驾驶员来启动一个B端传送门。</CommandDeployWormholePortalB_PilotDesc>
<NoPilotAvailable>没有可用的驾驶员</NoPilotAvailable>
<ForceLaunch>无人驾驶发射</ForceLaunch>
</LanguageData>

View File

@@ -62,6 +62,10 @@ namespace ArachnaeSwarm
}
options.Add(new FloatMenuOption(p.LabelCap, pilotAction));
}
// Add force launch option
options.Add(new FloatMenuOption("ForceLaunch".Translate(), () => StartChoosingDestination(null)));
Find.WindowStack.Add(new FloatMenu(options));
};
@@ -100,24 +104,47 @@ namespace ArachnaeSwarm
return false;
}
var mapParent = Find.WorldObjects.MapParentAt(t.Tile);
if (mapParent != null && mapParent.HasMap)
{
// Has map, let player choose local destination
StartChoosingLocalDestination(mapParent.Map, pilot, t.Tile, distance);
}
else
{
// No map, deploy to center
Launch(t.Tile, pilot, distance, IntVec3.Invalid);
}
return true;
}
private void StartChoosingLocalDestination(Map map, Pawn pilot, int tile, int distance)
{
CameraJumper.TryJump(new GlobalTargetInfo(map.Center, map));
Find.Targeter.BeginTargeting(TargetingParameters.ForDropPodsDestination(), localTarget =>
{
Launch(tile, pilot, distance, localTarget.Cell);
});
}
private void Launch(int destinationTile, Pawn pilot, int distance, IntVec3 arrivalCell)
{
float fuelCost = distance * Props.fuelPerTile;
refuelableComp.ConsumeFuel(fuelCost);
// Despawn pilot from the source map
pilot.DeSpawn();
if(pilot != null) pilot.DeSpawn();
EffecterDefOf.Skip_Entry.Spawn(this.parent.Position, this.parent.Map);
// Create the traveling object
var travelingWormhole = (TravelingWormhole)WorldObjectMaker.MakeWorldObject(DefDatabase<WorldObjectDef>.GetNamed("ARA_TravelingWormhole"));
travelingWormhole.sourcePortal = this.PortalA;
travelingWormhole.StartMove(parent.Map.Tile, t.Tile, pilot);
travelingWormhole.StartMove(parent.Map.Tile, destinationTile, pilot, arrivalCell);
Find.WorldObjects.Add(travelingWormhole);
PortalA.status = WormholePortalStatus.Deploying;
return true;
}
}

View File

@@ -18,6 +18,8 @@ namespace ArachnaeSwarm
private ThingOwner contents;
public IntVec3 specificArrivalCell = IntVec3.Invalid;
public override Material Material => def.Material;
public override Vector3 DrawPos => Vector3.Slerp(
@@ -38,15 +40,17 @@ namespace ArachnaeSwarm
Scribe_Values.Look(ref initialTile, "initialTile", 0);
Scribe_Values.Look(ref traveledPct, "traveledPct", 0f);
Scribe_Deep.Look(ref contents, "contents", this);
Scribe_Values.Look(ref specificArrivalCell, "specificArrivalCell", IntVec3.Invalid);
}
public void StartMove(int startTile, int destTile, Pawn pilot)
public void StartMove(int startTile, int destTile, Pawn pilot, IntVec3 arrivalCell)
{
initialTile = startTile;
destinationTile = destTile;
this.Tile = startTile;
contents.TryAdd(pilot, true);
this.specificArrivalCell = arrivalCell;
if (pilot != null) contents.TryAdd(pilot, true);
}
protected override void Tick()
@@ -63,31 +67,27 @@ namespace ArachnaeSwarm
private void Arrived()
{
if (contents.Any)
Map targetMap = GetOrGenerateMapUtility.GetOrGenerateMap(destinationTile, WorldObjectDefOf.Camp);
IntVec3 cell = specificArrivalCell.IsValid ? specificArrivalCell : DropCellFinder.RandomDropSpot(targetMap);
Building_WormholePortal_B portalB = (Building_WormholePortal_B)ThingMaker.MakeThing(ThingDef.Named("ARA_WormholePortal_B"));
GenSpawn.Spawn(portalB, cell, targetMap, WipeMode.Vanish);
Pawn pilot = contents.FirstOrDefault() as Pawn;
if (pilot != null)
{
Pawn pilot = contents.First() as Pawn;
if (pilot != null)
{
Map targetMap = GetOrGenerateMapUtility.GetOrGenerateMap(destinationTile, WorldObjectDefOf.Camp);
Building_WormholePortal_B portalB = (Building_WormholePortal_B)ThingMaker.MakeThing(ThingDef.Named("ARA_WormholePortal_B"));
IntVec3 cell = DropCellFinder.RandomDropSpot(targetMap);
GenSpawn.Spawn(portalB, cell, targetMap, WipeMode.Vanish);
IntVec3 pilotSpawnCell = CellFinder.RandomClosewalkCellNear(portalB.Position, targetMap, 5);
GenSpawn.Spawn(pilot, pilotSpawnCell, targetMap, WipeMode.Vanish);
contents.Remove(pilot);
EffecterDefOf.Skip_Exit.Spawn(cell, targetMap);
if (sourcePortal != null && !sourcePortal.Destroyed)
{
sourcePortal.SetLinkedPortal(portalB); // This sets status to Linked
portalB.SetLinkedPortal(sourcePortal);
}
}
IntVec3 pilotSpawnCell = CellFinder.RandomClosewalkCellNear(portalB.Position, targetMap, 5);
GenSpawn.Spawn(pilot, pilotSpawnCell, targetMap, WipeMode.Vanish);
contents.Remove(pilot);
}
EffecterDefOf.Skip_Exit.Spawn(cell, targetMap);
if (sourcePortal != null && !sourcePortal.Destroyed)
{
sourcePortal.SetLinkedPortal(portalB);
portalB.SetLinkedPortal(sourcePortal);
}
Find.WorldObjects.Remove(this);
}