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.
- Listed in Crafting and making
- Inherits or implements
DecraftingComponent,ISavable<GenericAssemblyStationData>,ISavableSave<GenericAssemblyStationData>,ISavableSaveBase - Derived types
GenericAssemblyStationData - Nested types
AssemblyPosition - Documented in Crafting
Constructors
| Member | What it is |
|---|---|
GenericAssemblyStation() | Unity makes components itself; use AddComponent or spawn a prefab instead of new. |
Fields
11 private and internal fields
| Member | What it is |
|---|---|
private List<Chiselable> addedChiselables | Chiselable components added to the docked item's extra rigidbodies. |
private PickupDock dock | The dock the assembly part goes into. |
private GenericAssemblyPart dockedPart | The docked assembly part, or null. |
private Transform downParent | Snap point parent for the down position. |
private bool isDockPositionUp | Whether the dock is in the up position. Saved. |
private MethodSync syncDockPosition | Message sync for the dock position. |
private static List<Rigidbody> toRemove | Scratch list for trackers to drop. Shared by all stations. |
private Dictionary<Rigidbody, CraftingPartTracker> trackedParts | Crafting parts inside the trigger, by rigidbody. |
private IUnityUpdateMethod trackParts | Registered update method, while parts are tracked. |
private static UpdateModule updateModule | Update module the tracking runs on. |
private Transform upParent | Snap point parent for the up position. |
Properties
| Member | What it is |
|---|---|
override bool CanPickupChangeWhileAdded { get; } | True: the docked item can be decrafted even if it isn't crafted yet. |
Methods
| Member | What 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
| Member | What 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. |