Merge pull request #616 from Putnam3145/patch-19

Made teleport work with cursor and handle errors.
develop
Lethosor 2015-05-19 16:42:00 -04:00
commit 1bb5239e5b
1 changed files with 3 additions and 2 deletions

@ -36,7 +36,8 @@ if args.showunitid or args.showpos then
end end
else else
local unit = args.unit and df.unit.find(args.unit) or dfhack.gui.getSelectedUnit(true) local unit = args.unit and df.unit.find(args.unit) or dfhack.gui.getSelectedUnit(true)
local pos = not(not args.x or not args.y or not args.z) and {x=args.x,y=args.y,z=args.z} or df.global.cursor local pos = not(not args.x or not args.y or not args.z) and {x=args.x,y=args.y,z=args.z} or {x=df.global.cursor.x,y=df.global.cursor.y,z=df.global.cursor.z}
if not unit then qerror('A unit needs to be selected or specified. Use teleport -showunitid to get a unit\'s ID.') end
if not pos.x or pos.x==-30000 then qerror('A position needs to be highlighted or specified. Use teleport -showpos to get a position\'s exact xyz values.') end
teleport(unit,pos) teleport(unit,pos)
end end