Phase 9+10: Status/Doctor/Medical bed + Wolves/WolfSpawner

The 'drama pair' shipped together via 3-agent fan-out.

Phase 9 — Status effects + Medicine:
- Status data class (PERSISTENT/EVENT, severity stacks max=3) + StatusCatalog
  (Bleeding ticks HP loss; Downed = incapacitated)
- Pawn HP (100 max, 30 downed threshold, 50 revive threshold), take_damage,
  heal, add_status/remove_status_by_id, is_downed/is_incapacitated, downed
  visual (body rotated 90° + desaturated)
- DoctorProvider (priority 9, highest) — scans World.pawns for nearest downed
  pawn, finds medical bed (or any bed fallback), emits 4-toil job:
  walk_to_patient → rescue → walk_to_bed → treat
- Bed.is_medical with red-cross marker draw on pillow; round-trips save
- KIND_RESCUE + KIND_TREAT toils + JobRunner _tick_rescue/_tick_treat
  (snap-to-bed on first treat tick, +0.5 hp/tick, bleed cure at 100-tick
  intervals; done at HP≥50 + no bleeding, 600-tick timeout)
- EventBus: pawn_took_damage, pawn_status_added, pawn_status_removed

Phase 10 — Combat + Wolves (wolf-first slice):
- Wolf entity (Node2D, 4-state APPROACH/ENGAGE/FLEE/DEAD, procedural
  canine sprite with red glowing eyes, 40 HP)
- Two-roll combat: 70% hit + 50% chance to apply Bleeding(1) on hit
- WolfSpawner — triggers at Clock.darkness_factor()≥0.8 with 1-in-game-day
  cooldown, packs of 1–2 at random map-edge cluster
- World.wolves registry + register_wolf/unregister_wolf

Integration: world.tscn load_steps 15→17 with DoctorProvider + WolfSpawner
nodes. world.gd registers doctor at top of provider list (priority 9 >
sleep 8 > eat 7 > construction 6 > chop≈plant 5 > mine≈craft 4 > haul 3
> rest 0). Middle bed at (47,24) marked is_medical=true.

MCP runtime verified: Bram took 75 dmg + Bleeding(2) → Downed (hp 25) →
Edda + Cora both volunteered doctor job → walked to patient → carried to
medical bed → treated → Bram healed to 94.2 hp, statuses cleared, back to
work. Wolf raid at day 3 22:00 fired; 4 wolves alive across raid cycles
by day 4 01:51. Screenshots confirm red-cross medical bed and wolf
silhouettes at night.

Phase 10 deliberately partial: wolf-side combat ships, pawn-side
weapons/armor/cover/friendly-fire deferred — full chain
(wolf→bites→pawn→bleeds→doctor) awaits player weapons.
Bleed-out timer at demo value (1200) vs design value (432000 = 6 in-game
hours) — documented in status_catalog.gd for first time-balance pass.

Delegation: Agent A (status + pawn HP), Agent B (doctor + treatment),
Agent C (wolf + spawner) — all Sonnet gdscript-refactor; integration on
Opus.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
megaproxy 2026-05-11 16:11:36 +01:00
parent a1e5b38dd6
commit 1b6ad2bcc6
21 changed files with 1016 additions and 35 deletions

View file

