extends Reference

const NAME = "idle"

var ctx = null

func _init():
	pass

func enter_from(state):
	ctx.get_node("item_dump").enabled = false
	ctx.get_node("coin_machine").enabled = false
	ctx.get_node("%item_holder").add_enabled = true
	ctx.get_node("%item_holder").remove_enabled = false # not possible
	ctx.get_node("status_light").idle()

func exit_to(state):
	pass

func on_coin_machine_coin_requirement_met(player):
	assert(false, "coin machine should be disabled while idle")

func on_cook_timer_timeout():
	assert(false, "cook timer shouldn't trigger while idle")

func on_item_holder_item_changed(item):
	assert(item != null, "there should be no item to remove while idle")
	ctx.change_state(ctx.StateHoldingItem.new())

func on_item_dump_completed():
	assert(false, "item dump should be disabled")

func take_damage():
	ctx.hp -= 1
	if ctx.hp <= 0:
		ctx.change_state(ctx.StateBroken.new())
