Repository navigation
01 Prototype Tech 06 Roles
Every item declares one of three roles. The role decides where it goes on the court, who owns its prop, and what gesture the player uses to move it.
Dependencies: Items (../08-items.md), Venue (../08-venue.md), ItemManager (../08-item-manager.md), Fixtures (../08-fixtures.md), Kit (../08-kit.md).
| Role | Holds | Example items |
|---|---|---|
ball |
Items that add a ball to the game | Training Ball, The Stray |
court |
Props on or around the court surface (always on court once acquired; removed only by Tinkerer) | Dead Weight, Spare, Court Lines, bot dock, jukebox, The Call |
equipment |
Items the main character wears or attaches to the paddle | Grip Tape, Wrist Brace, Ankle Weights, Cadence, Seven Years |
A fourth role, cursor, for gear the mouse cursor wears rather than the court or character (the Pluck glove), is proposed in SH-441 and not yet built.
Stat-only items (no visible prop) still declare a role: a paddle-speed upgrade is equipment, a ball-bounce tweak is ball.
Ball and court roles are additive: any number of items can share the role. Equipment has a per-type cap authored on ItemDefinition:
@export var equip_type_cap: int = 1Each item type (e.g. grip wrap, wrist brace) declares a maximum number that can be equipped at once. activate rejects the item if equipping it would exceed the cap for its type.
const _ROLE_REGISTRY: Dictionary[StringName, StringName] = {
&"ball": &"additive",
&"court": &"additive",
&"equipment": &"additive",
}-
ball: the ball rack hosts balls at rest; the court's ball manager hosts them in play.BallReconcilermoves balls between the two in response tocourt_changed(see08-balls.md). -
equipment: the gear rack hosts equipment at rest;paddle.tscn's attachment nodes (Handle,Head, etc.) host them when equipped. Parenting follows the scene; no fixture manager involvement. -
court: always on the court from acquisition.FixtureManagerspawns the prop at the next free marker underRoles/Court/(see08-fixtures.md). Court items have no kit state; when dragged to the Tinkerer they sit in the workshop queue until returned to the court or destroyed.
Only court uses FixtureManager. Ball and equipment props move between two authored parents.
Court items need authored world-space markers; ball and equipment do not.
func get_court_position(item_key: String) -> Vector2:
var markers := _child_markers_for(&"court")
var position_index := on_court[&"court"].find(item_key)
position_index = mini(position_index, markers.size() - 1)
return markers[position_index].global_positionEach court occupant takes the next marker; overflow stacks on the last.
On activate(item_key):
- Append to
on_court[role]. - Register effects with
EffectManager. - If
role == &"court",FixtureManagerspawns the prop. Forballandequipment, the parent scene handles prop placement directly. - Emit
court_changed.
Stat-only items skip step 3.
The player drags items between the kit and the court. Gesture details (live drag vs. step-off required) live in 08-kit.md. The role system's part:
- The role is baked into the item, so a drop on the appropriate target always routes the move.
- A
RoleHighlighterlights the target surface during drag (the court for ball, court markers for court-role props, the main character for equipment).
Character areas (shop, workshop) are child scenes of venue.tscn gated by unlocked_characters. Roles are authored under Roles/, gated by item occupancy. They can sit near each other but are never parented under each other.
- Occupancy: append, remove, overflow stacking on the last court marker.
-
get_court_positionreturns the right marker per index. -
court_changedfires on each transition. - A court item with no authored marker surfaces a clean error.
-
Within-role conflicts. Equipment uses a per-type cap. Each item type declares how many can be equipped simultaneously;
activateenforces it. - Debug overlay. Yes, behind a keypress. Shows role markers, current occupants, and equipment type caps.
Not filing yet.
- Role registry on
ItemManager. -
ItemDefinition.rolefield; authoring pass across existing items. -
Roles/Courtmarkers invenue.tscn. -
get_court_positionresolver. -
RoleHighlighterfor drag feedback. - Dev-only role overlay.
Contributing
The game
The Cast
Process
Reference