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

Streamline NumUpgradeSlots for X2ItemTemplates #93

Closed
Musashi1584 opened this issue Oct 24, 2017 · 5 comments · Fixed by #941
Closed

Streamline NumUpgradeSlots for X2ItemTemplates #93

Musashi1584 opened this issue Oct 24, 2017 · 5 comments · Fixed by #941
Labels
enhancement needs-docs Needs documentation

Comments

@Musashi1584
Copy link
Contributor

To extend upgrade slots to items other then weapons and make them accessible to modders
add GetNumWeaponUpgradeSlots() to X2ItemTemplate
and use it in all places that currently access X2WeaponTemplate(Template).NumUpgradeSlots.

GetNumWeaponUpgradeSlots returns NumUpgradeSlots if set (in case of X2WeaponTemplate) or reads the value from a helper config array.

Also add a function GetNumWeaponUpgradeSlots in XComGameState_Item that considers breakthroughs, and adds a way for mods to modify the output.

Pitfalls: Lookout for code that relies on weapons be the only items that use attachements.

@GingerAvalanche
Copy link
Contributor

Most errors that come up as a result of attaching a weapon upgrade to something that doesn’t have an X2WeaponTemplate are cosmetic in nature - UI pictures not appearing because the picture is based on the item you’re equipping to, for example - and most, if not all, are in UIArmory_WeaponUpgrade, UIArmory_WeaponUpgradeItem, UIArmory_LoadoutItem, and UIArmory_LoadoutItemTooltip. May want to leave this up to modders to assign their own pictures and icons, but some catch-all conditions should be added to avoid bad formatting in item descriptions.

UIArmory_WeaponUpgrade also contains the Armory function that checks how many upgrade slots to let the player fill. Grimy’s Loot Mod currently overrides this, but placing an event there that can be hooked into would improve compatibility between it and other future mods that may add different ways of handling NumUpgradeSlots. (e.g. Loot Mod, which stores and handles individual NumUpgradeSlots on a per-GameState basis)

@GingerAvalanche
Copy link
Contributor

Finally getting around to this, almost a year later. What a ride.

Will be adding GetNumUpgradeSlots() to X2ItemTemplate which will return NumUpgradeSlots if self is castable to X2WeaponTemplate. Otherwise, it will search an array of UpgradeSlotHelper structs and, if found, return the number of upgrade slots from that struct.

GetNumUpgradeSlots() in XComGameState_Item will fire an event that will allow mods to override the number on a per-gamestate basis. If a mod sets an XComLWTuple to true, the game will use whatever value is in a second tuple, otherwise it will call X2ItemTemplate::GetNumUpgradeSlots().

Everything that checks weapon templates for upgrade slots already checks for breakthroughs immediately thereafter, so the breakthrough check can be skipped.

@robojumper
Copy link
Member

FWIW, I'm not a huge fan of passing "override booleans" -- just pass a single integer as the first tuple element that contains the result of X2ItemTemplate:GetNumUpgradeSlots. That way, mods can do things like modifying the existing value etc.

GingerAvalanche added a commit to GingerAvalanche/X2WOTCCommunityHighlander that referenced this issue Oct 27, 2018
@robojumper robojumper added the needs-docs Needs documentation label Jan 18, 2020
@Musashi1584
Copy link
Contributor Author

@GingerAvalanche any chance you gonna submit a PR for this? If not I might give this a go sometime.

@GingerAvalanche
Copy link
Contributor

Yeah, I got distracted by yet another thing. The entire branch of changes I was looking to do isn’t done yet (and may never be if I keep getting distracted for years) but this issue can finally be done with.

GingerAvalanche added a commit to GingerAvalanche/X2WOTCCommunityHighlander that referenced this issue Jan 21, 2020
Implements Issue X2CommunityCore#289 changes

Allows any item type to be upgraded, and allows for upgrade slot handling on a per-state basis.
GingerAvalanche added a commit to GingerAvalanche/X2WOTCCommunityHighlander that referenced this issue May 16, 2020
Implements Issue X2CommunityCore#289 changes

Allows any item type to be upgraded, and allows for upgrade slot handling on a per-state basis.
GingerAvalanche added a commit to GingerAvalanche/X2WOTCCommunityHighlander that referenced this issue Oct 23, 2020
Allows any item type to be upgraded, and allows for upgrade slot handling on a per-state basis.

Implements issue X2CommunityCore#93
Implements issue X2CommunityCore#289
GingerAvalanche added a commit to GingerAvalanche/X2WOTCCommunityHighlander that referenced this issue Oct 23, 2020
Allows any item type to be upgraded, and allows for upgrade slot handling on a per-state basis.

Implements issue X2CommunityCore#93
Implements issue X2CommunityCore#289
GingerAvalanche added a commit to GingerAvalanche/X2WOTCCommunityHighlander that referenced this issue Oct 23, 2020
Allows any item type to be upgraded, and allows for upgrade slot handling on a per-state basis.

Implements issue X2CommunityCore#93
Implements issue X2CommunityCore#289
GingerAvalanche added a commit to GingerAvalanche/X2WOTCCommunityHighlander that referenced this issue Oct 23, 2020
Allows any item type to be upgraded, and allows for upgrade slot handling on a per-state basis.

Implements issue X2CommunityCore#93
Implements issue X2CommunityCore#289
GingerAvalanche added a commit to GingerAvalanche/X2WOTCCommunityHighlander that referenced this issue Oct 23, 2020
Allows any item type to be upgraded, and allows for upgrade slot handling on a per-state basis.

