Skip to main content

MouldPress

A class in Root.Township, the global namespace.

Lever-driven press that stamps a pattern item into a blank mould. The press moves on every side; only the server applies the pattern.

Constructors​

MemberWhat it is
MouldPress()Unity makes components itself; use AddComponent or spawn a prefab instead of new.

Fields​

11 private and internal fields
MemberWhat it is
private float addMaxThresholdLever value below which a pattern item can be docked.
private float downHeightLocal Y of the press head when fully down.
private Transform invalidPressWhere the pattern item is undocked to when the mould already has a definition.
private Lever leverLever that drives the press.
private PickupDock mouldOutputDockDock holding the mould.
private Transform pressPress head transform that moves with the lever.
private AnimationCurve pressCurveCurve from lever value to press position.
private AltaEvent pressedEvent fired after the server applies a pattern.
private float pressMinThresholdLever value above which the press applies the pattern.
private float upHeightLocal Y of the press head when fully up.
private PickupDock weaponPartDockDock holding the pattern item.

Methods​

MemberWhat it is
override void Initialize()Adds a filter to the weapon part dock.
void SetMould(PickupDock input, PickupDock output)Sets a blank mould's definition from the docked pattern item and destroys the item; if the mould already has one, undocks the item instead.
3 private and internal methods
MemberWhat it is
private void Awake()Hooks the lever's value change.
private void InputFilter(Interactor interactor, Pickup pickup, ref bool result)Only lets an item dock in the weapon part dock while the lever is below addMaxThreshold.
private void ValueChanged(Lever lever, float oldValue, float newValue)Moves the press head with the lever; server: past pressMinThreshold with both docks filled, calls SetMould and fires pressed.