Exemplo n.º 1
0
        private void RegisterAllComponentsOf(ThingWithComps parentThing)
        {
            CompPipeTrader comp = parentThing.GetComp <CompPipeTrader>();

            if (comp != null)
            {
                if (this.powerComps.Contains(comp))
                {
                    Log.Error("PowerNet adding powerComp " + comp + " which it already has.", false);
                }
                else
                {
                    this.powerComps.Add(comp);
                }
            }
            CompPipeTank comp2 = parentThing.GetComp <CompPipeTank>();

            if (comp2 != null)
            {
                if (this.batteryComps.Contains(comp2))
                {
                    Log.Error("PowerNet adding batteryComp " + comp2 + " which it already has.", false);
                }
                else
                {
                    this.batteryComps.Add(comp2);
                }
            }
        }
Exemplo n.º 2
0
        private bool IsActivePowerSource(CompPipe cp)
        {
            CompPipeTank compPowerBattery = cp as CompPipeTank;

            if (compPowerBattery != null && compPowerBattery.StoredEnergy > 0f)
            {
                return(true);
            }
            CompPipeTrader compPowerTrader = cp as CompPipeTrader;

            return(compPowerTrader != null && compPowerTrader.PowerOutput > 0f);
        }
Exemplo n.º 3
0
        private void DeregisterAllComponentsOf(ThingWithComps parentThing)
        {
            CompPipeTrader comp = parentThing.GetComp <CompPipeTrader>();

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

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

            GenDraw.FillableBarRequest r = default(GenDraw.FillableBarRequest);
            r.center      = this.DrawPos + Vector3.up * 0.1f;
            r.size        = Building_Tank.BarSize;
            r.fillPercent = comp.StoredEnergy / comp.Props.storedEnergyMax;
            r.filledMat   = Building_Tank.BatteryBarFilledMat;
            r.unfilledMat = Building_Tank.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);
            }
        }