seedpackets and handlers
This commit is contained in:
parent
2a7c402cd0
commit
73a2fe42ad
16 changed files with 157 additions and 58 deletions
21
scripts/gui/seedpacket/pickable_handler.gd
Normal file
21
scripts/gui/seedpacket/pickable_handler.gd
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
extends SeedpacketHandler
|
||||
|
||||
class_name PickableHandler
|
||||
|
||||
var chosen : bool
|
||||
var locked : bool = false
|
||||
var forbidden : bool = false
|
||||
|
||||
func _init(seedpacket : Seedpacket) -> void:
|
||||
super._init(seedpacket)
|
||||
LevelEventBus.hotbar_packets_update.connect(on_hotbar_changed)
|
||||
|
||||
func exit() -> void:
|
||||
LevelEventBus.hotbar_packets_update.disconnect(on_hotbar_changed)
|
||||
|
||||
func is_avaiable() -> bool:
|
||||
return not (chosen or locked or forbidden)
|
||||
|
||||
func on_hotbar_changed(to : Array[SeedpacketResource]):
|
||||
chosen = to.has(seedpacket.held_resource)
|
||||
seedpacket.update_contents()
|
||||
Loading…
Add table
Add a link
Reference in a new issue