-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathmain.lua
More file actions
67 lines (55 loc) · 1.72 KB
/
main.lua
File metadata and controls
67 lines (55 loc) · 1.72 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
-- starstorm returns
-- ssr team
mods["ReturnsAPI-ReturnsAPI"].auto{mp = true, namespace = "ssr"}
--- GLOBALS (Should be in ALL-CAPS for constants, Uppercase Initial for variables)
PATH = _ENV["!plugins_mod_folder_path"]
-- mod options stuff
Options = ModOptions.new("ssr")
-- Settings with defaults
-- (useful for setting the default settings when the toml file hasn't been generated
-- or config options are missing due to a new update adding more)
Settings = {
title_replacement = true,
chirrsmas = 0,
}
SettingsFile = TOML.new()
ssr_chirrsmas_active = false -- gets set in the library file
local init = function()
--- Initialize settings here before requiring anything, useful if some options require a restart to apply.
if SettingsFile:read() == nil then
SettingsFile:write(Settings)
else
Settings = SettingsFile:read()
end
local folders = {
"Misc", -- contains utility functions that other code depends on, so load first
"Language",
"Actors",
"Elites",
"Survivors",
"Items",
"Equipments",
"Interactables",
"Artifacts",
"Stages",
"Gameplay"
}
Stage.remove_all_rooms() -- reload stages
for _, folder in ipairs(folders) do
-- NOTE: this includes filepaths within subdirectories of the above folders
local filepaths = path.get_files(path.combine(PATH, folder))
for _, filepath in ipairs(filepaths) do
-- filter for files with the .lua extension, incase there's non-lua files
if string.sub(filepath, -4, -1) == ".lua" then
require(filepath)
end
end
end
-- once we have loaded everything, enable hot/live reloading.
-- this variable may be used by content code to make sure it behaves correctly when hotloading
HOTLOADING = true
end
Initialize.add(init)
if HOTLOADING then
init()
end