forked from Simnation/Main
ed
e
This commit is contained in:
parent
ef4fd3eece
commit
3c6281a3d5
2 changed files with 24 additions and 11 deletions
|
@ -50,11 +50,11 @@ Config.FillItems = {
|
||||||
-- Consumption Effects
|
-- Consumption Effects
|
||||||
Config.Effects = {
|
Config.Effects = {
|
||||||
food = {
|
food = {
|
||||||
hunger = 10,
|
hunger = 20, -- Increased from 10 to be more noticeable
|
||||||
stress = -5
|
stress = -5
|
||||||
},
|
},
|
||||||
water = {
|
water = {
|
||||||
thirst = 10,
|
thirst = 20, -- Increased from 10 to be more noticeable
|
||||||
stress = -2
|
stress = -2
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -143,25 +143,38 @@ RegisterNetEvent('pet-bowls:server:consumeBowl', function(bowlId)
|
||||||
{newLevel, bowlId}
|
{newLevel, bowlId}
|
||||||
)
|
)
|
||||||
|
|
||||||
-- Apply effects to player
|
-- Apply effects to player - FIXED VERSION
|
||||||
local effects = Config.Effects[bowl.type]
|
local effects = Config.Effects[bowl.type]
|
||||||
if effects then
|
if effects then
|
||||||
if effects.hunger then
|
-- Get player metadata
|
||||||
|
local metadata = Player.PlayerData.metadata
|
||||||
|
|
||||||
-- Apply hunger effect
|
-- Apply hunger effect
|
||||||
TriggerClientEvent('hud:client:UpdateHunger', src, effects.hunger, true)
|
if effects.hunger and bowl.type == 'food' then
|
||||||
|
metadata.hunger = math.min(100, metadata.hunger + effects.hunger)
|
||||||
|
Player.Functions.SetMetadata('hunger', metadata.hunger)
|
||||||
|
print('^2[Pet-Bowls]^7 Updated player hunger to ' .. metadata.hunger)
|
||||||
end
|
end
|
||||||
|
|
||||||
if effects.thirst then
|
|
||||||
-- Apply thirst effect
|
-- Apply thirst effect
|
||||||
TriggerClientEvent('hud:client:UpdateThirst', src, effects.thirst, true)
|
if effects.thirst and bowl.type == 'water' then
|
||||||
|
metadata.thirst = math.min(100, metadata.thirst + effects.thirst)
|
||||||
|
Player.Functions.SetMetadata('thirst', metadata.thirst)
|
||||||
|
print('^2[Pet-Bowls]^7 Updated player thirst to ' .. metadata.thirst)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Apply stress effect (if your server uses this)
|
||||||
if effects.stress then
|
if effects.stress then
|
||||||
-- Apply stress effect
|
if metadata.stress then
|
||||||
TriggerClientEvent('hud:client:UpdateStress', src, effects.stress)
|
metadata.stress = math.max(0, metadata.stress + effects.stress) -- Stress is negative in config
|
||||||
|
Player.Functions.SetMetadata('stress', metadata.stress)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Sync the updated status to the client
|
||||||
|
TriggerClientEvent('hud:client:UpdateNeeds', src, metadata.hunger, metadata.thirst)
|
||||||
|
end
|
||||||
|
|
||||||
-- Update all clients
|
-- Update all clients
|
||||||
TriggerClientEvent('pet-bowls:client:updateBowlLevel', -1, bowlId, newLevel)
|
TriggerClientEvent('pet-bowls:client:updateBowlLevel', -1, bowlId, newLevel)
|
||||||
TriggerClientEvent('ox_lib:notify', src, Config.Notifications.consumed)
|
TriggerClientEvent('ox_lib:notify', src, Config.Notifications.consumed)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue