-
Notifications
You must be signed in to change notification settings - Fork 199
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
Added ability to request gems by their value #1079
Conversation
could you update your fork? it appears to be out of date. For the future, it is better practice to create a branch on your fork before submitting a PR. That way you have the ability to work on other things while this PR is still under review. |
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.
needs documentation in the Overlays section of docs/caravan.rst
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.
Other than a request to uphold the style of the surrounding code, I think this looks great! Thanks!
internal/caravan/tradeagreement.lua
Outdated
TradeAgreementOverlay.ATTRS { | ||
desc = 'Adds select all/none functionality when requesting trade agreement items.', | ||
default_pos = { x = 45, y = -6 }, | ||
default_enabled = true, | ||
viewscreens = 'dwarfmode/Diplomacy/Requests', | ||
frame = { w = 40, h = 4 }, | ||
frame_style = gui.MEDIUM_FRAME, | ||
frame_background = gui.CLEAR_PEN, | ||
} |
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.
Inside of tables, the convention (at least inside of DFHack code) is to have no spaces around the =
internal/caravan/tradeagreement.lua
Outdated
self:addviews { | ||
widgets.HotkeyLabel { | ||
frame = { t = 1, l = 0 }, | ||
label = 'Select materials with value', |
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.
label = 'Select materials with value', | |
label = 'Select by value', |
internal/caravan/tradeagreement.lua
Outdated
return matPrices, matValuesUnique | ||
end | ||
|
||
local function ValueSelector() |
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.
convention for local functions is snake_case, not PascalCase (which is generally used for class names)
internal/caravan/tradeagreement.lua
Outdated
label = 'Select materials with value', | ||
key = 'CUSTOM_CTRL_M', | ||
on_activate = ValueSelector, | ||
visible = function() return GetTab() ~= nil end, |
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.
since GetTab
(or get_tab
, once renamed) is a function, this can just be visible=get_tab
internal/caravan/tradeagreement.lua
Outdated
list[index] = tostring(value.value) .. | ||
" - " .. tostring(value.count) .. " " .. (value.count == 1 and currTab.labelSingular or currTab.labelPlural) |
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 multi-part strings like this, it is usually cleaner to use a format string:
('%d - %d %s'):format(value.value, value.count,
value.count == 1 and currTab.labelSingular or currTab.labelPlural)
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'd also suggest adding the "gear" symbol after the value to indicate price. the number-heavy string label also feels a bit user-unfriendly. we might want to post some more screenshots to the #feature-discuss Discord channel to get feedback on that.
internal/caravan/tradeagreement.lua
Outdated
labelSingular = labelSingular, | ||
labelPlural = labelPlural, | ||
getCivResourceList = getCivResourceList, | ||
funcGetValue = funcGetValue, |
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.
the convention for this type of variable is to name it like get_value_fn
ping |
No description provided.