Commit Graph

16 Commits

Author SHA1 Message Date
Selt 07b9253401 fix(esx_progressbar): honour the requested duration and ignore cancelled runs
The processing thread counted the remaining time down in 1000 ms steps and read
the global CurrentProgress on every wake, which caused two problems.

Any duration that is not a whole number of seconds finished late, since the
thread only checked after another full second. The NUI bar runs on wall clock
time, so the bar completed and the player then stood frozen waiting for onFinish.

Cancelling did not stop the thread either. CancelProgressbar clears
CurrentProgress, but the sleeping thread only notices up to a second later, and if
a new bar was started in that window it saw a non-nil CurrentProgress and kept
decrementing the new one alongside its own thread. The new bar then finished at
roughly half its length, firing onFinish early.

The run now carries an id, so a thread stops as soon as its run is no longer the
current one, and the end is an absolute timestamp rather than a countdown.

Measured in game on artifact 25770, requested versus actual onFinish:
  before: 500 -> 1011, 4200 -> 5042, cancel then 3000 -> 1427
  after:  500 ->  519, 4200 -> 4222, cancel then 3000 -> 3058
2026-07-27 21:51:15 +02:00
JustGod e0ce2c6b27 Feat: ESX.CancelProgressbar 2024-10-25 23:36:40 +02:00
JustGod 5f660bcfac Fix progressbar always return false|nil 2024-10-25 23:35:54 +02:00
Mirow 959344e39f refactor(client): used cached esx ped 2024-07-26 22:19:28 +02:00
Gellipapa 9d90c9d674 🎨 Run formatter 2024-01-24 23:07:30 +01:00
Gellipapa 598c2f7c9f 🔧 Add missing onCancel callback method to progressbar 2023-10-16 23:49:10 +02:00
TheFantomas 88c8036a24 formatting(core): Format all 2023-06-29 20:20:28 +02:00
Thekuca 8f773621dd Merge pull request #1043 from FekyDEV/patch-1
feat(esx_progressbar): option to externally cancel the progressbar
2023-05-29 14:09:51 +02:00
Thekuca d979ba4ae8 Update Progress.lua 2023-05-12 23:09:38 +02:00
FekyDEV 349bb41e73 Added option to externally cancel progress bar
Personally, I think this feature should have been here a long time ago. I hope that adding this code will help players in the future and if anyone here has a suggestion for a code change feel free to comment.
2023-05-12 22:55:40 +02:00
TheFantomas d3086e61b4 lint(core): line contains trailing whitespace fixes 2023-05-07 19:39:11 +02:00
TheFantomas 612ffb59de Hmm 2023-05-07 19:26:11 +02:00
Csoki f2e5d63234 refactor(esx_progressbar): remove jquery (#867) 2023-02-05 18:18:31 +01:00
Benzo db983b931c move everything into core folder 2023-01-18 15:21:39 +01:00
Benzo 9f36559ac0 Revert "build: new repos"
This reverts commit cfb8e742e4.
2023-01-18 15:08:44 +01:00
Benzo cfb8e742e4 build: new repos 2023-01-18 15:06:15 +01:00