extends Area

export var coins_required : int = 1
export var enabled: bool = true

signal coin_requirement_met(player)

func _ready():
	assert(coins_required >= 0)
	set_meta("owner", self)

func on_player_interact(player) -> bool:
	assert(player.has_method("modify_inventory"))
	if not enabled: 
		return false
	if not player.modify_inventory("coins", -coins_required):
		return false
		
	emit_signal("coin_requirement_met", player)
	return true
