Skip to content

Commit

Permalink
Merge pull request #1129 from myk002/myk_trade_button_cover
Browse files Browse the repository at this point in the history
[caravan] add optional hider for vanilla trade goods button
  • Loading branch information
myk002 authored May 24, 2024
2 parents d7dffbb + 31b854d commit bc84f8e
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 0 deletions.
1 change: 1 addition & 0 deletions caravan.lua
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ OVERLAY_WIDGETS = {
tradebanner=trade.TradeBannerOverlay,
tradeagreement=tradeagreement.TradeAgreementOverlay,
movegoods=movegoods.MoveGoodsOverlay,
movegoods_hider=movegoods.MoveGoodsHiderOverlay,
assigntrade=movegoods.AssignTradeOverlay,
displayitemselector=pedestal.PedestalOverlay,
}
Expand Down
1 change: 1 addition & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ Template for new versions:
## Misc Improvements
- `gui/unit-info-viewer`: now displays a unit's weight, relative to either dwarves, elephants or cats
- `gui/unit-info-viewer`: shows a unit's relative size to its race's average.
- `caravan`: optional overlay to hide vanilla bring trade goods to depot button (if you prefer to always use the DFHack version and don't want to accidentally click on the vanilla button). enable ``caravan.movegoods_hider`` in `gui/control-panel` UI Overlays tab to use.

## Removed

Expand Down
17 changes: 17 additions & 0 deletions internal/caravan/movegoods.lua
Original file line number Diff line number Diff line change
Expand Up @@ -761,6 +761,23 @@ function MoveGoodsOverlay:init()
}
end

-- -------------------
-- MoveGoodsHiderOverlay
--

MoveGoodsHiderOverlay = defclass(MoveGoodsHiderOverlay, overlay.OverlayWidget)
MoveGoodsHiderOverlay.ATTRS{
desc='Hides the vanilla trade goods selection button.',
default_pos={x=-70, y=12},
viewscreens='dwarfmode/ViewSheets/BUILDING/TradeDepot',
frame={w=27, h=3},
frame_background=gui.CLEAR_PEN,
}

function MoveGoodsHiderOverlay:onInput(keys)
return keys._MOUSE_L and self:getMouseFramePos()
end

-- -------------------
-- AssignTradeOverlay
--
Expand Down

0 comments on commit bc84f8e

Please sign in to comment.