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.
- Listed in Crafting and making
- Inherits or implements
JointPoint,IJointSlotComponent - Documented in Crafting
Constructors
| Member | What it is |
|---|---|
JointSlot() | Unity makes components itself; use AddComponent or spawn a prefab instead of new. |
Fields
3 private and internal fields
| Member | What it is |
|---|---|
private bool isFlipWeighting | Backing field for IsFlipWeighting. On double-sided weapons, asks to flip when docked if this side is heavier. |
private MethodSyncStruct<bool> syncInsert | Method sync the server uses to send connects and disconnects, and the current state to joining players. |
private List<JointSlotType> types | Backing field for Types: slot types that decide which inserts fit. |
Properties
| Member | What 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
Events
| Member | What it is |
|---|---|
event Action<IJointSlotComponent> UsedChanged | Raised when a part is joined or removed. |
Methods
| Member | What 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
| Member | What 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:
ConfirmationCraftingPart.AttemptCraft, ConfirmationCraftingPart.SetupNailing, ConfirmationCraftingPart.targetSlot, CraftingOptions.bestMatch, CraftingOptions.possibleSlotPools, CraftingOptions.possibleSlots, CraftingPart.AttemptCraft, CraftingPart.CraftWithSlot, CraftingPart.LostChildAsTopLevel, CraftingPart.ReceivedChildAsTopLevel, CraftingPart.slots, CraftingPart.Slots, DecraftingComponent.availableSlots, DecraftingComponent.GetClosestSlot, JointInsert.ConnectedSlot, JointInsert.particlesPool, JointInsert.ShowLines, JointInsert.SwapLines, Arrow.craftedParts, MainMenuCraft.slot.