made the first changes towards multiplayer working

This commit is contained in:
2023-11-13 19:36:35 +11:00
parent b0f8a37f60
commit f004f64b71
26 changed files with 305 additions and 257 deletions

View File

@ -59,8 +59,15 @@ func shoot():
var target_hitbox = target.shape_owner_get_owner($RayCast3D.get_collider_shape())
if target_hitbox is Hitbox:
target_hitbox.damage(stats.damage)
networked_hit.rpc(get_tree().root.get_path_to(target_hitbox))
@rpc
func networked_shoot():
$AnimationPlayer.play("shoot")
@rpc("reliable")
func networked_hit(target_node_path : String):
var target_node = get_tree().root.get_node(target_node_path)
target_node.damage(stats.damage)

View File

@ -9,7 +9,7 @@ func _ready() -> void:
cooldown = 1.0 / stats.fire_rate
func set_raycast_origin(node):
func set_raycast_origin(_node):
pass

View File

@ -9,7 +9,7 @@ func _ready() -> void:
cooldown = 1.0 / stats.fire_rate
func set_raycast_origin(node):
func set_raycast_origin(_node):
pass

View File

@ -9,7 +9,7 @@ func _ready() -> void:
cooldown = 1.0 / stats.fire_rate
func set_raycast_origin(node):
func set_raycast_origin(_node):
pass