Add BigRock: 2×2 mineable boulder with full mining/path/save support

A new entity for multi-tile rock formations. Same duck-typed contract as
single-tile Rock so MineProvider scans both transparently via World.rocks.

Differences from Rock:
  • Occupies a 2×2 footprint anchored at origin_tile (top-left).
  • Renders a single 32×32 Sprite2D drawn from the FG_Grasslands_Spring 2×2
    cluster sprites at (22, 3) brown and (30, 3) gray.
  • Blocks pathfinding on all four footprint tiles — pawns route around it.
  • MineProvider asks `rock.approach_tile_for(pawn.tile)` for the walk
    destination, so the pawn stands beside the boulder instead of trying to
    path into the blocked footprint. Rock returns its own tile (walkable);
    BigRock picks the nearest walkable perimeter neighbour.
  • Mining takes 480 ticks (4× Rock) and drops 4 stone, one per footprint tile.

All init work happens in setup() rather than _ready(): the calling pattern is
`add_child(big); big.setup(origin)`, and _ready fires inside add_child with
origin_tile still at its zero default — anything reading origin_tile from
_ready would stamp the pathfinder at the wrong tile.

Wired through SaveSystem: factory preload, spawn-priority tier 0 (same as
Rock — static structures spawn before pawns), and a `&"big_rock"` factory.

World seed adds two demo boulders near the small-rock cluster
(65, 58) + (56, 64) so the visual contrast is on-screen from boot.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
megaproxy 2026-05-12 14:34:24 +01:00
parent 725d3fb701
commit 938e871bf1
6 changed files with 292 additions and 4 deletions

View file

@ -30,6 +30,7 @@ const EVENT_CATALOG_SCRIPT: Script = preload("res://scenes/storyteller/event_cat
const PAWN_SCENE: PackedScene = preload("res://scenes/pawn/pawn.tscn")
const TREE_SCENE: PackedScene = preload("res://scenes/entities/tree.tscn")
const ROCK_SCENE: PackedScene = preload("res://scenes/entities/rock.tscn")
const BIG_ROCK_SCENE: PackedScene = preload("res://scenes/entities/big_rock.tscn")
const STOCKPILE_SCENE: PackedScene = preload("res://scenes/world/stockpile_zone.tscn")
const WALL_SCENE: PackedScene = preload("res://scenes/entities/wall.tscn")
const FLOOR_SCENE: PackedScene = preload("res://scenes/entities/floor.tscn")
@ -66,6 +67,13 @@ const SAMPLE_ROCKS: Array[Vector2i] = [
Vector2i(60, 60), Vector2i(62, 60), Vector2i(63, 62), Vector2i(58, 62),
]
# 2×2 boulder formations (top-left anchor tiles). Two near the small-rock
# cluster so the player sees the size contrast on first scroll.
const SAMPLE_BIG_ROCKS: Array[Vector2i] = [
Vector2i(65, 58), # brown/gray (deterministic per-tile)
Vector2i(56, 64),
]
# HaulingProvider re-flow cadence — every 5 sim seconds at 1× (100 ticks).
const HAUL_SWEEP_INTERVAL_TICKS: int = 100
@ -409,7 +417,13 @@ func _spawn_sample_harvestables() -> void:
var rock = ROCK_SCENE.instantiate()
add_child(rock)
rock.setup(r_tile)
Audit.log("world", "spawned %d trees + %d rocks" % [SAMPLE_TREES.size(), SAMPLE_ROCKS.size()])
for br_origin in SAMPLE_BIG_ROCKS:
var big = BIG_ROCK_SCENE.instantiate()
add_child(big)
big.setup(br_origin)
Audit.log("world", "spawned %d trees + %d rocks + %d big rocks" % [
SAMPLE_TREES.size(), SAMPLE_ROCKS.size(), SAMPLE_BIG_ROCKS.size()
])
func _seed_phase5_demo_buildings() -> void: