M1a: survival core, pause menu, title screen and save/load

Design: docs/SURVIVAL_DESIGN.md (core loop, systems, architecture, phases).

Survival core (M1a):
- Items/recipes as data (data/*.json) in the addon SDK's define_item /
  define_recipe shape; procedural item meshes and offscreen-rendered icons
- Inventory class (40 slots, hotbar = row 1) shared by player and chests;
  click / right-click split / shift-click quick-move
- Actions autoload: the intent layer (craft, pickup, harvest_hit, place,
  transfer) that validates every change; becomes the RPC surface in M2
- Gathering: ground pickups (sticks, stones, flint); trees chopped with an
  axe fall and leave stumps; boulders mined with a pickaxe shrink per hit
- Crafting screen with station checks (workbench); placement mode with
  green/red ghost, rotation and overlap/slope validation
- Pieces: campfire (light, flames, embers), workbench, chest (16 slots)
- HUD: hotbar, held tool view model with swing, prompts, toasts

Menus and saving:
- ESC pause menu: resume, controls, fullscreen, mouse sensitivity, quit
- Title screen over a flyover of the island: Continue / New World (name +
  seed) / Load World (with delete) / Quit
- Saves autoload: one folder per world under user://worlds, atomic writes
  with a .bak; stores only player changes (player, pieces, chest contents,
  harvested resources, taken pickups) and regenerates the rest from the seed
- Autosave every 2 min, Save & Quit to title/desktop, save on window close

Fixes: UI screens now fill the viewport (were pinned top-left); title
backdrop no longer captures the mouse.

Tests: test_survival_core (31 checks), test_save_load (round trip + slots),
test_terrain_edges now checks 8 seeds for deep pits / unbanked water.
This commit is contained in:
Paul Bailey
2026-11-04 00:34:46 +00:00
parent 12f7fd677d
commit 4640f5e577
53 changed files with 3192 additions and 36 deletions

32
data/items.json Normal file
View File

@@ -0,0 +1,32 @@
{
"items": [
{ "id": "stick", "name": "Stick", "category": "resource", "stack": 50,
"description": "A sturdy branch. Handles, kindling, fuel.", "mesh": "stick", "fuel": 20 },
{ "id": "stone", "name": "Stone", "category": "resource", "stack": 50,
"description": "A fist-sized stone.", "mesh": "stone" },
{ "id": "flint", "name": "Flint", "category": "resource", "stack": 50,
"description": "Sharp-edged stone. Knaps into blades and axe heads.", "mesh": "flint" },
{ "id": "wood", "name": "Wood", "category": "resource", "stack": 50,
"description": "Split timber from a felled tree.", "mesh": "wood", "fuel": 60 },
{ "id": "stone_axe", "name": "Stone Axe", "category": "tool", "stack": 1,
"description": "Chops trees. Hold it and click on a tree.", "mesh": "stone_axe",
"tool": { "kind": "axe", "tier": 1, "damage": 1.0 } },
{ "id": "stone_pickaxe", "name": "Stone Pickaxe", "category": "tool", "stack": 1,
"description": "Breaks boulders into stone and flint.", "mesh": "stone_pickaxe",
"tool": { "kind": "pickaxe", "tier": 1, "damage": 1.0 } },
{ "id": "club", "name": "Wooden Club", "category": "weapon", "stack": 1,
"description": "Crude, heavy, effective. (Creatures arrive in M1d.)", "mesh": "club",
"weapon": { "damage": 12, "reach": 2.2, "stamina": 8 } },
{ "id": "campfire", "name": "Campfire", "category": "placeable", "stack": 5,
"description": "Light and warmth. Place it, then keep it burning.", "mesh": "campfire",
"place": { "piece": "campfire", "footprint": [1.4, 1.4] } },
{ "id": "workbench", "name": "Workbench", "category": "placeable", "stack": 1,
"description": "Crafting station for better gear and storage.", "mesh": "workbench",
"place": { "piece": "workbench", "footprint": [2.0, 1.1] } },
{ "id": "chest", "name": "Wooden Chest", "category": "placeable", "stack": 5,
"description": "Stores 16 stacks.", "mesh": "chest",
"place": { "piece": "chest", "footprint": [1.2, 0.8] } }
]
}