Each land's set pieces from its data: the barrow, the standing stones and the bear are the Valley's alone, the Cove keeps its wolves; the Cove's 0.6.0 plan (treasure: one each, each in its own place)

This commit is contained in:
Paul Bailey
2026-11-07 01:14:32 +00:00
parent 1bf33935e0
commit ec8caa9ef4
5 changed files with 75 additions and 16 deletions

View File

@@ -394,18 +394,21 @@ func _on_terrain_ready() -> void:
props.static_cuts.append([den.global_transform, 2.2, 3.4])
_update_grass_cuts()
# The barrow: scenery too (P3), out on open ground. Its guards only run
# where creatures do (_setup_bear).
barrow = preload("res://scripts/world/barrow.gd").new()
barrow.name = "Barrow"
add_child(barrow)
if barrow.place(self):
_update_grass_cuts()
# where creatures do (_setup_bear). (Each land has its own set pieces:
# the barrow and the stones are the Valley's: has_place().)
if has_place("barrow"):
barrow = preload("res://scripts/world/barrow.gd").new()
barrow.name = "Barrow"
add_child(barrow)
if barrow.place(self):
_update_grass_cuts()
# The standing stones (P5): where the Old Stag is called.
stones = preload("res://scripts/world/standing_stones.gd").new()
stones.name = "StandingStones"
add_child(stones)
if stones.place(self):
_update_grass_cuts()
if has_place("stones"):
stones = preload("res://scripts/world/standing_stones.gd").new()
stones.name = "StandingStones"
add_child(stones)
if stones.place(self):
_update_grass_cuts()
if DisplayServer.get_name() != "headless":
var fish := preload("res://scripts/fishing/lake_fish.gd").new()
fish.name = "LakeFish"
@@ -420,7 +423,8 @@ func _on_terrain_ready() -> void:
hazards.name = "Hazards"
add_child(hazards)
hazards.setup(self, not is_online())
stones.deciding = not is_online()
if stones != null:
stones.deciding = not is_online()
if server_mode:
if Saves.has_world():
var saved: Dictionary = Saves.load_state(Saves.current_id)
@@ -491,6 +495,8 @@ func _setup_bear() -> void:
thieves.enabled = not "--no-creatures" in OS.get_cmdline_user_args()
if barrow != null and barrow.found and thieves.enabled:
barrow.start()
if not has_place("bear"):
return # (bears only in the lands that list one: the Valley)
bears = preload("res://scripts/creatures/bear_range.gd").new()
bears.name = "Bear"
add_child(bears)
@@ -1202,6 +1208,16 @@ func water_at(x: float, z: float) -> Dictionary:
# and its ways out. (W0 adds these; systems move over to them as each worldlet
# needs them to be different.)
## Whether this land has set piece `kind` ("den", "barrow", "stones",
## "bear", "pier", "wreck"...): its worldlet's "places". A worldlet that
## doesn't list them has the Valley's set (den, barrow, stones, bear).
const DEFAULT_PLACES := ["den", "barrow", "stones", "bear"]
func has_place(kind: String) -> bool:
var places: Array = terrain.worldlet.get("places", [])
if places.is_empty():
return kind in DEFAULT_PLACES
return places.any(func(p): return p is Dictionary and String(p.get("type", "")) == kind)
## This worldlet's id ("valley") and its whole definition.
func worldlet_id() -> String:
return terrain.worldlet_id