|
|
@ -61,19 +61,13 @@ public partial class Item : RigidBody3D |
|
|
|
|
|
|
|
|
|
|
|
public void TryPickup() |
|
|
|
public void TryPickup() |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (this.IsAuthority()) |
|
|
|
RPC.To(GetMultiplayerAuthority()).Send(Manager.RelayRequest, GetPath(), |
|
|
|
RPC.ToAll().Send(Manager.RelayAccept, GetPath(), |
|
|
|
ItemManager.RequestFunc.RequestPickup, |
|
|
|
ItemManager.AcceptFunc.AcceptPickup, |
|
|
|
new Godot.Collections.Array()); |
|
|
|
new Godot.Collections.Array { Multiplayer.GetUniqueId() }); |
|
|
|
// RPC.To(GetMultiplayerAuthority()).Send(RequestPickup); |
|
|
|
// RPC.ToAll().Send(AcceptPickup, Multiplayer.GetUniqueId()); |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
RPC.To(GetMultiplayerAuthority()).Send(Manager.RelayRequest, GetPath(), |
|
|
|
|
|
|
|
ItemManager.RequestFunc.RequestPickup, |
|
|
|
|
|
|
|
new Godot.Collections.Array()); |
|
|
|
|
|
|
|
// RPC.To(GetMultiplayerAuthority()).Send(RequestPickup); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
[Rpc(RpcMode.AnyPeer)] |
|
|
|
[Rpc(RpcMode.AnyPeer, CallLocal = true)] |
|
|
|
void RequestPickup() |
|
|
|
void RequestPickup() |
|
|
|
{ |
|
|
|
{ |
|
|
|
// Pickup will be requested by any player to the owner of the item. |
|
|
|
// Pickup will be requested by any player to the owner of the item. |
|
|
@ -101,19 +95,13 @@ public partial class Item : RigidBody3D |
|
|
|
|
|
|
|
|
|
|
|
public void TryPlace(Grid grid, Transform3D localTransform) |
|
|
|
public void TryPlace(Grid grid, Transform3D localTransform) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (this.IsAuthority()) |
|
|
|
RPC.To(GetMultiplayerAuthority()).Send(Manager.RelayRequest, GetPath(), |
|
|
|
RPC.ToAll().Send(Manager.RelayAccept, GetPath(), |
|
|
|
ItemManager.RequestFunc.RequestPlace, |
|
|
|
ItemManager.AcceptFunc.AcceptPlace, |
|
|
|
new Godot.Collections.Array { grid.GetPath(), localTransform }); |
|
|
|
new Godot.Collections.Array { grid.GetPath(), localTransform }); |
|
|
|
// RPC.To(GetMultiplayerAuthority()).Send(RequestPlace, grid.GetPath(), localTransform); |
|
|
|
// RPC.ToAll().Send(AcceptPlace, grid.GetPath(), localTransform); |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
RPC.To(GetMultiplayerAuthority()).Send(Manager.RelayRequest, GetPath(), |
|
|
|
|
|
|
|
ItemManager.RequestFunc.RequestPlace, |
|
|
|
|
|
|
|
new Godot.Collections.Array { grid.GetPath(), localTransform }); |
|
|
|
|
|
|
|
// RPC.To(GetMultiplayerAuthority()).Send(RequestPlace, grid.GetPath(), localTransform); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
[Rpc(RpcMode.AnyPeer)] |
|
|
|
[Rpc(RpcMode.AnyPeer, CallLocal = true)] |
|
|
|
void RequestPlace(NodePath gridPath, Transform3D localTransform) |
|
|
|
void RequestPlace(NodePath gridPath, Transform3D localTransform) |
|
|
|
{ |
|
|
|
{ |
|
|
|
// Must be received by the owner of this item. |
|
|
|
// Must be received by the owner of this item. |
|
|
@ -144,19 +132,13 @@ public partial class Item : RigidBody3D |
|
|
|
|
|
|
|
|
|
|
|
public void TryThrow() |
|
|
|
public void TryThrow() |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (this.IsAuthority()) |
|
|
|
RPC.To(GetMultiplayerAuthority()).Send(Manager.RelayRequest, GetPath(), |
|
|
|
RPC.ToAll().Send(Manager.RelayAccept, GetPath(), |
|
|
|
ItemManager.RequestFunc.RequestThrow, |
|
|
|
ItemManager.AcceptFunc.AcceptThrow, |
|
|
|
new Godot.Collections.Array()); |
|
|
|
new Godot.Collections.Array()); |
|
|
|
// RPC.To(GetMultiplayerAuthority()).Send(RequestThrow); |
|
|
|
// RPC.ToAll().Send(AcceptThrow); |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
RPC.To(GetMultiplayerAuthority()).Send(Manager.RelayRequest, GetPath(), |
|
|
|
|
|
|
|
ItemManager.RequestFunc.RequestThrow, |
|
|
|
|
|
|
|
new Godot.Collections.Array()); |
|
|
|
|
|
|
|
// RPC.To(GetMultiplayerAuthority()).Send(RequestThrow); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
[Rpc(RpcMode.AnyPeer)] |
|
|
|
[Rpc(RpcMode.AnyPeer, CallLocal = true)] |
|
|
|
void RequestThrow() |
|
|
|
void RequestThrow() |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (!IsMultiplayerAuthority()) return; |
|
|
|
if (!IsMultiplayerAuthority()) return; |
|
|
|