Skip to content

Commit

Permalink
Apply Myk's code style suggestions for stripcaged
Browse files Browse the repository at this point in the history
  • Loading branch information
arekatir committed Jan 15, 2023
1 parent 8c3ace0 commit b193051
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions stripcaged.lua
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ local function cage_dump_list(list)
else
local sortedlist = {}
for classname, n in pairs(count) do
sortedlist[#sortedlist + 1] = {classname = classname, count = n}
table.insert(sortedlist, {classname = classname, count = n})
end
table.sort(sortedlist, (function(i, j) return i.count < j.count end))
print(('%s %d: '):format(type, cage.id))
Expand Down Expand Up @@ -172,14 +172,13 @@ local args = {...}

local list
if args[2] == 'here' then
print "NOTE: The 'here' option isn't well tested for v50 and only works with the keyboard cursor."
local it = dfhack.gui.getSelectedItem(true)
list = {it}
if not df.item_cagest:is_instance(it) and
not df.item_animaltrapst:is_instance(it) then
list = {}
for _, cage in ipairs(df.global.world.items.other.ANY_CAGE_OR_TRAP) do
if same_xyz(df.global.cursor, cage.pos) then
if same_xyz(it.pos, cage.pos) then
table.insert(list, cage)
end
end
Expand Down

0 comments on commit b193051

Please sign in to comment.