Skip to content

Commit 15c5c81

Browse files
Switch To Steamodded implementation
1 parent 31a44a1 commit 15c5c81

File tree

2 files changed

+2
-115
lines changed

2 files changed

+2
-115
lines changed

items/code.lua

Lines changed: 2 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ local code = {
99
default = "c_cry_crash",
1010
can_stack = true,
1111
can_divide = true,
12+
select_card = "consumeables",
13+
select_button_text = "b_pull",
1214
}
1315

1416
local code_digital_hallucinations_compat = {
@@ -5344,47 +5346,6 @@ local code_cards = {
53445346
return {
53455347
name = "Code Cards",
53465348
init = function()
5347-
--Code from Betmma's Vouchers
5348-
G.FUNCS.can_reserve_card = function(e)
5349-
local c1 = e.config.ref_table
5350-
if
5351-
#G.consumeables.cards
5352-
< G.consumeables.config.card_limit + (Cryptid.safe_get(c1, "edition", "negative") and 1 or 0)
5353-
then
5354-
e.config.colour = G.C.GREEN
5355-
e.config.button = "reserve_card"
5356-
else
5357-
e.config.colour = G.C.UI.BACKGROUND_INACTIVE
5358-
e.config.button = nil
5359-
end
5360-
end
5361-
G.FUNCS.reserve_card = function(e)
5362-
local c1 = e.config.ref_table
5363-
G.E_MANAGER:add_event(Event({
5364-
trigger = "after",
5365-
delay = 0.1,
5366-
func = function()
5367-
c1.area:remove_card(c1)
5368-
c1:add_to_deck()
5369-
if c1.children.price then
5370-
c1.children.price:remove()
5371-
end
5372-
c1.children.price = nil
5373-
if c1.children.buy_button then
5374-
c1.children.buy_button:remove()
5375-
end
5376-
c1.children.buy_button = nil
5377-
remove_nils(c1.children)
5378-
G.consumeables:emplace(c1)
5379-
SMODS.calculate_context({ pull_card = true, card = c1 })
5380-
G.GAME.pack_choices = G.GAME.pack_choices - 1
5381-
if G.GAME.pack_choices <= 0 then
5382-
G.FUNCS.end_consumeable(nil, delay_fac)
5383-
end
5384-
return true
5385-
end,
5386-
}))
5387-
end
53885349
--some code to make typing more characters better
53895350
G.FUNCS.text_input_key = function(args)
53905351
args = args or {}

lib/ui.lua

Lines changed: 0 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -321,80 +321,6 @@ end
321321
local G_UIDEF_use_and_sell_buttons_ref = G.UIDEF.use_and_sell_buttons
322322
function G.UIDEF.use_and_sell_buttons(card)
323323
local abc = G_UIDEF_use_and_sell_buttons_ref(card)
324-
-- Allow code cards to be reserved
325-
if (card.area == G.pack_cards and G.pack_cards) and card.ability.consumeable then --Add a use button
326-
if card.ability.set == "Code" then
327-
return {
328-
n = G.UIT.ROOT,
329-
config = { padding = -0.1, colour = G.C.CLEAR },
330-
nodes = {
331-
{
332-
n = G.UIT.R,
333-
config = {
334-
ref_table = card,
335-
r = 0.08,
336-
padding = 0.1,
337-
align = "bm",
338-
minw = 0.5 * card.T.w - 0.15,
339-
minh = 0.7 * card.T.h,
340-
maxw = 0.7 * card.T.w - 0.15,
341-
hover = true,
342-
shadow = true,
343-
colour = G.C.UI.BACKGROUND_INACTIVE,
344-
one_press = true,
345-
button = "use_card",
346-
func = "can_reserve_card",
347-
},
348-
nodes = {
349-
{
350-
n = G.UIT.T,
351-
config = {
352-
text = localize("b_pull"),
353-
colour = G.C.UI.TEXT_LIGHT,
354-
scale = 0.55,
355-
shadow = true,
356-
},
357-
},
358-
},
359-
},
360-
{
361-
n = G.UIT.R,
362-
config = {
363-
ref_table = card,
364-
r = 0.08,
365-
padding = 0.1,
366-
align = "bm",
367-
minw = 0.5 * card.T.w - 0.15,
368-
maxw = 0.9 * card.T.w - 0.15,
369-
minh = 0.1 * card.T.h,
370-
hover = true,
371-
shadow = true,
372-
colour = G.C.UI.BACKGROUND_INACTIVE,
373-
one_press = true,
374-
button = "Do you know that this parameter does nothing?",
375-
func = "can_use_consumeable",
376-
},
377-
nodes = {
378-
{
379-
n = G.UIT.T,
380-
config = {
381-
text = localize("b_use"),
382-
colour = G.C.UI.TEXT_LIGHT,
383-
scale = 0.45,
384-
shadow = true,
385-
},
386-
},
387-
},
388-
},
389-
{ n = G.UIT.R, config = { align = "bm", w = 7.7 * card.T.w } },
390-
{ n = G.UIT.R, config = { align = "bm", w = 7.7 * card.T.w } },
391-
{ n = G.UIT.R, config = { align = "bm", w = 7.7 * card.T.w } },
392-
{ n = G.UIT.R, config = { align = "bm", w = 7.7 * card.T.w } },
393-
-- Betmma can't explain it, neither can I
394-
},
395-
}
396-
end
397-
end
398324
-- Remove sell button from cursed jokers
399325
if
400326
card.area

0 commit comments

Comments
 (0)