Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 47 additions & 0 deletions Source/1.5/Building/Building_ShipBridge.cs
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,24 @@ private List<string> InterstellarFailReasons()
return result;
}

public bool DevChooseLaunchTarget(GlobalTargetInfo target)
{
if (Find.World.Impassable(target.Tile))
{
return false;
}
if (Find.WorldObjects.AnyWorldObjectAt(target.Tile))
{
return false;
}
if (CanLaunchNow)
{
ShipInteriorMod2.worldTileOverride = target.Tile;
ShipCountdown.InitiateCountdown(this);
QuestUtility.SendQuestTargetSignals(base.Map.Parent.questTags, "LaunchedShip");
}
return true;
}
[DebuggerHidden]
public override IEnumerable<Gizmo> GetGizmos()
{
Expand Down Expand Up @@ -1024,7 +1042,10 @@ public override IEnumerable<Gizmo> GetGizmos()
if (playerShipMap != null) //player ship in orbit already, move to temp map
Ship.CreateShipSketchIfFuelPct(1f, playerShipMap, 0, true);
else
{
ShipInteriorMod2.worldTileOverride = -1;
ShipCountdown.InitiateCountdown(this);
}
QuestUtility.SendQuestTargetSignals(base.Map.Parent.questTags, "LaunchedShip");
}
},
Expand All @@ -1042,6 +1063,32 @@ public override IEnumerable<Gizmo> GetGizmos()
launch.Disable(null);
}
yield return launch;
if (Prefs.DevMode && ShipInteriorMod2.FindPlayerShipMap() == null)
{
Command_Action launchToSpecificTile = new Command_Action()
{
groupable = false,
action = delegate
{
CameraJumper.TryJump(CameraJumper.GetWorldTarget(this));
Find.WorldSelector.ClearSelection();
Find.WorldTargeter.BeginTargeting(DevChooseLaunchTarget, canTargetTiles: true, closeWorldTabWhenFinished: true);
},
hotKey = KeyBindingDefOf.Misc1,
defaultLabel = "Dev: Launch to specific tile",
defaultDesc = "Pick a surface tile that will be associated with the ship. Based on selected tile latitude, solar panels will work great or bad. " +
"Quests and Ideology work sites will be genarated near picked surface tile."
};
if (!CanLaunchNow)
{
launchToSpecificTile.Disable(ShipUtility.LaunchFailReasons(this).First<string>());
}
else if (ShipCountdown.CountingDown)
{
launchToSpecificTile.Disable(null);
}
yield return launchToSpecificTile;
}
}
}
private bool ChoseWorldTarget(GlobalTargetInfo target)
Expand Down
12 changes: 11 additions & 1 deletion Source/1.5/ShipInteriorMod2.cs
Original file line number Diff line number Diff line change
Expand Up @@ -507,6 +507,9 @@ public static int FindWorldTile()
}
return -1;
}

// Can override world tile selection in dev Launch sommmand, launching ship over specified tile
public static int worldTileOverride = -1;
public static int FindWorldTilePlayer() //slower, will find tile nearest to ship object pos
{
float bestAbsLatitude = float.MaxValue;
Expand Down Expand Up @@ -539,7 +542,14 @@ public static Map GeneratePlayerShipMap(IntVec3 size)
WorldObjectOrbitingShip orbiter = (WorldObjectOrbitingShip)WorldObjectMaker.MakeWorldObject(ResourceBank.WorldObjectDefOf.ShipOrbiting);
orbiter.SetNominalPos();
orbiter.SetFaction(Faction.OfPlayer);
orbiter.Tile = FindWorldTilePlayer();
if (worldTileOverride == -1)
{
orbiter.Tile = FindWorldTilePlayer();
}
else
{
orbiter.Tile = worldTileOverride;
}
Find.WorldObjects.Add(orbiter);
Map map = MapGenerator.GenerateMap(size, orbiter, orbiter.MapGeneratorDef,null,null,false);
//map.fogGrid.ClearAllFog();
Expand Down