private void RegisterAllComponentsOf(ThingWithComps parentThing)
        {
            CompSteamTrader comp = parentThing.GetComp <CompSteamTrader>();

            if (comp != null)
            {
                if (this.SteamComps.Contains(comp))
                {
                    //Log.Error("SteamNet adding SteamComp " + comp + " which it already has.");
                }
                else
                {
                    this.SteamComps.Add(comp);
                }
            }
            CompSteamTank comp2 = parentThing.GetComp <CompSteamTank>();

            if (comp2 != null)
            {
                if (this.batteryComps.Contains(comp2))
                {
                    //Log.Error("SteamNet adding SteamTankComp " + comp2 + " which it already has.");
                }
                else
                {
                    this.batteryComps.Add(comp2);
                }
            }
        }
        private bool IsActiveSteamSource(CompSteam cp)
        {
            CompSteamTank CompSteamTank = cp as CompSteamTank;

            if (CompSteamTank != null && CompSteamTank.StoredSteam > 0f)
            {
                return(true);
            }
            CompSteamTrader compSteamTrader = cp as CompSteamTrader;

            return(compSteamTrader != null && compSteamTrader.SteamOutput > 0f);
        }
        private void DeregisterAllComponentsOf(ThingWithComps parentThing)
        {
            CompSteamTrader comp = parentThing.GetComp <CompSteamTrader>();

            if (comp != null)
            {
                this.SteamComps.Remove(comp);
            }
            CompSteamTank comp2 = parentThing.GetComp <CompSteamTank>();

            if (comp2 != null)
            {
                this.batteryComps.Remove(comp2);
            }
        }
Exemplo n.º 4
0
        public override void Draw()
        {
            base.Draw();
            CompSteamTank comp = base.GetComp <CompSteamTank>();

            GenDraw.FillableBarRequest r = default(GenDraw.FillableBarRequest);
            r.center      = this.DrawPos + Vector3.up * 0.1f;
            r.size        = Building_SteamTank.BarSize;
            r.fillPercent = comp.StoredSteam / comp.Props.storedSteamMax;
            r.filledMat   = Building_SteamTank.BatteryBarFilledMat;
            r.unfilledMat = Building_SteamTank.BatteryBarUnfilledMat;
            r.margin      = 0.15f;
            Rot4 rotation = base.Rotation;

            rotation.Rotate(RotationDirection.Clockwise);
            r.rotation = rotation;
            GenDraw.DrawFillableBar(r);
            if (this.ticksToExplode > 0 && base.Spawned)
            {
                base.Map.overlayDrawer.DrawOverlay(this, OverlayTypes.BurningWick);
            }
        }