File: commands.lua

package info (click to toggle)
boswars 2.8-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 96,652 kB
  • sloc: cpp: 57,250; python: 1,715; sh: 25; makefile: 17
file content (40 lines) | stat: -rw-r--r-- 1,495 bytes parent folder | download | duplicates (5)
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
-- Called when the user presses an unhandled key during the game
-- while no menu is open.  Returns true if it handled the key.
-- See the HTML documentation on HandleCommandKey for details.
function HandleIngameCommandKey(key, ctrl, alt, shift)
  if ((key == "h" and (ctrl or alt)) or key == "f1") then
    if (not IsNetworkGame()) then SetGamePaused(true) end
    RunHelpMenu()
  elseif (key == "f5") then
    if (not IsNetworkGame()) then SetGamePaused(true) end
    RunGameOptionsMenu()
  elseif (key == "f7") then
    if (not IsNetworkGame()) then SetGamePaused(true) end
    RunGameSoundOptionsMenu()
  elseif (key == "f9") then
    if (not IsNetworkGame()) then SetGamePaused(true) end
    RunPreferencesMenu()
  elseif ((key == "m" and alt) or key == "f10") then
    if (not IsNetworkGame()) then SetGamePaused(true) end
    RunGameMenu()
  elseif ((key == "s" and alt) or key == "f11") then
    if (not IsReplayGame() and not IsNetworkGame()) then
      SetGamePaused(true)
      RunSaveMenu()
    end
  elseif (key == "q" and (ctrl or alt)) then
    if (not IsNetworkGame()) then SetGamePaused(true) end
    RunQuitToMenuConfirmMenu()
  elseif (key == "r" and (ctrl or alt)) then
    if (not IsNetworkGame()) then SetGamePaused(true) end
    RunRestartConfirmMenu()
  elseif (key == "x" and (ctrl or alt)) then
    if (not IsNetworkGame()) then SetGamePaused(true) end
    RunExitConfirmMenu()
  else
    return false
  end
  return true
end

HandleCommandKey = HandleIngameCommandKey