feat(player): include previous job and gang data in update events#1218
Open
redutzu wants to merge 2 commits intoqbcore-framework:mainfrom
Open
feat(player): include previous job and gang data in update events#1218redutzu wants to merge 2 commits intoqbcore-framework:mainfrom
redutzu wants to merge 2 commits intoqbcore-framework:mainfrom
Conversation
Comment on lines
+275
to
+276
| TriggerEvent('QBCore:Server:SetDuty', self.PlayerData.source, self.PlayerData.job.onduty) | ||
| TriggerClientEvent('QBCore:Client:SetDuty', self.PlayerData.source, self.PlayerData.job.onduty) |
Member
There was a problem hiding this comment.
This would be slightly breaking for any resources that listened to OnJobUpdate for duty updates, although I'm not sure how many would do so.
Listening to QBCore:ToggleDuty would've also been fragile.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Adds previous state tracking to player job and gang updates by passing lastJob and lastGang to server and client events.
This provides downstream resources with access to both the old and new state, improving flexibility for event-driven logic without requiring additional state tracking.
The change is backward compatible, as existing handlers can ignore the extra argument.
Additionally refactors duty handling by moving SetDuty event triggering into SetJobDuty. Previously, these events were only fired when using ToggleDuty; now they are consistently triggered whenever duty is changed via SetJobDuty.
Applies to: