ensure face textures get reloaded on map load

develop
Myk Taylor 2023-09-09 07:20:59 -07:00
parent 9d233e6e34
commit 45e5168a91
No known key found for this signature in database
1 changed files with 27 additions and 15 deletions

@ -6,6 +6,8 @@ local setbelief = reqscript('modtools/set-belief')
local utils = require('utils')
local widgets = require('gui.widgets')
local GLOBAL_KEY = 'sort'
local CH_UP = string.char(30)
local CH_DN = string.char(31)
@ -1196,6 +1198,7 @@ local to_pen = dfhack.pen.parse
local DASH_PEN = to_pen{ch='-', fg=COLOR_WHITE, keep_lower=true}
local FACE_TILES = {}
local function init_face_tiles()
for idx=0,6 do
FACE_TILES[idx] = {}
local face_off = (6 - idx) * 2
@ -1215,6 +1218,7 @@ for idx,color in ipairs{COLOR_RED, COLOR_LIGHTRED, COLOR_YELLOW, COLOR_WHITE, CO
ensure_key(face, 1)[1] = to_pen{tile=FACE_TILES[idx-1][1][1], ch='/', fg=color}
FACE_TILES[idx-1] = face
end
end
function get_stress_face_tile(idx, x, y)
local elem = rating_annotations[idx]
@ -1261,6 +1265,14 @@ OVERLAY_WIDGETS = {
squad_annotation=SquadAnnotationOverlay,
}
dfhack.onStateChange[GLOBAL_KEY] = function(sc)
if sc ~= SC_MAP_LOADED or df.global.gamemode ~= df.game_mode.DWARF then
return
end
init_face_tiles()
end
--[[
local utils = require('utils')
local units = require('plugins.sort.units')