Edit script file game/scripts/server/inventory.cs
function serverCmdUse(%client, %data)
add this function below it
// get player object
%player = %client.getControlObject();
// verify it is a player object
if (%player.getClassName() !$= "Player")
return; // abort, it is not
// raycast for an item that the player is facing, and also look for types
// that could be between the player and the item they're facing.
%typeMask = $TypeMasks::ItemObjectType | $TypeMasks::StaticObjectType;
%result = %player.doRaycast(4 /*range*/, %typeMask);
// only care about object id part of the result
%result = getWord(%result, 0);
// pickup only if it's an item
if ((%result != 0) && (%result.getClassName() $= "Item"))
Next edit file game/scripts/client/default.bind.cs
moveMap.bindCmd(keyboard, "r", "commandToServer('reloadWeapon');", "");
add this line below it
moveMap.bindCmd(keyboard, "e", "commandToServer('PickupFacing');", "");
Do the same above procedure for preferences file game/scripts/client/config.cs
Now when you press E
key and are within 4 units of an item that you are facing it'll be picked up.
There is an issue with stock Lurker and Ryder ammo clip items where they aren't seen via containerRayCast() for some odd reason. Because of this the provided script will not work with those items and there isn't a known workaround for it at this time.