Ejemplo n.º 1
0
        public float OnPipeExit(WireOutput wire, Ray posDir, PipePayload payload)
        {
            var existingBlock = World.GetBlock(posDir.FirstPos) as EmptyBlock;

            if (existingBlock != null)
            {
                var target = World.FindPyramidPos(posDir.FirstPos);
                World.SetBlock(this.OriginType, target);
                return(1);
            }
            return(0);
        }
Ejemplo n.º 2
0
 protected override void Initialize()
 {
     outputWire = new WireOutput(this, typeof(PipeBlock), new Ray(0, 0, 0, Direction.Up), "Output");
     this.GetComponent <PropertyAuthComponent>().Initialize();
     this.GetComponent <LinkComponent>().Initialize(2);
     this.GetComponent <AttachmentComponent>().Initialize();
     this.GetComponent <PublicStorageComponent>().Initialize(2);
     timer           = new Timer(1000);
     timer.AutoReset = true;
     timer.Elapsed  += CustomTick;
     timer.Start();
 }
Ejemplo n.º 3
0
        public override void Initialize()
        {
            base.Initialize();
            this.status = this.Parent.GetComponent <StatusComponent>().CreateStatusElement();
            this.Parent.GetComponent <LiquidProducerComponent>().Setup(typeof(WaterItem), 1f, this.Parent.NamedOccupancyOffset("OutputPort"));

            // this is a special case, we really want to pull water but pipes are built around the assumption of pushing
            // input pipes don't trace pipe networks so for now inputPipe is a WireOutput purely for the network tracing
            // as this pipe doesn't actually output anything we need to manually update it, using chunk subscriber to handle updates
            // TODO: refactor pipes so pipe networks are their own thing which inputs and outputs get linked to
            this.inputPipe = new WireOutput(this.Parent, typeof(PipeBlock), this.Parent.NamedOccupancyOffset("InputPort"), Localizer.DoStr("Input"));

            this.ChunksChanged();
            this.UpdateStatus();
        }
Ejemplo n.º 4
0
        public float OnPipeExit(WireOutput wire, Ray posDir, PipePayload payload)
        {
            var pos           = posDir.FirstPos + Vector3i.Down;
            var existingBlock = World.GetBlock(pos);
            var waterOuput    = Mathf.Min(payload.Amount / payload.Time, .999f);

            switch (existingBlock)
            {
            // Set the existing block if it's there, or add a new block.
            case EmptyBlock _:
                World.SetBlock(typeof(WaterBlock), pos, waterOuput, true);
                break;

            case WaterBlock waterBlock:
                waterBlock.Water        = waterOuput;
                waterBlock.PipeSupplied = true;
                break;
            }

            return(payload.Amount);
        }
Ejemplo n.º 5
0
 public float OnPipeExit(WireOutput wire, Ray posDir, PipePayload payload)
 {
     WorldLayerManager.Obj.ClimateSim.AddGroundPollution(posDir.FirstPos.XZ, payload.Amount / SewageItemsPerPollution / TimeUtil.SecondsPerHour);
     return(payload.Amount);
 }