Skip to content

Commit

Permalink
feat: convars inventory:dropslots and inventory:dropweight
Browse files Browse the repository at this point in the history
Defaults to the player values.
  • Loading branch information
thelindat committed May 9, 2024
1 parent 888f4a7 commit 6d640f8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 3 additions & 0 deletions init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ shared = {
police = json.decode(GetConvar('inventory:police', '["police", "sheriff"]')),
}

shared.dropslots = GetConvarInt('inventory:dropslots', shared.playerslots)
shared.dropweight = GetConvarInt('inventory:dropslotcount', shared.playerweight)

do
if type(shared.police) == 'string' then
shared.police = { shared.police }
Expand Down
4 changes: 2 additions & 2 deletions modules/inventory/server.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1475,7 +1475,7 @@ end

local function CustomDrop(prefix, items, coords, slots, maxWeight, instance, model)
local dropId = generateInvId()
local inventory = Inventory.Create(dropId, ('%s %s'):format(prefix, dropId:gsub('%D', '')), 'drop', slots or shared.playerslots, 0, maxWeight or shared.playerweight, false, {})
local inventory = Inventory.Create(dropId, ('%s %s'):format(prefix, dropId:gsub('%D', '')), 'drop', slots or shared.dropslots, 0, maxWeight or shared.dropweight, false, {})

if not inventory then return end

Expand Down Expand Up @@ -1573,7 +1573,7 @@ local function dropItem(source, playerInventory, fromData, data)
end

local dropId = generateInvId('drop')
local inventory = Inventory.Create(dropId, ('Drop %s'):format(dropId:gsub('%D', '')), 'drop', shared.playerslots, toData.weight, shared.playerweight, false, {[data.toSlot] = toData})
local inventory = Inventory.Create(dropId, ('Drop %s'):format(dropId:gsub('%D', '')), 'drop', shared.dropslots, toData.weight, shared.dropweight, false, {[data.toSlot] = toData})

if not inventory then return end

Expand Down

0 comments on commit 6d640f8

Please sign in to comment.