Skip to content

Commit d8e6665

Browse files
authored
Use guidm cursor fns
* colonies.lua - guidm cursor * devel/light.lua (unavailable) - guidm cursor * devel/query.lua - guidm cursor; same_xyz * devel/tree-info.lua - guidm cursor * gui/advfort.lua (unavailable) - guidm cursor; same_xyz * gui/blueprint.lua - guidm cursor * gui/companion-order.lua (unavailable) - guidm cursor; same_xyz * gui/create-item.lua - add pos arg * gui/tiletypes.lua - guidm cursor * modtools/create-item.lua - respect opts.pos, handle inside hackWish * hfs-pit.lua - guidm cursor; fix up tiletypes * launch.lua - guidm cursor; fix projectile flag * putontable.lua - guidm cursor; same_xyz * source.lua - guidm cursor * stripcaged.lua - guidm cursor * teleport.lua - guidm cursor * toggle-kbd-cursor.lua - use clearCursorPos; exclude adv mode * docs/extinguish.rst - adv tag * docs/firestarter.rst - adv tag * docs/launch.rst - reinstated * docs/putontable.rst - reinstated * docs/toggle-kbd-cursor.rst - fort tag * docs/gui/create-item.rst - add pos arg * docs/modtools/create-item.rst - suggest "here" for pos * Update changelog.txt
1 parent a76a39a commit d8e6665

25 files changed

Lines changed: 160 additions & 121 deletions

changelog.txt

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,19 +30,26 @@ Template for new versions:
3030
- `devel/export-map`: export map tile data to a JSON file
3131
- `autocheese`: automatically make cheese using barrels that have accumulated sufficient milk
3232
- `gui/spectate`: interactive UI for configuring `spectate`
33+
- `launch`: (reinstated) thrash your enemies with a flying suplex
34+
- `putontable`: (reinstated) make an item appear on a table like in adventure mode
3335

3436
## New Features
35-
- `advtools`: new ``advtools.fastcombat`` overlay (enabled by default) allows you to skip combat animations and the announcement "More" button by mashing the movement keys
37+
- `advtools`: new ``advtools.fastcombat`` overlay (enabled by default) allows you to skip combat animations and the announcement "More" button by mashing the movement keys
3638

3739
## Fixes
3840
- `position`: support for adv mode look cursor
41+
- `devel/query`, `devel/tree-info`, `hfs-pit`, `colonies`: now function in adventure mode
42+
- `hfs-pit`: fix up tiletypes of pit walls, better placement of stairs (w/r/t eerie pits and ramp tops)
43+
- `modtools/create-item`: ``hackWish`` now respects ``opts.pos`` and will spawn items there if provided
44+
- `toggle-kbd-cursor`: exclude adventure mode because it isn't compatible
3945

4046
## Misc Improvements
4147
- `hide-tutorials`: handle tutorial popups for adventure mode
4248
- `hide-tutorials`: new ``reset`` command that will re-enable popups in the current game (in case you hid them all and now want them back)
4349
- `gui/notify`: moody dwarf notification turns red when they can't reach workshop or items
4450
- `gui/confirm`: in the delete manager order confirmation dialog, show a description of which order you have selected to delete
4551
- `position`: display both adventurer and site pos simultaneously. Display map block pos+offset of selected tile.
52+
- `gui/create-item`: now accepts a ``pos`` argument of where to spawn items
4653

4754
## Removed
4855

colonies.lua

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ and ``colonies convert TERMITE`` ends your beekeeping industry.
2020
2121
]====]
2222

23+
local guidm = require('gui.dwarfmode')
24+
2325
function findVermin(target_verm)
2426
for k,v in ipairs(df.global.world.raws.creatures.all) do
2527
if v.creature_id == target_verm then
@@ -50,8 +52,8 @@ function convert_vermin_to(target_verm)
5052
end
5153

5254
function place_vermin(target_verm)
53-
local pos = copyall(df.global.cursor)
54-
if pos.x == -30000 then
55+
local pos = guidm.getCursorPos()
56+
if not pos then
5557
qerror("Cursor must be pointing somewhere")
5658
end
5759
local verm = df.vermin:new()

devel/light.lua

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,6 @@ function setCell(x,y,cell)
2727
cell.bo=cell.bo or {r=0,g=0,b=0}
2828
render.setCell(x,y,cell)
2929
end
30-
function getCursorPos()
31-
local g_cursor=df.global.cursor
32-
if g_cursor.x ~= -30000 then
33-
return copyall(g_cursor)
34-
end
35-
end
3630
--luacheck: skip
3731
function falloff(color,sqDist,maxdist)
3832
local v1=1/(sqDist/maxdist+1)
@@ -273,7 +267,7 @@ function LightOverlay:calculateLightSun()
273267
end
274268
end
275269
function LightOverlay:calculateLightCursor()
276-
local c=getCursorPos()
270+
local c=guidm.getCursorPos()
277271

278272
if c then
279273

devel/query.lua

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
-- Written by Josh Cooper(cppcooper) on 2017-12-21, last modified: 2021-06-13
33
-- Version: 3.2
44
--luacheck:skip-entirely
5-
local utils=require('utils')
5+
local guidm = require('gui.dwarfmode')
6+
local utils = require('utils')
67
local validArgs = utils.invert({
78
'help',
89

@@ -221,14 +222,11 @@ function getSelectionData()
221222
elseif args.job then
222223
debugf(0,"job selection")
223224
selection = dfhack.gui.getSelectedJob(true)
224-
if selection == nil and df.global.cursor.x >= 0 then
225-
local pos = { x=df.global.cursor.x,
226-
y=df.global.cursor.y,
227-
z=df.global.cursor.z }
225+
local pos = guidm.getCursorPos()
226+
if selection == nil and pos then
228227
print("searching for a job at the cursor")
229228
for _link, job in utils.listpairs(df.global.world.jobs.list) do
230-
local jp = job.pos
231-
if jp.x == pos.x and jp.y == pos.y and jp.z == pos.z then
229+
if same_xyz(job.pos, pos) then
232230
if selection == nil then
233231
selection = {}
234232
end
@@ -240,7 +238,7 @@ function getSelectionData()
240238
path_info_pattern = path_info
241239
elseif args.tile then
242240
debugf(0,"tile selection")
243-
local pos = copyall(df.global.cursor)
241+
local pos = guidm.getCursorPos()
244242
selection = dfhack.maps.ensureTileBlock(pos.x,pos.y,pos.z)
245243
bpos = selection.map_pos
246244
path_info = string.format("tile[%d][%d][%d]",pos.x,pos.y,pos.z)
@@ -249,7 +247,7 @@ function getSelectionData()
249247
tiley = pos.y%16
250248
elseif args.block then
251249
debugf(0,"block selection")
252-
local pos = copyall(df.global.cursor)
250+
local pos = guidm.getCursorPos()
253251
selection = dfhack.maps.ensureTileBlock(pos.x,pos.y,pos.z)
254252
bpos = selection.map_pos
255253
path_info = string.format("blocks[%d][%d][%d]",bpos.x,bpos.y,bpos.z)

devel/tree-info.lua

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
--Print a tree_info visualization of the tree at the cursor.
22
--@module = true
3+
local guidm = require('gui.dwarfmode')
34

45
-- [w][n][e][s]
56
local branch_chars = {
@@ -172,7 +173,11 @@ function printTree(t)
172173
end
173174

174175
if not dfhack_flags.module then
175-
local p = dfhack.maps.getPlantAtTile(copyall(df.global.cursor))
176+
local p = guidm.getCursorPos()
177+
if not p then
178+
qerror('No cursor!')
179+
end
180+
p = dfhack.maps.getPlantAtTile(p)
176181
if p and p.tree_info then
177182
printTree(p.tree_info)
178183
else

docs/extinguish.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ extinguish
33

44
.. dfhack-tool::
55
:summary: Put out fires.
6-
:tags: fort armok buildings items map units
6+
:tags: fort adventure armok buildings items map units
77

88
With this tool, you can put out fires affecting map tiles, plants, units, items,
99
and buildings.

docs/firestarter.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ firestarter
33

44
.. dfhack-tool::
55
:summary: Lights things on fire.
6-
:tags: fort armok items map units
6+
:tags: fort adventure armok items map units
77

88
Feel the need to burn something? Set items, locations, or even entire
99
inventories on fire! Use while viewing an item, with the cursor over a map tile,

docs/gui/create-item.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,10 @@ Options
4242
``-f``, ``--unrestricted``
4343
Don't restrict the material options to only those that are normally
4444
appropriate for the selected item type.
45+
``-p``, ``--pos <x>,<y>,<z>``
46+
If specified, items will be spawned at the given coordinates instead of at
47+
the creator unit's feet. ``here`` can be used in place of ``<x>,<y>,<z>``
48+
to use the active keyboard cursor.
4549
``--startup``
4650
Instead of showing the item creation interface, start monitoring for a
4751
modded reaction with a code of ``DFHACK_WISH``. When a reaction with that

docs/launch.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ launch
33

44
.. dfhack-tool::
55
:summary: Thrash your enemies with a flying suplex.
6-
:tags: unavailable
6+
:tags: adventure armok units
77

88
Attack another unit and then run this command to grab them and fly in a glorious
99
parabolic arc to where you have placed the cursor. You'll land safely and your

docs/modtools/create-item.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,4 +48,5 @@ Options
4848
caste associated with it.
4949
``-p``, ``--pos <x>,<y>,<z>``
5050
If specified, items will be spawned at the given coordinates instead of at
51-
the creator unit's feet.
51+
the creator unit's feet. ``here`` can be used in place of ``<x>,<y>,<z>``
52+
to use the active keyboard cursor.

0 commit comments

Comments
 (0)