Skip to content

Commit

Permalink
chore: esx_basicneeds code cleaning
Browse files Browse the repository at this point in the history
- Removed unnecessary translation strings
-Remove management of eating and drinking animations as they are handled by ox_inventory
- Removed the various databases as the various items must be present in ox_inventory (items.lua) and not in the database
  • Loading branch information
bitpredator committed Sep 21, 2023
1 parent de30900 commit 616e6ef
Show file tree
Hide file tree
Showing 22 changed files with 4 additions and 144 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -69,63 +69,4 @@ end)

AddEventHandler('esx_basicneeds:isEating', function(cb)
cb(IsAnimated)
end)

RegisterNetEvent('esx_basicneeds:onUse')
AddEventHandler('esx_basicneeds:onUse', function(type, prop_name, anim)
if not IsAnimated then
local anim = anim
IsAnimated = true
if type == 'food' then
prop_name = prop_name or 'prop_cs_burger_01'
anim = anim
elseif type == 'drink' then
prop_name = prop_name or 'prop_ld_flow_bottle'
anim = anim
end

CreateThread(function()
local playerPed = PlayerPedId()
local x,y,z = table.unpack(GetEntityCoords(playerPed))
local prop = CreateObject(joaat(prop_name), x, y, z + 0.2, true, true, true)
local boneIndex = GetPedBoneIndex(playerPed, 18905)
AttachEntityToEntity(prop, playerPed, boneIndex, 0.12, 0.028, 0.001, 10.0, 175.0, 0.0, true, true, false, true, 1, true)

ESX.Streaming.RequestAnimDict(anim.dict, function()
TaskPlayAnim(playerPed, anim.dict, anim.name, anim.settings[1], anim.settings[2], anim.settings[3], anim.settings[4], anim.settings[5], anim.settings[6], anim.settings[7], anim.settings[8])
RemoveAnimDict(anim.dict)

Wait(3000)
IsAnimated = false
ClearPedSecondaryTask(playerPed)
DeleteObject(prop)
end)
end)
end
end)

-- Backwards compatibility
RegisterNetEvent('esx_basicneeds:onEat')
AddEventHandler('esx_basicneeds:onEat', function(prop_name)
local Invoke = GetInvokingResource()

print(('[^3WARNING^7] ^5%s^7 used ^5esx_basicneeds:onEat^7, this method is deprecated and should not be used! Refer to ^5https://documentation.esx-framework.org/addons/esx_basicneeds/events/oneat^7 for more info!'):format(Invoke))

if not prop_name then
prop_name = 'prop_cs_burger_01'
end
TriggerEvent('esx_basicneeds:onUse', 'food', prop_name)
end)

RegisterNetEvent('esx_basicneeds:onDrink')
AddEventHandler('esx_basicneeds:onDrink', function(prop_name)
local Invoke = GetInvokingResource()

print(('[^3WARNING^7] ^5%s^7 used ^5esx_basicneeds:onDrink^7, this method is deprecated and should not be used! Refer to ^5https://documentation.esx-framework.org/addons/esx_basicneeds/events/ondrink^7 for more info!'):format(Invoke))


if not prop_name then
prop_name = 'prop_ld_flow_bottle'
end
TriggerEvent('esx_basicneeds:onUse', 'drink', prop_name)
end)
end)
20 changes: 1 addition & 19 deletions server-data/resources/[esx_addons]/esx_basicneeds/config.lua
Original file line number Diff line number Diff line change
@@ -1,21 +1,3 @@
Config = {}
Config.Locale = 'en'
Config.Visible = false

Config.Items = {
["bread"] = {
type = "food",
prop = "prop_cs_burger_01",
status = 200000,
remove = true,
anim = {dict = 'mp_player_inteat@burger', name = 'mp_player_int_eat_burger_fp', settings = {8.0, -8, -1, 49, 0, 0, 0, 0}}
},

["water"] = {
type = "drink",
prop = "prop_ld_flow_bottle",
status = 100000,
remove = true,
anim = {dict = 'mp_player_intdrink', name = 'loop_bottle', settings = {1.0, -1.0, 2000, 0, 1, true, true, true}}
}
}
Config.Visible = false

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
Locales['da'] = {
['used_food'] = 'Du har spist 1x %s',
['used_drink'] = 'Du har drukket 1x %s',
['got_healed'] = 'Du er blevet helbredt.'
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
Locales['de'] = {
['used_food'] = 'Du hast 1x %s gegessen',
['used_drink'] = 'Du hast 1x %s getrunken',
['got_healed'] = 'Du wurdest geheilt.'
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
Locales['en'] = {
['used_food'] = 'You have eaten 1x %s',
['used_drink'] = 'You have drinked 1x %s',
['got_healed'] = 'You have been healed.'
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
Locales['fr'] = {
['used_food'] = 'Vous avez mangé 1x %s',
['used_drink'] = 'Vous avez bu 1x %s',
['got_healed'] = 'Vous avez été soigné.'
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
Locales['nl'] = {
['used_eat'] = 'je hebt een %s gegeten',
['used_drink'] = 'je hebt een %s gedronken',
}
['used_eat'] = 'je hebt een %s gegeten',
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
Locales['sl'] = {
['used_food'] = 'Vi ste pojedli 1x %s',
['used_drink'] = 'Vi ste popili 1x %s',
['got_healed'] = 'Vi ste bili Pozdravljeni.'
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
Locales['sr'] = {
['used_food'] = 'Pojeli ste 1x %s',
['used_drink'] = 'Popili ste 1x %s',
['got_healed'] = 'Vi ste izlečeni.'
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
Locales['zh-cn'] = {
['used_food'] = '已食用了1x %s',
['used_drink'] = '已饮用了1x %s',
['got_healed'] = '已重置饥饿+饥渴双值.'
}

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

0 comments on commit 616e6ef

Please sign in to comment.