static void Main(string[] args) { var ship = new TransportShip("shipz", 10); for (int i = 0; i < 4; i++) { var cargo = new TransportShip.Cargo("Bottles of Rum", 3); if (!ship.AddCargo(cargo)) { break; } } ship.ShowAvailableSpace(); ship.ListCargo(); var cargo2 = new TransportShip.Cargo("Bottles of Rum", 3); ship.RemoveCargo(cargo2); ship.ShowAvailableSpace(); ship.ListCargo(); var ship2 = new TransportShip("shipzor", 23); Console.WriteLine($"moving cargo from {ship.GetShipName()} to {ship2.GetShipName()}..."); ship.MoveCargoToOtherShip(ship2); Console.WriteLine("Ship2 cargo..: "); ship2.ListCargo(); ship2.ShowAvailableSpace(); Map map = new Map(); Console.ReadKey(); }
static void Main(string[] args) { var ship = new TransportShip("Planet Express", 10); while (true) { var cargo = new Cargo("Bottles of Slurm", 3); if (!ship.AddCargo(cargo)) { break; } } Console.WriteLine($"{ship.Name}, space available: {ship.Available}"); ship.ListCargo(); ship.RemoveCargo(); Console.WriteLine($"{ship.Name}, space available: {ship.Available}"); ship.ListCargo(); }
public static Thing DropShuttle(List <ActiveDropPodInfo> pods, Map map, IntVec3 cell, Faction faction = null) { ByakheeArrivalActionUtility.RemovePawnsFromWorldPawns(pods); Thing thing = QuestGen_Shuttle.GenerateShuttle(faction, null, null, false, false, false, 0, false, false, true, false, null, null, -1, null, false, true, false, false); TransportShip transportShip = TransportShipMaker.MakeTransportShip(TransportShipDefOf.Ship_Shuttle, null, thing); CompTransporter compTransporter = thing.TryGetComp <CompTransporter>(); for (int i = 0; i < pods.Count; i++) { compTransporter.innerContainer.TryAddRangeOrTransfer(pods[i].innerContainer, true, false); } if (!cell.IsValid) { cell = DropCellFinder.GetBestShuttleLandingSpot(map, Faction.OfPlayer); } transportShip.ArriveAt(cell, map.Parent); transportShip.AddJobs(new ShipJobDef[] { ShipJobDefOf.Unload, ShipJobDefOf.FlyAway }); return(thing); }
private static void SendShuttle(FCEvent evt) { Map playerHomeMap = Find.World.GetComponent <FactionFC>().TaxMap; List <ShipLandingArea> landingZones = ShipLandingBeaconUtility.GetLandingZones(playerHomeMap); IntVec3 landingCell = DropCellFinder.GetBestShuttleLandingSpot(playerHomeMap, Faction.OfPlayer); if (!landingZones.Any() || landingZones.Any(zone => zone.Clear)) { MakeDeliveryLetterAndMessage(evt); Thing shuttle = ThingMaker.MakeThing(ThingDefOf.Shuttle); TransportShip transportShip = TransportShipMaker.MakeTransportShip(TransportShipDefOf.Ship_Shuttle, evt.goods, shuttle); transportShip.ArriveAt(landingCell, playerHomeMap.Parent); transportShip.AddJobs(new ShipJobDef[] { ShipJobDefOf.Unload, ShipJobDefOf.FlyAway }); } else { if (!evt.isDelayed) { Messages.Message(((string)"shuttleLandingBlockedWithItems".Translate(evt.goods.ToLetterString())).Replace("\n", " "), MessageTypeDefOf.RejectInput); evt.isDelayed = true; } if (evt.source == -1) { evt.source = playerHomeMap.Tile; } evt.timeTillTrigger = Find.TickManager.TicksGame + 1000; CreateDeliveryEvent(evt); } }
static void Main(string[] args) { //var express = new TransportShip("Planet Express", 10); ////var nostromo = new TransportShip("Nostromo", 50); //express.AddCargo(new Cargo("Item A", 1)); //express.AddCargo(new Cargo("Item B", 1)); //Cargo cargo; //while ((cargo = express.RemoveCargo()) != null) //{ // Console.WriteLine($"Removed cargo {cargo.Description}"); //} //while (true) //{ // var cargo = new Cargo("Bottles of Slurm"); // if (!ship.AddCargo(cargo)) // { // break; // } //} //Console.WriteLine($"{ship.Name}, space available: {ship.Available}"); //ship.ListCargo(); //ship.RemoveCargo(); //Console.WriteLine($"{ship.Name}, space available: {ship.Available}"); //ship.ListCargo(); //while (true) //{ // var cargo = new Cargo("Crate with strange eggs", 4); // if (!nostromo.AddCargo(cargo)) // break; //} //Console.WriteLine($"{nostromo.Name}, space available: {nostromo.Available}"); //Console.WriteLine("- Moving some cargo to Planet Express..."); //nostromo.MoveCargoToOtherShip(express); //Console.WriteLine($"{nostromo.Name}, space available: {nostromo.Available}"); //Console.WriteLine($"{express.Name}, space available: {express.Available}"); //express.ListCargo(); var express = new TransportShip("Planet Express", 10); var nostromo = new TransportShip("Nostromo", 50); var station = new SpaceStation("Solaris"); express.AddCargo(new Cargo("Item A from Planet Express", 1)); express.AddCargo(new Cargo("Item B from Planet Express", 1)); // Planet Express dropping off its cargo to the station station.DropOff("secret password key", express); // Nostromo picking it up, using the same key station.PickUp("secret password key", nostromo); Console.WriteLine("-- Planet Express --"); express.ListCargo(); Console.WriteLine("--Nostromo--"); nostromo.ListCargo(); }