-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdebug.lua
More file actions
70 lines (64 loc) · 1.93 KB
/
debug.lua
File metadata and controls
70 lines (64 loc) · 1.93 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
---------------------------------------------------------------------------------------
-- Debugger --
---------------------------------------------------------------------------------------
--[[
Dependencies:
bb_comforts.lua
]]--
function SetupDebugger()
InitDebugger()
AddOnSaveGameLoaded(InitDebugger)
end
function InitDebugger()
SetCallbacks()
debug_testModeActive = false
SetKeyBindings()
end
function SetCallbacks()
GameCallback_GUI_ChatStringInputDone = function (command)
local cmd = loadstring(command)
cmd()
end
end
function SetKeyBindings()
Input.KeyBindDown(Keys.ModifierControl + Keys.ModifierShift + Keys.ModifierAlt + Keys.Multiply, "ToggleTestMode()", 15)
Input.KeyBindDown(Keys.U, "TestMode_SpeedUp()", 15)
Input.KeyBindDown(Keys.R, "TestMode_ResetSpeed()", 15)
Input.KeyBindDown(Keys.C, "TestMode_ResetCinematicMode()", 15)
Input.KeyBindDown(Keys.T, "TestMode_CreateTroops()", 15)
Input.KeyBindDown(Keys.P, "TestMode_ShowChatInput()", 15)
end
function TestMode_ShowChatInput()
if debug_testModeActive then
XGUIEng.ShowWidget("ChatInput", 1)
end
end
function ToggleTestMode()
debug_testModeActive = not debug_testModeActive
if debug_testModeActive then
Message("debug mode active")
else
Message("debug mode inactive")
end
end
function TestMode_SpeedUp()
if debug_testModeActive then
Game.GameTimeSpeedUp()
end
end
function TestMode_ResetSpeed()
if debug_testModeActive then
Game.GameTimeReset()
end
end
function TestMode_ResetCinematicMode()
if debug_testModeActive then
Interface_SetCinematicMode(0)
end
end
function TestMode_CreateTroops()
if debug_testModeActive then
assert(global.mainHero, "Debug: A Hero has to be defined")
CreateMilitaryGroup(1, Entities.PU_LeaderBow4, 8, GetPosition(global.mainHero))
end
end