The Cove's wreck: driftwood and salt on the beach, the captain's sea chest (a treasure map, nails, salt; once each), each player's own X on the map; online too

This commit is contained in:
Paul Bailey
2026-11-07 02:00:31 +00:00
parent ec8caa9ef4
commit 419c71e638
17 changed files with 470 additions and 7 deletions

View File

@@ -0,0 +1,23 @@
extends StaticBody3D
## The wreck's sea chest (wreck.gd): what you look at and press E on. Online,
## your game asks the server, which gives you your share once.
var wreck: Node3D
func interact_prompt(player: Node) -> String:
if wreck.had(_id(player)):
return "The captain's sea chest (empty: you've had what was in it)"
return "[E] Open the captain's sea chest"
func interact(player: Node) -> void:
if wreck.world.is_online():
PlayerNet.ask("wreck_chest", [])
return
wreck.open_for(player, _id(player))
## Whose share: the player's id (a server's character, or, at home, yours).
static func _id(player: Node) -> String:
var pid: Variant = player.get("player_id")
if pid != null and not String(pid).is_empty():
return String(pid)
return String(Net.get_identity().player_id)