Compare commits
5 Commits
1a356da6e0
...
0f629a6387
| Author | SHA1 | Date | |
|---|---|---|---|
| 0f629a6387 | |||
|
|
16f2eaad52 | ||
| 90d2e70a6e | |||
|
|
d22b01f5e6 | ||
|
|
eca9963653 |
87
BauSystem/hotkeys.lua
Normal file
87
BauSystem/hotkeys.lua
Normal file
@@ -0,0 +1,87 @@
|
||||
-- This file is a part of the SteamWar software.
|
||||
--
|
||||
-- Copyright (C) 2025 SteamWar.de-Serverteam
|
||||
--
|
||||
-- This program is free software: you can redistribute it and/or modify
|
||||
-- it under the terms of the GNU Affero General Public License as published by
|
||||
-- the Free Software Foundation, either version 3 of the License, or
|
||||
-- (at your option) any later version.
|
||||
--
|
||||
-- This program is distributed in the hope that it will be useful,
|
||||
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
-- GNU Affero General Public License for more details.
|
||||
--
|
||||
-- You should have received a copy of the GNU Affero General Public License
|
||||
-- along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
---
|
||||
--- This serves both as an example and a quick start to the Stewamwar Script Api
|
||||
---
|
||||
|
||||
function hotkeys_freeze(pressed)
|
||||
if pressed then
|
||||
exec("/freeze")
|
||||
end
|
||||
end
|
||||
|
||||
function hotkeys_rgc(pressed)
|
||||
if pressed then
|
||||
exec("/rgc")
|
||||
end
|
||||
end
|
||||
|
||||
function hotkeys_rgp(pressed)
|
||||
if pressed then
|
||||
exec("/rgp")
|
||||
end
|
||||
end
|
||||
|
||||
trace_cycle_counter = 0;
|
||||
function hotkeys_cycle_trace_view(pressed)
|
||||
if not pressed then
|
||||
return
|
||||
end
|
||||
trace_cycle = (trace_cycle + 1) % 3
|
||||
trace_commands = {"trace hide", "trace show", "trace show -e -c"}
|
||||
exec(trace_commands[trace_cycle + 1])
|
||||
end
|
||||
|
||||
function hotkeys_tick_step(pressed)
|
||||
if pressed then
|
||||
exec("tick step")
|
||||
end
|
||||
end
|
||||
|
||||
function hotkeys_tpslimit(pressed)
|
||||
if not pressed then
|
||||
return
|
||||
end
|
||||
if tps.limit() == 20 then
|
||||
exec("tpslimit 200")
|
||||
else
|
||||
exec("tpslimit 20")
|
||||
end
|
||||
end
|
||||
|
||||
function hotkeys_tb(pressed)
|
||||
if pressed then
|
||||
exec("tb -e")
|
||||
end
|
||||
end
|
||||
|
||||
function hotkeys_trace_delete(pressed)
|
||||
if pressed then
|
||||
exec("trace delete")
|
||||
end
|
||||
end
|
||||
|
||||
hotkey("ctrl+g", hotkeys_freeze)
|
||||
hotkey("ctrl+c", hotkeys_rgc)
|
||||
hotkey("ctrl+v", hotkeys_rgp)
|
||||
hotkey("ctrl+x", hotkeys_tick_step)
|
||||
hotkey("shift+x", hotkeys_cycle_trace_view)
|
||||
hotkey("ctrl+y", hotkeys_tb)
|
||||
hotkey("ctrl+alt", hotkeys_trace_delete)
|
||||
hotkey("ctrl+h", hotkeys_trace_delete)
|
||||
|
||||
Reference in New Issue
Block a user