Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions add-thought.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion full-heal.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion gui/create-item.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions gui/family-affairs.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion teleport.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down