@ -0,0 +1,108 @@
class_name DoctorProvider extends WorkProvider
## WorkProvider for the Doctor work category. Slots into the 5-layer pawn AI
## (Decision → WorkProvider → Job + JobRunner) at priority 9 — above sleep (8)
## so able-bodied doctors volunteer for rescue before their own rest.
## Phase 17 will expose this via the work-priority matrix so the player can
## set individual pawns to Doctor=Off.
##
## Rescue model (Phase 9):
## A doctor pawn picks the nearest downed pawn that has no doctor already
## assigned to them. The job is a 4-toil sequence:
## 1. walk_to(patient.tile) — doctor walks to the downed pawn
## 2. rescue(patient_path) — single-tick marker (doctor "arrived")
## 3. walk_to(medical_bed.tile)— doctor walks to the nearest medical bed
## 4. treat(patient_path) — multi-tick: snap patient to bed, heal until
## HP ≥ 50 AND not bleeding, or 600-tick timeout
##
## Phase 9 simplification: the patient is teleported to the bed on the first
## tick of the treat toil (no carry visual). Phase 17 may add a proper carry
## animation and render the patient following the doctor during the walk.
##
## Bed preference: medical beds (is_medical=true) over regular beds.
## Fallback: any available bed if no medical bed exists.
## Hard fail: if no bed is available at all, the job is not issued and
## Audit.log records the skip so the developer can see the bottleneck.
##
## Pawn and Bed are intentionally duck-typed to avoid the class_name
## registration-order trap documented in Phase 2/3.
##
## docs/architecture.md "Doctor work — Downed priority"
## docs/design.md "Downed & death"
func _init() -> void:
category = &"doctor"
# Priority 9 > sleep (8) > eat (7) > construction (6) > …
# Above sleep: saving a downed pawn beats the doctor's personal rest need.
# Phase 17 may let the player tune this per-pawn via the work-priority matrix.
priority = 9
# ── WorkProvider override ─────────────────────────────────────────────────────
## Returns a 4-toil rescue Job for `pawn`, or null if there is nothing to do.
##
## `pawn` is duck-typed: must expose .is_downed(), .carried_item, .tile,
## .pawn_name, and .get_path().
func find_best_for(pawn) -> Job:
# Downed pawns can't doctor (Decision Layer 1 also blocks them via
# is_incapacitated(); this guard is belt-and-suspenders).
if pawn.has_method("is_downed") and pawn.is_downed():
return null
# Don't interrupt an active carry — finish hauling first.
if pawn.carried_item != null:
return null
# Find the nearest downed pawn that isn't this pawn.
var best_patient = null
var best_dist: int = 999999
for p in World.pawns:
if not p.has_method("is_downed") or not p.is_downed():
continue
if p == pawn:
continue
var d: int = abs(p.tile.x - pawn.tile.x) + abs(p.tile.y - pawn.tile.y)
if d < best_dist:
best_dist = d
best_patient = p
if best_patient == null:
return null
# Find the nearest available medical bed (preferred) or any available bed.
var medical_bed = _find_best_bed()
if medical_bed == null:
Audit.log(
"doctor",
"%s: no bed available for %s — rescue skipped" % [pawn.pawn_name, best_patient.pawn_name]
)
return null
var j := Job.new()
j.label = "Rescue %s → bed at %s" % [best_patient.pawn_name, medical_bed.tile]
# 4-toil sequence per the doctor rescue model above.
j.toils.append(Toil.walk_to(best_patient.tile))
j.toils.append(Toil.rescue(best_patient.get_path()))
j.toils.append(Toil.walk_to(medical_bed.tile))
j.toils.append(Toil.treat(best_patient.get_path()))
return j
# ── helpers ───────────────────────────────────────────────────────────────────
## Returns the best available bed for medical treatment.
## Prefers beds with is_medical=true; falls back to any available bed.
## Returns null when no bed is available at all.
func _find_best_bed():
# First pass: look for a medical bed.
for bed in World.beds:
if not bed.is_available():
continue
if bed.get("is_medical") == true:
return bed
# Second pass: accept any available bed if no medical bed was found.
for bed in World.beds:
if bed.is_available():
return bed
return null

View file

@ -0,0 +1 @@
uid://dtmlwkb718mij

View file

