Added broken state to hydroponic station and fixed a bug with all the brokens tates where they wouldn't heal the object back up on repair
This commit is contained in:
1 parent
6e6da14975
commit
ef4b8bd7cf
10 files changed
+105
-7
No files matched your search
@@ -10,6 +10,9 @@ func _init():
|
||||
func enter_from(state):
|
||||
ctx.get_node("coin_machine").enabled = false
|
||||
ctx.get_node("item_holder").add_enabled = true
|
||||
ctx.get_node("item_holder").remove_enabled = true
|
||||
ctx.status_light.warn()
|
||||
ctx.item_dump.enabled = false
|
||||
|
||||
func exit_to(state):
|
||||
pass
|
||||
@@ -23,3 +26,10 @@ func on_grow_timer_timeout():
|
||||
func on_item_holder_item_changed(item):
|
||||
if item == null:
|
||||
ctx.change_state(ctx.StateIdle.new())
|
||||
|
||||
func on_item_dump_item_dump_completed():
|
||||
assert(false)
|
||||
|
||||
func on_damage_taken():
|
||||
if ctx.current_hp <= 0:
|
||||
ctx.change_state(ctx.StateBroken.new())
|
||||
@@ -0,0 +1,36 @@
|
||||
extends Reference
|
||||
|
||||
const NAME = "broken"
|
||||
|
||||
var ctx = null
|
||||
|
||||
func _init():
|
||||
pass
|
||||
|
||||
func enter_from(state):
|
||||
ctx.get_node("coin_machine").enabled = false
|
||||
ctx.get_node("item_holder").add_enabled = false
|
||||
ctx.get_node("item_holder").remove_enabled = false
|
||||
ctx.status_light.fail()
|
||||
ctx.item_dump.enabled = true
|
||||
ctx.item_dump.reset()
|
||||
|
||||
func exit_to(state):
|
||||
pass
|
||||
|
||||
func on_coin_machine_coin_requirement_met(player):
|
||||
assert(false)
|
||||
|
||||
func on_grow_timer_timeout():
|
||||
assert(false)
|
||||
|
||||
func on_item_holder_item_changed(item):
|
||||
if item == null:
|
||||
ctx.change_state(ctx.StateIdle.new())
|
||||
|
||||
func on_item_dump_item_dump_completed():
|
||||
ctx.full_heal()
|
||||
ctx.change_state(ctx.StateIdle.new())
|
||||
|
||||
func on_damage_taken():
|
||||
assert(false, "cant take damage when broken")
|
||||
@@ -12,8 +12,11 @@ func _init():
|
||||
func enter_from(state):
|
||||
ctx.get_node("coin_machine").enabled = false
|
||||
ctx.get_node("item_holder").add_enabled = false
|
||||
ctx.get_node("item_holder").remove_enabled = false
|
||||
ctx.get_node("grow_timer").start()
|
||||
ctx.get_node("MeshInstance").set_surface_material(0, mat)
|
||||
ctx.status_light.activate()
|
||||
ctx.item_dump.enabled = false
|
||||
|
||||
func exit_to(state):
|
||||
ctx.get_node("MeshInstance").set_surface_material(0, null)
|
||||
@@ -28,3 +31,11 @@ func on_grow_timer_timeout():
|
||||
|
||||
func on_item_holder_item_changed(item):
|
||||
assert(item.item_type == raw_yam)
|
||||
|
||||
func on_item_dump_item_dump_completed():
|
||||
assert(false)
|
||||
|
||||
func on_damage_taken():
|
||||
ctx.get_node("grow_timer").stop()
|
||||
if ctx.current_hp <= 0:
|
||||
ctx.change_state(ctx.StateBroken.new())
|
||||
@@ -10,6 +10,9 @@ func _init():
|
||||
func enter_from(state):
|
||||
ctx.get_node("coin_machine").enabled = true
|
||||
ctx.get_node("item_holder").add_enabled = true
|
||||
ctx.get_node("item_holder").remove_enabled = true
|
||||
ctx.status_light.idle()
|
||||
ctx.item_dump.enabled = false
|
||||
|
||||
func exit_to(state):
|
||||
pass
|
||||
@@ -23,3 +26,10 @@ func on_grow_timer_timeout():
|
||||
func on_item_holder_item_changed(item):
|
||||
assert(item != null)
|
||||
ctx.change_state(ctx.StateBlocked.new())
|
||||
|
||||
func on_item_dump_item_dump_completed():
|
||||
assert(false)
|
||||
|
||||
func on_damage_taken():
|
||||
if ctx.current_hp <= 0:
|
||||
ctx.change_state(ctx.StateBroken.new())
|
||||
Reference in new issue
Block a user