Skip to content

Commit

Permalink
Merge branch 'DFHack:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
AndrielChaoti authored Oct 7, 2023
2 parents d4660e1 + b74a293 commit 60ca9d4
Show file tree
Hide file tree
Showing 47 changed files with 1,240 additions and 426 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ repos:
args: ['--fix=lf']
- id: trailing-whitespace
- repo: https://github.com/python-jsonschema/check-jsonschema
rev: 0.26.3
rev: 0.27.0
hooks:
- id: check-github-workflows
- repo: https://github.com/Lucas-C/pre-commit-hooks
Expand Down
2 changes: 2 additions & 0 deletions caravan.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
--@ module = true

local movegoods = reqscript('internal/caravan/movegoods')
local pedestal = reqscript('internal/caravan/pedestal')
local trade = reqscript('internal/caravan/trade')
local tradeagreement = reqscript('internal/caravan/tradeagreement')

Expand All @@ -20,6 +21,7 @@ OVERLAY_WIDGETS = {
tradeagreement=tradeagreement.TradeAgreementOverlay,
movegoods=movegoods.MoveGoodsOverlay,
assigntrade=movegoods.AssignTradeOverlay,
displayitemselector=pedestal.PedestalOverlay,
}

INTERESTING_FLAGS = {
Expand Down
31 changes: 30 additions & 1 deletion changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,41 @@ Template for new versions:
## New Features

## Fixes
- `suspendmanager`: fix errors when constructing near the map edge
- `gui/sandbox`: fix scrollbar moving double distance on click

## Misc Improvements
- `autofish`: changed ``--raw`` argument format to allow explicit setting to on or off

## Removed

# 50.11-r1

## New Tools
- `startdwarf`: (reinstated) set number of starting dwarves

## New Features
- `startdwarf`: overlay scrollbar so you can scroll through your starting dwarves if they don't all fit on the screen
- A new searchable, sortable, filterable dialog for selecting items for display on pedestals and display cases

## Fixes
- `suspendmanager`: fixed a bug where floor grates, bars, bridges etc. wouldn't be recognised as walkable, leading to unnecessary suspensions in certain cases.

## Misc Improvements
- `devel/inspect-screen`: display total grid size for UI and map layers
- `suspendmanager`: now suspends constructions that would cave-in immediately on completion

# 50.10-r1

## Fixes
- 'fix/general-strike: fix issue where too many seeds were getting planted in farm plots

# 50.09-r4

## Misc Improvements
- `autofish`: changed ``--raw`` argument format to allow explicit setting to on or off
- `caravan`: move goods to depot screen can now see/search/trade items inside of barrels and pots
- `gui/launcher`: show tagged tools in the autocomplete list when a tag name is typed

# 50.09-r3

## New Tools
Expand Down
23 changes: 0 additions & 23 deletions devel/dump-offsets.lua
Original file line number Diff line number Diff line change
@@ -1,26 +1,5 @@
-- Dump all global addresses

--[====[
devel/dump-offsets
==================
.. warning::
THIS SCRIPT IS STRICTLY FOR DFHACK DEVELOPERS.
Running this script on a new DF version will NOT
MAKE IT RUN CORRECTLY if any data structures
changed, thus possibly leading to CRASHES AND/OR
PERMANENT SAVE CORRUPTION.
This dumps the contents of the table of global addresses (new in 0.44.01).
Passing global names as arguments calls setAddress() to set those globals'
addresses in-game. Passing "all" does this for all globals.
]====]

GLOBALS = {}
for k, v in pairs(df.global._fields) do
GLOBALS[v.original_name] = k
Expand Down Expand Up @@ -50,13 +29,11 @@ else
search = {0x12345678, 0x87654321, 0x89abcdef}
end

local addrs = {}
function save_addr(name, addr)
print(("<global-address name='%s' value='0x%x'/>"):format(name, addr))
if iargs[name] or iargs.all then
ms.found_offset(name, addr)
end
addrs[name] = addr
end

local extended = false
Expand Down
54 changes: 35 additions & 19 deletions devel/inspect-screen.lua
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
-- Read from the screen and display info about the tiles

local gui = require('gui')
local utils = require('utils')
local guidm = require('gui.dwarfmode')
local widgets = require('gui.widgets')
local overlay = require('plugins.overlay')

Expand All @@ -19,32 +19,42 @@ function Inspect:init()
self:addviews{
widgets.Label{
frame={t=0, l=0},
text={'Current screen: ', {text=scr_name, pen=COLOR_CYAN}}},
text={'Current screen: ', {text=scr_name, pen=COLOR_CYAN}},
},
widgets.CycleHotkeyLabel{
view_id='layer',
frame={t=2, l=0},
key='CUSTOM_CTRL_A',
label='Inspect layer:',
options={{label='UI', value='ui'}, 'map'},
enabled=self:callback('is_unfrozen')},
enabled=self:callback('is_unfrozen'),
},
widgets.CycleHotkeyLabel{
view_id='empties',
frame={t=3, l=0},
key='CUSTOM_CTRL_E',
label='Empty elements:',
options={'hide', 'show'}},
options={'hide', 'show'},
},
widgets.ToggleHotkeyLabel{
view_id='freeze',
frame={t=4, l=0},
key='CUSTOM_CTRL_F',
label='Freeze current tile:',
initial_option=false},
initial_option=false,
},
widgets.Label{
frame={t=6},
text={{text=self:callback('get_mouse_pos')}}},
text={{text=self:callback('get_grid_size')}},
},
widgets.Label{
frame={t=7},
text={{text=self:callback('get_mouse_pos')}},
},
widgets.Label{
view_id='report',
frame={t=8},},
frame={t=9},
},
}
end

Expand All @@ -56,6 +66,15 @@ function Inspect:do_refresh()
return self:is_unfrozen() and not self:getMouseFramePos()
end

function Inspect:get_grid_size()
if self.subviews.layer:getOptionValue() == 'ui' then
local width, height = dfhack.screen.getWindowSize()
return ('UI grid size: %d x %d'):format(width, height)
end
local layout = guidm.getPanelLayout()
return ('Map grid size: %d x %d'):format(layout.map.width, layout.map.height)
end

local cur_mouse_pos = {x=-1, y=-1}
function Inspect:get_mouse_pos()
local pos, text = cur_mouse_pos, ''
Expand Down Expand Up @@ -294,37 +313,34 @@ local function get_map_report(show_empty)
end

function Inspect:onRenderBody()
if self:do_refresh() then
local show_empty = self.subviews.empties:getOptionValue() == 'show'
local report = self.subviews.layer:getOptionValue() == 'ui' and
get_ui_report(show_empty) or get_map_report(show_empty)
self.subviews.report:setText(report)
self:updateLayout()
end
if not self:do_refresh() then return end
local show_empty = self.subviews.empties:getOptionValue() == 'show'
local report = self.subviews.layer:getOptionValue() == 'ui' and
get_ui_report(show_empty) or get_map_report(show_empty)
self.subviews.report:setText(report)
self:updateLayout()
end

function Inspect:onInput(keys)
if Inspect.super.onInput(self, keys) then
return true
end
if keys._MOUSE_L_DOWN and not self:getMouseFramePos() then
if keys._MOUSE_L and not self:getMouseFramePos() then
self.subviews.freeze:cycle()
return true
end
end

InspectScreen = defclass(InspectScreen, gui.ZScreen)
InspectScreen = defclass(InspectScreen, gui.ZScreenModal)
InspectScreen.ATTRS{
focus_string='inspect-screen',
force_pause=true,
pass_mouse_clicks=false,
}

function InspectScreen:init()
-- prevent hotspot widgets from reacting
overlay.register_trigger_lock_screen(self)

self:addviews{Inspect{view_id='main'}}
self:addviews{Inspect{}}
end

function InspectScreen:onDismiss()
Expand Down
4 changes: 2 additions & 2 deletions devel/sc.lua
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ local function check_container(obj, path)
if df.isvalid(v) == 'ref' then
local s, a = v:sizeof()

if v and v._kind == 'container' and k ~= 'bad' then
if v and v._kind == 'container' and k ~= 'bad' and k ~= 'temp_save' then
if tostring(v._type):sub(1,6) == 'vector' and check_vectors and not is_valid_vector(a) then
local key = tostring(obj._type) .. '.' .. k
if not checkedp[key] then
Expand Down Expand Up @@ -162,7 +162,7 @@ local function check_container(obj, path)
--print (' OK')
else
bold (t)
err (' NOT OK '.. s .. ' ' .. s2)
err (' NOT OK '.. s .. ' ' .. s2 .. ' at ' .. path .. '.' .. k)
end
end

Expand Down
12 changes: 12 additions & 0 deletions docs/caravan.rst
Original file line number Diff line number Diff line change
Expand Up @@ -94,3 +94,15 @@ Trade agreement

A small panel is shown with a hotkey (``Ctrl-A``) for selecting all/none in the
currently shown category.

Display furniture
`````````````````

A button is added to the screen when you are viewing display furniture
(pedestals and display cases) where you can launch an item assignment GUI.

The dialog allows you to sort by name, value, or where the item is currently
assigned for display.

You can search by name, and you can filter by item quality and by whether the
item is forbidden.
2 changes: 1 addition & 1 deletion docs/gui/autofish.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ should also count your raw fish. You can also check whether or not autofish is
currently fishing or not.

Usage
=====
-----

::

Expand Down
2 changes: 1 addition & 1 deletion docs/gui/design.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ gui/design

.. dfhack-tool::
:summary: Design designation utility with shapes.

:tags: fort design productivity map

This tool provides a point and click interface to make designating shapes
and patterns easier. Supports both digging designations and placing constructions.
Expand Down
4 changes: 2 additions & 2 deletions docs/gui/suspendmanager.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ gui/suspendmanager

.. dfhack-tool::
:summary: Intelligently suspend and unsuspend jobs.

:tags: fort jobs

This is the graphical configuration interface for the `suspendmanager`
automation tool.

Usage
=====
-----

::

Expand Down
27 changes: 20 additions & 7 deletions docs/startdwarf.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,16 @@ startdwarf
==========

.. dfhack-tool::
:summary: Increase the number of dwarves you embark with.
:tags: unavailable embark fort armok
:summary: Change the number of dwarves you embark with.
:tags: embark fort armok

You must use this tool before embarking (e.g. at the site selection screen or
any time before) to change the number of dwarves you embark with from the
default of 7.
You must use this tool before you get to the embark preparation screen (e.g. at
the site selection screen or any time before) to change the number of dwarves
you embark with from the default of 7. The value that you set will remain in
effect until DF is restarted (or you use `startdwarf` to set a new value).

Note that the game requires that you embark with no fewer than 7 dwarves, so
this tool can only increase the starting dwarf count, not decrease it.
The maximum number of dwarves you can have is 32,767, but that is far more than
the game can handle.

Usage
-----
Expand All @@ -24,6 +25,18 @@ Examples

``startdwarf 10``
Start with a few more warm bodies to help you get started.
``startdwarf 1``
Hermit fort! (also see the `hermit` tool for keeping it that way)
``startdwarf 500``
Start with a teeming army of dwarves (leading to immediate food shortage and
FPS issues).

Overlay
-------

The vanilla DF screen doesn't provide a way to scroll through the starting
dwarves, so if you start with more dwarves than can fit on your screen, this
tool provides a scrollbar that you can use to scroll through them. The vanilla
list was *not* designed for scrolling, so there is some odd behavior. When you
click on a dwarf to set skills, the list will jump so that the dwarf you
clicked on will be at the top of the page.
2 changes: 2 additions & 0 deletions docs/suspendmanager.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ This tool will watch your active jobs and:
- suspend construction jobs on top of a smoothing, engraving or track carving
designation. This prevents the construction job from being completed first,
which would erase the designation.
- suspend construction jobs that would cave in immediately on completion,
such as when building walls or floors next to grates/bars.

Usage
-----
Expand Down
25 changes: 0 additions & 25 deletions docs/workorder-recheck.rst

This file was deleted.

4 changes: 2 additions & 2 deletions exportlegends.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1070,7 +1070,7 @@ function LegendsOverlay:init()
end

function LegendsOverlay:onInput(keys)
if keys._MOUSE_L_DOWN and progress_percent < 0 and
if keys._MOUSE_L and progress_percent < 0 and
self.subviews.button_mask:getMousePos() and
self.subviews.do_export:getOptionValue()
then
Expand Down Expand Up @@ -1102,7 +1102,7 @@ end

function DoneMaskOverlay:onInput(keys)
if progress_percent >= 0 then
if keys.LEAVESCREEN or (keys._MOUSE_L_DOWN and self:getMousePos()) then
if keys.LEAVESCREEN or (keys._MOUSE_L and self:getMousePos()) then
return true
end
end
Expand Down
Loading

0 comments on commit 60ca9d4

Please sign in to comment.