protected override IEnumerable <Toil> MakeNewToils() { yield return(Toils_Goto.GotoCell(TargetIndex.A, PathEndMode.OnCell)); if (!ShipHarmony.IsShip(this.pawn)) { Log.Error("JobDriver_Disembark is only meant for boats."); yield break; } yield return(Toils_Disembark.DisembarkWithLord(this.pawn)); }
public override void LordToilTick() { if (Find.TickManager.TicksGame % 100 == 0) { Lord lord = this.lord; List <Pawn> pawns = this.lord.ownedPawns.Where(x => !ShipHarmony.IsShip(x)).ToList(); if (!pawns.Any(x => !x.IsColonist && !x.RaceProps.Animal && x.Spawned)) { lord.ReceiveMemo("AllSlavesGathered"); } } }
public override void LordToilTick() { if (Find.TickManager.TicksGame % 100 == 0) { Lord lord = this.lord; List <Pawn> pawns = this.lord.ownedPawns.Where(x => !ShipHarmony.IsShip(x)).ToList(); IntVec3 intVec = this.meetingPoint; string memo = "AllSlavesGathered"; Predicate <Pawn> shouldCheckIfArrived = (Pawn x) => !x.IsColonist && !x.RaceProps.Animal; GatherAnimalsAndSlavesForShipsUtility.CheckArrived(lord, pawns, intVec, memo, shouldCheckIfArrived, false, null); } }
public LordJob_FormAndSendCaravanShip(List <TransferableOneWay> transferables, List <Pawn> ships, List <Pawn> sailors, List <Pawn> downedPawns, List <Pawn> prisoners, IntVec3 meetingPoint, IntVec3 exitPoint, int startingTile, int destinationTile) { this.transferables = transferables; this.ships = ships; this.leadShip = ships.First(x => ShipHarmony.IsShip(x) && x.RaceProps.baseBodySize == ships.Max(y => y.RaceProps.baseBodySize)); this.downedPawns = downedPawns; this.meetingPoint = meetingPoint; this.exitPoint = exitPoint; this.startingTile = startingTile; this.destinationTile = destinationTile; this.sailors = sailors; this.prisoners = prisoners; }
public void Notify_CaravanArrived(Caravan caravan) { if (caravan.PawnsListForReading.Where(x => !ShipHarmony.IsShip(x)).Count() > this.TotalAvailableSeats) { Messages.Message("CaravanMustHaveEnoughSpaceOnShip".Translate(), this, MessageTypeDefOf.RejectInput, false); return; } for (int i = dockedBoats.Count - 1; i >= 0; i--) { Pawn p = dockedBoats[i]; caravan.pawns.TryAddOrTransfer(p); } Find.WorldObjects.Remove(this); }
public override void LordToilTick() { if (Find.TickManager.TicksGame % 200 == 0) { Lord lord = this.lord; List <Pawn> pawnsLeft = this.lord.ownedPawns.Where(x => !ShipHarmony.IsShip(x)).ToList(); IntVec3 intVec = this.meetingPoint; if (!pawnsLeft.Any(x => x.Spawned)) { this.lord.ownedPawns.RemoveAll(x => !ShipHarmony.IsShip(x)); this.lord.ReceiveMemo("AllPawnsOnboard"); } } }
public override void UpdateAllDuties() { foreach (Pawn p in this.lord.ownedPawns) { if (!ShipHarmony.IsShip(p)) { p.mindState.duty = new PawnDuty(DutyDefOf_Ships.PrepareCaravan_BoardShip) { locomotion = LocomotionUrgency.Jog }; } else { p.mindState.duty = new PawnDuty(DutyDefOf_Ships.PrepareCaravan_WaitShip); } } }
public override void UpdateAllDuties() { foreach (Pawn p in this.lord.ownedPawns) { if (ShipHarmony.IsShip(p)) { p.mindState.duty = new PawnDuty(DutyDefOf_Ships.PrepareCaravan_WaitShip); } else if (!p.RaceProps.Animal && !p.IsColonist && (!ShipHarmony.IsShip(p))) { p.mindState.duty = new PawnDuty(DutyDefOf_Ships.PrepareCaravan_SendSlavesToShip, this.meetingPoint, -1f); p.mindState.duty.pawnsToGather = PawnsToGather.Slaves; } else { p.mindState.duty = new PawnDuty(DutyDefOf.PrepareCaravan_Wait, this.meetingPoint, -1f); } } }
private Pawn FindShipToDeposit(Pawn pawn, Pawn downedPawn) { List <Pawn> ships = pawn.GetLord().ownedPawns.Where(x => ShipHarmony.IsShip(x)).ToList(); return(ships.MaxBy(x => x.GetComp <CompShips>().Props.roles.Find(y => y.handlingType == HandlingTypeFlags.None).slots)); }
public override void LordToilTick() { if (Find.TickManager.TicksGame % 100 == 0) { GatherAnimalsAndSlavesForShipsUtility.CheckArrived(this.lord, this.lord.ownedPawns.Where(x => ShipHarmony.IsShip(x)).ToList(), this.exitSpot, "ReadyToExitMap", (Pawn x) => true, true, null); } }
public static void EnterSpawn(Caravan caravan, Map map, Func <Pawn, IntVec3> spawnCellGetter, CaravanDropInventoryMode caravanDropInventoryMode = CaravanDropInventoryMode.DoNotDrop, bool draftColonists = true) { List <Pawn> pawns = new List <Pawn>(caravan.PawnsListForReading).Where(x => ShipHarmony.IsShip(x)).ToList(); MapExtension mapE = MapExtensionUtility.GetExtensionToMap(map); Rot4 spawnDir = GetEdgeToSpawnBoatOn(caravan, map); for (int i = 0; i < pawns.Count; i++) { IntVec3 loc = CellFinderExtended.MiddleEdgeCell(spawnDir, map, pawns[i], (IntVec3 c) => GenGridShips.Standable(c, map, mapE) && !c.Fogged(map)); //Change back to spawnCellGetter later pawns[i].GetComp <CompShips>().Angle = 0; Pawn ship = GenSpawn.Spawn(pawns[i], loc, map, spawnDir.Opposite, WipeMode.Vanish, false) as Pawn; ship.drafter.Drafted = draftColonists ? true : false; } caravan.RemoveAllPawns(); if (caravan.Spawned) { Find.WorldObjects.Remove(caravan); } }
public static void Enter(Caravan caravan, Map map, CaravanEnterMode enterMode, CaravanDropInventoryMode dropInventoryMode = CaravanDropInventoryMode.DoNotDrop, bool draftColonists = true, Predicate <IntVec3> extraValidator = null) { if (enterMode == CaravanEnterMode.None) { Log.Error(string.Concat(new object[] { "Caravan ", caravan, " tried to enter map ", map, " with no enter mode. Defaulting to edge." }), false); enterMode = CaravanEnterMode.Edge; } //Ensure pawns are onboard till a fix for dock settling is done if (ShipHarmony.HasShip(caravan) && caravan.PawnsListForReading.Any(x => !ShipHarmony.IsShip(x))) { ShipHarmony.BoardAllCaravanPawns(caravan); } IntVec3 enterCell = GetWaterCell(caravan, map, CaravanEnterMode.Edge); //Caravan Enter Mode back to enterMode Func <Pawn, IntVec3> spawnCellGetter = (Pawn p) => p.ClampToMap(CellFinderExtended.RandomSpawnCellForPawnNear(enterCell, map, 4), map); EnterMapUtilityBoats.EnterSpawn(caravan, map, spawnCellGetter, dropInventoryMode, draftColonists); }