extends Reference

const NAME = "broken"

var ctx = null

func _init():
	pass

func enter_from(state):
	ctx.coin_machine.enabled = false
	ctx.item_dump.enabled = true
	ctx.item_dump.reset()
	ctx.item_holder.add_enabled = true
	ctx.progress_text.text = "Broken"
	for item_slot in ctx.item_slots:
		item_slot.add_enabled = true
		item_slot.remove_enabled = true
	ctx.status_light.fail()

func exit_to(state):
	pass

func update(delta):
	pass

func on_coin_machine_coin_requirement_met(player):
	assert(false)

func on_gen_timer_timeout():
	assert(false)

func on_slot_item_changed(item):
	pass

func on_item_holder_item_changed(item):
	pass

func on_item_dump_item_dump_completed():
	if ctx.item_holder.item_in_hold == null:
		ctx.change_state(ctx.States[ctx.EState.IDLE].new())
	else:
		ctx.change_state(ctx.States[ctx.EState.BLOCKED].new("Blocked!"))

func on_damage_taken():
	assert(false, "cant take damage if already broken")
