CoinPress
A class in Root.Township, the global namespace.
A lever press that turns input items into coins. When the lever is pulled down fully, the server takes items from the input dock and adds output to the output dock.
- Listed in Global namespace: C to D
- Inherits or implements
NetworkEntityBehaviour - Documented in Smelting and forging
Constructors
| Member | What it is |
|---|---|
CoinPress() | Unity makes components itself; use AddComponent or spawn a prefab instead of new. |
Fields
13 private and internal fields
| Member | What it is |
|---|---|
private float addMaxThreshold | Lever value under which items can be added to the input dock. |
private float downHeight | Local height of the press when fully down. |
private PickupDock inputDock | Dock that takes the item to be pressed. |
private Lever lever | The lever that drives the press. |
private int output | How many output items one press makes (5 by default). |
private PickupDock outputDock | Dock the made items go into. Spawns a new stack there or adds to the existing one. |
private Item outputItem | The item the press makes. |
private Transform press | Transform of the press head that moves with the lever. |
private AnimationCurve pressCurve | Curve from lever value to press height. |
private AltaEvent pressed | Event raised on the server after each press. |
private float pressMinThreshold | Lever value above which a press happens. |
private int requiredInput | How many input items one press uses. |
private float upHeight | Local height of the press when fully up. |
Methods
| Member | What it is |
|---|---|
override void Initialize() | Adds the input dock filter. |
3 private and internal methods
| Member | What it is |
|---|---|
private void Awake() | Hooks the lever's ValueChanged. |
private void InputFilter(Interactor interactor, Pickup pickup, ref bool result) | Only allows docking into the input while the lever is near the top (below addMaxThreshold). |
private void ValueChanged(Lever lever, float oldValue, float newValue) | Moves the press with the lever. Server: when the lever passes pressMinThreshold with enough input, destroys requiredInput items and adds output items. |