diff --git a/add-thought.lua b/add-thought.lua index 257e36f740..14b150ce1c 100644 --- a/add-thought.lua +++ b/add-thought.lua @@ -14,12 +14,12 @@ local utils=require('utils') function addEmotionToUnit(unit,thought,emotion,severity,strength,subthought) local emotions=unit.status.current_soul.personality.emotions - if not (type(emotion)=='number') then - emotion=df.emotion_type[emotion] + if not (tonumber(emotion)) then + emotion=df.emotion_type[tonumber(emotion)] end local properThought=nil - if not (type(thought)=='number') then - properThought=df.unit_thought_type[thought] + if not (tonumber(thought)) then + properThought=df.unit_thought_type[tonumber(thought)] if not properThought then for k,syn in ipairs(df.global.world.raws.syndromes.all) do if syn.syn_name==thought then @@ -72,7 +72,7 @@ end local args = utils.processArgs({...}, validArgs) -local unit = args.unit and df.unit.find(args.unit) or dfhack.gui.getSelectedUnit(true) +local unit = args.unit and df.unit.find(tonumber(args.unit)) or dfhack.gui.getSelectedUnit(true) if not unit then qerror('A unit must be specified or selected.') end if args.gui then diff --git a/full-heal.lua b/full-heal.lua index 5e42132094..67d4b93c67 100644 --- a/full-heal.lua +++ b/full-heal.lua @@ -40,7 +40,7 @@ if args.help then end if(args.unit) then - unit = df.unit.find(args.unit) + unit = df.unit.find(tonumber(args.unit)) else unit = dfhack.gui.getSelectedUnit() end diff --git a/gui/create-item.lua b/gui/create-item.lua index 959582a99f..4abd10d056 100644 --- a/gui/create-item.lua +++ b/gui/create-item.lua @@ -248,7 +248,7 @@ args = utils.processArgs({...}, validArgs) eventful=require('plugins.eventful') if not args.startup then - local unit=args.unit and df.unit.find(args.unit) or dfhack.gui.getSelectedUnit(true) + local unit=tonumber(args.unit) and df.unit.find(tonumber(args.unit)) or dfhack.gui.getSelectedUnit(true) if unit then hackWish(unit) else diff --git a/gui/family-affairs.lua b/gui/family-affairs.lua index 8df8c82638..ff448a25e1 100644 --- a/gui/family-affairs.lua +++ b/gui/family-affairs.lua @@ -257,13 +257,13 @@ if not dfhack.world.isFortressMode() then end if args[1] == "divorce" and tonumber(args[2]) then - local unit = df.unit.find(args[2]) + local unit = df.unit.find(tonumber(args[2])) if unit then Divorce (unit) return end end if tonumber(args[1]) and tonumber(args[2]) then - local unit1 = df.unit.find(args[1]) - local unit2 = df.unit.find(args[2]) + local unit1 = df.unit.find(tonumber(args[1])) + local unit2 = df.unit.find(tonumber(args[2])) if unit1 and unit2 then Divorce (unit1) Divorce (unit2) diff --git a/teleport.lua b/teleport.lua index 8c5eda3576..4979253dca 100644 --- a/teleport.lua +++ b/teleport.lua @@ -50,7 +50,7 @@ if args.showunitid or args.showpos then printall(df.global.cursor) end else - local unit = args.unit and df.unit.find(args.unit) or dfhack.gui.getSelectedUnit(true) + local unit = tonumber(args.unit) and df.unit.find(tonumber(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 {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