예제 #1
0
 public override AcceptanceReport AllowsPlacing(BuildableDef def, IntVec3 center, Rot4 rot, Map map, Thing thingToIgnore = null)
 {
     if (FuelingPortUtility.FuelingPortGiverAtFuelingPortCell(center, map) == null)
     {
         return("MustPlaceNearFuelingPort".Translate());
     }
     return(true);
 }
예제 #2
0
        public override void DrawGhost(ThingDef def, IntVec3 center, Rot4 rot, Color ghostCol)
        {
            Map currentMap = Find.CurrentMap;

            if (def.building != null && def.building.hasFuelingPort && FuelingPortUtility.GetFuelingPortCell(center, rot).Standable(currentMap))
            {
                DrawFuelingPortCell(center, rot);
            }
        }
        public override void DrawGhost(ThingDef def, IntVec3 center, Rot4 rot)
        {
            Map visibleMap = Find.VisibleMap;

            if (def.building != null && def.building.hasFuelingPort && FuelingPortUtility.GetFuelingPortCell(center, rot).Standable(visibleMap))
            {
                PlaceWorker_FuelingPort.DrawFuelingPortCell(center, rot);
            }
        }
예제 #4
0
        public override void DrawGhost(ThingDef def, IntVec3 center, Rot4 rot, Color ghostCol)
        {
            Map currentMap = Find.CurrentMap;

            if (def.building == null || !def.building.hasFuelingPort)
            {
                return;
            }
            if (!FuelingPortUtility.GetFuelingPortCell(center, rot).Standable(currentMap))
            {
                return;
            }
            PlaceWorker_FuelingPort.DrawFuelingPortCell(center, rot);
        }
예제 #5
0
        public override void ProcessInput(Event ev)
        {
            base.ProcessInput(ev);
            if (transporters == null)
            {
                transporters = new List <CompTransporter>();
            }
            if (!transporters.Contains(transComp))
            {
                transporters.Add(transComp);
            }
            CompLaunchable launchable = transComp.Launchable;

            if (launchable != null)
            {
                Building fuelingPortSource = launchable.FuelingPortSource;
                if (fuelingPortSource != null)
                {
                    Map map = transComp.Map;
                    tmpFuelingPortGivers.Clear();
                    map.floodFiller.FloodFill(fuelingPortSource.Position, (IntVec3 x) => FuelingPortUtility.AnyFuelingPortGiverAt(x, map), delegate(IntVec3 x)
                    {
                        tmpFuelingPortGivers.Add(FuelingPortUtility.FuelingPortGiverAt(x, map));
                    });
                    for (int i = 0; i < transporters.Count; i++)
                    {
                        Building fuelingPortSource2 = transporters[i].Launchable.FuelingPortSource;
                        if (fuelingPortSource2 != null && !tmpFuelingPortGivers.Contains(fuelingPortSource2))
                        {
                            Messages.Message("MessageTransportersNotAdjacent".Translate(), fuelingPortSource2, MessageTypeDefOf.RejectInput, historical: false);
                            return;
                        }
                    }
                }
            }
            for (int j = 0; j < transporters.Count; j++)
            {
                if (transporters[j] != transComp && !transComp.Map.reachability.CanReach(transComp.parent.Position, transporters[j].parent, PathEndMode.Touch, TraverseParms.For(TraverseMode.PassDoors)))
                {
                    Messages.Message("MessageTransporterUnreachable".Translate(), transporters[j].parent, MessageTypeDefOf.RejectInput, historical: false);
                    return;
                }
            }
            Dialog_LoadTransporters dialog_LoadTransporters = new Dialog_LoadTransporters(transComp.Map, transporters);

            dialog_LoadTransporters.autoLoot = transComp.Shuttle != null && transComp.Shuttle.CanAutoLoot;
            Find.WindowStack.Add(dialog_LoadTransporters);
        }
