-
Notifications
You must be signed in to change notification settings - Fork 70
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 for weapon stacking behaviour #1433
Conversation
0ced9c9
to
bdbf2e4
Compare
"items with identical attachments now stack together in the inventory" |
Will have to test that separately. There was no specific thought given to weapon customisation causing a weapon to become unique, so it's likely this would stack weapons with the same attachments but different customisations in the current state. I can fix this later but am away from pc for a week or so now so will take a look in the new year. |
|
Then upgraded and customized weapons will lose their appearance and stack. That should never be the case. |
Fair enough - It should be easy enough to revise to take account of customisation to be fair. If you force the behaviour to work 'correctly' & no-stack everything it makes a royal mess of the strategy debug start inventory and I do think having non unique items with the same attachments stacking makes sense (the original code in that function is downright awful) so I'd prefer to revise it that way than just blanket no-stack everything which isn't infinite but yeah - fixing the other two issues without playing with the item stacking behaviour is also perfectly possible. |
bdbf2e4
to
3270828
Compare
Updated PR now checks weapon appearances in the HasUnmodifiedItem function which is called when putting items back into the inventory so it ensures that upgraded weapons with custom appearances do not stack (non-upgraded weapons / infinite items continue to set the default weapon appearance on the soldier which is used if no custom appearance is already set on the weapon). This means: Does that seem reasonable? I've also added the chosen weapons to the 'OnEquipFix' array so their attachments don't get stripped (so if, for whatever reason mods decided to add multiple copies of the chosen weapons they wouldn't get stacked and have their attachments removed just like the TLE weapons). |
3270828
to
f778858
Compare
Haven't reviewed the PR yet, but I'm generally not a fan of any solution that involves maintaining config exclusion lists in the Highlander or else things break. |
Well the alternative is basically patching all of the weapons in X2Item_TLE_Weapons so that they fire the onAcquired function when you equip them, which is also a perfectly reasonable solution but I'm not sure if we're even allowed to modify that file since we don't have a 'TLE Highlander' as far as I know. If I can't create a manual array of template names and I can't modify the templates, then I fail to see how the issue (1429) can be fixed - unless it can be done via OPTC and dumped out into an external fix mod. |
Why is simply not stacking weapons with any weapon upgrades attached is not an option? |
c0ffdf5
to
33255ed
Compare
Yeah, that's better. I'll do a proper review later. To be clear, my main issue wasn't with configurable array itself, but more with filling it in Highlander. If you want, you can still add a configurable array of stackable items with upgrades, but it must be empty by default. |
And I'd probably prefer it done in a separate PR. |
Makes sense - it would be a lot easier, now I understand how these functions work, to make a configurable feature in a new PR, allowing items with identical attachments & appearance to stack. I agree it's better that way than trying to do too much at once. |
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.
Good work, but needs hair-licking.
X2WOTCCommunityHighlander/Src/XComGame/Classes/XComGameState_HeadquartersXCom.uc
Outdated
Show resolved
Hide resolved
X2WOTCCommunityHighlander/Src/XComGame/Classes/XComGameState_HeadquartersXCom.uc
Outdated
Show resolved
Hide resolved
X2WOTCCommunityHighlander/Src/XComGame/Classes/XComGameState_HeadquartersXCom.uc
Outdated
Show resolved
Hide resolved
X2WOTCCommunityHighlander/Src/XComGame/Classes/XComGameState_HeadquartersXCom.uc
Outdated
Show resolved
Hide resolved
X2WOTCCommunityHighlander/Src/XComGame/Classes/XComGameState_Item.uc
Outdated
Show resolved
Hide resolved
33255ed
to
378d9c5
Compare
Fixes #1429
This PR removes a check on number of upgrade slots from HasBeenModified. This was erroneously returning false for weapons where attachments are added by an onAcquired function andwith 0 upgrade slots on the template (e.g. TLE / chosen weapons), which would cause duplicates of those items to be stacked. This could cause downstream issues with attachments when equipping / removing them as the inventory functions expect all weapons with attachments to not be stacked.