-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinit.lua
More file actions
63 lines (51 loc) · 1.44 KB
/
init.lua
File metadata and controls
63 lines (51 loc) · 1.44 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
local IM_WorldMenu = nil
local function init(self)
local originalConditionalHook
if originalConditionalHook == nil then
function modApi:conditionalHook(conditionFn, fn, remove)
assert(type(conditionFn) == "function")
assert(type(fn) == "function")
remove = remove == nil and true or remove
assert(type(remove) == "boolean")
table.insert(self.conditionalHooks, {
condition = conditionFn,
hook = fn,
remove = remove
})
end
end
IM_WorldMenu = require(self.scriptPath.."worldmenu")
IM_WorldMenu.visible = false
sdlext.addUiRootCreatedHook(function(screen, uiRoot)
IM_WorldMenu:create(screen, uiRoot)
end)
end
local function load(self)
modApi:conditionalHook(
function()
--LOG("Is Game? "..tostring(sdlext.isGame()))
--LOG("Is Main Menu? "..tostring(sdlext.isMainMenu()))
--LOG("Is Hangar? "..tostring(sdlext.isHangar()))
--LOG("Mission Status? "..tostring(GetCurrentMission()))
if sdlext.isGame() and GetCurrentMission() == nil and not (sdlext.isMainMenu() or sdlext.isHangar()) then
return true
else
IM_WorldMenu.visible = false
return false
end
end,
function()
LOG("eyy")
IM_WorldMenu.visible = true
end,
false
)
end
return {
id = "IM_Drawtest",
name = "Draw Test",
version = "1.0.0",
requirements = {},--Not a list of mods needed for our mod to function, but rather the mods that we need to load before ours to maintain compability
init = init,
load = load,
}