Skip to content

Commit

Permalink
Mod class
Browse files Browse the repository at this point in the history
Missing some internal params but those can just be ignored as long as type declaration uses `Mod|table`
  • Loading branch information
GauntletGames-2086 committed Feb 4, 2025
1 parent 2cdff13 commit e45317f
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lsp_def/classes/game_object.lua
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
---@meta

---@class SMODS.GameObject: Object
---@field mod? Mod|table The mod this object is created by.
---@field log_interval? number
---@field loc_txt? table Contains data used for displaying text related to this object. See SMODS documentation for each class on the format.
---@field mod? table Mod this object is created by.
---@field registered? boolean
---@field obj_table? table Table of objects registered to this class.
---@field obj_buffer? string[] Array of keys to all objects registered to this class.
Expand Down
29 changes: 28 additions & 1 deletion lsp_def/core.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,30 @@
---@meta

SMODS = {}
SMODS = {}

---@class Mod
---@field id string Unique ID.
---@field name string Name of the mod.
---@field display_name? string Display name of the mod.
---@field description string Mod description.
---@field priority? number Loaded mods are sorted via priority.
---@field badge_colour? table HEX color of the mod badge.
---@field badge_text_colour? table HEX color of the text inside the mod badge.
---@field prefix string Unique string. All objects created by this mod have this string appended to their key.
---@field version? string Mod version.
---@field dump_loc? true Dumps G.localization table into this mod's directory.
---@field dependencies? table[] All mods in this array must be installed and loaded for this mod to load.
---@field conflicts? table[] No mods in this array can be installed for this mod to load.
---@field provides? table[] If any of the mods in this array are not installed or loaded, this mod will act as a stand in.
---@field main_file string Path to the main .lua file of this mod.
---@field config_file? string Path to the config file of this mod. Defaults to "config.lua" if not provided.
---@field config? table Config values for this mod.
---@field can_load? boolean?
---@field config_tab? fun(): table Creates this mod's config tab UI.
---@field extra_tabs? fun(): table[] Creates additional tabs within this mod's menu.
---@field custom_collection_tabs? fun(): table[] Creates additional buttons displayed inside the "Other" tab in collections.
---@field description_loc_vars? fun(self: Mod|table): table Allows dynamic display of this mod's description.
---@field custom_ui? fun(mod_nodes: table) Allows manipulating this mod's description tab.
---@field set_ability_reset_keys? fun(): table When a card's `ability` table is changed, values with a key matching inside this table will not persist.
---@field reset_game_globals? fun(run_start: boolean) Allows resetting global values every new run or round.
---@field set_debuff? fun(card: Card|table): boolean|string? Allows controlling when a card is debuffed or not. Return `"prevent_debuff"` to force a card to be undebuffable.
2 changes: 1 addition & 1 deletion lsp_def/meta.lua
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
---@class Card_Character: Moveable
---@class CardArea: Moveable

-- Commonly used functions (either typed as @class or defined)
-- Commonly used functions in vanilla (either typed as @class or defined)

---@param hex string
---@return table
Expand Down

0 comments on commit e45317f

Please sign in to comment.