mirror of
https://github.com/Pax1601/DCSOlympus.git
synced 2025-10-29 16:56:34 +00:00
Minor bug fixing, added patcher for Export.lua, added plugin options to enable/disable mod
This commit is contained in:
@@ -1 +0,0 @@
|
||||
local Olympuslfs=require('lfs');dofile(Olympuslfs.writedir()..'Scripts/OlympusExport.lua')
|
||||
@@ -137,7 +137,7 @@ function Olympus.move(ID, lat, lng, altitude, speed, category, taskOptions)
|
||||
Olympus.notify("Olympus.move not implemented yet for " .. category, 2)
|
||||
end
|
||||
else
|
||||
Olympus.notify("Error in Olympus.move " .. unitName, 2)
|
||||
Olympus.notify("Error in Olympus.move " .. ID, 2)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
BIN
scripts/OlympusPatcher.exe
Normal file
BIN
scripts/OlympusPatcher.exe
Normal file
Binary file not shown.
42
scripts/OlympusPatcher.py
Normal file
42
scripts/OlympusPatcher.py
Normal file
@@ -0,0 +1,42 @@
|
||||
import shutil
|
||||
import sys
|
||||
|
||||
START_STRING = "/* Olympus START */\n"
|
||||
END_STRING = "/* Olympus END */\n"
|
||||
EXPORT_STRING = "local Olympuslfs=require('lfs');dofile(Olympuslfs.writedir()..'Scripts/OlympusExport.lua')\n"
|
||||
|
||||
def main(flag):
|
||||
if flag == "-i":
|
||||
try:
|
||||
with open("Export.lua", "r") as f:
|
||||
shutil.copyfile("Export.lua", "Export.lua.bak")
|
||||
lines = f.readlines()
|
||||
if START_STRING in lines:
|
||||
return
|
||||
except FileNotFoundError:
|
||||
print('File does not exist')
|
||||
|
||||
with open("Export.lua", "a") as f:
|
||||
f.writelines(["\n", START_STRING, EXPORT_STRING, END_STRING, "\n"])
|
||||
elif flag == "-u":
|
||||
try:
|
||||
with open("Export.lua", "r") as f:
|
||||
shutil.copyfile("Export.lua", "Export.lua.bak")
|
||||
lines = f.readlines()
|
||||
except FileNotFoundError:
|
||||
print('File does not exist')
|
||||
|
||||
with open("Export.lua", "w") as f:
|
||||
block = False
|
||||
for line in lines:
|
||||
if line == START_STRING:
|
||||
block = True
|
||||
|
||||
if not block:
|
||||
f.write(line)
|
||||
|
||||
if line == END_STRING:
|
||||
block = False
|
||||
|
||||
if __name__ == "__main__":
|
||||
main(sys.argv[1])
|
||||
Reference in New Issue
Block a user