Skip to content

Commit e0f6350

Browse files
committed
use new textures for unsuspend overlay
1 parent 04e3165 commit e0f6350

File tree

1 file changed

+16
-7
lines changed

1 file changed

+16
-7
lines changed

unsuspend.lua

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,18 @@ function SuspendOverlay:refresh_screen_buildings()
135135
self.screen_buildings = screen_buildings
136136
end
137137

138+
local function get_texposes()
139+
local start = dfhack.textures.getMapUnsuspendTexposStart()
140+
local valid = start > 0
141+
142+
local function tp(offset)
143+
return valid and start + offset or nil
144+
end
145+
146+
return tp(0), tp(1), tp(2)
147+
end
148+
local PLANNED_TEXPOS, SUSPENDED_TEXPOS, REPEAT_SUSPENDED_TEXPOS = get_texposes()
149+
138150
function SuspendOverlay:render_marker(dc, bld, screen_pos)
139151
if not bld or #bld.jobs ~= 1 then return end
140152
local data = self.in_progress_buildings[bld.id]
@@ -144,16 +156,13 @@ function SuspendOverlay:render_marker(dc, bld, screen_pos)
144156
or not job.flags.suspend then
145157
return
146158
end
147-
local color = COLOR_YELLOW
148-
local ch = 'x'
159+
local color, ch, texpos = COLOR_YELLOW, 'x', SUSPENDED_TEXPOS
149160
if buildingplan and buildingplan.isPlannedBuilding(bld) then
150-
color = COLOR_GREEN
151-
ch = 'P'
161+
color, ch, texpos = COLOR_GREEN, 'P', PLANNED_TEXPOS
152162
elseif data.suspend_count > 1 then
153-
color = COLOR_RED
154-
ch = 'X'
163+
color, ch, texpos = COLOR_RED, 'X', REPEAT_SUSPENDED_TEXPOS
155164
end
156-
dc:seek(screen_pos.x, screen_pos.y):tile(ch, nil, color)
165+
dc:seek(screen_pos.x, screen_pos.y):tile(ch, texpos, color)
157166
end
158167

159168
function SuspendOverlay:onRenderFrame(dc)

0 commit comments

Comments
 (0)