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:
23
scripts/world/wreck_chest.gd
Normal file
23
scripts/world/wreck_chest.gd
Normal 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)
|
||||
Reference in New Issue
Block a user