Guest User

ac130 En options.xml

a guest
Aug 16th, 2021
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.65 KB | None | 0 0
  1. function init()
  2.     eaop = GetBool("savegame.mod.eaop")
  3.     if eaop == 0 then eaop = 0.15 end
  4.     changingkey = false
  5.     selectedkey = ""
  6. end
  7.  
  8. uniqueCharacters = {
  9.     [1] = "lmb",
  10.     [2] = "rmb",
  11.     [3] = "up",
  12.     [4] = "down",
  13.     [5] = "left",
  14.     [6] = "right",
  15.     [7] = "space",
  16.     [8] = "interact",
  17.     [9] = "return",
  18. }
  19.  
  20. function getAlphabet ()
  21.     local letters = {}
  22.     for ascii = 65, 90 do table.insert(letters, string.char(ascii)) end
  23.     for key,value in ipairs(uniqueCharacters) do table.insert(letters, value) end
  24.     return letters
  25. end
  26. alpha = getAlphabet()
  27.  
  28. function tick()
  29.     if(changingkey and (InputPressed("any") or InputPressed("rmb") )) then
  30.  
  31.         for key,value in ipairs(alpha) do
  32.             if(InputPressed(value)) then
  33.                 SetString("savegame.mod.controls."..selectedkey,value)
  34.                 selectedkey = ""
  35.                 changingkey = false
  36.             end
  37.         end
  38.     end
  39. end
  40.  
  41. keybinds = {
  42.     changetype = "V",
  43.     changeammo = "C",
  44.     changespread = "Z",
  45. }
  46. keybindorder = {
  47.     [1] = "changetype",
  48.     [2] = "changeammo",
  49.     [3] = "changespread"
  50. }
  51.  
  52. function draw()
  53.     UiTranslate(UiCenter(), 350)
  54.     UiAlign("center middle")
  55.  
  56.     UiFont("bold.ttf", 48)
  57.     UiText("Enhanced AC130 airstrike")
  58.     UiFont("regular.ttf", 26)
  59.     UiTranslate(0, 70)
  60. --  UiPush()
  61. --      UiText("No Cooldown")
  62. --      UiTranslate(15, 40)
  63. --      UiAlign("right")
  64. --      UiColor(0.5, 0.8, 1)
  65. --      if eaop then
  66. --          if UiTextButton("Yes", 20, 20) then
  67. --              eaop = false
  68. --          SetBool("savegame.mod.eaop", eaop)
  69. --          end
  70. --      else
  71. --          if UiTextButton("No", 20, 20) then
  72. --              eaop = true
  73. --              SetBool("savegame.mod.eaop", eaop)
  74. --          end
  75. --      end
  76.         UiColor(1,1,1)
  77.         UiTranslate(-15,40)
  78.         UiAlign("center middle")
  79.         UiButtonImageBox("ui/common/box-outline-6.png", 6, 6)
  80.         for key, val in ipairs(keybindorder) do
  81.             local inputKey = keybinds[val]
  82.             key = val
  83.            
  84.             if(GetString("savegame.mod.controls."..key,val)~="")then
  85.                 inputKey = GetString("savegame.mod.controls."..key,inputKey)
  86.             end
  87.             local displaytext = string.format("%-10s %5s",key..": ",inputKey)
  88.    
  89.             if(changingkey and selectedkey == key) then
  90.                 displaytext = string.format("%-10s %5s",key..": ","____")
  91.                 UiTextButton(displaytext, 250, 40)
  92.             else
  93.                 if UiTextButton(displaytext, 250, 40) and not changingkey then
  94.                    
  95.                     changingkey = true
  96.                     selectedkey = key
  97.  
  98.                 end
  99.             end
  100.             UiTranslate(0,50)
  101.         end
  102.         if UiTextButton("Reset to default",250,40) then
  103.             for key, val in ipairs(keybindorder) do
  104.                 local inputKey = keybinds[val]
  105.                 SetString("savegame.mod.controls."..val,inputKey)
  106.             end
  107.         end
  108.     UiPop()
  109.  
  110.     UiButtonImageBox("ui/common/box-outline-6.png", 6, 6)
  111.  
  112.     UiTranslate(0, 300)
  113.     if UiTextButton("Close", 80, 40) then
  114.         Menu()
  115.     end
  116. end
Advertisement
Add Comment
Please, Sign In to add comment