@ -105,6 +105,10 @@ func tick() -> void:
_tick_eat(t)
Toil.KIND_SLEEP:
_tick_sleep(t)
Toil.KIND_RESCUE:
_tick_rescue(t)
Toil.KIND_TREAT:
_tick_treat(t)
if t.done:
job.advance()
@ -621,6 +625,140 @@ func _tick_sleep(t) -> void:
t.done = true
## Execute one tick of a RESCUE toil.
##
## Single-tick marker. The doctor walks to the patient via a preceding WALK_TO
## toil; this toil records the visit and immediately completes. The actual
## "transport" of the patient to the medical bed is handled by the subsequent
## WALK_TO(bed) + TREAT toil sequence: the TREAT toil snaps the patient to the
## doctor's tile on its first tick, which is the bed tile.
##
## If the patient is gone or no longer downed, we log and skip (done=true)
## so the job runner doesn't stall on a phantom task.
func _tick_rescue(t) -> void:
var patient = _resolve_patient(t)
if patient == null:
Audit.log(
"job_runner",
"%s rescue: patient gone or invalid — skipping" % pawn.pawn_name
)
t.done = true
return
if not patient.has_method("is_downed") or not patient.is_downed():
Audit.log(
"job_runner",
"%s rescue: patient %s is not downed — skipping" % [pawn.pawn_name, patient.pawn_name]
)
t.done = true
return
t.data["started"] = true
Audit.log(
"job_runner",
"%s reached downed %s — walking to bed for treatment" % [pawn.pawn_name, patient.pawn_name]
)
t.done = true
## Execute one tick of a TREAT toil.
##
## First tick (started=false):
## - Resolve the patient node. If gone or no longer downed, skip immediately.
## - Snap the patient to the doctor's current tile (the medical-bed tile the
## doctor just walked to). This is the Phase 9 simplification: no carry
## visual; Phase 17 may replace this with a proper carry animation.
## - Mark started=true, ticks_treating=0.
##
## Every tick (including first, after the snap):
## - Increment ticks_treating.
## - Call patient.heal(0.5).
## - Every 100 ticks: remove "bleeding" status if present (full cure, Phase 9
## simplification; Phase 17 may reduce severity incrementally).
## - Done when patient.hp >= HP_REVIVE_THRESHOLD AND no "bleeding" status.
## - Done (safety ceiling) when ticks_treating > 600.
##
## HP_REVIVE_THRESHOLD mirrors Pawn.HP_REVIVE_THRESHOLD (50.0). Compared as a
## literal so the duck-typed pawn ref doesn't need const access.
const _HP_REVIVE_THRESHOLD: float = 50.0
const _TREAT_TICKS_MAX: int = 600
func _tick_treat(t) -> void:
var patient = _resolve_patient(t)
if not t.data.get("started", false):
# ── first-tick: validate and snap patient to bed tile ─────────────────
if patient == null:
Audit.log("job_runner", "%s treat: patient gone — skipping" % pawn.pawn_name)
t.done = true
return
if not patient.has_method("is_downed") or not patient.is_downed():
Audit.log(
"job_runner",
"%s treat: patient %s already up — skipping" % [pawn.pawn_name, patient.pawn_name]
)
t.done = true
return
# Snap patient to the doctor's current tile (the medical-bed tile).
# Phase 9 simplification: instant teleport; Phase 17 may add carry visual.
patient.tile = pawn.tile
patient.position = Vector2(pawn.tile.x * 16 + 8, pawn.tile.y * 16 + 8)
t.data["started"] = true
t.data["ticks_treating"] = 0
Audit.log(
"job_runner",
"%s treating %s at %s" % [pawn.pawn_name, patient.pawn_name, pawn.tile]
)
# ── per-tick treatment ─────────────────────────────────────────────────────
if patient == null or not is_instance_valid(patient):
t.done = true
return
t.data["ticks_treating"] = int(t.data.get("ticks_treating", 0)) + 1
var ticks: int = int(t.data["ticks_treating"])
patient.heal(0.5)
# Cure bleeding in full after 100 ticks of treatment (Phase 9 simplification).
if ticks % 100 == 0 and patient.has_method("has_status") and patient.has_status(&"bleeding"):
patient.remove_status_by_id(&"bleeding")
Audit.log(
"job_runner",
"%s cleared bleeding on %s (tick %d)" % [pawn.pawn_name, patient.pawn_name, ticks]
)
# Done when HP is above revive threshold AND bleeding is cleared.
var hp_ok: bool = patient.hp >= _HP_REVIVE_THRESHOLD
var bleed_ok: bool = not (patient.has_method("has_status") and patient.has_status(&"bleeding"))
if hp_ok and bleed_ok:
Audit.log(
"job_runner",
"%s finished treating %s (hp=%.1f, ticks=%d)" % [pawn.pawn_name, patient.pawn_name, patient.hp, ticks]
)
t.done = true
return
# Safety ceiling — prevent the toil from stalling if HP/bleed can't converge.
if ticks > _TREAT_TICKS_MAX:
Audit.log(
"job_runner",
"%s treatment timeout for %s (hp=%.1f, ticks=%d)" % [pawn.pawn_name, patient.pawn_name, patient.hp, ticks]
)
t.done = true
## Resolve the patient Pawn node from the NodePath stored in `t.data["patient"]`.
## Returns null and logs if the node is absent or no longer valid.
## Shared by _tick_rescue and _tick_treat.
func _resolve_patient(t):
var path := NodePath(t.data.get("patient", ""))
if path == NodePath(""):
return null
var node = get_tree().get_root().get_node_or_null(path)
if node == null or not is_instance_valid(node):
return null
return node
# ── helpers ──────────────────────────────────────────────────────────────────
## Emit job_completed, log, and clear the job reference.

78
scenes/ai/status.gd Normal file
View file

@ -0,0 +1,78 @@
class_name Status extends RefCounted
## A single status effect entry on a pawn.
##
## Follows the same data-only / RefCounted pattern as Thought (thought.gd).
## StatusCatalog holds the factory functions; Pawn owns the runtime array.
##
## Phase 9 ships with Bleeding and Downed.
## Phase 12 adds Wet / Cold. Phase 17 adds Sick / Infected.
##
## Save / load contract:
## var s2 := Status.from_dict(s.to_dict())
## assert(s2.id == s.id and s2.severity == s.severity)
##
## docs/design.md "Health & status effects"; docs/architecture.md "Status interrupts".
## Statuses shipped in Phase 9. Extend this enum when new statuses land.
enum Kind {
BLEEDING, ## Continuous HP loss. Cleared by treatment.
DOWNED, ## Cannot act; rescue required. Cleared when HP >= revive threshold.
}
## PERSISTENT statuses remain until an external system clears them (e.g. Downed
## clears when HP rises above HP_REVIVE_THRESHOLD via doctor treatment).
## EVENT statuses tick down ticks_remaining and self-clear at zero (reserved for
## future one-shot statuses like a brief stun).
enum Lifetime {
PERSISTENT,
EVENT,
}
## Unique identifier — merge key in Pawn.add_status(). e.g. &"bleeding", &"downed".
var id: StringName = &""
## Which logical status this is. Drives gameplay effects in Pawn._process_statuses().
var kind: Kind = Kind.BLEEDING
## Human-readable label for Audit logs and future pawn-detail UI.
## Not i18n'd here; call Strings.t("status." + id) for player-visible text.
var label: String = ""
## Severity scales the effect. Bleeding: 1 = light, 2 = moderate, 3 = severe.
## add_status() increments severity on stack-merge instead of duplicating.
var severity: int = 1
## Ceiling for severity stacking. Bleeding caps at 3.
var max_severity: int = 3
## Whether this status self-clears after ticks_remaining ticks.
var lifetime: Lifetime = Lifetime.PERSISTENT
## Remaining sim ticks before an EVENT status self-clears. PERSISTENT ignores this.
var ticks_remaining: int = 0
# ── save / load ───────────────────────────────────────────────────────────────
func to_dict() -> Dictionary:
return {
"id": String(id),
"kind": kind,
"label": label,
"severity": severity,
"max_severity": max_severity,
"lifetime": lifetime,
"ticks_remaining": ticks_remaining,
}
static func from_dict(d: Dictionary) -> Status:
var s := Status.new()
s.id = StringName(d.get("id", ""))
s.kind = int(d.get("kind", Kind.BLEEDING)) as Kind
s.label = str(d.get("label", ""))
s.severity = int(d.get("severity", 1))
s.max_severity = int(d.get("max_severity", 3))
s.lifetime = int(d.get("lifetime", Lifetime.PERSISTENT)) as Lifetime
s.ticks_remaining = int(d.get("ticks_remaining", 0))
return s

1
scenes/ai/status.gd.uid Normal file
View file

@ -0,0 +1 @@
uid://l4kigu3knft5

View file

