Skip to content

Commit

Permalink
refactor(items): minor item tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
thelindat committed Feb 17, 2024
1 parent df98468 commit 51b3f0f
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 9 deletions.
17 changes: 12 additions & 5 deletions data/items.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ return {
weight = 220,
degrade = 60,
client = {
image = 'burger_chicken.png',
status = { hunger = 200000 },
anim = 'eating',
prop = 'burger',
Expand Down Expand Up @@ -79,15 +80,15 @@ return {
},
},

['cola'] = {
label = 'eCola',
['sprunk'] = {
label = 'Sprunk',
weight = 350,
client = {
status = { thirst = 200000 },
anim = { dict = 'mp_player_intdrink', clip = 'loop_bottle' },
prop = { model = `prop_ecola_can`, pos = vec3(0.01, 0.01, 0.06), rot = vec3(5.0, 5.0, -180.5) },
prop = { model = `prop_ld_can_01`, pos = vec3(0.01, 0.01, 0.06), rot = vec3(5.0, 5.0, -180.5) },
usetime = 2500,
notification = 'You quenched your thirst with cola'
notification = 'You quenched your thirst with a sprunk'
}
},

Expand Down Expand Up @@ -115,6 +116,9 @@ return {

['identification'] = {
label = 'Identification',
client = {
image = 'card_id.png'
}
},

['panties'] = {
Expand Down Expand Up @@ -206,9 +210,12 @@ return {
},

['mastercard'] = {
label = 'Mastercard',
label = 'Fleeca Card',
stack = false,
weight = 10,
client = {
image = 'card_bank.png'
}
},

['scrapmetal'] = {
Expand Down
11 changes: 11 additions & 0 deletions data/weapons.lua
Original file line number Diff line number Diff line change
Expand Up @@ -724,6 +724,7 @@ return {
weight = 280,
type = 'muzzle',
client = {
image = 'at_suppressor.png',
component = {
`COMPONENT_AT_PI_SUPP`,
`COMPONENT_AT_PI_SUPP_02`,
Expand All @@ -739,6 +740,7 @@ return {
weight = 280,
type = 'muzzle',
client = {
image = 'at_suppressor.png',
component = {
`COMPONENT_AT_AR_SUPP`,
`COMPONENT_AT_AR_SUPP_02`,
Expand Down Expand Up @@ -786,6 +788,7 @@ return {
type = 'magazine',
weight = 280,
client = {
image = 'at_clip_extended.png',
component = {
`COMPONENT_APPISTOL_CLIP_02`,
`COMPONENT_CERAMICPISTOL_CLIP_02`,
Expand All @@ -808,6 +811,7 @@ return {
type = 'magazine',
weight = 280,
client = {
image = 'at_clip_extended.png',
component = {
`COMPONENT_ASSAULTSMG_CLIP_02`,
`COMPONENT_COMBATPDW_CLIP_02`,
Expand All @@ -826,6 +830,7 @@ return {
type = 'magazine',
weight = 280,
client = {
image = 'at_clip_extended2.png',
component = {
`COMPONENT_ASSAULTSHOTGUN_CLIP_02`,
`COMPONENT_HEAVYSHOTGUN_CLIP_02`,
Expand All @@ -839,6 +844,7 @@ return {
type = 'magazine',
weight = 280,
client = {
image = 'at_clip_extended2.png',
component = {
`COMPONENT_ADVANCEDRIFLE_CLIP_02`,
`COMPONENT_ASSAULTRIFLE_CLIP_02`,
Expand All @@ -863,6 +869,7 @@ return {
type = 'magazine',
weight = 280,
client = {
image = 'at_clip_drum.png',
component = {
`COMPONENT_GUSENBERG_CLIP_02`,
`COMPONENT_MG_CLIP_02`,
Expand All @@ -878,6 +885,7 @@ return {
type = 'magazine',
weight = 280,
client = {
image = 'at_clip_extended2.png',
component = {
`COMPONENT_HEAVYSNIPER_MK2_CLIP_02`,
`COMPONENT_MARKSMANRIFLE_CLIP_02`,
Expand All @@ -892,6 +900,7 @@ return {
type = 'magazine',
weight = 280,
client = {
image = 'at_clip_drum.png',
component = {
`COMPONENT_COMBATPDW_CLIP_03`,
`COMPONENT_MACHINEPISTOL_CLIP_03`,
Expand All @@ -906,6 +915,7 @@ return {
type = 'magazine',
weight = 280,
client = {
image = 'at_clip_drum.png',
component = {
`COMPONENT_HEAVYSHOTGUN_CLIP_03`
},
Expand All @@ -918,6 +928,7 @@ return {
type = 'magazine',
weight = 280,
client = {
image = 'at_clip_drum.png',
component = {
`COMPONENT_ASSAULTRIFLE_CLIP_03`,
`COMPONENT_COMPACTRIFLE_CLIP_03`,
Expand Down
12 changes: 8 additions & 4 deletions modules/items/shared.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ end
local ItemList = {}
local isServer = IsDuplicityVersion()

local function setImagePath(path)
if path then
return path:match('^[%w]+://') and path or ('%s/%s'):format(client.imagepath, path)
end
end

---@param data OxItem
local function newItem(data)
data.weight = data.weight or 0
Expand Down Expand Up @@ -55,9 +61,7 @@ local function newItem(data)
data.export = useExport(string.strsplit('.', clientData.export))
end

if clientData.image then
clientData.image = clientData.image:match('^[%w]+://') and clientData.image or ('%s/%s'):format(client.imagepath, clientData.image)
end
clientData.image = setImagePath(clientData.image)

if clientData.propTwo then
clientData.prop = clientData.prop and { clientData.prop, clientData.propTwo } or clientData.propTwo
Expand Down Expand Up @@ -94,7 +98,7 @@ for type, data in pairs(lib.load('data.weapons')) do
local clientData = v.client

if clientData?.image then
clientData.image = clientData.image:match('^[%w]+://') and ('url(%s)'):format(clientData.image) or ('url(%s/%s)'):format(client.imagepath, clientData.image)
clientData.image = setImagePath(clientData.image)
end
end

Expand Down

0 comments on commit 51b3f0f

Please sign in to comment.