23 lines
643 B
GDScript
23 lines
643 B
GDScript
class_name ArrangeAction extends ActionLeaf
|
|
|
|
func tick(actor: Node, blackboard: Blackboard) -> int:
|
|
var source_slot = blackboard.get_value("source_slot", -1)
|
|
var target_slot = blackboard.get_value("target_slot", -1)
|
|
|
|
if source_slot == -1 or target_slot == -1:
|
|
return FAILURE
|
|
|
|
if actor.action_points < 2:
|
|
return FAILURE
|
|
|
|
var selected_item = actor.playerboard[source_slot]
|
|
actor.playerboard[target_slot] = selected_item
|
|
actor.playerboard[source_slot] = -1
|
|
|
|
if actor.is_multiplayer_authority():
|
|
actor.rpc("sync_playerboard", actor.playerboard)
|
|
actor.action_points -= 2
|
|
actor.has_performed_action = true
|
|
|
|
return SUCCESS
|