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

View File

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

View File

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

View File

@@ -62,6 +62,10 @@ namespace ArachnaeSwarm
} }
options.Add(new FloatMenuOption(p.LabelCap, pilotAction)); 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)); Find.WindowStack.Add(new FloatMenu(options));
}; };
@@ -100,24 +104,47 @@ namespace ArachnaeSwarm
return false; 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; float fuelCost = distance * Props.fuelPerTile;
refuelableComp.ConsumeFuel(fuelCost); refuelableComp.ConsumeFuel(fuelCost);
// Despawn pilot from the source map if(pilot != null) pilot.DeSpawn();
pilot.DeSpawn();
EffecterDefOf.Skip_Entry.Spawn(this.parent.Position, this.parent.Map); EffecterDefOf.Skip_Entry.Spawn(this.parent.Position, this.parent.Map);
// Create the traveling object
var travelingWormhole = (TravelingWormhole)WorldObjectMaker.MakeWorldObject(DefDatabase<WorldObjectDef>.GetNamed("ARA_TravelingWormhole")); var travelingWormhole = (TravelingWormhole)WorldObjectMaker.MakeWorldObject(DefDatabase<WorldObjectDef>.GetNamed("ARA_TravelingWormhole"));
travelingWormhole.sourcePortal = this.PortalA; travelingWormhole.sourcePortal = this.PortalA;
travelingWormhole.StartMove(parent.Map.Tile, t.Tile, pilot); travelingWormhole.StartMove(parent.Map.Tile, destinationTile, pilot, arrivalCell);
Find.WorldObjects.Add(travelingWormhole); Find.WorldObjects.Add(travelingWormhole);
PortalA.status = WormholePortalStatus.Deploying; PortalA.status = WormholePortalStatus.Deploying;
return true;
} }
} }

View File

@@ -18,6 +18,8 @@ namespace ArachnaeSwarm
private ThingOwner contents; private ThingOwner contents;
public IntVec3 specificArrivalCell = IntVec3.Invalid;
public override Material Material => def.Material; public override Material Material => def.Material;
public override Vector3 DrawPos => Vector3.Slerp( public override Vector3 DrawPos => Vector3.Slerp(
@@ -38,15 +40,17 @@ namespace ArachnaeSwarm
Scribe_Values.Look(ref initialTile, "initialTile", 0); Scribe_Values.Look(ref initialTile, "initialTile", 0);
Scribe_Values.Look(ref traveledPct, "traveledPct", 0f); Scribe_Values.Look(ref traveledPct, "traveledPct", 0f);
Scribe_Deep.Look(ref contents, "contents", this); 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; initialTile = startTile;
destinationTile = destTile; destinationTile = destTile;
this.Tile = startTile; this.Tile = startTile;
contents.TryAdd(pilot, true); this.specificArrivalCell = arrivalCell;
if (pilot != null) contents.TryAdd(pilot, true);
} }
protected override void Tick() protected override void Tick()
@@ -63,31 +67,27 @@ namespace ArachnaeSwarm
private void Arrived() 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; IntVec3 pilotSpawnCell = CellFinder.RandomClosewalkCellNear(portalB.Position, targetMap, 5);
if (pilot != null) GenSpawn.Spawn(pilot, pilotSpawnCell, targetMap, WipeMode.Vanish);
{ contents.Remove(pilot);
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);
}
}
} }
EffecterDefOf.Skip_Exit.Spawn(cell, targetMap);
if (sourcePortal != null && !sourcePortal.Destroyed)
{
sourcePortal.SetLinkedPortal(portalB);
portalB.SetLinkedPortal(sourcePortal);
}
Find.WorldObjects.Remove(this); Find.WorldObjects.Remove(this);
} }