Pawn record and Pawns registry #77
Labels
No labels
assets
bug
duplicate
enhancement
help wanted
invalid
question
testing
ui
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
liamjd/UntitledColonyBuilder#77
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Part of milestone #4. game.gd spawns one pawn in
_ready()and drops the reference, so nothing can enumerate pawns, select one, or reposition them after the terrain regenerates.Follow the
Building/Buildingssplit: the record is the truth, the node is one way of drawing it.Design:
Pawn extends Entity(RefCounted) record:id(registry-assigned, never reused),cell: Vector2i,state(IDLE, MOVING),speed(tiles per second). Milestone #5 issue #74 addsroleto this record.PawnView extends Node3D: it owns the capsule and, in the mover issue, the walking. It holds its record's id, not the record.Pawns extends Node3Dregistry:spawn(cell) -> Pawn,remove(id),get(id),all(),view_for(id). Receivesmapby injection from game.gd, asBuildingsdoes, so it works standalone in tests with no views.map.random_walkable_position()with a seeded RNG so the layout is reproducible per run seed. [For dev only, not a gameplay mechanic.]map.regenerated, despawns every pawn and respawns onto the new main region. A pawn from the previous map may be floating or underwater otherwise.pawn_height. See #46 for whysurface_y(level_at(cell))is wrong on shoreline tiles; useheight_at()ordrawn_level_at()once it exists.GameState.pawn_spawned(pawn)/pawn_removed(pawn)signals, matching the building signals.AC:
PawnView;Pawnis the record. Run the editor scan after the rename or every use of the type fails to parse.all()reflects both.Follow this ticket with #80, #78 and #81 to see some gameplay progression