示例#1
0
        /// <summary>
        /// Post Spawn for Component
        /// </summary>
        /// <param name="respawningAfterLoad">Unused Flag</param>
        public override void PostSpawnSetup(bool respawningAfterLoad)
        {
            CentralizedClimateControlUtility.GetNetManager(parent.Map).RegisterProducer(this);
            FlickableComp = parent.GetComp <CompFlickable>();

            base.PostSpawnSetup(respawningAfterLoad);
        }
        /// <summary>
        /// Building de-spawned from the map
        /// </summary>
        /// <param name="map">RimWorld Map</param>
        public override void PostDeSpawn(Map map)
        {
            CentralizedClimateControlUtility.GetNetManager(map).DeregisterPipe(this);
            ResetFlowVariables();

            base.PostDeSpawn(map);
        }
        /// <summary>
        /// Main method to Print a Atlas Pipe Graphic
        /// </summary>
        /// <param name="layer">Section Layer calling this Print command</param>
        /// <param name="parent">Parent Object</param>
        public override void Print(SectionLayer layer, Thing parent)
        {
            var material = LinkedDrawMatFrom(parent, parent.Position);

            Printer_Plane.PrintPlane(layer, parent.TrueCenter(), Vector2.one, material, 0f);
            for (var i = 0; i < 4; i++)
            {
                var intVec = parent.Position + GenAdj.CardinalDirections[i];

                if (!intVec.InBounds(parent.Map) ||
                    !CentralizedClimateControlUtility.GetNetManager(parent.Map).ZoneAt(intVec, FlowType) || intVec.GetTerrain(parent.Map).layerable)
                {
                    continue;
                }

                var thingList = intVec.GetThingList(parent.Map);

                Predicate <Thing> predicate = CheckPipe;
                if (thingList.Any(predicate))
                {
                    continue;
                }

                var material2 = LinkedDrawMatFrom(parent, intVec);
                Printer_Plane.PrintPlane(layer, intVec.ToVector3ShiftedWithAltitude(parent.def.Altitude), Vector2.one, material2, 0f);
            }
        }
示例#4
0
        /// <summary>
        /// Overriden Function for Pipe Atlas. It Checks for Neighbouring tiles if it should be Linked to the target cell.
        /// This Function specifies the condition that will be used.
        ///
        /// Here we just check if the target cell that is asked for linkage has a Pipe of the same Color or not.
        /// </summary>
        /// <param name="intVec">Target Cell</param>
        /// <param name="parent">Parent Object</param>
        /// <returns>Should Link with Same Color Pipe or not</returns>
        public override bool ShouldLinkWith(IntVec3 intVec, Thing parent)
        {
            //var building = parent as Building;
            //if (building == null)
            if ((parent as Building) == null)
            {
                return(false);
            }

            return(intVec.InBounds(parent.Map) && CentralizedClimateControlUtility.GetNetManager(parent.Map).ZoneAt(intVec, FlowType));
        }
示例#5
0
        /// <summary>
        /// Get the Gizmos for AirVent
        /// Here, we generate the Gizmo for Chaning Pipe Priority
        /// </summary>
        /// <returns>List of Gizmos</returns>
        public override IEnumerable <Gizmo> GetGizmos()
        {
            foreach (Gizmo g in base.GetGizmos())
            {
                yield return(g);
            }

            if (CompAirFlowConsumer != null)
            {
                yield return(CentralizedClimateControlUtility.GetPipeSwitchToggle(CompAirFlowConsumer));
            }
        }
        /// <summary>
        /// Tick for Consumers. Here:
        /// - We Rebuild if Priority is Changed
        /// - We take the Converted Temperature from Climate Units
        /// </summary>
        public void TickRare()
        {
            if (_alertChange)
            {
                var manager = CentralizedClimateControlUtility.GetNetManager(parent.Map);
                manager.DirtyPipeWholeGrid();
                _alertChange = false;
            }

            if (!IsOperating())
            {
                return;
            }

            ConvertedTemperature = AirFlowNet.AverageConvertedTemperature;
        }
示例#7
0
        /// <summary>
        /// Tick for Consumers. Here:
        /// - We Rebuild if Priority is Changed
        /// - We take the Converted Temperature from Climate Units
        /// </summary>
        public void TickRare()
        {
            if (_alertChange)
            {
                //var manager = CentralizedClimateControlUtility.GetNetManager(parent.Map);
                //manager.IsDirty = true;

                // Direct access is given, so we should use it  --Brain
                CentralizedClimateControlUtility.GetNetManager(parent.Map).IsDirty = true;
                _alertChange = false;
            }

            if (!IsOperating())
            {
                return;
            }

            ConvertedTemperature = AirFlowNet.AverageConvertedTemperature;
        }
 /// <summary>
 /// Overriden Function for Pipe Atlas. It Checks for Neighbouring tiles if it should be Linked to the target cell.
 /// This Function specifies the condition that will be used.
 ///
 /// Here we just check if the target cell that is asked for linkage has a Pipe of the same Color or not.
 /// </summary>
 /// <param name="vec">Target Cell</param>
 /// <param name="parent">Parent Object</param>
 /// <returns>Should Link with Same Color Pipe or not</returns>
 public override bool ShouldLinkWith(IntVec3 vec, Thing parent)
 {
     return(vec.InBounds(parent.Map) && CentralizedClimateControlUtility.GetNetManager(parent.Map).ZoneAt(vec, FlowType));
 }
 /// <summary>
 /// Component spawned on the map
 /// </summary>
 /// <param name="respawningAfterLoad">Unused flag</param>
 public override void PostSpawnSetup(bool respawningAfterLoad)
 {
     CentralizedClimateControlUtility.GetNetManager(parent.Map).RegisterPipe(this);
     base.PostSpawnSetup(respawningAfterLoad);
 }