Skip to main content

GenericAssemblyStation

A class in Root.Township, Alta.Crafting.

Assembly station with a dock for a GenericAssemblyPart, set up or down. Offers crafting options for parts brought near it and lets you chisel parts off the docked item.

Constructors​

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

Fields​

11 private and internal fields
MemberWhat it is
private List<Chiselable> addedChiselablesChiselable components added to the docked item's extra rigidbodies.
private PickupDock dockThe dock the assembly part goes into.
private GenericAssemblyPart dockedPartThe docked assembly part, or null.
private Transform downParentSnap point parent for the down position.
private bool isDockPositionUpWhether the dock is in the up position. Saved.
private MethodSync syncDockPositionMessage sync for the dock position.
private static List<Rigidbody> toRemoveScratch list for trackers to drop. Shared by all stations.
private Dictionary<Rigidbody, CraftingPartTracker> trackedPartsCrafting parts inside the trigger, by rigidbody.
private IUnityUpdateMethod trackPartsRegistered update method, while parts are tracked.
private static UpdateModule updateModuleUpdate module the tracking runs on.
private Transform upParentSnap point parent for the up position.

Properties​

MemberWhat it is
override bool CanPickupChangeWhileAdded { get; }True: the docked item can be decrafted even if it isn't crafted yet.

Methods​

MemberWhat it is
override void Initialize()Creates the dock position sync.
override void OnConnected(Player player)Sends the dock position to a joining player if something is docked.
void TriggerEnter(Collider other)Called by the trigger when a collider enters; tracks crafting parts while something is docked.
void TriggerExit(Collider other)Called by the trigger when a collider leaves; cancels its pending connection with the docked part.
protected override bool ValidateCraftingPart(CraftingPart part)Refuses to knock off a part if any IBlockDisassembly on it says it can't be disassembled.
12 private and internal methods
MemberWhat it is
private void Awake()Hooks the dock's filter and dock events.
private void CalculateDockPosition(Interactor interactor)Picks up or down from the part's allowed positions, or from which is nearer the player's hand if both are allowed.
private void CreateOption()Offers a crafting option between the docked part and a held part nearby.
private void DockFilter(Interactor interactor, Pickup pickup, ref bool result)Only accepts pickups with a GenericAssemblyPart.
private void FixPosition(CraftingPart part, bool isLoad)Re-applies the dock position after the docked part is crafted or decrafted.
private void GetAdditionalChiselables(Pickup pickup)Makes the docked item's other rigidbodies hittable for decrafting too.
private void InsertPiece(Interactor interactor, Pickup pickup, PickupDock dock)Handler for docking: positions the part, syncs, and starts decrafting and crafting options.
private void PositionDock()Moves the dock's snap point to the up or down parent and sets the part's position.
private void RemovePiece(Interactor interactor, Pickup pickup, PickupDock dock)Handler for undocking: removes the chiselables and any pending connection.
private void SetUpTrackedParts(Collider collider)Starts tracking a crafting part entering the trigger.
private void SyncDockPosition(IPlayer player, Stream stream)Network message for the up or down dock position.
private void TrackParts()Per-frame update while parts are near: offers options and drops trackers that are gone.