-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathadventure_map.lua
More file actions
105 lines (84 loc) · 2.42 KB
/
Copy pathadventure_map.lua
File metadata and controls
105 lines (84 loc) · 2.42 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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
local mod_path = "" .. SMODS.current_mod.path
assert(SMODS.load_file("globals.lua"))()
MAP.mod = SMODS.current_mod
-- Adding a new state
G.STATES.ADVENTURE_MAP = 2081
local function is_lua_path(path)
return string.sub(path, -4) == ".lua"
end
local function folder_load(mod_path, folder)
local files = NFS.getDirectoryItems(mod_path .. folder)
for _, file in ipairs(files) do
if is_lua_path(file) then
print("[ADVENTURE_MAP] Loading lua file " .. file)
local f, err = SMODS.load_file(folder.."/" .. file)
if err then
error(err)
end
f()
end
end
end
local function recursive_load(mod_path, folder, fileTree)
local filesTable = NFS.getDirectoryItems(mod_path..folder)
for i,v in ipairs(filesTable) do
local file = folder.."/"..v
local info = NFS.getInfo(mod_path..file)
if info then
if info.type == "file" and is_lua_path(file) then
local f, err = SMODS.load_file(file)
if err then
error(err)
end
f()
fileTree = fileTree.."\n"..file
elseif info.type == "directory" and NFS.getInfo(mod_path..file.."/.loadignore") == nil then
--fileTree = fileTree.."\n"..file.." (DIR)"
fileTree = recursive_load(mod_path, file, fileTree)
end
end
end
return fileTree
end
folder_load(mod_path, "base")
folder_load(mod_path, "items")
folder_load(mod_path, "ui")
folder_load(mod_path, "state")
print(recursive_load(mod_path, 'scenarios', "[ADVENTURE_MAP] Loading LUA:"))
print("[ADVENTURE_MAP] Stopped Loading")
SMODS.current_mod.calculate = function(self, context)
if context.beat_boss and context.end_of_round and context.main_eval then
if G.GAME.combat_event then
else
MAP.MapManager.generate_new_map()
end
end
if context.tag_triggered then
G.GAME.tags_used = G.GAME.tags_used + 1
end
end
SMODS.current_mod.reset_game_globals = function(run_start)
if run_start then
print(G.STATE)
print(G.STATE_COMPLETE)
G.STATE = G.STATES.ADVENTURE_MAP
G.STATE_COMPLETE = false
MAP.MapManager.generate_new_map()
G.GAME.events_visited_total = 0
G.GAME.tags_used = 0
end
end
SMODS.Atlas{
key = "modicon",
path = "icon.png",
px=34,
py=34
}
local main_menu_jokers = {"j_map_travel_guide", "j_map_gps"}
-- Adds Cavendish to the title screen
SMODS.current_mod.menu_cards = function()
return { -- This takes any SMODS.create_card parameters
key = main_menu_jokers[math.random(#main_menu_jokers)],
remove_original = true -- This removes the vanilla Ace
}
end