update
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
extends ActionLeaf
|
||||
|
||||
func tick(actor: Node, blackboard: Blackboard) -> int:
|
||||
var put_position = blackboard.get_value("put_position")
|
||||
var put_slot = blackboard.get_value("put_slot")
|
||||
|
||||
if not put_position or put_slot == -1:
|
||||
return FAILURE
|
||||
|
||||
# Check if we still have the item and AP
|
||||
if actor.action_points <= 0 or actor.playerboard[put_slot] == -1:
|
||||
return FAILURE
|
||||
|
||||
# Check if target position is still empty
|
||||
var cell = Vector3i(put_position.x, 1, put_position.y)
|
||||
if actor.enhanced_gridmap.get_cell_item(cell) != -1:
|
||||
return FAILURE
|
||||
|
||||
# Put the item
|
||||
var item = actor.playerboard[put_slot]
|
||||
if actor.is_multiplayer_authority():
|
||||
actor.rpc("sync_grid_item", cell.x, cell.y, cell.z, item)
|
||||
actor.playerboard[put_slot] = -1
|
||||
actor.rpc("sync_playerboard", actor.playerboard)
|
||||
actor.has_performed_action = true
|
||||
actor.action_points -= 1
|
||||
|
||||
return SUCCESS
|
||||
Reference in New Issue
Block a user