forked from OceanRamen/Brainstorm
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBrainstorm_keyhandler.lua
More file actions
38 lines (35 loc) · 1.24 KB
/
Brainstorm_keyhandler.lua
File metadata and controls
38 lines (35 loc) · 1.24 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
local lovely = require("lovely")
local nativefs = require("nativefs")
Brainstorm.AUTOREROLL = {}
local saveKeys = { "1", "2", "3", "4", "5" }
function Brainstorm.key_press_update(key)
-- Brainstorm Key Handler
for i, k in ipairs(saveKeys) do
-- SaveState
if key == k and love.keyboard.isDown(Brainstorm.SETTINGS.keybinds.saveState) then
if G.STAGE == G.STAGES.RUN then
compress_and_save(G.SETTINGS.profile .. "/" .. "saveState" .. k .. ".jkr", G.ARGS.save_run)
saveManagerAlert("Saved state to slot [" .. k .. "]")
end
end
-- LoadState
if key == k and love.keyboard.isDown(Brainstorm.SETTINGS.keybinds.loadState) then
G:delete_run()
G.SAVED_GAME = get_compressed(G.SETTINGS.profile .. "/" .. "saveState" .. k .. ".jkr")
if G.SAVED_GAME ~= nil then
G.SAVED_GAME = STR_UNPACK(G.SAVED_GAME)
end
G:start_run({
savetext = G.SAVED_GAME,
})
saveManagerAlert("Loaded save from slot [" .. k .. "]")
end
end
-- FastReroll
if key == Brainstorm.SETTINGS.keybinds.rerollSeed and love.keyboard.isDown("lctrl") then
FastReroll()
end
if key == Brainstorm.SETTINGS.keybinds.autoReroll and love.keyboard.isDown("lctrl") then
Brainstorm.AUTOREROLL.autoRerollActive = not Brainstorm.AUTOREROLL.autoRerollActive
end
end