Move code out of update loop

This commit is contained in:
Emik 2025-03-27 20:43:29 +01:00
parent f7037ce504
commit 6bf2f76b34
Signed by untrusted user who does not match committer: emik
GPG key ID: 09CDFF9E5703688D
2 changed files with 18 additions and 17 deletions

View file

@ -176,12 +176,16 @@ SMODS.Joker {
soul_pos = {x = 1, y = 0}, soul_pos = {x = 1, y = 0},
cost = 8, cost = 8,
rarity = 3, rarity = 3,
update = function(_, card, _) add_to_deck = function(_, _, _)
if card.added_to_deck and card.children.center and card.children.floating_sprite then local honey = SMODS.find_card("j_jane_honey")
local extra = card.ability.extra or {}
local y = extra.is_corrupted and 1 or 0 for _, v in ipairs(honey) do
card.children.center:set_sprite_pos({x = 0, y = y}) if not v.ability.extra.is_corrupted and v ~= honey[#honey] then
card.children.floating_sprite:set_sprite_pos({x = Jane.sinister and 2 or 1, y = y}) v.sell_cost = v.sell_cost + honey[#honey].sell_cost
v.ability.extra.is_corrupted = true
honey[#honey]:start_dissolve()
honey[#honey] = nil
end
end end
end, end,
loc_vars = function(_, _, card) loc_vars = function(_, _, card)
@ -201,6 +205,14 @@ SMODS.Joker {
Jane.sinister and (is_corrupted and "..." or "S-STOP THAT!! YOU'RE FREAKING ME OOOUT!!!") or "", Jane.sinister and (is_corrupted and "..." or "S-STOP THAT!! YOU'RE FREAKING ME OOOUT!!!") or "",
}} }}
end, end,
update = function(_, card, _)
if card.added_to_deck and card.children.center and card.children.floating_sprite then
local extra = card.ability.extra or {}
local y = extra.is_corrupted and 1 or 0
card.children.center:set_sprite_pos({x = 0, y = y})
card.children.floating_sprite:set_sprite_pos({x = Jane.sinister and 2 or 1, y = y})
end
end,
} }
if Cryptid then if Cryptid then

View file

@ -324,17 +324,6 @@ function Game:update(dt)
G.P_BLINDS["bl_jane_wee"].mult = 22 / blind G.P_BLINDS["bl_jane_wee"].mult = 22 / blind
G.P_BLINDS["bl_jane_descending"].mult = math.floor(8 * math.sqrt(blind)) / blind G.P_BLINDS["bl_jane_descending"].mult = math.floor(8 * math.sqrt(blind)) / blind
local honey = SMODS.find_card("j_jane_honey")
for _, v in ipairs(honey) do
if not v.ability.extra.is_corrupted and v ~= honey[#honey] then
v.sell_cost = v.sell_cost + honey[#honey].sell_cost
v.ability.extra.is_corrupted = true
honey[#honey]:start_dissolve()
honey[#honey] = nil
end
end
if not Jane.bans_done then if not Jane.bans_done then
delete_hardbans() delete_hardbans()
Jane.bans_done = true Jane.bans_done = true