private bool CheckForErrors(List <Pawn> pawns) { if (!this.transferables.Any((TransferableOneWay x) => x.CountToTransfer != 0)) { Messages.Message("CantSendEmptyTransportPods".Translate(), MessageTypeDefOf.RejectInput); return(false); } if (this.MassUsage > this.MassCapacity) { this.FlashMass(); Messages.Message("TooBigTransportersMassUsage".Translate(), MessageTypeDefOf.RejectInput); return(false); } if (pawns.Count > PawnCapacity) { Messages.Message("OverPawnRiderLimit".Translate(new object[] { PawnCapacity.ToString() }), MessageTypeDefOf.RejectInput); return(false); } Pawn pawn = pawns.Find((Pawn x) => !x.MapHeld.reachability.CanReach(x.PositionHeld, this.transporters[0].parent, PathEndMode.Touch, TraverseParms.For(TraverseMode.PassDoors, Danger.Deadly, false))); if (pawn != null) { Messages.Message("PawnCantReachTransporters".Translate(new object[] { pawn.LabelShort }).CapitalizeFirst(), MessageTypeDefOf.RejectInput); return(false); } Map map = this.transporters[0].parent.Map; for (int i = 0; i < this.transferables.Count; i++) { if (this.transferables[i].ThingDef.category == ThingCategory.Item) { int countToTransfer = this.transferables[i].CountToTransfer; int num = 0; if (countToTransfer > 0) { for (int j = 0; j < this.transferables[i].things.Count; j++) { Thing thing = this.transferables[i].things[j]; if (map.reachability.CanReach(thing.Position, this.transporters[0].parent, PathEndMode.Touch, TraverseParms.For(TraverseMode.PassDoors, Danger.Deadly, false))) { num += thing.stackCount; if (num >= countToTransfer) { break; } } } if (num < countToTransfer) { if (countToTransfer == 1) { Messages.Message("TransporterItemIsUnreachableSingle".Translate(new object[] { this.transferables[i].ThingDef.label }), MessageTypeDefOf.RejectInput); } else { Messages.Message("TransporterItemIsUnreachableMulti".Translate(new object[] { countToTransfer, this.transferables[i].ThingDef.label }), MessageTypeDefOf.RejectInput); } return(false); } } } } return(true); }
private bool CheckForErrors(List <Pawn> pawns) { if (!transferables.Any(x => x.CountToTransfer != 0)) { Messages.Message("CantSendEmptyTransportPods".Translate(), MessageTypeDefOf.RejectInput); return(false); } if (MassUsage > MassCapacity) { FlashMass(); Messages.Message("TooBigTransportersMassUsage".Translate(), MessageTypeDefOf.RejectInput); return(false); } if (pawns.Count > PawnCapacity) { Messages.Message("OverPawnRiderLimit".Translate( PawnCapacity.ToString() ), MessageTypeDefOf.RejectInput); return(false); } var pawn = pawns.Find(x => !x.MapHeld.reachability.CanReach(x.PositionHeld, transporters[0].parent, PathEndMode.Touch, TraverseParms.For(TraverseMode.PassDoors))); if (pawn != null) { Messages.Message("PawnCantReachTransporters".Translate( pawn.LabelShort ).CapitalizeFirst(), MessageTypeDefOf.RejectInput); return(false); } var parentMap = transporters[0].parent.Map; foreach (var transferableOneWay in transferables) { if (transferableOneWay.ThingDef.category != ThingCategory.Item) { continue; } var countToTransfer = transferableOneWay.CountToTransfer; var num = 0; if (countToTransfer <= 0) { continue; } foreach (var thing in transferableOneWay.things) { if (!parentMap.reachability.CanReach(thing.Position, transporters[0].parent, PathEndMode.Touch, TraverseParms.For(TraverseMode.PassDoors))) { continue; } num += thing.stackCount; if (num >= countToTransfer) { break; } } if (num >= countToTransfer) { continue; } if (countToTransfer == 1) { Messages.Message("TransporterItemIsUnreachableSingle".Translate( transferableOneWay.ThingDef.label ), MessageTypeDefOf.RejectInput); } else { Messages.Message("TransporterItemIsUnreachableMulti".Translate( countToTransfer, transferableOneWay.ThingDef.label ), MessageTypeDefOf.RejectInput); } return(false); } return(true); }