using System.Collections.Generic; using UnityEngine; namespace GrassCutter { /// /// A drive-over grate with a bin behind it: a mower that rolls onto the grate empties its hopper into the bin, and two hatches /// at the back send it out as bundles onto belts. The cheap way to put a field's mowing straight onto a production line. /// The model is 7 m long; the prefab sets it so the grate is the front half and the hatches face back. /// public class UnloadBay : SiloPiece { const float GrateFront = 3.5f, GrateBack = -0.5f, GrateWide = 2.1f, HatchBack = 3.5f; public override string Prompt => Loc.F("Unload Bay: drive a mower onto the grate (bin {0})", GameDefs.Kilos(Silo.Value)); public override bool CanInteract => false; public override void Interact() { } public override string PadName => Loc.T("Unload Bay"); public override void Ports(List into) { var back = -transform.forward; var at = transform.position + transform.up * GameDefs.BeltLowest + back * HatchBack; into.Add(new Port { at = at - transform.right * 0.8f, dir = back }); into.Add(new Port { at = at + transform.right * 0.8f, dir = back }); } public override Vector3 PadSpot => transform.position + transform.forward * ((GrateFront + GrateBack) * 0.5f) + transform.up * 0.3f; public override bool OnPad(Vector3 p) { var l = transform.InverseTransformPoint(p); return Mathf.Abs(l.x) < GrateWide + 0.6f && l.z > GrateBack - 1f && l.z < GrateFront + 1.2f && Mathf.Abs(l.y) < 3f; } } }