Skip to main content

JointSlot

A class in Root.Township, Alta.Crafting.

A place on a CraftingPart where another part's insert can join (a blade onto a handle). The server joins parts and syncs the join; clients replay it from the sync.

Constructors​

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

Fields​

3 private and internal fields
MemberWhat it is
private bool isFlipWeightingBacking field for IsFlipWeighting. On double-sided weapons, asks to flip when docked if this side is heavier.
private MethodSyncStruct<bool> syncInsertMethod sync the server uses to send connects and disconnects, and the current state to joining players.
private List<JointSlotType> typesBacking field for Types: slot types that decide which inserts fit.

Properties​

MemberWhat it is
CraftingPart ConnectedPart { get; private set; }The part joined into this slot, or null.
override IEnumerable<JointPointType> GeneralTypes { get; }The slot types, as general joint point types.
bool IsFlipWeighting { get; }For double-sided weapons: asks to flip when docked if this side is heavier.
bool IsUsed { get; }True if a part is joined here.
IEnumerable<JointSlotType> Types { get; }Slot types that say which inserts fit.
1 private and internal property
MemberWhat it is
private bool Alta.Crafting.IJointSlotComponent.IsDestroyed { get; }True once the Unity object has been destroyed.

Events​

MemberWhat it is
event Action<IJointSlotComponent> UsedChangedRaised when a part is joined or removed.

Methods​

MemberWhat it is
void AlignAndChild(CraftingPart insertPart)Rotates the inserted part and parents it so its insert sits on this slot.
void AlignAndChild(CraftingPart insertPart, Quaternion rotation)Rotates the inserted part and parents it so its insert sits on this slot.
Quaternion CalculateConnectedRotation(CraftingPart insertPart)Rotation the inserted part needs so its insert lines up with this slot.
override void Initialize()Sets up the message that syncs joins.
override void InitializeAsServer(SpawnData spawnData)Server: joins any part already placed under the slot in the prefab, marking its forging as done.
override void OnConnected(Player player)Server: sends a joining player what is in the slot.
override void OnJointConnected(bool isPlayingEffects)Plays the attach effect (when effects are on) and raises UsedChanged.
override void OnJointDisconnected(bool isPlayingEffects)Raises UsedChanged.
bool Supports(JointInsertType type)True if any of the slot's types allows the given insert type.
bool TryConnect(CraftingPart insertPart, bool isPlayingEffects)Joins a part here: parents it, attaches durability, raises the crafted events, reports a craft task and syncs. False if either side is taken.
bool TryDisconnect(bool isPlayingEffects)Splits the joined part out and syncs. False if the slot is empty.
protected override void OnValidate()Names the object after its slot type in the editor.
2 private and internal methods
MemberWhat it is
private void FindExisting()Server: on spawn, connects a crafting part already under the slot and marks its forged points fully done.
private async void SyncInsert(IPlayer player, Stream stream, bool isPlayingEffects)Method sync handler: sends whether a part is connected and which one; receivers connect or disconnect to match.

Used in​

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