|
|
@ -2,6 +2,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
local stock = require 'plugins.stockpiles'
|
|
|
|
local stock = require 'plugins.stockpiles'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function check_enabled()
|
|
|
|
|
|
|
|
return stock.isEnabled()
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
function world_guard()
|
|
|
|
function world_guard()
|
|
|
|
if not dfhack.isMapLoaded() then
|
|
|
|
if not dfhack.isMapLoaded() then
|
|
|
|
qerror("World is not loaded")
|
|
|
|
qerror("World is not loaded")
|
|
|
@ -9,6 +13,7 @@ function world_guard()
|
|
|
|
end
|
|
|
|
end
|
|
|
|
return true
|
|
|
|
return true
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
function guard()
|
|
|
|
function guard()
|
|
|
|
if not string.match(dfhack.gui.getCurFocus(), '^dwarfmode/QueryBuilding/Some/Stockpile') then
|
|
|
|
if not string.match(dfhack.gui.getCurFocus(), '^dwarfmode/QueryBuilding/Some/Stockpile') then
|
|
|
|
qerror("This script requires a stockpile selected in the 'q' mode")
|
|
|
|
qerror("This script requires a stockpile selected in the 'q' mode")
|
|
|
@ -39,7 +44,10 @@ function usage()
|
|
|
|
print("")
|
|
|
|
print("")
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
if args.load then
|
|
|
|
if not check_enabled() then
|
|
|
|
|
|
|
|
qerror("Stockpiles plugin not enabled. Enable it with: enable stockpiles")
|
|
|
|
|
|
|
|
return
|
|
|
|
|
|
|
|
elseif args.load then
|
|
|
|
if not guard() then return end
|
|
|
|
if not guard() then return end
|
|
|
|
stock.load_settings()
|
|
|
|
stock.load_settings()
|
|
|
|
elseif args.save then
|
|
|
|
elseif args.save then
|
|
|
@ -52,4 +60,3 @@ elseif args.dir then
|
|
|
|
else
|
|
|
|
else
|
|
|
|
usage()
|
|
|
|
usage()
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|