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); }
public override bool TryPlaceObject(Player player, Vector3i position, Quaternion rotation) { Vector3i startPosition = position - new Vector3i((int)(StockpileComponent.Dimensions.x / 2f), 1, (int)(StockpileComponent.Dimensions.z / 2f)); foreach (var offset in StockpileComponent.Dimensions.XZ.XYIter()) { var worldPos = startPosition + offset.X_Z(); if (!World.GetBlock(worldPos).Is <Solid>()) { player.SendTemporaryErrorLoc("Stockpile requires solid ground to be placed on."); return(false); } } return(base.TryPlaceObject(player, position, rotation)); }
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); }