Beispiel #1
0
        public FCPlanetRoadQueue CreateRoadQueue(string planetName, bool logFailure = true)
        {
            FCPlanetRoadQueue queue = GetRoadQueue(planetName);

            if (queue != null)
            {
                if (logFailure)
                {
                    Log.Message("Empire - Road queue for " + planetName + " already exists.");
                }

                return(queue);
            }
            queue = new FCPlanetRoadQueue(planetName, this.roadDef, this.daysBetweenTicks);
            roadQueues.Add(queue);
            return(queue);
        }
Beispiel #2
0
        public void RoadTick()
        {
            if (this.roadDef == null || !this.roadBuildingEnabled)
            {
                this.wasRoadBuildingDisabled = true;
                return;
            }

            // Every 20 ticks causes a slight stutter, but the game is still playable
            // TODO: Make this a config option
            if (Find.TickManager.TicksGame % 20 == 0)
            {
                FactionFC         faction = Find.World.GetComponent <FactionFC>();
                FCPlanetRoadQueue queue   = this.GetRoadQueue(Find.World.info.name);

                if (!roadBuilders && faction.hasTrait(FCPolicyDefOf.roadBuilders))
                {
                    foreach (FCPlanetRoadQueue prq in this.roadQueues)
                    {
                        prq.shouldUpdateSettlementsToProcess = true;
                        prq.daysBetweenTicks = 1;
                    }
                    this.roadBuilders     = true;
                    this.daysBetweenTicks = 1;
                }

                // If road building was disabled, then set the next tick to make a road
                // to the correct time
                if (this.wasRoadBuildingDisabled)
                {
                    this.wasRoadBuildingDisabled = false;
                    foreach (FCPlanetRoadQueue prq in this.roadQueues)
                    {
                        prq.nextRoadTick = Find.TickManager.TicksGame + GenDate.TicksPerDay * prq.daysBetweenTicks;
                    }
                }

                queue.ProcessOnePath();
                queue.BuildRoadSegments();
            }
        }