Skip to main content

Items, interaction and damage

This area covers everything a hand touches: picking things up, belts and bags, item wear, buttons and levers, weapons, hits, health and what happens to your items when you die. All of it lives in Root.Township. Many types have no namespace; the rest are in Alta.Inventory, Alta.Impact, Alta.Character, Alta.QuickAccessActions and Alta.Pages.

The big picture​

  • Hands are Interactors. Each hand of each player has one. When you squeeze grip, it looks for the best Interactable it overlaps and starts an interaction with it.
  • Almost everything you can hold is a Pickup. Pickup is an Interactable with a rigidbody, grab points, an Item definition and a joint to the hand.
  • Belts, the back slot, bag slots, shelves and pouches are PickupDocks. A dock is also an Interactable. While an item is docked, you grab the dock and it hands you the item.
  • Weapons and tools are ImpactTools, and anything that can be hit has ImpactDetectors. A hit becomes an ImpactHit, which a HealthObject turns into damage.

Who decides what​

The game trusts clients more than you might expect. In short:

WhatDecided byNotes
Grabbing and letting goThe grabbing player's clientIt sends the grab; the server only checks that the hand belongs to the sender and that the player is alive. No distance check.
Putting an item in a dockThe client, then the server checksThe server runs PickupDock.CheckAllowed and sends a correction if it refuses.
Splitting stacks, pouches, quantitiesServerClients ask; the server spawns pouches and keeps QuantityStored.
A held weapon hitting a creature, tree or rockThe wielder's clientIt works out the hit and sends SyncImpact. The server checks only that the sender last held the tool.
A creature's weapon hitting a playerThe victim's clientSame message, other direction.
A player hitting a playerServerThe server resolves PvP hits itself.
Damage, health, death, durability, embeddingServerClients see the results through stat sync and entity messages.
Fall damageThe falling client reports the drop heightThe server deals the damage.

So a server mod sees every grab, dock and hit, but it sees most of them after a client already acted.

All of this was checked against the server build that Tavern servers run (assembly 0.0.39.2). For the classes in this area it's the same code as the client download, so these server checks are the only ones there are.

Numbers marked "asset values" come from the game's prefabs and settings assets in build main-1.7.2.1.42203. They're a few examples. The reference tables list every item, material and durability setting.

Everything in this area runs on Unity's main thread, from Unity callbacks (Update, LateUpdate, collisions) and network message handlers. The few async methods (PlayerHealth.GrantInvincibilityToImpacts, the start delay on PhysicalButton) use Task.Delay and carry on through Unity's synchronisation context, so also on the main thread. See Impacts and hit detection and Interactor and hands for the details.

Pages in this area​

PageWhat's on it
InteractableThe base class for anything a hand can interact with. Events, filters, forwarding, channels.
Interactor and handsHands, Controller, how a grab is picked, how grabs are networked, giving items from the server.
PickupThings you can hold. Joints, weight, docking events, breaking.
Grab points and hand-touch pointsGrabPoint (where a hand holds an item) and HandHoverPoint (hold your hand on it to activate).
DocksPickupDock, stacks, CheckAllowed, filters, dock settings.
Player inventoryHands, back slot, belt slots, bags, pouches and PickupContainer. Reading and filling a player's inventory.
Items and materialsItem definitions, tags, PhysicalMaterial and PhysicalMaterialPart.
DurabilityDurabilityModule: wear, stages, breaking.
EmbeddingEmbeddable: arrows and blades that stick into things.
Impacts and hit detectionImpactTool, ImpactDetector, ImpactHit, how a swing becomes a hit and who works it out.
Health and damageHealthObject, PlayerHealth, DamageData, damage sources and multipliers, AOEDamage.
Death and itemsWhat happens to held and docked items when a player is downed and dies.
Buttons and leversPhysicalButton, Lever and friends.
Quick access menuThe wrist menu and summoned action items.
Pages and booksRecipe pages, books and the town's shared page list.

Spawning in general is in Spawning. Item-specific spawning (into a dock, as a pouch) is on Player inventory.

Other types in this area​

These exist and you may run into them. They're not covered in depth.

TypeWhat it is
MultiHandPickup, CapPickupPickup subclasses for two-handed items and caps.
PullPickup, TelescopicPickup, RotatePickup, MovePickup, WheelGrab, RopeGrabBehaviours on pickups that slide, extend, turn or are pulled along a path.
SpawnerGrabGrabbing it spawns a fresh item into your hand (a dispenser).
AssistGrabInteractable, GrabAssistControllerThe grab assist setting: reaching for things a little out of range. Created per hand only when the setting is on.
LongHoldInteractableAn interactable you must hold for a while.
InteractionForwarderAn interactable that passes the grab on to another one.
FakePickupAn Interactable that looks like a pickup but isn't one.
PickupHolderHolds one pickup in place (server decides, synced).
PickupAreaTracks the pickups inside a trigger.
HoverPickupFloats a pickup back to a target spot when it's let go.
PickupDecayServer-side decay timer for pickups, paused while held or docked.
ThrowablePickupBase for custom throw behaviour (ThrowAlignHelper).
PlayerInteractionManager, PlayerInteractionRestrictorServer-side per-player charge counters ("you can take 3 of these").
HeldPickupHandler, PickupBasedSkill, PowerHitSkills that read how you use a held item.
Chest, Lock, KeyItem, LockableHingeLockable storage in Alta.Inventory.
CommunalStorage, StorageOrganizerShared storage in Alta.Inventory.
AutomaticDockArea, RejectDockAreaAreas that dock or refuse items dropped into them.
DockByDefault, PickupDockPedestalSpawn, EmptyDockAfterTimePeriodDocks that start filled, refill or empty themselves.
ImpactSystemHitManagerLets a client subscribe to the server's hits (debug hit display).
DamageDisplayer, DamagePopup, HitboxVisualizerDamage numbers and hitbox debug views.
FakePlayerHealthA HealthObject for training targets.
BeltA drive belt between pulleys in mechanisms. Not the player's belt.