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

Accessories disappearance #307

Merged
merged 5 commits into from
May 14, 2023
Merged

Conversation

swkeep
Copy link
Contributor

@swkeep swkeep commented May 14, 2023

While remaking one of my scripts, I stumbled upon a bug that caused accessories to disappear when changing the character's bag.
Bug: https://cdn.discordapp.com/attachments/1072115896706936963/1107204394828701717/bug.mp4

This fix should address the issue to some degree, If the tracker config is set to the correct value.
After: https://cdn.discordapp.com/attachments/1072115896706936963/1107204239727530054/fix-maybe.mp4

And I removed a duplicate code too.

swkeep added 2 commits May 14, 2023 09:16
fix(outfits): Prevent disappearance of accessories
refactor(outfits/config): add TrackerClothingOptions
Copy link
Member

@TheiLLeniumStudios TheiLLeniumStudios left a comment

Choose a reason for hiding this comment

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

Thank you for the PR. I've requested a few changes but other than that, it looks good

@@ -36,6 +36,7 @@ function GetDefaultConfig()
tattoos = false,
enableExit = true,
hasTracker = Config.PreventTrackerRemoval and Framework.HasTracker(),
trackerClothingOptions = Config.TrackerClothingOptions,
Copy link
Member

Choose a reason for hiding this comment

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

This config gets passed into the UI so its not necessary to send the tracking options to it. You can just remove this and use Config.TrackerClothingOptions instead in client/outfits.lua

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure, i'll move it on top of the if statement

local tracker = Config.TrackerClothingOptions

   if data["accessory"] ~= nil then

@@ -50,28 +50,36 @@ function LoadJobOutfit(oData)
SetPedComponentVariation(ped, 6, data["shoes"].item, data["shoes"].texture, 0)
end

-- Bag
Copy link
Member

Choose a reason for hiding this comment

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

Doesn't this cause the outfits to not have a bag anymore?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I didn't test it because my script takes control of the backpacks on the server. However, I will test it without it to see what happens. But, I believe that shouldn't remove bags.

Copy link
Member

Choose a reason for hiding this comment

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

Yeah but what I mean is that this will not work anymore with the change above: https://github.com/iLLeniumStudios/illenium-appearance/blob/main/shared/config.lua#L610

As the table for the outfits goes through this event, it would not set the bag for that outfit and will keep whatever the user is wearing already

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I tested it on qbcore load/logout and restarting the script works fine.

Copy link
Member

Choose a reason for hiding this comment

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

@swkeep can you try setting a different bag in the outfits and then see if putting on that outfit applies that bag? I think that is the case that I'm trying to make sure, is working

Copy link
Member

Choose a reason for hiding this comment

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

@swkeep Nevermind. It should work, I didn't check the full file and it was just a duplicate, my bad

@@ -43,6 +43,10 @@ Config.NearestShopBlipUpdateDelay = 10000
Config.InvincibleDuringCustomization = true

Config.PreventTrackerRemoval = true -- Disables "Scarf and Chains" section if the player has tracker
Config.TrackerClothingOptions = {
item = 13,
Copy link
Member

Choose a reason for hiding this comment

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

Can you please rename this to drawable? I would like this to be more consistent, atleast in the config. And I have plans to change the item to drawable in other places as well so it will be a 1 less thing for me to modify

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure, I have a question. Will something like data["accessory"].item be renamed to drawable and moved to the compatibility layer, or will it remain the same?

Copy link
Member

Choose a reason for hiding this comment

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

The outfit data format compatibility will stay the same for some time. I'm just trying to make sure that anything new that is added, doesn't use the old conventions with item as the key and follows the new data format

else
SetPedComponentVariation(ped, 7, data["accessory"].item, data["accessory"].texture, 0)
end
else
local config = GetDefaultConfig()
Copy link
Member

Choose a reason for hiding this comment

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

Same here. You do not need to get the config here since that is strictly for the UI. Just use Config.TrackerClothingOptions

-- Badge
if data["decals"] ~= nil then
SetPedComponentVariation(ped, 10, data["decals"].item, data["decals"].texture, 0)
end

-- Accessory
if data["accessory"] ~= nil then
local config = GetDefaultConfig()
Copy link
Member

Choose a reason for hiding this comment

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

Same as the comment above

@TheiLLeniumStudios
Copy link
Member

Awesome! LGTM

@TheiLLeniumStudios TheiLLeniumStudios merged commit 86b7dad into iLLeniumStudios:main May 14, 2023
TheiLLeniumStudios pushed a commit that referenced this pull request May 28, 2023
* refactor: remove duplicate code

* fix(outfits): Prevent disappearance of accessories

fix(outfits): Prevent disappearance of accessories
refactor(outfits/config): add TrackerClothingOptions

* refactor(outfits/config): remove redundant passing TrackerClothingOptions to UI

* refactor(config): rename item to drawable

* chore: change bag to default  value
TheiLLeniumStudios added a commit that referenced this pull request May 29, 2023
* chore(pipelines): Tekton CI pipeline for lint

* chore(pipelines): Fix pipeline taskRef

* Change name for the pipelinerun

* Add secret to clone repo

* Run as 0

* Use specific hash for arm64 image

* Fix hash for lua lint action

* Change image

* feat(ui/radial): Add support for ox_lib radial menu (#268)

Co-authored-by: iLLeniumStudios <104288623+TheiLLeniumStudios@users.noreply.github.com>

* fix(framework/esx): Fix loadout bug (#271)

Co-authored-by: iLLeniumStudios <104288623+TheiLLeniumStudios@users.noreply.github.com>

* fix(cache): Set ped cache after SetPlayerPed (#292)

* fix(locales): Typo in locale keys

* fix(player): Armour not restoring properly

* fix(cache/ped): Wait 150ms instead of setting ped cache manually

* fix(playeroutfitrooms): Invalid reference to the target ped (#293)

* feat(tattoos): Tattoos for Build 2802

* fix(ui): Radial menu shirt icon

* fix(radialmenu): Radialmenu option not showing up for clothing rooms and player outfit rooms

* feat(target): usePoly usage for targets (#295)

* chore(release): Remove .tekton from release zip

* feat(management/qbox): qbx-management support for BossManagedOutfits (#296)

* refactor(radialmenu): Move logic to separate files for each framework (#297)

* refactor(radialmenu): Move to logic separate files for each framework

* refactor(client): Remove unused variable

* refactor(client): Move logic to separate lua files (#300)

* fix(radial): Remove check to not have redudant if statements in zones

* fix(management): Nil value for args

* fix(radial): qb and qbx compatibility issues

* fix(esx): Loadout issue on load

* fix(esx): Only restore loadout if exists

* fix(outfits): Accessories disappearance  (#307)

* refactor: remove duplicate code

* fix(outfits): Prevent disappearance of accessories

fix(outfits): Prevent disappearance of accessories
refactor(outfits/config): add TrackerClothingOptions

* refactor(outfits/config): remove redundant passing TrackerClothingOptions to UI

* refactor(config): rename item to drawable

* chore: change bag to default  value

* Add path to workspace

* Add dummy

* Remove lint action

* Enable fail on warnings

* Disable colorized output

* Remove dummy variable

---------

Co-authored-by: Malcolm Keefe <27903055+Mkeefeus@users.noreply.github.com>
Co-authored-by: AlfaRP <88886043+Alfita2021@users.noreply.github.com>
Co-authored-by: swkeep <49286776+swkeep@users.noreply.github.com>
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