44 lines
1.0 KiB
GDScript

extends Reference
const NAME = "blocked"
var ctx = null
var label : String = "Blocked!"
func _init(var block_string : String):
label = block_string
func enter_from(state):
for item_slot in ctx.item_slots:
item_slot.add_enabled = true
item_slot.remove_enabled = true
ctx.item_dump.enabled = false
ctx.coin_machine.enabled = false
ctx.progress_text.text = label
ctx.status_light.warn()
func exit_to(state):
pass
func update(delta):
pass
func on_coin_machine_coin_requirement_met(player):
assert(false, "coin machine should be disabled while blocked")
func on_gen_timer_timeout():
assert(false, "gen timer should be disabled while blocked")
func on_item_slot_item_changed(item):
for item_slot in ctx.item_slots:
if item_slot.has_item():
return
ctx.change_state(ctx.States[ctx.EState.IDLE].new())
func on_item_dump_item_dump_completed():
assert(false, "item dump should be disabled while blocked")
func on_damage_taken():
if ctx.current_hp <= 0:
ctx.change_state(ctx.States[ctx.EState.BROKEN].new())