Library-wide refactor#3
Open
Oinite12 wants to merge 41 commits into
Open
Conversation
… so much shit hhghgshghbsdjhglsdbgvaewrgbv)
…do better organization and a second pass)
Fix tab
…llion other small tweaks)
…some annotation tweaks)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request refactors, uh, pretty much everything. The goal of this project is to improve the readability and navigability of the entire library, so that other developers have an incentive to use this library or at least introduce cross-mod compatibility. This scope may have been stepped over a few times, but I tried to hold back from entire reworks - at least until I finish this preliminary refactor.
I would say that this refactor covers 90% of the library and is 90% complete. There are several things that I've glossed over (particularly UI code (not really sure how to go about cleaning it)), and despite my best efforts, there are some functions that I simply do not understand and thus am unable to annotate/document. I've marked trouble points with "todo", which can be easily searched for across the repository; help in those areas would be greatly appreciated.
I tried to make sure that function behaviours don't change, but there may be some oversights on my end. Unfortunately I don't really have a good way to debug these functions, so if anyone is able to do some bug-hunting, that would be appreciated. Additionally, despite trying to preserve function behaviors, this whole project is still drastic in its changes, hence my fork and this PR.
(I also wrote some wiki pages, but that documentation is only reflective of this fork/PR, so I'd rather not share it unless this PR is accepted. If it isn't accepted, I can still publish the wiki pages but I'll have to do some rewrites to reflect the current library.)
The following changes have been made:
Spectrallib/lspdef.d.luahas been created to extend existing SMODS classes/annotations.Spectrallib.ascension_numbersholds numbers or number-valued functions describing how many cards are needed for ascension.Spectrallib.manipulate_typesdefines behaviours for the manipulation types "+", "X", "^", and "hyper". It also allows the definition of new types.Spectrallib.vanilla_forcetrigger_resultsholds definitions for vanilla Joker forcetrigger effects.Spectrallib.vanilla_unapply_resultsholds definitions for vanilla voucher unredeeming effects.Spectrallib.deck_config_apply_effectsdefines how specific deck config keys should be interpreted. It also allows the definition of modded config keys.G.FUNCS.cry_asc_UI_set(EXPLOIT:// changing color of Ascension Power)Spectrallib.has_tether(Actually use Hyperspace Tether)G.FUNCS.get_poker_hand_info(Clusterwark special name)Spectrallib.calculate_starting_asc_power(Extra starting Ascension Power for DECLARE:// hands)Spectrallib.calculate_bonus_asc_power(Bonus Ascension Power from EXPLOT://, and Sol/Perkele under Observatory)Spectrallib.ascension_numbers(for Cryptid poker hands)Spectrallib.ascension_power_enabled(Contentset-activated Ascended Hands)Spectrallib.deck_config_apply_effects(forconfig.cry_beta)Entropy.get_highlighted_cards = Spectrallib.get_highlighted_cardsEntropy.blind_is = Spectrallib.blind_isSpectrallib.calculate_ascension_modification(Axeh's effect)SMODS.upgrade_poker_hands(Strawberry Pie's effect)Spectrallib.deck_config_apply_effects(forconfig.plincoins)Card:no(Fusion components also checked for"no_"..key)Spectrallib.ascension_numbers(for Bunco poker hands)Spectrallib.ascension_numbers(for Spectrum API poker hands)G.localization.dynamic.ascended_hand_text(hand_text, scoring_hand)- Unique to each localization that defines this function, this function describes how to change the names of poker hands that have been ascended (like that Flush Five, Flush Six, Flush Seven etc. type of thing).dynamicsubtable of the localization table might be useful for localization-specific dynamic text.Spectrallib.redeem_animation(card, cfg)- Plays the voucher redeem animation, with some customization options.Spectrallib.iter.blinds(blind_keys)- An iterator, used in a for-loop: Takes a list of blind keys and iterates through each of them as Blinds.Spectrallib.iter.areacards(areas)- An iterator, used in a for-loop: Takes a list of cards, a card area, a list of list of cards, or a list of card areas, and iterates through each of their cards.Spectrallib.calculate_starting_asc_power(hand_name, hand_cards, hand_scoring_cards) -> number- Gets the starting ascension power of the current hand. This represents the ascension power that is directly based on the current hand. This function is intended to be hook to allow additional sources to add to this value.Spectrallib.calculate_bonus_asc_power(hand_name, hand_cards, hand_scoring_cards) -> number- Gets the bonus ascension power of the current hand. This represents the ascension power that is given by external sources. (Example, Cryptid's EXPLOIT://) This function is intended to be hook to allow additional sources to add to this value.G.UIDEF.bought_decks() -> UINode- This function was missing, causing crashes when viewing the redeemed decks tab, so I nabbed it from Entropy and refactored it