Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: use statebags for hunger/thirst/stress #395

Merged
merged 22 commits into from
Apr 2, 2024
Merged

feat: use statebags for hunger/thirst/stress #395

merged 22 commits into from
Apr 2, 2024

Conversation

TonybynMp4
Copy link
Contributor

@TonybynMp4 TonybynMp4 commented Mar 1, 2024

Description

Statebags are cool 👍
It keeps compatibility with the old way of setting those values, so we can start using statebags without anything being broken until then!

(please test to make sure i didn't fuck it up)

Checklist

  • I have personally loaded this code into an updated Qbox project and checked all of its functionality.
  • My pull request fits the contribution guidelines & code conventions.

bridge/qb/server/events.lua Outdated Show resolved Hide resolved
server/loops.lua Show resolved Hide resolved
server/player.lua Show resolved Hide resolved
@TonybynMp4 TonybynMp4 requested a review from mafewtm March 4, 2024 20:39
@Fraprwnt
Copy link

Fraprwnt commented Mar 5, 2024

I tried to test this, there was an error on line 10 about compare nil with number and in the console it was arithemetic on nil value server/loops.lua:6

@TonybynMp4
Copy link
Contributor Author

I tried to test this, there was an error on line 10 about compare nil with number and in the console it was arithemetic on nil value server/loops.lua:6

Try again now, errors makes sense if the values aren't set to begin with 😆

@Fraprwnt
Copy link

Fraprwnt commented Mar 5, 2024

I tried to test this, there was an error on line 10 about compare nil with number and in the console it was arithemetic on nil value server/loops.lua:6

Try again now, errors makes sense if the values aren't set to begin with 😆

Yes, this works well, there are no errors, I found several problems, when I eat it does increase in the bar, but when I continue eating it gets stuck and doesn't add any more, and when I drink it's the same, what's there actually decreases.

@TonybynMp4
Copy link
Contributor Author

when I eat it does increase in the bar, but when I continue eating it gets stuck and doesn't add any more, and when I drink it's the same, what's there actually decreases.

That's weird, i don't really see why that would happen, tbh 🤔

@mafewtm
Copy link
Member

mafewtm commented Mar 8, 2024

I'm experiencing the same issue too. When I use this with your hud pr, the first time I eat it updates but after that, it doesnt update anymore from what I can tell.

@TonybynMp4
Copy link
Contributor Author

TonybynMp4 commented Mar 8, 2024

Yes, this works well, there are no errors, I found several problems, when I eat it does increase in the bar, but when I continue eating it gets stuck and doesn't add any more, and when I drink it's the same, what's there actually decreases.

@Fraprwnt can you please update core smallresources & hud and try again now? :)
(you too @mafewtm)

@Fraprwnt
Copy link

Fraprwnt commented Mar 9, 2024

Yes, this works well, there are no errors, I found several problems, when I eat it does increase in the bar, but when I continue eating it gets stuck and doesn't add any more, and when I drink it's the same, what's there actually decreases.

@Fraprwnt can you please update core smallresources & hud and try again now? :) (you too @mafewtm)

to eat using items from ox_inventory remains the same. It only increases after the first meal. The second and third don't change anything, but to eat using items from the smallresources config, for the first and second meal the same amount of food and drink increases.

server/loops.lua Outdated Show resolved Hide resolved
server/player.lua Outdated Show resolved Hide resolved
server/player.lua Outdated Show resolved Hide resolved
server/events.lua Outdated Show resolved Hide resolved
server/player.lua Outdated Show resolved Hide resolved
Copy link
Member

@Manason Manason left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

metadata must always be modified using the SetMetadata function of player. Otherwise certain events won't fire, which are relied upon for updating QBX.PlayerData for example, and likely used in other scripts.

@TonybynMp4 TonybynMp4 requested a review from Manason March 18, 2024 16:40
Copy link
Member

@Manason Manason left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix listing errors and make sure this is thoroughly tested please

Copy link
Member

@mafewtm mafewtm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As long as it's been thoroughly tested.

@TonybynMp4 TonybynMp4 linked an issue Mar 30, 2024 that may be closed by this pull request
@mafewtm mafewtm merged commit 6ee7fc9 into main Apr 2, 2024
3 of 4 checks passed
@mafewtm mafewtm deleted the statusStatebag branch April 2, 2024 14:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Switch hunger/thirst to a statebag
6 participants