-
Notifications
You must be signed in to change notification settings - Fork 194
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add the Tracks gui, hotkey friendly #1172
base: master
Are you sure you want to change the base?
Conversation
for |
end | ||
end | ||
|
||
TestOverlay = defclass(TestOverlay, widgets.Window) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably name this (and TestScreen) something other than "Test"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this will need a few more rounds of review, but first it needs docs so I know what the intended use case and behavior is
edit: also, please clean up lint and pre-commit.ci warnings
} | ||
|
||
--tile=dfhack.screen.findGraphicsTile('INTERFACE_BITS_BUILDING_PLACEMENT', 1, 0) | ||
local pen_direction = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
these two aren't Window attributes and can be removed
viewscreens= { | ||
'dungeonmode/Default', | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also can be removed
self.directional = false | ||
self.show_yours = true | ||
self.show_others = true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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? |
Support for showing directions, hiding your tracks and hiding other tracks