The pirate treasure: each player's own mound at their X, dug with a pickaxe; the drowned crew rise at night or when the chest comes up; the ship's compass, a spyglass, a cutlass and pirate gold; online too

This commit is contained in:
Paul Bailey
2026-11-07 09:54:51 +00:00
parent 74bd8f5898
commit 5bcfa23710
18 changed files with 594 additions and 11 deletions

View File

@@ -56,6 +56,7 @@ var hud: CanvasLayer
var pier: Node3D ## the Cove's pier (scripts/world/pier.gd), or null
var tunnel: Node3D ## the cliff tunnel (scripts/world/tunnel.gd, J1), or null
var wreck: Node3D ## the Cove's wreck (scripts/world/wreck.gd, 0.6.0), or null
var treasure: Node3D ## the pirate treasure (scripts/world/treasure.gd), or null
var sea_cave: Node3D ## the Cove's end of it (scripts/world/sea_cave.gd), or null
var traveling := false ## on the way to another worldlet (the scene is about to change)
var _session_time := 0.0 ## seconds played since the last save
@@ -373,6 +374,13 @@ func _on_terrain_ready() -> void:
if not menu_mode and wk.place(self):
wreck = wk
props.keep_clear.append([wk.global_position, 9.0])
var tr := preload("res://scripts/world/treasure.gd").new()
tr.name = "Treasure"
add_child(tr)
if tr.setup(self):
treasure = tr
else:
tr.free()
else:
wk.free()
# The journey's ways on (J1): the Valley's cliff tunnel and the Cove's sea
@@ -701,6 +709,7 @@ func collect_save() -> Dictionary:
"stones": stones.save_data() if stones != null else {},
"tunnel": tunnel.to_data() if tunnel != null else {},
"wreck": wreck.to_data() if wreck != null else {},
"treasure": treasure.to_data() if treasure != null else {},
"map": map_data(),
}
@@ -718,6 +727,7 @@ func _shared_state(harvested: Dictionary, regrow: Dictionary, taken: Array, drop
"stones": stones.save_data() if stones != null else {},
"tunnel": tunnel.to_data() if tunnel != null else {},
"wreck": wreck.to_data() if wreck != null else {},
"treasure": treasure.to_data() if treasure != null else {},
}
## The live pieces (placed and not being removed).
@@ -853,6 +863,8 @@ func _apply_save(s: Dictionary, with_player: bool) -> void:
tunnel.load_data(s.get("tunnel", {}))
if wreck != null:
wreck.load_data(s.get("wreck", {}))
if treasure != null:
treasure.load_data(s.get("treasure", {}))
if with_player:
load_map_data(String(s.get("map", "")))
# The bear (bear_range.gd): applied when it's set up, after loading.