Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ Template for new versions:
## New Tools

## New Features
- `trackstop`: can now toggle gear assemblies

## Fixes

Expand Down
7 changes: 6 additions & 1 deletion docs/trackstop.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ trackstop
:summary: Overlay to allow changing track stop and related building settings after construction.
:tags: fort buildings interface

This script provides 3 overlays that are managed by the `overlay` framework.
This script provides 4 overlays that are managed by the `overlay` framework.
The script does nothing when executed.

The ``trackstop`` overlay allows the player to change the friction and dump
Expand All @@ -19,3 +19,8 @@ of a selected pressure plate after it has been constructed. Manual value entry
of ranges for minecart and creature triggers is provided, allowing greater
precision than the game interface normally permits. Incrementing or decrementing
values always restricts them to the usual intervals.

The ``gearassembly`` overlay allows the player to toggle the state of a selected
gear assembly without linking it to a lever first. This is useful for dwarfputing
and other applications where it may be desirable to default to the disengaged
state until triggered.
32 changes: 31 additions & 1 deletion trackstop.lua
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ function RollerOverlay:render(dc)
self.subviews.direction:setOption(DIRECTION_MAP_REVERSE[b.direction])
self.subviews.speed:setOption(SPEED_MAP_REVERSE[b.speed])

TrackStopOverlay.super.render(self, dc)
RollerOverlay.super.render(self, dc)
end

function RollerOverlay:init()
Expand Down Expand Up @@ -539,8 +539,38 @@ function PlateOverlay:init()
}
end

GearOverlay = defclass(GearOverlay, overlay.OverlayWidget)
GearOverlay.ATTRS{
desc='Adds widget for toggling gear assemblies.',
default_pos={x=-83, y=32},
version=2,
default_enabled=true,
viewscreens='dwarfmode/ViewSheets/BUILDING/GearAssembly',
frame={w=15, h=3},
frame_style=gui.MEDIUM_FRAME,
frame_background=gui.CLEAR_PEN,
}

function GearOverlay:render(dc)
self.subviews.gear_toggle:setOption(not getBuild().gear_flags.disengaged)
GearOverlay.super.render(self, dc)
end

function GearOverlay:init()
self:addviews{
widgets.ToggleHotkeyLabel{
view_id='gear_toggle',
frame={t=0, l=0},
label='State:',
key='CUSTOM_SHIFT_X',
on_change=function() getBuild():setTriggerState(0) end,
},
}
end

OVERLAY_WIDGETS = {
trackstop=TrackStopOverlay,
rollers=RollerOverlay,
pressureplate=PlateOverlay,
gearassembly=GearOverlay,
}
Loading