Skip to main content

JointInsert

A class in Root.Township, Alta.Crafting.

The plug end of a crafting part that goes into another part's JointSlot. Also draws the guide lines to nearby slots while the player holds the part (client only).

Constructors​

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

Fields​

6 private and internal fields
MemberWhat it is
private Vector3 insertLengthBacking field for InsertLength.
private bool isShowingLinesTrue while guide lines to slots are shown.
private PlayerController linesPlayerPlayer the guide lines are shown for.
private Dictionary<JointSlot, SplineParticlesPooled> particlesPoolPooled spline particles drawing a line to each slot.
private static PickupTypeSettings settingsShared PickupTypeSettings (line pool and colours).
private JointInsertType typeBacking field for Type.

Properties​

MemberWhat it is
JointSlot ConnectedSlot { get; set; }The slot this insert is plugged into, or null. Set by JointSlot when connecting and disconnecting.
override IEnumerable<JointPointType> GeneralTypes { get; }The insert's joint type, as a one-item list, for slot matching.
Vector3 InsertLength { get; }Local offset for how far the insert reaches into a slot. Used by CraftingOptions when it is non-zero.
JointInsertType Type { get; }The insert type that decides which slots it fits.

Methods​

MemberWhat it is
void HideLines()Client: releases all guide lines.
void ShowLines(HashSet<JointSlot> slots, PlayerController player, JointSlot active)Client: draws a glowing line from each candidate slot to this insert, highlighting the active one.
void SwapLines(JointSlot previousBest, JointSlot newBest)Client: moves the active highlight from the previous best slot to the new one.
protected override void OnDrawGizmosSelected()Editor: draws the insert length as a yellow line.
protected override void OnValidate()Editor: renames the GameObject to match the insert type.
2 private and internal methods
MemberWhat it is
private void Start()Caches the global PickupTypeSettings used for line colours.
private void TryAdd(List<GameObject> list, params string[] names)Adds named children of the crafting part to a list if found. Not called in this build.

Used in​

Members of other types that take, return or hold a JointInsert: