add the Tracks gui, hotkey friendly#1172
add the Tracks gui, hotkey friendly#1172Crystalwarrior wants to merge 1 commit intoDFHack:masterfrom
Conversation
|
for |
| end | ||
| end | ||
|
|
||
| TestOverlay = defclass(TestOverlay, widgets.Window) |
There was a problem hiding this comment.
Probably name this (and TestScreen) something other than "Test"
There was a problem hiding this comment.
in addition, it's not an overlay. The common pattern is to name the screen FooScreen and the Window Foo. E.g. TracksScreen and Tracks
| } | ||
|
|
||
| --tile=dfhack.screen.findGraphicsTile('INTERFACE_BITS_BUILDING_PLACEMENT', 1, 0) | ||
| local pen_direction = { |
There was a problem hiding this comment.
for actual arrows for the cardinal directions, use the arrow characters.
e.g. from trackstop.lua:
local NORTH = 'North '..string.char(24)
local EAST = 'East '..string.char(26)
local SOUTH = 'South '..string.char(25)
local WEST = 'West '..string.char(27)|
|
||
| --tile=dfhack.screen.findGraphicsTile('INTERFACE_BITS_BUILDING_PLACEMENT', 1, 0) | ||
| local pen_direction = { | ||
| to_pen{ch='v',fg=COLOR_YELLOW,}, -- tile=dfhack.screen.findGraphicsTile('ROLLERS', 8, 2),}, -- 0 South |
There was a problem hiding this comment.
lists in Lua are 1-based. If you want to match the value of the direction flag (which appears to be a 0-based enum), assign the indices directly, like:
local pen_direction = {
[df.spoor_flag_dir.north] = to_pen{...},
[df.spoor_flag_dir.south] = ...| end | ||
| end | ||
|
|
||
| TestOverlay = defclass(TestOverlay, widgets.Window) |
There was a problem hiding this comment.
in addition, it's not an overlay. The common pattern is to name the screen FooScreen and the Window Foo. E.g. TracksScreen and Tracks
| window, | ||
| } | ||
| onTimer() | ||
| repeatUtil.scheduleEvery(timerId, 1, 'ticks', onTimer) |
There was a problem hiding this comment.
I suggest not using repeatUtil here. That makes cleanup messy. Instead, update in your own render method when the tick counter has incremented.
| default_pos={x=20, y=0}, | ||
| default_enabled=true, |
There was a problem hiding this comment.
these two aren't Window attributes and can be removed
| viewscreens= { | ||
| 'dungeonmode/Default', | ||
| }, |
| self.directional = false | ||
| self.show_yours = true | ||
| self.show_others = true |
There was a problem hiding this comment.
you don't need to copy widget state into your object. you can access the widget state directly. Then you also don't need to have on_change handlers
|
Looks like adventure beta 23 finally added tracking to Steam version? Do any changes need to be made to account for this? |
|
Nope! This is safe to close now that steam version added tracking properly. |
Support for showing directions, hiding your tracks and hiding other tracks