Files
Emberwild/scripts/building/jar.gd

30 lines
742 B
GDScript

extends "res://scripts/building/piece.gd"
## Clay jar: 6 slots of storage, opened with E like a chest, and food kept in
## it lasts three times as long (Inventory.keep_mult).
const SLOTS := 6
const KEEP := 3.0
var inventory := Inventory.new(SLOTS)
func _build() -> void:
inventory.keep_mult = KEEP
func display_name() -> String:
return "Clay Jar"
func dismantle_block_reason() -> String:
for s in inventory.slots:
if s != null:
return "Empty the jar first"
return ""
func interact_prompt(_player: Node) -> String:
var used := 0
for s in inventory.slots:
if s != null:
used += 1
return "Clay jar (%d/%d, food keeps 3x as long) [E] Open" % [used, SLOTS]
func interact(player: Node) -> void:
player.open_inventory(self)