Repository navigation
Expand file tree
/
Copy pathcode_generation.lua
More file actions
79 lines (67 loc) · 1.89 KB
/
Copy pathcode_generation.lua
File metadata and controls
79 lines (67 loc) · 1.89 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
-- These functions are (hopefully) no longer used
-- i am still keeping them here in case theyre needed in the future
function Scholar.regenerate_files()
local function generate_code(key)
-- No
local template = [[
SMODS.Joker:take_ownership("%s", {
no_collection = true,
in_pool = function()
return false
end,
})
table.insert(Scholar.Jokers, {
orig_key = "%s",
order = %s,
config = {extra = {}},
loc_vars = function(self, info_queue, card)
-- info_queue[#info_queue+1] = G.P_CENTERS[""]
return {vars = {}}
end,
remove_from_deck = function(self, card, from_debuff)
end,
add_to_deck = function(self, card, from_debuff)
end,
calculate = function(self, card, context)
end,
})
]]
return template:format(key:sub(3), key, tostring(G.P_CENTERS[key].order))
end
-- i mean lets try
local path = "Mods/Scholar/src/jokers"
for _, filename in pairs(SMODS.NFS.getDirectoryItems(path)) do
SMODS.NFS.remove(path .. "/" .. filename)
end
for _, center in pairs(G.P_CENTER_POOLS.Joker) do
if not center.original_mod then
SMODS.NFS.write("Mods/Scholar/src/jokers/" .. center.key:sub(3) .. ".lua", generate_code(center.key))
end
end
end
function Scholar.gen_loc_text()
local template = [[
return {
descriptions = {
Joker = {
%s
}
}
}
]]
local joker_template = [[
%s = {
name = "%s",
text = {{
}},
},
]]
local built = ""
for _,joker in ipairs(G.P_CENTER_POOLS.Joker) do
if joker.original_mod then
local constructed = joker_template:format(joker.key, localize{set = "Joker", type = "name_text", key = joker.orig_key} )
built = built .. constructed .. "\n"
end
end
love.system.setClipboardText(template:format(built))
end