update
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
extends ActionLeaf
|
||||
|
||||
func tick(actor: Node, blackboard: Blackboard) -> int:
|
||||
var source_slot = blackboard.get_value("source_slot")
|
||||
var target_slot = blackboard.get_value("target_slot")
|
||||
|
||||
if source_slot == -1 or target_slot == -1:
|
||||
return FAILURE
|
||||
|
||||
# Verify conditions are still valid
|
||||
if actor.action_points < 2 or actor.playerboard[source_slot] == -1:
|
||||
return FAILURE
|
||||
|
||||
if actor.playerboard[target_slot] != -1:
|
||||
return FAILURE
|
||||
|
||||
# Do the arrangement
|
||||
if actor.is_multiplayer_authority():
|
||||
var item = actor.playerboard[source_slot]
|
||||
actor.playerboard[target_slot] = item
|
||||
actor.playerboard[source_slot] = -1
|
||||
actor.rpc("sync_playerboard", actor.playerboard)
|
||||
actor.has_performed_action = true
|
||||
actor.action_points -= 2
|
||||
|
||||
return SUCCESS
|
||||
Reference in New Issue
Block a user