Sync moving items in the inventory
This commit is contained in:
parent
37fe348b2f
commit
69e6c61bd1
@ -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;
|
||||
|
@ -19,7 +19,12 @@ namespace Cyber.Items {
|
||||
/// <summary>
|
||||
/// Use the item in the given slot.
|
||||
/// </summary>
|
||||
Use
|
||||
Use,
|
||||
|
||||
/// <summary>
|
||||
/// Switch items between two slots.
|
||||
/// </summary>
|
||||
Switch
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -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 });
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handles an <see cref="InventoryActionPkt"/> to handle. Ran on server and client.
|
||||
/// </summary>
|
||||
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user