42 lines
930 B
GDScript
42 lines
930 B
GDScript
extends Reference
|
|
|
|
const NAME = "idle"
|
|
|
|
var ctx = null
|
|
var item_to_craft = null
|
|
|
|
func _init():
|
|
pass
|
|
|
|
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 = true
|
|
ctx.progress_text.text = "Ready!"
|
|
ctx.status_light.idle()
|
|
|
|
func exit_to(state):
|
|
pass
|
|
|
|
func update(delta):
|
|
pass
|
|
|
|
func on_coin_machine_coin_requirement_met(player):
|
|
ctx.change_state(ctx.States[ctx.EState.WORKING].new())
|
|
|
|
func on_gen_timer_timeout():
|
|
assert(false, "gen timer cannot be running while idle")
|
|
|
|
func on_item_slot_item_changed(item):
|
|
if item != null:
|
|
ctx.change_state(ctx.States[ctx.EState.BLOCKED].new("Blocked!"))
|
|
|
|
func on_item_dump_item_dump_completed():
|
|
assert(false, "item dump should be disabled while idle")
|
|
|
|
func on_damage_taken():
|
|
if ctx.current_hp <= 0:
|
|
ctx.change_state(ctx.States[ctx.EState.BROKEN].new())
|