Skip to content

Commit

Permalink
refactor(weapons): adjust jerry can weight and durability loss
Browse files Browse the repository at this point in the history
Resolves #1659.
  • Loading branch information
thelindat committed Jun 7, 2024
1 parent 9f4b1a4 commit 81554df
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
5 changes: 3 additions & 2 deletions data/weapons.lua
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,7 @@ return {
['WEAPON_FIREEXTINGUISHER'] = {
label = 'Fire Extinguisher',
weight = 8616,
durability = 0.006
},

['WEAPON_FIREWORK'] = {
Expand Down Expand Up @@ -458,8 +459,8 @@ return {
},

['WEAPON_PETROLCAN'] = {
label = 'Gas Can',
weight = 12000,
label = 'Jerry Can',
weight = 4000,
},

['WEAPON_GADGETPISTOL'] = {
Expand Down
8 changes: 8 additions & 0 deletions modules/inventory/server.lua
Original file line number Diff line number Diff line change
Expand Up @@ -432,6 +432,10 @@ function Inventory.SlotWeight(item, slot, ignoreCount)
end
end

if item.hash == `WEAPON_PETROLCAN` then
weight += 15000 * (slot.metadata.ammo / 100)
end

if slot.metadata.components then
for i = #slot.metadata.components, 1, -1 do
local componentWeight = Items(slot.metadata.components[i])?.weight
Expand Down Expand Up @@ -2538,6 +2542,10 @@ local function updateWeapon(source, action, value, slot, specialAmmo)
weapon.metadata.durability = 0
end

if item.hash == `WEAPON_PETROLCAN` then
weapon.weight = Inventory.SlotWeight(item, weapon)
end

if action ~= 'throw' then
inventory:syncSlotsWithPlayer({
{ item = weapon }
Expand Down

0 comments on commit 81554df

Please sign in to comment.