예제 #6
0
        public override void ProcessInput(Event ev)
        {
            base.ProcessInput(ev);
            if (this.transporters == null)
            {
                this.transporters = new List <CompTransporter>();
            }
            if (!this.transporters.Contains(this.transComp))
            {
                this.transporters.Add(this.transComp);
            }
            CompLaunchable launchable = this.transComp.Launchable;

            if (launchable != null)
            {
                Building fuelingPortSource = launchable.FuelingPortSource;
                if (fuelingPortSource != null)
                {
                    Map map = this.transComp.Map;
                    Command_LoadToTransporter.tmpFuelingPortGivers.Clear();
                    map.floodFiller.FloodFill(fuelingPortSource.Position, (IntVec3 x) => FuelingPortUtility.AnyFuelingPortGiverAt(x, map), delegate(IntVec3 x)
                    {
                        Command_LoadToTransporter.tmpFuelingPortGivers.Add(FuelingPortUtility.FuelingPortGiverAt(x, map));
                    }, 2147483647, false, null);
                    for (int i = 0; i < this.transporters.Count; i++)
                    {
                        Building fuelingPortSource2 = this.transporters[i].Launchable.FuelingPortSource;
                        if (fuelingPortSource2 != null && !Command_LoadToTransporter.tmpFuelingPortGivers.Contains(fuelingPortSource2))
                        {
                            Messages.Message("MessageTransportersNotAdjacent".Translate(), fuelingPortSource2, MessageTypeDefOf.RejectInput);
                            return;
                        }
                    }
                }
            }
            for (int j = 0; j < this.transporters.Count; j++)
            {
                if (this.transporters[j] != this.transComp)
                {
                    if (!this.transComp.Map.reachability.CanReach(this.transComp.parent.Position, this.transporters[j].parent, PathEndMode.Touch, TraverseParms.For(TraverseMode.PassDoors, Danger.Deadly, false)))
                    {
                        Messages.Message("MessageTransporterUnreachable".Translate(), this.transporters[j].parent, MessageTypeDefOf.RejectInput);
                        return;
                    }
                }
            }
            Find.WindowStack.Add(new Dialog_LoadTransporters(this.transComp.Map, this.transporters));
        }
예제 #7
0
        public static void DrawFuelingPortCell(IntVec3 center, Rot4 rot)
        {
            Vector3 position = FuelingPortUtility.GetFuelingPortCell(center, rot).ToVector3ShiftedWithAltitude(AltitudeLayer.MetaOverlays);

            Graphics.DrawMesh(MeshPool.plane10, position, Quaternion.identity, FuelingPortCellMaterial, 0);
        }
        public override void DrawGhost(ThingDef def, IntVec3 center, Rot4 rot, Color ghostCol)
        {
            Map             currentMap           = Find.CurrentMap;
            List <Building> allBuildingsColonist = currentMap.listerBuildings.allBuildingsColonist;

            for (int i = 0; i < allBuildingsColonist.Count; i++)
            {
                Building building = allBuildingsColonist[i];
                if (building.def.building.hasFuelingPort && !Find.Selector.IsSelected(building) && FuelingPortUtility.GetFuelingPortCell(building).Standable(currentMap))
                {
                    PlaceWorker_FuelingPort.DrawFuelingPortCell(building.Position, building.Rotation);
                }
            }
        }
예제 #9
0
 public static IntVec3 GetFuelingPortCell(Building podLauncher)
 {
     return(FuelingPortUtility.GetFuelingPortCell(podLauncher.Position, podLauncher.Rotation));
 }
예제 #10
0
 public static Building FuelingPortGiverAtFuelingPortCell(IntVec3 c, Map map)
 {
     for (int i = 0; i < 4; i++)
     {
         IntVec3 c2 = c + GenAdj.CardinalDirections[i];
         if (c2.InBounds(map))
         {
             List <Thing> thingList = c2.GetThingList(map);
             for (int j = 0; j < thingList.Count; j++)
             {
                 Building building = thingList[j] as Building;
                 if (building != null && building.def.building.hasFuelingPort && FuelingPortUtility.GetFuelingPortCell(building) == c)
                 {
                     return(building);
                 }
             }
         }
     }
     return(null);
 }
예제 #11
0
 public static bool AnyFuelingPortGiverAt(IntVec3 c, Map map)
 {
     return(FuelingPortUtility.FuelingPortGiverAt(c, map) != null);
 }
예제 #12
0
 internal void <> m__1(IntVec3 x)
 {
     Command_LoadToTransporter.tmpFuelingPortGivers.Add(FuelingPortUtility.FuelingPortGiverAt(x, this.map));
 }
예제 #13
0
 internal bool <> m__0(IntVec3 x)
 {
     return(FuelingPortUtility.AnyFuelingPortGiverAt(x, this.map));
 }