예제 #1
0
        private void RegisterAllComponentsOf(ThingWithComps parentThing)
        {
            CompWaterTrader comp = parentThing.GetComp <CompWaterTrader>();

            if (comp != null)
            {
                if (this.WaterComps.Contains(comp))
                {
                    //Log.Error("WaterNet adding WaterComp " + comp + " which it already has.");
                }
                else
                {
                    this.WaterComps.Add(comp);
                }
            }
            CompWaterTank comp2 = parentThing.GetComp <CompWaterTank>();

            if (comp2 != null)
            {
                if (this.batteryComps.Contains(comp2))
                {
                    //Log.Error("WaterNet adding WaterTankComp " + comp2 + " which it already has.");
                }
                else
                {
                    this.batteryComps.Add(comp2);
                }
            }
        }
예제 #2
0
        private bool IsActiveWaterSource(CompWater cp)
        {
            CompWaterTank CompWaterTank = cp as CompWaterTank;

            if (CompWaterTank != null && CompWaterTank.StoredWater > 0f)
            {
                return(true);
            }
            CompWaterTrader compWaterTrader = cp as CompWaterTrader;

            return(compWaterTrader != null && compWaterTrader.WaterOutput > 0f);
        }
예제 #3
0
        private void DeregisterAllComponentsOf(ThingWithComps parentThing)
        {
            CompWaterTrader comp = parentThing.GetComp <CompWaterTrader>();

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

            if (comp2 != null)
            {
                this.batteryComps.Remove(comp2);
            }
        }
예제 #4
0
        public override void Draw()
        {
            base.Draw();
            CompWaterTank comp = base.GetComp <CompWaterTank>();

            GenDraw.FillableBarRequest r = default(GenDraw.FillableBarRequest);
            r.center = (this.DrawPos + Vector3.up * 0.1f) + Props.indicatorOffset;
            r.size   = new Vector2
                           (Building_WaterTank.BarSize.x * Props.indicatorDrawSize.x,
                           Building_WaterTank.BarSize.y * Props.indicatorDrawSize.y);
            r.fillPercent = comp.StoredWater / comp.Props.storedWaterMax;
            r.filledMat   = Building_WaterTank.BatteryBarFilledMat;
            r.unfilledMat = Building_WaterTank.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);
            }
        }