@ -0,0 +1,59 @@
class_name StatusCatalog
## Static factory registry for named statuses.
##
## Mirrors ThoughtCatalog: each factory returns a fresh Status with all fields
## set correctly. Callers must not mutate the returned object before passing
## it to Pawn.add_status() — add_status() handles severity stack-merging.
##
## Phase 9 ships: bleeding(), downed().
## Phase 12 will add: wet(), cold().
## Phase 17 will add: sick(), infected().
##
## Usage pattern:
## pawn.add_status(StatusCatalog.bleeding(2))
##
## docs/design.md "Health & status effects"; docs/design.md "Downed & death".
## Sim ticks before an untreated bleed-out causes death.
## design.md "Downed & death": 6 in-game hours.
## At 20 Hz × 60 s/min × 60 min/hr × 6 hr = 432 000 ticks at 1×.
## At Fast (5×) that compresses to ~86 400 real-Hz-ticks — but game time is
## what the player sees, so this constant is in game-time-equivalent ticks
## (the same 20-Hz tick stream; speed multiplier compresses the real clock,
## not the tick count that this timer counts against).
## Phase 20 may retune; keeping the name locked from day one per design.md.
const BLEED_OUT_TICKS: int = 432000 # 6 in-game hours at 20 Hz
## HP lost per sim tick per severity level.
## Severity 1: 0.05 / tick. Severity 3: 0.15 / tick.
## At severity 3, 100 HP → 0 in 100 / 0.15 = ~667 ticks ≈ 33 sim-seconds at 1×.
## At Fast (5×) real time: ~7 s. Tune Phase 20.
const BLEED_HP_PER_TICK: float = 0.05
## Returns a Bleeding status at the given severity (13).
## Severity is clamped to [1, 3]. Lifetime is PERSISTENT — cleared by doctor
## treatment, not by time expiry.
static func bleeding(severity: int = 1) -> Status:
var s := Status.new()
s.id = &"bleeding"
s.kind = Status.Kind.BLEEDING
s.label = "Bleeding"
s.severity = clampi(severity, 1, 3)
s.max_severity = 3
s.lifetime = Status.Lifetime.PERSISTENT
return s
## Returns a Downed status.
## Downed has severity 1 (single-instance — you're either down or you're not).
## Cleared externally by Pawn._check_revive() when HP rises to HP_REVIVE_THRESHOLD.
static func downed() -> Status:
var s := Status.new()
s.id = &"downed"
s.kind = Status.Kind.DOWNED
s.label = "Downed"
s.severity = 1
s.max_severity = 1
s.lifetime = Status.Lifetime.PERSISTENT
return s

View file

@ -0,0 +1 @@
uid://brxx7qkvew0a5

View file

@ -20,6 +20,8 @@ const KIND_BUILD: StringName = &"build" # Timed construction on a Wall /
const KIND_CRAFT: StringName = &"craft" # Timed crafting at a Workbench driven by a Bill
const KIND_EAT: StringName = &"eat" # Consume pawn.carried_item and restore hunger
const KIND_SLEEP: StringName = &"sleep" # Sleep in a Bed (or on the floor) until pawn.sleep is full
const KIND_RESCUE: StringName = &"rescue" # Marker: doctor has visited the downed pawn; single-tick no-op
const KIND_TREAT: StringName = &"treat" # Multi-tick: apply medicine until patient HP ≥ revive threshold + no bleeding
var kind: StringName = KIND_IDLE
## Toil-specific params — all values must be int, float, bool, String, Dict, or Array.
@ -135,6 +137,52 @@ static func sleep_in_bed(bed_path: NodePath) -> Toil:
return t
## Single-tick marker: the doctor has physically reached the downed patient.
## On execution the doctor visits the patient tile; the actual transport happens
## in the subsequent walk_to(bed) and treat toils.
##
## `patient_path` is the NodePath of the downed Pawn; stored as String for JSON safety.
##
## data keys:
## "patient" — String(patient_path)
## "started" — bool; set true on first tick so the match arm knows it fired.
static func rescue(patient_path: NodePath) -> Toil:
var t := Toil.new()
t.kind = KIND_RESCUE
t.data = {
"patient": String(patient_path),
"started": false,
}
return t
## Multi-tick treatment of a downed pawn.
##
## First tick: snap the patient to the doctor's current tile (the medical-bed
## tile the doctor just walked to), mark started.
## Every tick: apply 0.5 HP of healing. Clear the "bleeding" status every
## 100 ticks (Phase 9 simplification — full bleed cure in one pass; Phase 17
## may model severity reduction per tick).
## Done when patient.hp >= HP_REVIVE_THRESHOLD AND patient has no bleeding,
## or after 600 ticks (safety ceiling).
##
## `patient_path` is the NodePath of the patient Pawn; stored as String for JSON safety.
##
## data keys:
## "patient" — String(patient_path)
## "started" — bool; false until first tick
## "ticks_treating" — int; incremented each tick; safety ceiling at 600
static func treat(patient_path: NodePath) -> Toil:
var t := Toil.new()
t.kind = KIND_TREAT
t.data = {
"patient": String(patient_path),
"started": false,
"ticks_treating": 0,
}
return t
## Timed crafting action at a Workbench.
## `workbench_path` is the NodePath of the Workbench entity (stored as String for JSON safety).
## `bill_index` is the index into workbench.bills that this toil should run.

101
scenes/ai/wolf_spawner.gd Normal file
View file