Implements issue X2CommunityCore#93
Implements issue X2CommunityCore#289
GingerAvalanche added a commit to GingerAvalanche/X2WOTCCommunityHighlander that referenced this issue Oct 23, 2020
Allows any item type to be upgraded, and allows for upgrade slot handling on a per-state basis.

Implements issue X2CommunityCore#93
Implements issue X2CommunityCore#289
GingerAvalanche added a commit to GingerAvalanche/X2WOTCCommunityHighlander that referenced this issue Oct 24, 2020
Allows any item type to be upgraded, and allows for upgrade slot handling on a per-state basis.

Implements issue X2CommunityCore#93
Implements issue X2CommunityCore#289
Iridar pushed a commit to Iridar/X2WOTCCommunityHighlander that referenced this issue Jan 9, 2021
Allows any item type to be upgraded, and allows for upgrade slot handling on a per-state basis.

Implements issue X2CommunityCore#93
Implements issue X2CommunityCore#289
Iridar pushed a commit to Iridar/X2WOTCCommunityHighlander that referenced this issue Jan 9, 2021
Item upgrade improvements (X2CommunityCore#93 & X2CommunityCore#289)

Allows any item type to be upgraded, and allows for upgrade slot handling on a per-state basis.

Implements issue X2CommunityCore#93
Implements issue X2CommunityCore#289

Docs: Fix crash when ref provides event spec

Fake rebase.
Iridar pushed a commit to Iridar/X2WOTCCommunityHighlander that referenced this issue Jan 9, 2021
Item upgrade improvements (X2CommunityCore#93 & X2CommunityCore#289)

Allows any item type to be upgraded, and allows for upgrade slot handling on a per-state basis.

Implements issue X2CommunityCore#93
Implements issue X2CommunityCore#289

Docs: Fix crash when ref provides event spec

Fake rebase.

Add new files to CHL source.
Iridar pushed a commit to Iridar/X2WOTCCommunityHighlander that referenced this issue Jan 9, 2021
Allows any item type to be upgraded, and allows for upgrade slot handling on a per-state basis.

Implements issue X2CommunityCore#93
Implements issue X2CommunityCore#289
Iridar pushed a commit to Iridar/X2WOTCCommunityHighlander that referenced this issue Jan 9, 2021
Allows any item type to be upgraded, and allows for upgrade slot handling on a per-state basis.

Implements issue X2CommunityCore#93
Implements issue X2CommunityCore#289
Iridar pushed a commit to Iridar/X2WOTCCommunityHighlander that referenced this issue Jan 9, 2021
Allows any item type to be upgraded, and allows for upgrade slot handling on a per-state basis.

Implements issue X2CommunityCore#93
Implements issue X2CommunityCore#289
Iridar pushed a commit to Iridar/X2WOTCCommunityHighlander that referenced this issue Jan 9, 2021
Allows any item type to be upgraded, and allows for upgrade slot handling on a per-state basis.

Implements issue X2CommunityCore#93
Implements issue X2CommunityCore#289
Iridar pushed a commit to Iridar/X2WOTCCommunityHighlander that referenced this issue Feb 9, 2021
Allows any item type to be upgraded, and allows for upgrade slot handling on a per-state basis.

Implements issue X2CommunityCore#93
Implements issue X2CommunityCore#289
Iridar pushed a commit to Iridar/X2WOTCCommunityHighlander that referenced this issue Feb 9, 2021
Item upgrade improvements (X2CommunityCore#93 & X2CommunityCore#289)

Allows any item type to be upgraded, and allows for upgrade slot handling on a per-state basis.

Implements issue X2CommunityCore#93
Implements issue X2CommunityCore#289

Added event docs and made minor adjustments to code.

Added event docs and made minor adjustments to code.

Fixed event docs.

Fixed event docs again.

Another fix.

More fixes.

Really hard to please.

More docs fixes.

Fixed typo.

Removed commit messages.
Iridar pushed a commit to Iridar/X2WOTCCommunityHighlander that referenced this issue Feb 9, 2021
Iridar pushed a commit to Iridar/X2WOTCCommunityHighlander that referenced this issue Feb 9, 2021
Iridar pushed a commit to Iridar/X2WOTCCommunityHighlander that referenced this issue Feb 9, 2021
Iridar pushed a commit to Iridar/X2WOTCCommunityHighlander that referenced this issue May 24, 2021
Iridar pushed a commit to Iridar/X2WOTCCommunityHighlander that referenced this issue May 24, 2021
Iridar pushed a commit to Iridar/X2WOTCCommunityHighlander that referenced this issue May 24, 2021
Iridar pushed a commit to Iridar/X2WOTCCommunityHighlander that referenced this issue May 24, 2021
Iridar pushed a commit to Iridar/X2WOTCCommunityHighlander that referenced this issue May 24, 2021
Iridar pushed a commit to Iridar/X2WOTCCommunityHighlander that referenced this issue May 24, 2021
Iridar pushed a commit to Iridar/X2WOTCCommunityHighlander that referenced this issue May 28, 2021
Iridar added a commit to Iridar/X2WOTCCommunityHighlander that referenced this issue Jun 16, 2021
Xymanek pushed a commit that referenced this issue Jun 16, 2021
#1025)

* Fixed compile warnings left over from implementing issues #93 and #289

* Added comments.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement needs-docs Needs documentation
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants