Skip to content

Commit

Permalink
unify stress face pens and rewrite arrival sort docs
Browse files Browse the repository at this point in the history
  • Loading branch information
myk002 committed Sep 9, 2023
1 parent 6ec5e0e commit 9d233e6
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 12 deletions.
11 changes: 7 additions & 4 deletions docs/plugins/sort.rst
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,14 @@ be effective in the military in their current state (though see "melee
potential" and "ranged potential" sorts below for predictions about future
effectiveness).

The "arrival order" sort shows the order that your dwarves appeared at your
fort. The numbers on the left indicate the relative arrival order, and the
numbers for the most recent migration wave will be colored bright green.
The "arrival order" sorts your citizens according to the most recent time they
entered your map. The numbers on the left indicate the relative arrival order,
and the numbers for the group of dwarves that most recently entered the map
will be at the top and be colored bright green. If you run this sort after you
get a new group of migrants, the migrant wave will be colored bright green.
Dwarves that arrived earlier will have numbers in yellow, and your original
dwarves (if any still survive) will have numbers in red.
dwarves (if any still survive and have never left and re-entered the map) will
have numbers in red.

The "stress" sort order will bring your most stressed dwarves to the top, ready
for addition to a :wiki:`therapy squad <Stress#Recovering_unhappy_dwarves>` to
Expand Down
15 changes: 7 additions & 8 deletions plugins/lua/sort.lua
Original file line number Diff line number Diff line change
Expand Up @@ -991,7 +991,7 @@ local function is_unstable(unit)
end

local function is_maimed(unit)
return unit.flags2.vision_missing or
return not unit.flags2.vision_good or
unit.status2.limbs_grasp_count < 2 or
unit.status2.limbs_stand_count == 0
end
Expand Down Expand Up @@ -1207,14 +1207,13 @@ for idx=0,6 do
end
end

local ASCII_FACE_TILES = {}
for idx,color in ipairs{COLOR_RED, COLOR_LIGHTRED, COLOR_YELLOW, COLOR_WHITE, COLOR_GREEN, COLOR_LIGHTGREEN, COLOR_LIGHTCYAN} do
local face = {}
ensure_key(face, 0)[0] = to_pen{ch=1, fg=color}
ensure_key(face, 0)[1] = to_pen{ch='\\', fg=color}
ensure_key(face, 1)[0] = to_pen{ch='\\', fg=color}
ensure_key(face, 1)[1] = to_pen{ch='/', fg=color}
ASCII_FACE_TILES[idx-1] = face
ensure_key(face, 0)[0] = to_pen{tile=FACE_TILES[idx-1][0][0], ch=1, fg=color}
ensure_key(face, 0)[1] = to_pen{tile=FACE_TILES[idx-1][0][1], ch='\\', fg=color}
ensure_key(face, 1)[0] = to_pen{tile=FACE_TILES[idx-1][1][0], ch='\\', fg=color}
ensure_key(face, 1)[1] = to_pen{tile=FACE_TILES[idx-1][1][1], ch='/', fg=color}
FACE_TILES[idx-1] = face
end

function get_stress_face_tile(idx, x, y)
Expand All @@ -1223,7 +1222,7 @@ function get_stress_face_tile(idx, x, y)
return x == 0 and y == 1 and DASH_PEN or gui.CLEAR_PEN
end
local val = math.min(6, elem.val)
return (dfhack.screen.inGraphicsMode() and FACE_TILES or ASCII_FACE_TILES)[val][y][x]
return FACE_TILES[val][y][x]
end

function SquadAnnotationOverlay:init()
Expand Down

0 comments on commit 9d233e6

Please sign in to comment.