Qbox-project / qbx_smallresources

GNU General Public License v3.0
7 stars 37 forks source link

refactor: rename addHunger to setHunger #99

Closed ArturMichalak closed 1 month ago

ArturMichalak commented 1 month ago

Description

Many users have reported errors related to consumables. The problem lies in the synchronization of the statebag with the player's metadata in qbx_core. However, I have made a few improvements in smallresurces that may be of value.

The name addHunger is confusing when replacing an old value instead of adding a new one to it. A new function addHunger has appeared in PR, whose logic is more in line with its name.

Moreover, a hotfix has been placed in the code for https://github.com/Qbox-project/qbx_core/issues/457.

Debug commands at https://github.com/Qbox-project/qbx_adminmenu/pull/57

TonybynMp4 commented 1 month ago

IMO this pr shouldn't be. You're saying it's "confusing" that the function is called addHunger, when it literally adds hunger..

Manason commented 1 month ago

IMO this pr shouldn't be. You're saying it's "confusing" that the function is called addHunger, when it literally adds hunger..

addHunger should increment current hunger by some amount. setHunger would replace current hunger with some amount.

Didn't read the PR, just want to clarify on what names should go with what in case there is confusion.

ArturMichalak commented 1 month ago

Thanks a lot, I didn't know how to describe these functions well. I'll adapt it soon.