26 lines
683 B
GDScript
26 lines
683 B
GDScript
extends "res://scripts/building/piece.gd"
|
|
## Grave: left where you died, holding everything you carried. Open it with E
|
|
## to take your things back; it crumbles once empty.
|
|
|
|
var inventory := Inventory.new(40)
|
|
|
|
func _build() -> void:
|
|
inventory.changed.connect(_on_changed)
|
|
|
|
func display_name() -> String:
|
|
return "Your grave"
|
|
|
|
func interact_prompt(_player: Node) -> String:
|
|
return "Your grave [E] Recover belongings"
|
|
|
|
func interact(player: Node) -> void:
|
|
player.open_inventory(self)
|
|
|
|
func _on_changed() -> void:
|
|
if WorldNet.world != null:
|
|
return # online, the server crumbles it (world_net.gd)
|
|
for s in inventory.slots:
|
|
if s != null:
|
|
return
|
|
queue_free.call_deferred()
|