public override bool ShouldRemoveMapNow(out bool alsoRemoveWorldObject) { if (!Map.mapPawns.AnyPawnBlockingMapRemoval && !MapHelper.AnyVehicleSkyfallersBlockingMap(Map) && ticksSinceCrash >= TicksTillRemovalAfterCrash) { alsoRemoveWorldObject = true; return(true); } alsoRemoveWorldObject = false; return(false); }
public override void Tick() { base.Tick(); if (!MapHelper.AnyVehicleSkyfallersBlockingMap(Map)) { ticksSinceCrash++; } ticksTillReinforcements--; if (ticksTillReinforcements < 0 && reinforcementsFrom != null) { ReinforcementsArrived(); } }
/// <summary> /// Ensure map is not removed with vehicles that contain pawns or maps currenty being targeted for landing. /// </summary> /// <param name="__instance"></param> /// <param name="__result"></param> public static void AnyVehicleBlockingMapRemoval(MapPawns __instance, ref bool __result, Map ___map) { if (__result is false) { if (LandingTargeter.Instance.IsTargeting && Current.Game.CurrentMap == ___map) { __result = true; return; } if (MapHelper.AnyVehicleSkyfallersBlockingMap(___map)) { __result = true; return; } if (MapHelper.AnyAerialVehiclesInRecon(___map)) { __result = true; return; } foreach (Pawn pawn in __instance.AllPawnsSpawned) { if (pawn is VehiclePawn vehicle && vehicle.AllPawnsAboard.NotNullAndAny()) { foreach (Pawn sailor in vehicle.AllPawnsAboard) { if (!sailor.Downed && sailor.IsColonist) { __result = true; return; } if (sailor.relations != null && sailor.relations.relativeInvolvedInRescueQuest != null) { __result = true; return; } if (sailor.Faction == Faction.OfPlayer || sailor.HostFaction == Faction.OfPlayer) { if (sailor.CurJob != null && sailor.CurJob.exitMapOnArrival) { __result = true; return; } } //Caravan to join for? } } } } }