暂存
This commit is contained in:
Binary file not shown.
@@ -4,7 +4,7 @@
|
||||
<JobDef>
|
||||
<defName>ARA_DeployWormhole</defName>
|
||||
<driverClass>ArachnaeSwarm.JobDriver_DeployWormhole</driverClass>
|
||||
<reportString>deploying wormhole.</reportString>
|
||||
<reportString>正在部署虫洞。</reportString>
|
||||
<allowOpportunisticPrefix>true</allowOpportunisticPrefix>
|
||||
</JobDef>
|
||||
|
||||
|
||||
@@ -4,19 +4,18 @@
|
||||
<!-- ==================== A端传送门 ==================== -->
|
||||
<ThingDef ParentName="BuildingBase">
|
||||
<defName>ARA_WormholePortal_A</defName>
|
||||
<label>wormhole portal (A)</label>
|
||||
<description>The primary control unit of a wormhole network. It can launch a secondary portal to a distant location, establishing a stable connection.</description>
|
||||
<label>阿拉克涅坑道虫虫洞</label>
|
||||
<description>阿拉克涅虫洞网络的主体组成部分。它可以向远方发射尾巴作为虫洞出口,它是阿拉克涅坑道虫头部的一部分,装入虫洞的物体会被坑道虫加压移动从而快速旅行,虫洞允许双向通行。</description>
|
||||
<thingClass>ArachnaeSwarm.Building_WormholePortal_A</thingClass>
|
||||
<graphicData>
|
||||
<texPath>Things/Building/Misc/LongRangeMineralScanner</texPath>
|
||||
<graphicClass>Graphic_Multi</graphicClass>
|
||||
<drawSize>(4,4)</drawSize>
|
||||
<damageData>
|
||||
<cornerTL>Damage/Corner</cornerTL>
|
||||
<cornerTR>Damage/Corner</cornerTR>
|
||||
<cornerBL>Damage/Corner</cornerBL>
|
||||
<cornerBR>Damage/Corner</cornerBR>
|
||||
</damageData>
|
||||
<texPath>ArachnaeSwarm/Building/ARA_Wormhole_A</texPath>
|
||||
<graphicClass>Graphic_Single</graphicClass>
|
||||
<shaderType>CutoutComplex</shaderType>
|
||||
<drawSize>(2.2,2.2)</drawSize>
|
||||
<shadowData>
|
||||
<volume>(1.6, 0.5, 1.6)</volume>
|
||||
<offset>(0,0,-0.1)</offset>
|
||||
</shadowData>
|
||||
</graphicData>
|
||||
<altitudeLayer>Building</altitudeLayer>
|
||||
<passability>Impassable</passability>
|
||||
@@ -35,10 +34,6 @@
|
||||
<ComponentSpacer>6</ComponentSpacer>
|
||||
</costList>
|
||||
<comps>
|
||||
<li Class="CompProperties_Power">
|
||||
<compClass>CompPowerTrader</compClass>
|
||||
<basePowerConsumption>500</basePowerConsumption>
|
||||
</li>
|
||||
<li Class="CompProperties_Flickable"/>
|
||||
<li Class="ArachnaeSwarm.CompProperties_RefuelableNutrition">
|
||||
<fuelCapacity>500.0</fuelCapacity>
|
||||
@@ -52,11 +47,10 @@
|
||||
<targetFuelLevelConfigurable>true</targetFuelLevelConfigurable>
|
||||
</li>
|
||||
<li Class="ArachnaeSwarm.CompProperties_LaunchableWormhole">
|
||||
<fuelNeededToLaunch>50</fuelNeededToLaunch>
|
||||
<maxLaunchDistance>100</maxLaunchDistance>
|
||||
<fuelPerTile>2.5</fuelPerTile>
|
||||
</li>
|
||||
</comps>
|
||||
<designationCategory>Misc</designationCategory>
|
||||
<designationCategory>ARA_Buildings</designationCategory>
|
||||
<building>
|
||||
<ai_chillDestination>false</ai_chillDestination>
|
||||
</building>
|
||||
@@ -68,14 +62,18 @@
|
||||
<!-- ==================== B端传送门 ==================== -->
|
||||
<ThingDef ParentName="BuildingBase">
|
||||
<defName>ARA_WormholePortal_B</defName>
|
||||
<label>wormhole portal (B)</label>
|
||||
<description>A remotely deployed secondary portal. It is linked to a primary portal (A) and allows for two-way travel.</description>
|
||||
<label>阿拉克涅坑道虫虫洞出口</label>
|
||||
<description>一个被远程部署的虫洞出口。它是阿拉克涅坑道虫尾巴的一部分,装入虫洞的物体会被坑道虫加压移动从而快速旅行,虫洞允许双向通行。</description>
|
||||
<thingClass>ArachnaeSwarm.Building_WormholePortal_B</thingClass>
|
||||
<graphicData>
|
||||
<texPath>Things/Building/Misc/LongRangeMineralScanner</texPath>
|
||||
<graphicClass>Graphic_Multi</graphicClass>
|
||||
<color>(150, 150, 250)</color> <!-- A different color to distinguish -->
|
||||
<drawSize>(4,4)</drawSize>
|
||||
<texPath>ArachnaeSwarm/Building/ARA_Wormhole_B</texPath>
|
||||
<graphicClass>Graphic_Single</graphicClass>
|
||||
<shaderType>CutoutComplex</shaderType>
|
||||
<drawSize>(2.2,2.2)</drawSize>
|
||||
<shadowData>
|
||||
<volume>(1.6, 0.5, 1.6)</volume>
|
||||
<offset>(0,0,-0.1)</offset>
|
||||
</shadowData>
|
||||
</graphicData>
|
||||
<altitudeLayer>Building</altitudeLayer>
|
||||
<passability>Impassable</passability>
|
||||
@@ -85,10 +83,6 @@
|
||||
</statBases>
|
||||
<size>(2,2)</size>
|
||||
<comps>
|
||||
<li Class="CompProperties_Power">
|
||||
<compClass>CompPowerTrader</compClass>
|
||||
<basePowerConsumption>200</basePowerConsumption>
|
||||
</li>
|
||||
<li Class="CompProperties_Flickable"/>
|
||||
</comps>
|
||||
<tradeability>None</tradeability>
|
||||
|
||||
21
1.6/1.6/Defs/WorldObjectDefs/ARA_Wormhole_WorldObjects.xml
Normal file
21
1.6/1.6/Defs/WorldObjectDefs/ARA_Wormhole_WorldObjects.xml
Normal file
@@ -0,0 +1,21 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<Defs>
|
||||
|
||||
<WorldObjectDef>
|
||||
<defName>ARA_TravelingWormhole</defName>
|
||||
<label>掘进中的虫洞</label>
|
||||
<worldObjectClass>ArachnaeSwarm.TravelingWormhole</worldObjectClass>
|
||||
<texture>World/WorldObjects/Caravan</texture>
|
||||
<useDynamicDrawer>true</useDynamicDrawer>
|
||||
<expandingIcon>true</expandingIcon>
|
||||
<expandingIconTexture>World/WorldObjects/Expanding/Caravan</expandingIconTexture>
|
||||
<expandingIconPriority>100</expandingIconPriority>
|
||||
<expandMore>true</expandMore>
|
||||
<modExtensions>
|
||||
<li Class="ArachnaeSwarm.DefModExtension_TravelingWormhole">
|
||||
<travelSpeed>10</travelSpeed>
|
||||
</li>
|
||||
</modExtensions>
|
||||
</WorldObjectDef>
|
||||
|
||||
</Defs>
|
||||
@@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<LanguageData>
|
||||
|
||||
<!-- Commands & Messages -->
|
||||
<CommandDeployWormholePortalB_Pilot>部署虫洞传送门</CommandDeployWormholePortalB_Pilot>
|
||||
<CommandDeployWormholePortalB_PilotDesc>选择一名驾驶员来启动一个B端传送门。</CommandDeployWormholePortalB_PilotDesc>
|
||||
<NoPilotAvailable>没有可用的驾驶员</NoPilotAvailable>
|
||||
|
||||
</LanguageData>
|
||||
@@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<LanguageData>
|
||||
|
||||
<!-- Commands & Messages -->
|
||||
<CommandDeployWormholePortalB_Pilot>部署虫洞传送门</CommandDeployWormholePortalB_Pilot>
|
||||
<CommandDeployWormholePortalB_PilotDesc>选择一名驾驶员来启动一个B端传送门。</CommandDeployWormholePortalB_PilotDesc>
|
||||
<NoPilotAvailable>没有可用的驾驶员</NoPilotAvailable>
|
||||
|
||||
</LanguageData>
|
||||
BIN
Content/Textures/ArachnaeSwarm/Building/ARA_Wormhole_A.png
Normal file
BIN
Content/Textures/ArachnaeSwarm/Building/ARA_Wormhole_A.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 34 KiB |
BIN
Content/Textures/ArachnaeSwarm/Building/ARA_Wormhole_B.png
Normal file
BIN
Content/Textures/ArachnaeSwarm/Building/ARA_Wormhole_B.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 46 KiB |
@@ -210,6 +210,8 @@
|
||||
<Compile Include="Wormhole\Building_WormholePortal_B.cs" />
|
||||
<Compile Include="Wormhole\CompLaunchableWormhole.cs" />
|
||||
<Compile Include="Wormhole\JobDriver_DeployWormhole.cs" />
|
||||
<Compile Include="Wormhole\TravelingWormhole.cs" />
|
||||
<Compile Include="Wormhole\DefModExtension_TravelingWormhole.cs" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- 自定义清理任务,删除obj文件夹中的临时文件 -->
|
||||
|
||||
@@ -137,59 +137,21 @@ namespace ArachnaeSwarm
|
||||
}
|
||||
}
|
||||
|
||||
public override IEnumerable<FloatMenuOption> GetFloatMenuOptions(Pawn selPawn)
|
||||
{
|
||||
foreach (var option in base.GetFloatMenuOptions(selPawn))
|
||||
{
|
||||
yield return option;
|
||||
}
|
||||
|
||||
if (status == WormholePortalStatus.Linked)
|
||||
{
|
||||
yield break;
|
||||
}
|
||||
|
||||
if (!selPawn.CanReach(this, PathEndMode.Touch, Danger.Deadly))
|
||||
{
|
||||
yield return new FloatMenuOption("CannotUseNoPath".Translate(), null);
|
||||
yield break;
|
||||
}
|
||||
|
||||
var compLaunchable = this.GetComp<CompLaunchableWormhole>();
|
||||
var compRefuelable = this.GetComp<CompRefuelable>();
|
||||
|
||||
if (compRefuelable.Fuel < compLaunchable.Props.fuelNeededToLaunch)
|
||||
{
|
||||
yield return new FloatMenuOption("CommandDeployWormholePortalB_Pilot".Translate() + " (" + "NotEnoughFuel".Translate() + ")", null);
|
||||
yield break;
|
||||
}
|
||||
|
||||
// TODO: Create ARA_DeployWormhole JobDef
|
||||
var jobDef = DefDatabase<JobDef>.GetNamed("ARA_DeployWormhole", false);
|
||||
if (jobDef == null)
|
||||
{
|
||||
yield return new FloatMenuOption("DEV: JobDef ARA_DeployWormhole not found", null);
|
||||
yield break;
|
||||
}
|
||||
|
||||
void action()
|
||||
{
|
||||
var job = JobMaker.MakeJob(jobDef, this);
|
||||
selPawn.jobs.TryTakeOrderedJob(job, JobTag.Misc);
|
||||
}
|
||||
|
||||
yield return new FloatMenuOption("CommandDeployWormholePortalB_Pilot".Translate(), action);
|
||||
}
|
||||
|
||||
public override string GetInspectString()
|
||||
{
|
||||
string text = base.GetInspectString();
|
||||
text += "\n" + "Status".Translate() + ": " + status.ToString().Translate();
|
||||
System.Text.StringBuilder stringBuilder = new System.Text.StringBuilder();
|
||||
stringBuilder.Append(base.GetInspectString());
|
||||
|
||||
if (stringBuilder.Length > 0) stringBuilder.AppendLine();
|
||||
stringBuilder.Append("Status".Translate() + ": " + status.ToString().Translate());
|
||||
|
||||
if (linkedPortalB != null && !linkedPortalB.Destroyed)
|
||||
{
|
||||
text += "\n" + "LinkedTo".Translate() + ": " + linkedPortalB.Map.Parent.LabelCap;
|
||||
stringBuilder.AppendLine();
|
||||
stringBuilder.Append("LinkedTo".Translate() + ": " + linkedPortalB.Map.Parent.LabelCap);
|
||||
}
|
||||
return text;
|
||||
return stringBuilder.ToString();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -106,16 +106,20 @@ namespace ArachnaeSwarm
|
||||
|
||||
public override string GetInspectString()
|
||||
{
|
||||
string text = base.GetInspectString();
|
||||
System.Text.StringBuilder stringBuilder = new System.Text.StringBuilder();
|
||||
stringBuilder.Append(base.GetInspectString());
|
||||
|
||||
if (linkedPortalA != null && !linkedPortalA.Destroyed)
|
||||
{
|
||||
text += "\n" + "LinkedTo".Translate() + ": " + linkedPortalA.Map.Parent.LabelCap;
|
||||
if (stringBuilder.Length > 0) stringBuilder.AppendLine();
|
||||
stringBuilder.Append("LinkedTo".Translate() + ": " + linkedPortalA.Map.Parent.LabelCap);
|
||||
}
|
||||
else
|
||||
{
|
||||
text += "\n" + "ConnectionLost".Translate();
|
||||
if (stringBuilder.Length > 0) stringBuilder.AppendLine();
|
||||
stringBuilder.Append("ConnectionLost".Translate());
|
||||
}
|
||||
return text;
|
||||
return stringBuilder.ToString();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using RimWorld;
|
||||
using RimWorld.Planet;
|
||||
using UnityEngine;
|
||||
using Verse;
|
||||
using Verse.AI;
|
||||
|
||||
namespace ArachnaeSwarm
|
||||
{
|
||||
@@ -21,8 +23,49 @@ namespace ArachnaeSwarm
|
||||
|
||||
public override IEnumerable<Gizmo> CompGetGizmosExtra()
|
||||
{
|
||||
// The gizmo is now replaced by a float menu option.
|
||||
yield break;
|
||||
if (PortalA?.status == WormholePortalStatus.Linked)
|
||||
{
|
||||
yield break;
|
||||
}
|
||||
|
||||
Command_Action launchCommand = new Command_Action();
|
||||
launchCommand.defaultLabel = "CommandDeployWormholePortalB_Pilot".Translate();
|
||||
launchCommand.defaultDesc = "CommandDeployWormholePortalB_PilotDesc".Translate();
|
||||
launchCommand.icon = ContentFinder<Texture2D>.Get("UI/Commands/LaunchShip");
|
||||
|
||||
// Fuel check is now more complex, we can show max range or check on target selection.
|
||||
// For simplicity, we'll disable if there's basically no fuel.
|
||||
if (refuelableComp.Fuel < Props.fuelPerTile)
|
||||
{
|
||||
launchCommand.Disable("NotEnoughFuel".Translate());
|
||||
}
|
||||
|
||||
List<Pawn> pilots = parent.Map.mapPawns.AllPawnsSpawned
|
||||
.Where(p => p.IsColonistPlayerControlled && !p.Downed && !p.IsBurning() && p.CanReach(parent, PathEndMode.Touch, Danger.Deadly))
|
||||
.ToList();
|
||||
|
||||
if (!pilots.Any())
|
||||
{
|
||||
launchCommand.Disable("NoPilotAvailable".Translate());
|
||||
}
|
||||
|
||||
launchCommand.action = delegate
|
||||
{
|
||||
List<FloatMenuOption> options = new List<FloatMenuOption>();
|
||||
foreach (Pawn p in pilots)
|
||||
{
|
||||
void pilotAction()
|
||||
{
|
||||
var jobDef = DefDatabase<JobDef>.GetNamed("ARA_DeployWormhole");
|
||||
var job = JobMaker.MakeJob(jobDef, parent);
|
||||
p.jobs.TryTakeOrderedJob(job, JobTag.Misc);
|
||||
}
|
||||
options.Add(new FloatMenuOption(p.LabelCap, pilotAction));
|
||||
}
|
||||
Find.WindowStack.Add(new FloatMenu(options));
|
||||
};
|
||||
|
||||
yield return launchCommand;
|
||||
}
|
||||
|
||||
public void StartChoosingDestination(Pawn pilot)
|
||||
@@ -30,13 +73,14 @@ namespace ArachnaeSwarm
|
||||
CameraJumper.TryJump(CameraJumper.GetWorldTarget(this.parent));
|
||||
Find.WorldSelector.ClearSelection();
|
||||
int tile = this.parent.Map.Tile;
|
||||
Find.WorldTargeter.BeginTargeting((GlobalTargetInfo t) => ChoseWorldTarget(t, pilot), true, CompLaunchable.TargeterMouseAttachment, true, delegate
|
||||
int maxDist = (int)(refuelableComp.Fuel / Props.fuelPerTile);
|
||||
Find.WorldTargeter.BeginTargeting((GlobalTargetInfo t) => ChoseWorldTarget(t, pilot, maxDist), true, CompLaunchable.TargeterMouseAttachment, true, delegate
|
||||
{
|
||||
GenDraw.DrawWorldRadiusRing(tile, this.Props.maxLaunchDistance);
|
||||
GenDraw.DrawWorldRadiusRing(tile, maxDist);
|
||||
}, (GlobalTargetInfo t) => "Select target tile");
|
||||
}
|
||||
|
||||
private bool ChoseWorldTarget(GlobalTargetInfo t, Pawn pilot)
|
||||
private bool ChoseWorldTarget(GlobalTargetInfo t, Pawn pilot, int maxDist)
|
||||
{
|
||||
if (!t.IsValid)
|
||||
{
|
||||
@@ -49,51 +93,35 @@ namespace ArachnaeSwarm
|
||||
return false;
|
||||
}
|
||||
|
||||
MapParent mapParent = Find.World.worldObjects.MapParentAt(t.Tile);
|
||||
if (mapParent?.HasMap ?? false)
|
||||
int distance = Find.WorldGrid.TraversalDistanceBetween(parent.Map.Tile, t.Tile, true);
|
||||
if (distance > maxDist)
|
||||
{
|
||||
Deploy(mapParent, pilot);
|
||||
}
|
||||
else
|
||||
{
|
||||
LongEventHandler.QueueLongEvent(delegate
|
||||
{
|
||||
var newMap = GetOrGenerateMapUtility.GetOrGenerateMap(t.Tile, WorldObjectDefOf.Camp);
|
||||
Deploy(newMap.Parent, pilot);
|
||||
}, "GeneratingMap", doAsynchronously: false, null);
|
||||
Messages.Message("NotEnoughFuel".Translate(), MessageTypeDefOf.RejectInput);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private void Deploy(MapParent mapParent, Pawn pilot)
|
||||
{
|
||||
refuelableComp.ConsumeFuel(this.Props.fuelNeededToLaunch);
|
||||
float fuelCost = distance * Props.fuelPerTile;
|
||||
refuelableComp.ConsumeFuel(fuelCost);
|
||||
|
||||
// 传送驾驶员
|
||||
// Despawn pilot from the source map
|
||||
pilot.DeSpawn();
|
||||
|
||||
EffecterDefOf.Skip_Entry.Spawn(this.parent.Position, this.parent.Map);
|
||||
|
||||
Building_WormholePortal_B portalB = (Building_WormholePortal_B)ThingMaker.MakeThing(ThingDef.Named("ARA_WormholePortal_B"));
|
||||
IntVec3 cell = DropCellFinder.RandomDropSpot(mapParent.Map);
|
||||
GenSpawn.Spawn(portalB, cell, mapParent.Map, WipeMode.Vanish);
|
||||
|
||||
// 在B端生成驾驶员
|
||||
IntVec3 pilotSpawnCell = CellFinder.RandomSpawnCellForPawnNear(portalB.Position, mapParent.Map, 5);
|
||||
GenSpawn.Spawn(pilot, pilotSpawnCell, mapParent.Map, WipeMode.Vanish);
|
||||
|
||||
EffecterDefOf.Skip_Exit.Spawn(cell, mapParent.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);
|
||||
|
||||
PortalA.SetLinkedPortal(portalB);
|
||||
portalB.SetLinkedPortal(PortalA);
|
||||
Find.WorldObjects.Add(travelingWormhole);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public class CompProperties_LaunchableWormhole : CompProperties
|
||||
{
|
||||
public float fuelNeededToLaunch;
|
||||
public int maxLaunchDistance;
|
||||
public float fuelPerTile = 1f; // Default fuel cost per tile
|
||||
|
||||
public CompProperties_LaunchableWormhole()
|
||||
{
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
using Verse;
|
||||
|
||||
namespace ArachnaeSwarm
|
||||
{
|
||||
public class DefModExtension_TravelingWormhole : DefModExtension
|
||||
{
|
||||
public float travelSpeed = 20f; // Default speed in tiles per day
|
||||
}
|
||||
}
|
||||
97
Source/ArachnaeSwarm/Wormhole/TravelingWormhole.cs
Normal file
97
Source/ArachnaeSwarm/Wormhole/TravelingWormhole.cs
Normal file
@@ -0,0 +1,97 @@
|
||||
using RimWorld;
|
||||
using RimWorld.Planet;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using UnityEngine;
|
||||
using Verse;
|
||||
|
||||
namespace ArachnaeSwarm
|
||||
{
|
||||
[StaticConstructorOnStartup]
|
||||
public class TravelingWormhole : WorldObject, IThingHolder
|
||||
{
|
||||
public Building_WormholePortal_A sourcePortal;
|
||||
public int destinationTile;
|
||||
|
||||
private int initialTile;
|
||||
private float traveledPct;
|
||||
|
||||
private ThingOwner contents;
|
||||
|
||||
public override Material Material => def.Material;
|
||||
|
||||
public override Vector3 DrawPos => Vector3.Slerp(
|
||||
Find.WorldGrid.GetTileCenter(initialTile),
|
||||
Find.WorldGrid.GetTileCenter(destinationTile),
|
||||
traveledPct);
|
||||
|
||||
public TravelingWormhole()
|
||||
{
|
||||
contents = new ThingOwner<Thing>(this, true, LookMode.Deep);
|
||||
}
|
||||
|
||||
public override void ExposeData()
|
||||
{
|
||||
base.ExposeData();
|
||||
Scribe_References.Look(ref sourcePortal, "sourcePortal");
|
||||
Scribe_Values.Look(ref destinationTile, "destinationTile", 0);
|
||||
Scribe_Values.Look(ref initialTile, "initialTile", 0);
|
||||
Scribe_Values.Look(ref traveledPct, "traveledPct", 0f);
|
||||
Scribe_Deep.Look(ref contents, "contents", this);
|
||||
}
|
||||
|
||||
public void StartMove(int startTile, int destTile, Pawn pilot)
|
||||
{
|
||||
initialTile = startTile;
|
||||
destinationTile = destTile;
|
||||
|
||||
this.Tile = startTile;
|
||||
contents.TryAdd(pilot, true);
|
||||
}
|
||||
|
||||
protected override void Tick()
|
||||
{
|
||||
base.Tick();
|
||||
var speed = def.GetModExtension<DefModExtension_TravelingWormhole>()?.travelSpeed ?? 20f;
|
||||
traveledPct += (1f / GenDate.TicksPerDay) * speed;
|
||||
if (traveledPct >= 1f)
|
||||
{
|
||||
traveledPct = 1f;
|
||||
Arrived();
|
||||
}
|
||||
}
|
||||
|
||||
private void Arrived()
|
||||
{
|
||||
if (contents.Any)
|
||||
{
|
||||
Pawn pilot = contents.First() as Pawn;
|
||||
if (pilot != null)
|
||||
{
|
||||
Map targetMap = GetOrGenerateMapUtility.GetOrGenerateMap(destinationTile, null);
|
||||
|
||||
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);
|
||||
portalB.SetLinkedPortal(sourcePortal);
|
||||
}
|
||||
}
|
||||
}
|
||||
Find.WorldObjects.Remove(this);
|
||||
}
|
||||
|
||||
public ThingOwner GetDirectlyHeldThings() => contents;
|
||||
public void GetChildHolders(List<IThingHolder> outChildren) => ThingOwnerUtility.AppendThingHoldersFromThings(outChildren, GetDirectlyHeldThings());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user