Make Void always hidden, make hooking more resilient to lag
This commit is contained in:
parent
dff89f4062
commit
2132afb1e8
7 changed files with 51 additions and 34 deletions
|
|
@ -3,7 +3,7 @@
|
|||
"id": "Roland",
|
||||
"name": "Roland",
|
||||
"prefix": "Roland",
|
||||
"version": "2.8.19",
|
||||
"version": "2.8.20",
|
||||
"badge_colour": "8BE9FD",
|
||||
"display_name": "Roland",
|
||||
"main_file": "src/main.lua",
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@ SMODS.Challenge {
|
|||
|
||||
local spin_to_win = SMODS.Challenge {
|
||||
key = "Spin_To_Win",
|
||||
jokers = f(4):map(f().const {id = "j_Bakery_Spinner", eternal = true}):table(),
|
||||
jokers = f(4):map(f().const {id = "j_joker", eternal = true}):table(),
|
||||
restrictions = {banned_cards = {{id = "c_Roland_coolheaded"}}},
|
||||
pronouns = "they_them",
|
||||
apply = function(self)
|
||||
|
|
@ -261,12 +261,6 @@ SMODS.Challenge {
|
|||
}
|
||||
|
||||
q(function()
|
||||
if not G.P_CENTERS.j_Bakery_Spinner then
|
||||
f(spin_to_win.jokers):each(function(v)
|
||||
v.id = "j_joker"
|
||||
end)
|
||||
end
|
||||
|
||||
f {
|
||||
{G.P_TAGS, is_banned_from_pastry, pastries.banned_tags},
|
||||
{G.P_BLINDS, is_banned_from_pastry, pastries.banned_other},
|
||||
|
|
@ -280,3 +274,13 @@ q(function()
|
|||
f(v[1]):where(v[2]):each(adder(v[3]))
|
||||
end)
|
||||
end)
|
||||
|
||||
q(function()
|
||||
if not G.P_CENTERS.j_Bakery_Spinner then
|
||||
return true
|
||||
end
|
||||
|
||||
f(spin_to_win.jokers):each(function(v)
|
||||
v.id = "j_Bakery_Spinner"
|
||||
end)
|
||||
end)
|
||||
|
|
|
|||
|
|
@ -205,7 +205,7 @@ q(function()
|
|||
local estate = G.P_CENTERS.j_Bakery_Estate
|
||||
|
||||
if not estate then
|
||||
return
|
||||
return true
|
||||
end
|
||||
|
||||
---@param card Card|{ Roland_frozen: {estate: integer} }
|
||||
|
|
@ -214,18 +214,14 @@ q(function()
|
|||
return 1
|
||||
end
|
||||
|
||||
card.Roland_frozen.estate = card.Roland_frozen.estate or
|
||||
f(card.area.cards):swap():any(function(_, k)
|
||||
return k == card
|
||||
end) or 1
|
||||
|
||||
card.Roland_frozen.estate = card.Roland_frozen.estate or card.rank or 1
|
||||
return card.Roland_frozen.estate
|
||||
end
|
||||
|
||||
local orig_calculate = estate.calculate
|
||||
|
||||
function estate:calculate(card, context, ...)
|
||||
if not card or not card.edition or not card.edition.Roland_frozen then
|
||||
if not ((card or {}).edition or {}).Roland_frozen then
|
||||
return orig_calculate(self, card, context, ...)
|
||||
end
|
||||
|
||||
|
|
@ -241,7 +237,7 @@ q(function()
|
|||
local orig_loc_vars = estate.loc_vars
|
||||
|
||||
function estate:loc_vars(info_queue, card, ...)
|
||||
if not card or not card.edition or not card.edition.Roland_frozen then
|
||||
if not ((card or {}).edition or {}).Roland_frozen then
|
||||
return orig_loc_vars(self, info_queue, card, ...)
|
||||
end
|
||||
|
||||
|
|
@ -255,7 +251,7 @@ q(function()
|
|||
local proxy = G.P_CENTERS.j_Bakery_Proxy
|
||||
|
||||
if not proxy then
|
||||
return
|
||||
return true
|
||||
end
|
||||
|
||||
---@param card Card|{ Roland_frozen: {proxy: string} }
|
||||
|
|
@ -308,7 +304,7 @@ q(function()
|
|||
local orig_flip_double_sided = (Bakery_API or {}).flip_double_sided
|
||||
|
||||
if not orig_flip_double_sided then
|
||||
return
|
||||
return true
|
||||
end
|
||||
|
||||
function Bakery_API.flip_double_sided(card, ...)
|
||||
|
|
|
|||
|
|
@ -10,7 +10,22 @@ local function protect(fun)
|
|||
end
|
||||
end
|
||||
|
||||
local function protect_ev(fun)
|
||||
local function protect_ev(fun, retries)
|
||||
if type(fun) == "function" and retries then
|
||||
local orig_fun = fun
|
||||
|
||||
fun = function(...)
|
||||
local ret = orig_fun(...)
|
||||
|
||||
if ret == true then
|
||||
retries = retries - 1
|
||||
return retries <= 0
|
||||
else
|
||||
return ret
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if type(fun) == "table" then
|
||||
fun.func = protect(fun.func)
|
||||
fun = getmetatable(fun) == Event and fun or Event(fun)
|
||||
|
|
@ -63,10 +78,10 @@ local f = assert(SMODS.load_file "src/lib/funky.lua")() or require "lib.funky"
|
|||
|
||||
--- Queues an event to be run.
|
||||
--- Note that events added this way implicitly `return true` unless you explicitly `return false`, unlike the vanilla ones.
|
||||
--- @param fun (fun():false|nil)|Event The event or a function to run turn into an event.
|
||||
--- @param front boolean|nil `true` to add the event to the front of the queue, rather than the end.
|
||||
--- @param fun (fun():boolean?)|Event The event or a function to run turn into an event.
|
||||
--- @param front? boolean `true` to add the event to the front of the queue, rather than the end.
|
||||
local function q(fun, front)
|
||||
G.E_MANAGER:add_event(protect_ev(fun), nil, front)
|
||||
G.E_MANAGER:add_event(protect_ev(fun, SMODS.current_mod and 100), nil, front)
|
||||
end
|
||||
|
||||
--- Determines if a center is allowed to be usable.
|
||||
|
|
|
|||
10
src/main.lua
10
src/main.lua
|
|
@ -14,8 +14,12 @@ end
|
|||
|
||||
q(function()
|
||||
-- Special shoutout to all contributors. <3
|
||||
---@type table<string, {name: string, fg: table, bg: table}>
|
||||
local contributors, mods = Bakery_API.contributors, SMODS.Mods
|
||||
---@type table<string, {name: string, fg: table, bg: table}>?
|
||||
local contributors = (Bakery_API or {}).contributors
|
||||
|
||||
if not contributors then
|
||||
return true
|
||||
end
|
||||
|
||||
contributors.Roland_aster = {
|
||||
name = "asterSSH",
|
||||
|
|
@ -35,7 +39,7 @@ q(function()
|
|||
bg = HEX "ff79c6ff",
|
||||
}
|
||||
|
||||
if mods.DebugPlus and mods.Roland.config.import_funky then
|
||||
if SMODS.Mods.DebugPlus and SMODS.Mods.Roland.config.import_funky then
|
||||
_G.f, _G.q, _G.u = unpack(qol)
|
||||
end
|
||||
end, true)
|
||||
|
|
|
|||
|
|
@ -147,7 +147,7 @@ spectral {
|
|||
end,
|
||||
}
|
||||
|
||||
local void = spectral {
|
||||
spectral {
|
||||
key = "void",
|
||||
pronouns = "it_its",
|
||||
artist = "aster",
|
||||
|
|
@ -205,7 +205,3 @@ local void = spectral {
|
|||
}
|
||||
end,
|
||||
}
|
||||
|
||||
q(function()
|
||||
void.hidden = not SMODS.Mods.Cryptid
|
||||
end)
|
||||
|
|
|
|||
|
|
@ -130,13 +130,15 @@ function get_blind_amount(ante, ...)
|
|||
end
|
||||
|
||||
q(function()
|
||||
if not G.P_CENTERS.c_Bakery_Scribe then
|
||||
return
|
||||
local scribe = G.P_CENTERS.c_Bakery_Scribe
|
||||
|
||||
if not scribe then
|
||||
return true
|
||||
end
|
||||
|
||||
local orig_can_use = G.P_CENTERS.c_Bakery_Scribe.can_use
|
||||
local orig_can_use = scribe.can_use
|
||||
|
||||
function G.P_CENTERS.c_Bakery_Scribe.can_use(...)
|
||||
function scribe.can_use(...)
|
||||
return orig_can_use(...) and
|
||||
(SMODS.Mods.Roland.config.scribable_basket or f(G.jokers.highlighted):all(function(v)
|
||||
return v.config.center.key ~= "j_Roland_basket"
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue