feat: Implement Tekton roaming NPC with movement, combat, carry, throw, and knock mechanics.
This commit is contained in:
+5
-2
@@ -106,9 +106,12 @@ func move_to(target_pos: Vector2i):
|
||||
emit_signal("movement_finished")
|
||||
)
|
||||
|
||||
if is_multiplayer_authority():
|
||||
if is_multiplayer_authority() and can_rpc():
|
||||
rpc("sync_movement", target_pos)
|
||||
|
||||
func can_rpc() -> bool:
|
||||
return multiplayer.has_multiplayer_peer() and multiplayer.multiplayer_peer.get_connection_status() == MultiplayerPeer.CONNECTION_CONNECTED
|
||||
|
||||
@rpc("any_peer", "call_remote", "reliable")
|
||||
func sync_movement(target_pos: Vector2i):
|
||||
move_to(target_pos)
|
||||
@@ -388,7 +391,7 @@ func spawn_tiles_around(count: int = 4):
|
||||
|
||||
if item_id != -1:
|
||||
var main = get_tree().get_root().get_node_or_null("Main")
|
||||
if main:
|
||||
if main and can_rpc():
|
||||
main.rpc("sync_grid_item", pos.x, 1, pos.y, item_id)
|
||||
spawned += 1
|
||||
|
||||
|
||||
Reference in New Issue
Block a user