-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
Fix broken layer hiding on clothes with multiple equipment slots #34080
base: master
Are you sure you want to change the base?
Fix broken layer hiding on clothes with multiple equipment slots #34080
Conversation
…Component to allow more precise layer hide behavior and more CPU efficient layer toggling.
…n layer (e.g. gas mask and welding mask) Add documentation Change gas masks to use the new HideLayerClothingComponent structure as an example of its usage
It required some bigger refactors than I'd intended, but this solves the problems and removes some excessive looping over the full inventory in
Nevermind I fixed it. |
Also, I don't mind going through and converting all of the items using HideLayerClothingComponent over to the new setup. Compatibility is there so it isn't an issue either way, but getting them onto the new one is a good way to encourage future items to also use the new one. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Other than ClothingComponent.EquippedInSlot
gteting cleared too early, it mostly seems fine. Though there are a few other changes I want to make to just clean up the system a bit, do you mind if I push some changes to your branch? Otherwise I can also just open a separate PR later
I don't mind at all! Better to have it clean the first time and fewer PRs IMO |
any non-permanent visibility toggle with `SlotFlags.None` isn't supported with how its set up. And similarly, the slot flags argument does nothing if permanent = true. So IMO it makes more sense to infer it from a nullable arg.
Too much pasta
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
I'm just guessing at what this was meant to do
I've pushed some changes, including:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Forgive me the liberty of reviewing your code in your review of my code, but there is one bug to fix here. I don't mind fixing it though, if you want.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Forgive me the liberty of reviewing your code in your review of my code, but there is one bug to fix here. I don't mind fixing it though, if you want.
No worries, thanks for reviewing my changes. Assuming its the one you pointed out I just fixed it, but obviously feel free to push any changes you want to make or revert any I made, it's still your PR
... I found another bug, but I have no idea what's causing it. Folding a bandana to wear on the head, the bandana doesn't render when worn. If you spawn a folded bandana and put it on your head, it renders appropriately. If you unfold that bandana and wear it on your face, that renders too. If you then refold the bandana and put it on your head, the bandana no longer renders on the sprite. I'll dig into this some more, but this is not ready to ship. Edit: I am completely stumped. |
The cause was that toggling a mask sets a prefix for the clothing RSI state. Previously foldable clothing was being given special treatment in the mask system without any comments or explanation, and was seemingly not setting its rsi state specifically if the mask was being toggled due to folding, which I accidentally removed in an earlier commit. I've fixed it now by making bandanas use the existing |
I can find no bugs. LGTM. |
Oh hell. Merge conflicts. @ElectroJr it's in the code you changed. Could I ask you to fix it? |
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
About the PR
Adjusted ClothingSystem logic to confirm that a slot to be hidden by a HideLayerComponent matches the slot that an item is equipped in. Added more precise layer selection for the HideLayerClothingComponent, so that different layers may be hidden depending on which slot the item is equipped in. Adjusted the HumanAppearanceComponent to track which slot(s) are hiding each hidden layer (permanently hidden layers are unaffected by this change).
Before PR: ClothingSystem compared the sum combination of slots an item can be equipped in to the slot the HideLayerComponent's slot. This would always be false for clothing with more than one equip slot.
After PR: ClothingSystem specifically checks for a match between the item's current equipped slot and the HideLayerComponent's slot.
Why / Balance
Addresses issue #33965
Technical details
This should be slightly more performant in
ToggleVisibleLayers
--at the very least it should shift off some CPU cycles in exchange for a small amount of added memory. Specifically, nested loops over the character's inventory slots have been removed in favor of maintaining what had been small HashSets as small Dictionaries instead.Care has been taken to ensure that no existing items break on this change. Items can use the new functionality added to HideLayerClothingComponent, but it isn't mandatory unless that item will be equippable in multiple clothing slots.
Media
Requirements
Breaking changes
Changelog