Demo… Red trace is client, Purple is the server
Here’s the setup from the demo.
Trace Logic determines what type of interaction is happening. Door, Elevator, Item
Normally I do this with Gameplay tags. The Actor tag approach is for quick setup and simplicity.
If it’s client executing the trace we route out to call a srv rpc. Srv Interact
If it’s the server executing the trace we route to a switch Interaction Type
which directs the logic to execute a specific event based on the type.
Item == Srv Pickup Item
Srv Pickup Item
calls a BPI event in the Player States Inventory Actor Component to pickup the specific item.
AC_Inventory “Pickup Loot Item” function
This process does zero casting. It relies 100% on BP Interfaces.
For the sake of simplicity this demo only has 1 world pickup item and a single inventory slot.
Dropping the item
Note the client validates the item/slot and simply calls the server to drop.
The Server is determining “What” based on the selected slot (which there’s only one for demo). We don’t pass references, only simple data (slot 1, 2 and the like).
If the item is valid (exists), then the server calls Drop Item
on the Inventory actor component.