From cc0e353ac363cb0b5b5700b2519e1c47fcc9618c Mon Sep 17 00:00:00 2001 From: Aiz Date: Wed, 7 Aug 2024 00:09:12 +0200 Subject: [PATCH] revert(config): don't use steamodded config for values that i don't know how to modify in game which is all of them. --- config.lua => configuration.lua | 3 +-- jokers/chess_pawn.lua | 5 ++--- jokers/kiki_bouba.lua | 3 +-- main.lua | 4 ++-- utils.lua | 5 ++--- 5 files changed, 8 insertions(+), 12 deletions(-) rename config.lua => configuration.lua (99%) diff --git a/config.lua b/configuration.lua similarity index 99% rename from config.lua rename to configuration.lua index e505552..27b3f4b 100644 --- a/config.lua +++ b/configuration.lua @@ -1,5 +1,4 @@ --- TODO: rework this later and do an actual config. -return { +Aiz.config = { -- jokers not listed here will still be enabled jokers = { blÄhaj = true, diff --git a/jokers/chess_pawn.lua b/jokers/chess_pawn.lua index ff959c0..126b860 100644 --- a/jokers/chess_pawn.lua +++ b/jokers/chess_pawn.lua @@ -1,6 +1,5 @@ -- Chess pawn -- After a few rounds it promotes to a different chess joker -local config = SMODS.current_mod.config SMODS.Joker({ key = "chess_pawn", loc_txt = { @@ -34,7 +33,7 @@ SMODS.Joker({ -- Remove any jokers that aren't registered -- Prevents crash from trying to create non existent jokers local available_jokers = {} - for k, v in pairs(config.pawn.promotion) do + for k, v in pairs(Aiz.config.pawn.promotion) do for _, center in pairs(G.P_CENTERS) do if center.set == "Joker" then if k == center.key then @@ -48,7 +47,7 @@ SMODS.Joker({ for key, probability in pairs(available_jokers) do if #SMODS.find_card(key, true) > 0 then available_jokers[key] = probability - * config.pawn.duplicate_chance_reduction + * Aiz.config.pawn.duplicate_chance_reduction end end diff --git a/jokers/kiki_bouba.lua b/jokers/kiki_bouba.lua index 8eb0477..f5ef36e 100644 --- a/jokers/kiki_bouba.lua +++ b/jokers/kiki_bouba.lua @@ -1,4 +1,3 @@ -local config = SMODS.current_mod.config SMODS.Joker({ key = "kiki_bouba", loc_txt = { @@ -32,7 +31,7 @@ SMODS.Joker({ and context.other_joker ~= card then local is_kiki = - config.is_kiki[context.other_joker.config.center_key] + Aiz.config.is_kiki[context.other_joker.config.center_key] local eval, text, color = nil, nil, nil if is_kiki == nil then return diff --git a/main.lua b/main.lua index b63d82c..1430703 100644 --- a/main.lua +++ b/main.lua @@ -13,7 +13,6 @@ Aiz = {} local current_mod = SMODS.current_mod local mod_path = SMODS.current_mod.path -local config = SMODS.current_mod.config -- contains filenames of modules that can be enabled disabled local modules = { @@ -82,12 +81,13 @@ SMODS.Atlas({ -- load utils assert(SMODS.load_file("utils.lua"))() +assert(SMODS.load_file("configuration.lua"))() -- load all enabled jokers -- only explicitly disabled jokers are disabled -- jokers not listed are still enabled for _, joker in ipairs(modules.jokers) do - local enabled = config.jokers[joker] == nil or config.jokers[joker] + local enabled = Aiz.config.jokers[joker] == nil or Aiz.config.jokers[joker] if enabled then assert(SMODS.load_file("jokers/" .. joker .. ".lua"))() end diff --git a/utils.lua b/utils.lua index 4144aef..e6eada3 100644 --- a/utils.lua +++ b/utils.lua @@ -1,4 +1,3 @@ -local config = SMODS.current_mod.config Aiz.utils = { create_blocking_card = function(card, position, silent) G.E_MANAGER:add_event(Event({ @@ -84,7 +83,7 @@ Aiz.utils = { ---@return boolean is_suit_type = function(playing_card, suit_type) -- stylua: ignore - for suit, _ in pairs(config.suits[suit_type]) do + for suit, _ in pairs(Aiz.config.suits[suit_type]) do if playing_card:is_suit(suit) then return true end @@ -97,7 +96,7 @@ Aiz.utils = { return select( 2, pseudorandom_element( - config.suits[suit_type], + Aiz.config.suits[suit_type], pseudoseed("random_suit") ) )