diff --git a/NEWS b/NEWS index 3b7ef4761..507f5d2e2 100644 --- a/NEWS +++ b/NEWS @@ -3,6 +3,7 @@ DFHack Future plugins will not be loaded if globals they specify as required are not located (should prevent some crashes) Fixes advfort works again + digfort: now checks file type and existence exportlegends: Fixed map export full-heal: Fixed a problem with selecting units in the GUI gui/hack-wish: Fixed restrictive material filters diff --git a/scripts/digfort.rb b/scripts/digfort.rb index 74db423d3..0d41649b3 100644 --- a/scripts/digfort.rb +++ b/scripts/digfort.rb @@ -1,70 +1,65 @@ # designate an area for digging according to a plan in csv format -raise "usage: digfort " if not $script_args[0] -planfile = File.read($script_args[0]) +fname = $script_args[0].to_s -if df.cursor.x == -30000 - puts "place the game cursor to the top-left corner of the design" - throw :script_finished +if not $script_args[0] then + puts " Usage: digfort " + throw :script_finished +end +if not fname[-4..-1] == ".csv" then + puts " The plan file must be in .csv format." + throw :script_finished +end +if not File.file?(fname) then + puts " The specified file does not exist." + throw :script_finished end -# a sample CSV file -# empty lines are ignored -# a special comment with start(dx, dy) means the actual patterns starts at cursor.x-dx, cursor.y-dy -# the CSV file should be saved in the main DF directory, alongside of Dwarf Fortress.exe -sample_csv = <