G_TWMG - Oinite12/tiwmig-mod GitHub Wiki
G_TWMG
is a highly-scoped object that contains values and functions used across all mod scripts. Contents are defined in global.lua
and loaded via the file-loading system.
Functions added here often handle repetitive tasks where having a consistent function to immediately update all such tasks is beneficial.
-
.max_card_layers
- NUMBER: The maximum number of additional card layers that will be rendered. -
.inf_j_iter
- TABLE: Used in the infinite Joker iterator.-
.index
- NUMBER: The index of the group of Jokers to iterate; updated repeatedly by the infinite Joker iterator. -
.group_size
- NUMBER: The size of groups of Jokers to iterate. -
.funcs
- TABLE: Contains functions that takei
NUMBER, which is the index of each individual Joker. These functions are run by the infinite Joker iterator.
-
-
Arguments:
type
STRING,id
STRING or NUMBER - Output: STRING
A shorthand for tiwmig_<type>_sprite_<id>
; used to more strongly standardize the key name of card layers.
-
Arguments:
joker_key
STRING - Output: STRING
A shorthand for the otherwise lengthy G.localization.descriptions.Joker[joker_key].name
. If the Joker is not localized in any language, joker_key
is returned instead.
-
Arguments:
card
OBJECT "Card" - Output: BOOLEAN true FROM EVENT
Adds an event to the event queue. This event plays an animation on card
that pinches it horizontally into nothing before removing card
entirely. This animation is associated with the depletion of food Jokers.
-
Arguments:
card
OBJECT "Card",target
OBJECT "Card",sum
STRING - Output: BOOLEAN true FROM EVENT
Adds an event to the event queue. This event removes card
and target
before adding the Joker with Joker key sum
. To clarify: card
is usually the card that is just being added, while target
is usually the card already held in the Joker tray.
Editions transfer from component to sum, with priority given to (from highest to lowest), Negative, Polychrome, Holographic, Foil, the edition of target
, and the edition of card
. (The last two items are for cross-mod compatibility, though I haven't necessarily tested this yet.)
-
Arguments:
card
OBJECT "Card",recipe_table
TABLE - Output: BOOLEAN true FROM EVENT
Adds an event to the event queue. First, recipe_table
is an ordered table containing ordered tables of the form {other_card_id, result_card_id}
, where other_card_id
is the Joker key of the Joker to be fused with card
, and result_card_id
is the Joker key of the resultant Joker.
The function adds an event that goes through each table in recipe_table
. If a Joker with key other_card_id
is found (hereby called target
), the following conditions must be met for a fusion to occur:
- Neither
card
nortarget
are debuffed - Neither
card
nortarget
are already involved in a fusion If the conditions are met, mark both cards as being involved in a fusion, and runG_TWMG.poutine_fusion(card, target, result_card_id)
.