|
|
|
@ -78,18 +78,19 @@ public partial class Item : RigidBody3D |
|
|
|
|
if (player.Pickup.HasItemsHeld) return; |
|
|
|
|
// TODO: Check if player is in range. |
|
|
|
|
|
|
|
|
|
var localTransform = player.Pickup.GlobalBasis.Inverse() * GlobalBasis; |
|
|
|
|
RPC.ToAll().Send(Manager.RelayAccept, GetPath(), |
|
|
|
|
ItemManager.AcceptFunc.AcceptPickup, |
|
|
|
|
new Godot.Collections.Array { player.PeerId }); |
|
|
|
|
// RPC.ToAll().Send(AcceptPickup, player.PeerId); |
|
|
|
|
new Godot.Collections.Array { player.PeerId, localTransform }); |
|
|
|
|
// RPC.ToAll().Send(AcceptPickup, player.PeerId, localTransform); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
[Rpc(CallLocal = true)] |
|
|
|
|
void AcceptPickup(int peerId) |
|
|
|
|
void AcceptPickup(int peerId, Transform3D localTransform) |
|
|
|
|
{ |
|
|
|
|
var player = Game.Players.ByPeerId(peerId); |
|
|
|
|
Reparent(player.Pickup); |
|
|
|
|
Transform = Transform3D.Identity; // TODO: Rotate item? |
|
|
|
|
Transform = localTransform; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|