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

Use external state management #593

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

abdel1touimi
Copy link

Description

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.

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.

Would setting the hunger and thirst decay to 0 accomplish the same thing as this PR?

@abdel1touimi
Copy link
Author

Would setting the hunger and thirst decay to 0 accomplish the same thing as this PR?

No, because:

  1. bridge/qb/client/events.lua:
    Statebag handlers for thirst, hunger, and stress will still be present. While these primarily update the HUD, it would still be beneficial to remove them to clean things up.

  2. client/loops.lua:
    Player health will continue to decrease despite setting the decay to 0.

  3. server/events.lua:
    Statebag handlers will still be active, syncing player metadata with the player state for hunger and thirst.

  4. server/loops.lua:
    Even if decay is set to 0, metadata updates will continue.

  5. server/player.lua:
    It’s redundant at this point. I see no need to keep it, but that’s just my opinion.

@Manason
Copy link
Member

Manason commented Oct 18, 2024

Would setting the hunger and thirst decay to 0 accomplish the same thing as this PR?

No, because:

1. **`bridge/qb/client/events.lua`**:
   Statebag handlers for thirst, hunger, and stress will still be present. While these primarily update the HUD, it would still be beneficial to remove them to clean things up.

2. **`client/loops.lua`**:
   Player health will continue to decrease despite setting the decay to 0.

3. **`server/events.lua`**:
   Statebag handlers will still be active, syncing player metadata with the player state for hunger and thirst.

4. **`server/loops.lua`**:
   Even if decay is set to 0, metadata updates will continue.

5. **`server/player.lua`**:
   It’s redundant at this point. I see no need to keep it, but that’s just my opinion.

One of my concerns is breaking our existing API behavior. Other resources set metadata or a statebag and expect it to be synced and updated. Maybe dropping thirst/hunger should be moved to config rather than being hard coded. I'd like to find a way to add compatibility for your resource without changing the behavior for existing Qbox integrations.

@abdel1touimi
Copy link
Author

Would setting the hunger and thirst decay to 0 accomplish the same thing as this PR?

No, because:

1. **`bridge/qb/client/events.lua`**:
   Statebag handlers for thirst, hunger, and stress will still be present. While these primarily update the HUD, it would still be beneficial to remove them to clean things up.

2. **`client/loops.lua`**:
   Player health will continue to decrease despite setting the decay to 0.

3. **`server/events.lua`**:
   Statebag handlers will still be active, syncing player metadata with the player state for hunger and thirst.

4. **`server/loops.lua`**:
   Even if decay is set to 0, metadata updates will continue.

5. **`server/player.lua`**:
   It’s redundant at this point. I see no need to keep it, but that’s just my opinion.

One of my concerns is breaking our existing API behavior. Other resources set metadata or a statebag and expect it to be synced and updated. Maybe dropping thirst/hunger should be moved to config rather than being hard coded. I'd like to find a way to add compatibility for your resource without changing the behavior for existing Qbox integrations.

I understand the issue.
I will implement some change in the player states and be back to you

@abdel1touimi
Copy link
Author

change done in playerstates.

Now it accept changes done directly in metadata or statebag

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.

2 participants