Skip to content

Commit 506c62c

Browse files
authored
Merge pull request DFHack#5562 from ab9rf/tailor-dye
add dye automation to `tailor`
2 parents 1896055 + a93ace4 commit 506c62c

File tree

3 files changed

+303
-49
lines changed

3 files changed

+303
-49
lines changed

docs/plugins/tailor.rst

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ Usage
2828
tailor now
2929
tailor materials <material> [<material> ...]
3030
tailor confiscate [true|false]
31+
tailor dye [true|false]
3132

3233
By default, ``tailor`` will prefer using materials in this order::
3334

@@ -48,6 +49,11 @@ too precious to routinely make into cloth. ``tailor`` does not support modded
4849
"cloth" types which utilize custom reactions for making clothing out of those
4950
cloth types.
5051

52+
If dye management is enabled, ``tailor`` will also issue orders to dye cloth
53+
as needed to fulfill fortress clothing requirements, and will issue orders to
54+
manufacture dyes required to fulfill the dye cloth orders. Dye management is
55+
disabled by default.
56+
5157
Examples
5258
--------
5359

@@ -69,3 +75,11 @@ Caveats
6975
Modded cloth-like materials are not supported because custom reactions do not
7076
support being sized for non-dwarf races. The game only supports sizing the
7177
built-in default make-clothing or make-armor reactions.
78+
79+
Dye automation will not not issue orders to mill dyes that are made at a
80+
millstone or quern because Dwarf Fortress does not currently support
81+
"mill plant" orders for a specified material.
82+
83+
At present, dye automation uses any available dye and cloth will be dyed
84+
with whatever color dye can be found or made. The ability to specify color
85+
preferences may be added in the future.

plugins/lua/tailor.lua

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ end
1717
function status()
1818
dfhack.print(('tailor is %s'):format(isEnabled() and "enabled" or "disabled"))
1919
print((' %s confiscating tattered clothing'):format(tailor_getConfiscate() and "and" or "but not"))
20+
print(('tailor %s automating dye'):format(tailor_getAutomateDye() and "is" or "is not"))
2021
print('materials preference order:')
2122
for _,name in ipairs(tailor_getMaterialPreferences()) do
2223
print((' %s'):format(name))
@@ -38,6 +39,11 @@ function setConfiscate(opt)
3839
tailor_setConfiscate(fl)
3940
end
4041

42+
function setAutomateDye(opt)
43+
local fl = argparse.boolean(opt[1], "set dye")
44+
tailor_setAutomateDye(fl)
45+
end
46+
4147
function parse_commandline(...)
4248
local args, opts = {...}, {}
4349
local positionals = process_args(opts, args)
@@ -55,6 +61,8 @@ function parse_commandline(...)
5561
setMaterials(positionals)
5662
elseif command == 'confiscate' then
5763
setConfiscate(positionals)
64+
elseif command == 'dye' then
65+
setAutomateDye(positionals)
5866
else
5967
return false
6068
end

0 commit comments

Comments
 (0)