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