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

@ -15,9 +15,11 @@ class_name MineProvider extends WorkProvider
## pathfinder).
##
## Duck-typing note: Rock is referenced without class_name (class may not be
## registered yet when this provider loads). We rely only on:
## rock.tile: Vector2i
## registered yet when this provider loads). World.rocks may also hold BigRock
## instances; both expose the same interface so we just iterate the array:
## rock.tile: Vector2i — for distance scoring
## rock.is_mineable() -> bool
## rock.approach_tile_for(pawn_tile) -> Vector2i — walk destination
## rock.get_path() -> NodePath
@ -48,6 +50,12 @@ func find_best_for(pawn) -> Job:
var j := Job.new()
j.label = "Mine rock at %s" % best.tile
j.target_node = best
j.toils.append(Toil.walk_to(best.tile))
# Ask the entity where the pawn should stand. Single rocks return their own
# tile (walkable). BigRocks return a perimeter tile so the pawn doesn't try
# to pathfind into the blocked 2×2 footprint.
var walk_tile: Vector2i = (
best.approach_tile_for(pawn.tile) if best.has_method("approach_tile_for") else best.tile
)
j.toils.append(Toil.walk_to(walk_tile))
j.toils.append(Toil.interact(best.get_path(), &"on_mine_tick"))
return j