@ -0,0 +1,101 @@
class_name WolfSpawner extends Node
## Storyteller-side spawner for wolf raid events.
##
## Spawn trigger (Phase 10): full night (darkness_factor >= 0.8) AND off cooldown.
## Season-weighted spawning (design.md "Wolf spawn") is deferred to Phase 12
## when WeatherSystem / SeasonSystem land.
##
## WolfSpawner is a Node child of the World scene — not an autoload.
## Wolf scenes are add_child()'d to get_parent() (the World scene root) so
## wolves share the same node tree as all other entities.
##
## Pack size is PACK_MINPACK_MAX for Phase 10 demo. design.md target is 14;
## widen the range in Phase 17 once the combat spike validates feel.
const PACK_MIN: int = 1
const PACK_MAX: int = 2 # Phase 10 demo; design.md target 14 for Phase 17.
## Minimum sim ticks between raids. 4800 ticks = 1 in-game day at 20 Hz.
## Prevents stacked raids in consecutive night phases.
const RAID_COOLDOWN_TICKS: int = 4800
## How far from each map edge to allow spawn tiles (avoids corner/boundary weirdness).
const MAP_EDGE_BLEED: int = 2
## Preloaded Wolf scene. Mirrors the pattern used by Tree/Item entities.
const WOLF_SCENE: PackedScene = preload("res://scenes/entities/wolf.tscn")
## Sim-tick number of the last raid this spawner triggered.
## Initialised to -RAID_COOLDOWN_TICKS so the first eligible night is fair game.
var _last_raid_tick: int = -RAID_COOLDOWN_TICKS
func _ready() -> void:
EventBus.sim_tick.connect(_on_sim_tick)
func _on_sim_tick(n: int) -> void:
# Gate 1: only spawn during deep night (darkness >= 0.8 means past dusk ramp).
# Clock.darkness_factor() returns 1.0 at full night, 0.8 at ~90% through the dusk ramp.
if Clock.darkness_factor() < 0.8:
return
# Gate 2: cooldown — at least one in-game day between raids.
if n - _last_raid_tick < RAID_COOLDOWN_TICKS:
return
_trigger_raid(n)
func _trigger_raid(current_tick: int) -> void:
_last_raid_tick = current_tick
var pack_size := randi_range(PACK_MIN, PACK_MAX)
var spawn_tiles := _pick_spawn_tiles(pack_size)
for spawn_tile in spawn_tiles:
var w: Wolf = WOLF_SCENE.instantiate()
get_parent().add_child(w)
w.setup(spawn_tile)
Audit.log("wolf", "RAID: %d wolf(ves) spawned at %s" % [pack_size, spawn_tiles])
func _pick_spawn_tiles(count: int) -> Array[Vector2i]:
## Choose a random map edge, then return `count` tiles clustered near a
## random anchor on that edge. All tiles are inside MAP_EDGE_BLEED to avoid
## corner/boundary edge cases with the pathfinder grid bounds.
##
## Map size matches World.MAP_SIZE_TILES (80×80 in Phase 1).
## Duck-typed access to World.MAP_SIZE_TILES would require it to be declared
## there; using the literal constant is safe for MVP and matches the pattern
## used in WolfSpawner's Phase 10 scope. Phase 16 or 17 can wire this to
## World.MAP_SIZE_TILES when that const lands on the autoload.
const MAP_W: int = 80
const MAP_H: int = 80
var side: int = randi() % 4 # 0 = top, 1 = right, 2 = bottom, 3 = left
var anchor: Vector2i
match side:
0: # Top edge
anchor = Vector2i(
randi_range(MAP_EDGE_BLEED, MAP_W - MAP_EDGE_BLEED - 1),
MAP_EDGE_BLEED
)
1: # Right edge
anchor = Vector2i(
MAP_W - MAP_EDGE_BLEED - 1,
randi_range(MAP_EDGE_BLEED, MAP_H - MAP_EDGE_BLEED - 1)
)
2: # Bottom edge
anchor = Vector2i(
randi_range(MAP_EDGE_BLEED, MAP_W - MAP_EDGE_BLEED - 1),
MAP_H - MAP_EDGE_BLEED - 1
)
_: # Left edge (side == 3)
anchor = Vector2i(
MAP_EDGE_BLEED,
randi_range(MAP_EDGE_BLEED, MAP_H - MAP_EDGE_BLEED - 1)
)
# Cluster wolves horizontally from the anchor; they start packed together.
var tiles: Array[Vector2i] = []
for i in count:
tiles.append(anchor + Vector2i(i, 0))
return tiles

View file

@ -0,0 +1 @@
uid://61se8jnhy1v3