overextended / ox_inventory

Slot-based inventory with metadata.
https://overextended.dev/ox_inventory
GNU General Public License v3.0
444 stars 689 forks source link

Durability requirement when crafting & remove expired items #1019

Open alex070609 opened 1 year ago

alex070609 commented 1 year ago

Is your feature request related to a problem? Please describe. I would like to enquire a request because the crafting table is frustating regarding items and jobs

Describe the solution you'd like I Would love to see a job specific use to see the craftings tables to prevent peoples not having the correct job from using it

Also it'll be great to be able to "inverse" the usage of the Durabitity setting so that an item can "expire" as seen on the item.lua using the "degrade" metadata as if for exemple meat is below 20% then you cannot use it anymore for crafting if possible ? and if crafted the item that is used as ingredients can be removed even if a designated durability is used maybed zith a true/false check ?

Describe alternatives you've considered Maybe if using ESX check if the framework is related and if the job under ESX.PlayerData.job.name is "ok" with a "job" setting in data/crafting.lua

example i did on my server

data/crafting.lua

{
    {
        name = 'steak',
        ingredients = {
        uncooked_steak = 1,
    },
    duration = 5000,
    count = 1,
    metadata = {},
    job = 'tastybreak'
},

modules/crafting/client.lua, line 101

local function nearbyBench(point)
    Citizen.CreateThread(function()
        while ESX.PlayerData.job == nil do
            Citizen.Wait(100)
        end
    end)
    if ESX ~= nil and ESX.PlayerData ~= nil and ESX.PlayerData.job ~= nil then 
        if ESX.PlayerData.job.name == job then
            ---@diagnostic disable-next-line: param-type-mismatch
            DrawMarker(1, point.coords.x, point.coords.y, point.coords.z-1, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.5, 1.5, 0.1, 255, 255, 255, 100, false, false, 0, true, false, false, false)

            if point.isClosest and point.currentDistance < 1.5 and IsControlJustReleased(0, 38) then
                client.openInventory('crafting', { id = point.benchid, index = point.index })
            end
        end
    end
end
thelindat commented 1 year ago

Leaving durability/degradation out of the discussion for now.

Groups are already a thing and you cannot access the crafting table if you don't have the required group(s); works the same as stashes and shops. ESX jobs are converted into the group structure.

Nasdrov commented 1 year ago

for example (as stash or shop ...) :

groups = {['mechanic'] = 0},

No need to look too far @alex070609 ...

alex070609 commented 1 year ago

ok thanks, and for the "reversed" durability ? what do you think ?