Skip to content

Commit

Permalink
refactor(config): plan for future convar changes
Browse files Browse the repository at this point in the history
Better support with FxDK and generally easier for people to modify. None of this is active yet.
  • Loading branch information
thelindat committed Jan 13, 2022
1 parent 9c049f6 commit 0f73432
Show file tree
Hide file tree
Showing 3 changed files with 126 additions and 0 deletions.
73 changes: 73 additions & 0 deletions config.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# Future releases of inventory will utilise this new convar setup
# Continue using your current config while preparing for this breaking change

# Activate specific event handlers and functions (supported: esx)
setr inventory:framework "esx"

# Load specific language file from data/locales
setr inventory:locale "en"

# Number of slots for player inventories
setr inventory:slots 50

# Maximum carry capacity for players, in kilograms
setr inventory:weight 30000

# Weapons will reload after reaching 0 ammo
setr inventory:autoreload false

# Blur the screen while accessing the inventory
setr inventory:screenblur true

# Trim whitespace from vehicle plates when checking owned vehicles
setr inventory:trimplate true

# Integrated support for qtarget stashes, shops, etc
setr inventory:qtarget false

# Default hotkeys to access primary and secondary inventories, and hotbar
setr inventory:keys ["F2", "K", "TAB"]

# Enable control action when inventory is open
setr inventory:enablekeys [249]

# Jobs with access to police armoury, evidence lockers, etc
setr inventory:police ["police", "sheriff"]

# Basic text-file logging (improvements are planned)
set inventory:logs false

# Item prices fluctuate in shops
set inventory:randomprices true

# Compare current version to latest release on GitHub
set inventory:versioncheck true

# Loot will randomly generate inside unowned vehicles and dumpsters
set inventory:randomloot true

# Minimum job grade to remove items from evidence lockers
set inventory:evidencegrade 2

# Stashes will be wiped after remaining unchanged for the given time
set inventory:clearstashes "6 MONTH"

# Set the contents of randomly generated inventories
set inventory:loot {
"vehicle": [
["cola", 1, 1],
["water", 1, 1],
["garbage", 1, 2, 50],
["panties", 1, 1, 5],
["money", 1, 50],
["money", 200, 400, 5],
["bandage", 1, 1]
],

"dumpster": [
["mustard", 1, 1],
["garbage", 1, 3],
["money", 1, 10],
["burger", 1, 1]
]
}
52 changes: 52 additions & 0 deletions fxmanifest.lua
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,55 @@ files {
'data/*.lua',
'data/**/*.lua'
}

-- FxDK settings
convar_category 'shared' {
'Shared inventory settings',
{
{'Activate specific event handlers and functions', '$inventory:framework', 'CV_MULTI', {
false, 'esx'
}},
{'Load specific language file from data/locales', '$inventory:locale', 'CV_MULTI', {
'en', 'cs', 'da', 'es', 'fr', 'it', 'nl', 'pt-br'
}},
{'Number of slots for player inventories', '$inventory:slots', 'CV_INT', 50},
{'Maximum carry capacity for players, in kilograms', '$inventory:weight', 'CV_INT', 30000},
{'Weapons will reload after reaching 0 ammo', '$inventory:autoreload', 'CV_BOOL', false},
{'Blur the screen while accessing the inventory', '$inventory:screenblur', 'CV_BOOL', true},
{'Trim whitespace from vehicle plates when checking owned vehicles', '$inventory:trimplate', 'CV_BOOL', true},
{'Integrated support for qtarget stashes, shops, etc', '$inventory:qtarget', 'CV_BOOL', true},
{'Default hotkeys to access primary and secondary inventories, and hotbar', '$inventory:keys', 'CV_STRING', '["F2", "K", "TAB"]'},
{'Enable control action when inventory is open', '$inventory:enablekeys', 'CV_STRING', '[249]'},
{'Jobs with access to police armoury, evidence lockers, etc', '$inventory:police', 'CV_STRING', '["police", "sheriff"]'}
}
}

convar_category 'server' {
'Server inventory settings',
{
{'Basic text-file logging (improvements are planned)', 'inventory:logs', 'CV_BOOL', true},
{'Item prices fluctuate in shops', 'inventory:randomprices', 'CV_BOOL', true},
{'Compare current version to latest release on GitHub', 'inventory:versioncheck', 'CV_BOOL', true},
{'Loot will randomly generate inside unowned vehicles and dumpsters', 'inventory:randomloot', 'CV_BOOL', true},
{'Minimum job grade to remove items from evidence lockers', 'inventory:evidencegrade', 'CV_INT', 2},
{'Stashes will be wiped after remaining unchanged for the given time', 'inventory:clearstashes', 'CV_STRING', "6 MONTH"},
{'Set the contents of randomly generated inventories', 'inventory:loot', 'CV_STRING', {[[
"vehicle": [
["cola", 1, 1],
["water", 1, 1],
["garbage", 1, 2, 50],
["panties", 1, 1, 5],
["money", 1, 50],
["money", 200, 400, 5],
["bandage", 1, 1]
],
"dumpster": [
["mustard", 1, 1],
["garbage", 1, 3],
["money", 1, 10],
["burger", 1, 1]
]
]]}}
}
}
1 change: 1 addition & 0 deletions modules/items/server.lua
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ local itemFormat = [[
ox.info('Inventory has loaded '..count..' items')
collectgarbage('collect') -- clean up from initialisation
ox.ready = true
ox.info('A future version of ox_inventory will modify convars for simpler use and FxDK support (check config.cfg)')
--[[local ignore = {[0] = '?', [`WEAPON_UNARMED`] = 'unarmed', [966099553] = 'shovel'}
while true do
Wait(45000)
Expand Down

0 comments on commit 0f73432

Please sign in to comment.