Commit 137bc3e
Fix Center Unlock Text (#1262)
* Fix Center Unlock Text
Unlocks normally only differentiate Vouchers, with the default being Jokers. This makes sense in vanilla, as you can only unlock Vouchers and Jokers.
Steamodded adds methods for mod developers to implement locked consumables, editions and enhancements, but currently does not adjust the unlock text to differentiate between different unlockable types.
This is a pretty barebones and primitive implementation of adjusting the unlock box text to account for other types, and could benefit from a more sophisticated implementation, such as relying on a util function that could support additional modded object types.
Additionally, even though the vanilla text for unlock type is always ``G.C.BLUE``, I wonder if it would be acceptable to implement support for adjusting that as well, however that is beyond the scope of this.
* Adjustments + Util Function
Instead of having this long series of conditions, let's implement the much better solution of using ```localize('k_'..string.lower(card and card.center and card.center.set or 'unknown'))``` to solve the problem.
Let's additionally wrap this in a util helper function which will be what the patch code overwrites the original string argument with, so that mod developers can hook it if they wish to implement specific circumstances where they would like to replace the text of the unlock type.
This is a solution I feel that is fully within the spirit of SMODS.
* Correction
The original variable in the UI code is ``card_center``, not ``card``
* Change from patches.regex to patches.pattern
Whoops
* Small explainer comment on the util function
---------
Co-authored-by: Casimir Eisenach <casimirusenormus@hotmail.de>1 parent 446c1cb commit 137bc3e
3 files changed
+17
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
373 | 373 | | |
374 | 374 | | |
375 | 375 | | |
376 | | - | |
| 376 | + | |
| 377 | + | |
377 | 378 | | |
378 | 379 | | |
379 | 380 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
909 | 909 | | |
910 | 910 | | |
911 | 911 | | |
| 912 | + | |
| 913 | + | |
| 914 | + | |
| 915 | + | |
| 916 | + | |
| 917 | + | |
| 918 | + | |
| 919 | + | |
| 920 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3716 | 3716 | | |
3717 | 3717 | | |
3718 | 3718 | | |
| 3719 | + | |
3719 | 3720 | | |
3720 | 3721 | | |
3721 | 3722 | | |
| |||
3936 | 3937 | | |
3937 | 3938 | | |
3938 | 3939 | | |
| 3940 | + | |
| 3941 | + | |
| 3942 | + | |
| 3943 | + | |
| 3944 | + | |
3939 | 3945 | | |
0 commit comments