diff --git a/Assets/Scripts/Controls/InventoryInterface.cs b/Assets/Scripts/Controls/InventoryInterface.cs
index 2b0cd36..155dbe5 100644
--- a/Assets/Scripts/Controls/InventoryInterface.cs
+++ b/Assets/Scripts/Controls/InventoryInterface.cs
@@ -187,7 +187,7 @@ namespace Cyber.Controls {
Lerper.LerpTransformPosition(ItemGridCellMeshes[CurrentIndex].transform, new Vector3(), 10f);
// Switch items
- Inventory.Drive.SwitchSlots(GrabbedItemIndex, CurrentIndex);
+ Client.Send(PktType.InventoryAction, Inventory.ActionHandler.BuildSlotSwitch(GrabbedItemIndex, CurrentIndex));
// Reset grabbing
GrabbedItem = null;
diff --git a/Assets/Scripts/Items/InventoryAction.cs b/Assets/Scripts/Items/InventoryAction.cs
index 97374af..90b06e7 100644
--- a/Assets/Scripts/Items/InventoryAction.cs
+++ b/Assets/Scripts/Items/InventoryAction.cs
@@ -19,7 +19,12 @@ namespace Cyber.Items {
///
/// Use the item in the given slot.
///
- Use
+ Use,
+
+ ///
+ /// Switch items between two slots.
+ ///
+ Switch
}
}
diff --git a/Assets/Scripts/Items/InventoryActionHandler.cs b/Assets/Scripts/Items/InventoryActionHandler.cs
index 0648c73..e259f23 100644
--- a/Assets/Scripts/Items/InventoryActionHandler.cs
+++ b/Assets/Scripts/Items/InventoryActionHandler.cs
@@ -50,6 +50,10 @@ namespace Cyber.Items {
return new InventoryActionPkt(InventoryAction.Equip, itemIdx);
}
+ public InventoryActionPkt BuildSlotSwitch(int switchFrom, int switchTo) {
+ return new InventoryActionPkt(InventoryAction.Switch, new int[]{ switchFrom, switchTo });
+ }
+
///
/// Handles an to handle. Ran on server and client.
///
@@ -76,6 +80,9 @@ namespace Cyber.Items {
return true;
}
return false;
+ case InventoryAction.Switch:
+ Inventory.Drive.SwitchSlots(intList[0], intList[1]);
+ return true;
}
return false;
}