Beispiel #1
0
        public static void LandShip(Map map, Thing ship)
        {
            Thing    blockingThing;
            IntVec3  center = IntVec3.Invalid;
            CompShip comp   = ship.TryGetComp <CompShip>();

            Area_LandingZone lz = map.areaManager.LandingZone();

            if (lz != null && !lz.TryFindShipLandingArea(ship.def.size, out center, out blockingThing) && blockingThing != null)
            {
                Messages.Message("TraderShipsLandingZoneBlocked".Translate("TraderShipsBlockedBy".Translate(blockingThing)), blockingThing, MessageTypeDefOf.NeutralEvent, true);
            }

            if (!center.IsValid && ThingDefOf.ShipLandingBeacon != null && !DropCellFinder.TryFindShipLandingArea(map, out center, out blockingThing) && blockingThing != null)
            {
                Messages.Message("TraderShipsLandingZoneBlocked".Translate("TraderShipsBlockedBy".Translate(blockingThing)), blockingThing, MessageTypeDefOf.NeutralEvent, true);
            }

            if (!center.IsValid)
            {
                FindCloseLandingSpot(out center, comp.tradeShip.Faction, map, ship.def.size);
            }

            GenPlace.TryPlaceThing(SkyfallerMaker.MakeSkyfaller(comp.Props.landAnimation, ship), center, map, ThingPlaceMode.Near);
        }
Beispiel #2
0
        public static Area_LandingZone LandingZone(this AreaManager areaManager)
        {
            Area_LandingZone res = areaManager.Get <Area_LandingZone>();

            if (res == null)
            {
                areaManager.AllAreas.Add(res = new Area_LandingZone(areaManager));
            }

            return(res);
        }