Simple copyMultiplayer support

main
copygirl 2 weeks ago
parent 0da19cbe10
commit 4cd2c4641a
  1. 7
      copyThrower.gd

@ -133,6 +133,11 @@ func _throw_hearts_in_queue(delta: float) -> void:
# Only return now because we do want to clear the queue even if the skeleton was missing, and the doctor was never heard from again! [pause for comedic effect] Anyway, that's how I lost my medical license.
if not skeleton: return
# copyMultiplayer support: Target a random player's skeleton.
var copyMP = $"../copyMultiplayer"
if copyMP: skeleton = ([ skeleton ] + copyMP.get_all_sync_controllers()
.map(func(c): return c.skeleton).filter(func(s): return s != null)).pick_random()
# Add object early so we can use global_position.
add_child(object)
@ -156,6 +161,8 @@ func _throw_hearts_in_queue(delta: float) -> void:
func on_collide(object: RigidBody3D, body: CharacterBody3D) -> void:
var collider := body.get_parent() as BoneAttachment3D
if not collider: return
# Ignore when object collides with a skeleton other than our own.
if collider.get_parent() != get_skeleton(): return
var pos := object.global_position
var vel := object.linear_velocity

Loading…
Cancel
Save