Merge branch 'develop' into dig-now

develop
Myk 2023-02-21 18:59:30 -08:00 committed by GitHub
commit b516c8753e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 87 additions and 36 deletions

@ -18,6 +18,20 @@ An automated labor management tool that only addressed hauling labors, leaving t
of skilled labors entirely up to the player. Fundamentally incompatible with the work detail
system of labor management in v50 of Dwarf Fortress.
.. _combine-drinks:
combine-drinks
==============
Replaced by the new `combine` script. Run
``combine here --types=drink``
.. _combine-plants:
combine-plants
==============
Replaced by the new `combine` script. Run
``combine here --types=plants``
.. _command-prompt:
command-prompt

@ -42,14 +42,16 @@ changelog.txt uses a syntax similar to RST, with a few special sequences:
- `autodump`: changed behaviour to only change ``dump`` and ``forbid`` flags if an item is successfully dumped.
-@ `autochop`: generate default names for burrows with no assigned names
- ``Buildings::StockpileIterator``: check for stockpile items on block boundary.
- `dig-now`: fixed designations being invalidated after digging prior designations by buffering all designations
- `dig-now`: added scanning the job list for designations that can't be found in the map data
- `dig-now`: fixed multi-layer channel designations only channeling every second layer
- `tailor`: block making clothing sized for toads; make replacement clothing orders use the size of the wearer, not the size of the garment; add support for adamantine cloth (off by default); improve logging
-@ `confirm`: fix fps drop when enabled
## Misc Improvements
- DFHack tool windows that capture mouse clicks (and therefore prevent you from clicking on the "pause" button) now unconditionally pause the game when they open (but you can still unpause with the keyboard if you want to). Examples of this behavior: `gui/quickfort`, `gui/blueprint`, `gui/liquids`
- `showmood`: now shows the number of items needed for cloth and bars in addition to the technically correct but always confusing "total dimension" (150 per bar or 10,000 per cloth)
-@ Stopped mouse clicks from affecting the map when a click on a DFHack screen dismisses the window
- `confirm`: configuration data is now persisted globally.
- `dig-now`: added handling of dig designations that have been converted into active jobs
## Documentation

@ -30,7 +30,11 @@ By default, ``tailor`` will prefer using materials in this order::
silk cloth yarn leather
but you can use the ``tailor materials`` command to restrict which materials
are used, and in what order.
are used, and in what order. ``tailor`` supports adamantine cloth (using the
keyword ``adamantine``) but does not use it by default, as most players find
adamantine too precious to routinely make into cloth. ``tailor`` does not
support modded "cloth" types which utilize custom reactions to making clothing
out of those cloth types.
Examples
--------
@ -46,3 +50,12 @@ Examples
Restrict the materials used for automatically manufacturing clothing to
silk, cloth, and yarn, preferred in that order. This saves leather for
other uses, like making armor.
Note
----
The reason for the limitation on modded cloth-like materials is
because custom reactions do not support the in-game mechanic
which allows a manager order to specify a different size for clothing items.
This mechanic only works for reactions that use the default make-clothing or
make-armor reactions, and is a limitation of the game itself.

@ -1 +1 @@
Subproject commit 54d3f896c9938f79758fed07c20da78c78094723
Subproject commit 7917f062c403a47d4d190bafc2470b247c8aa642

@ -66,6 +66,7 @@ bool set_conf_paused (string name, bool pause);
class confirmation_base {
public:
bool dirty = false;
enum cstate { INACTIVE, ACTIVE, SELECTED };
virtual string get_id() = 0;
virtual string get_focus_string() = 0;
@ -281,6 +282,7 @@ public:
}
state = s;
dirty = true;
if (s == INACTIVE) {
active_id = "";
confirmation_base::active = nullptr;
@ -371,6 +373,8 @@ public:
return state == ACTIVE;
}
void render() {
if (state == ACTIVE)
{
static vector<string> lines;
static const std::string pause_message =
"Pause confirmations until you exit this screen";
@ -380,8 +384,7 @@ public:
Screen::Pen corner_dr = Screen::Pen((char)188, COLOR_GREY, COLOR_BLACK);
Screen::Pen border_ud = Screen::Pen((char)205, COLOR_GREY, COLOR_BLACK);
Screen::Pen border_lr = Screen::Pen((char)186, COLOR_GREY, COLOR_BLACK);
if (state == ACTIVE)
{
split_string(&lines, get_message(), "\n");
size_t max_length = 40;
for (string line : lines)
@ -463,9 +466,11 @@ public:
}
set_state(INACTIVE);
}
// clean up any artifacts
if(dirty) {
dirty = false;
df::global::gps->force_full_display_count = 1;
}
}
string get_id() override = 0;
string get_focus_string() override = 0;
#define CONF_LUA_START using namespace conf_lua; Lua::StackUnwinder unwind(l_state); push(screen); push(get_id());

@ -28,7 +28,8 @@ function setMaterials(names)
idxs.silk or -1,
idxs.cloth or -1,
idxs.yarn or -1,
idxs.leather or -1)
idxs.leather or -1,
idxs.adamantine or -1)
end
function parse_commandline(...)

@ -56,6 +56,7 @@ enum ConfigValues {
CONFIG_CLOTH_IDX = 2,
CONFIG_YARN_IDX = 3,
CONFIG_LEATHER_IDX = 4,
CONFIG_ADAMANTINE_IDX = 5,
};
static int get_config_val(PersistentDataItem &c, int index) {
@ -119,10 +120,11 @@ static const MatType
M_SILK = MatType("silk", df::job_material_category::mask_silk, df::armor_general_flags::SOFT),
M_CLOTH = MatType("cloth", df::job_material_category::mask_cloth, df::armor_general_flags::SOFT),
M_YARN = MatType("yarn", df::job_material_category::mask_yarn, df::armor_general_flags::SOFT),
M_LEATHER = MatType("leather", df::job_material_category::mask_leather, df::armor_general_flags::LEATHER);
M_LEATHER = MatType("leather", df::job_material_category::mask_leather, df::armor_general_flags::LEATHER),
M_ADAMANTINE = MatType("adamantine", df::job_material_category::mask_strand, df::armor_general_flags::SOFT);
static const std::list<MatType> all_materials = { M_SILK, M_CLOTH, M_YARN, M_LEATHER };
static std::list<MatType> material_order = all_materials;
static const std::list<MatType> all_materials = { M_SILK, M_CLOTH, M_YARN, M_LEATHER, M_ADAMANTINE };
static std::list<MatType> material_order = { M_SILK, M_CLOTH, M_YARN, M_LEATHER }; // M_ADAMANTINE is not included by default
static struct BadFlags {
uint32_t whole;
@ -208,11 +210,13 @@ public:
supply[M_CLOTH] += ss;
else if (mat.material->flags.is_set(df::material_flags::YARN))
supply[M_YARN] += ss;
else if (mat.material->flags.is_set(df::material_flags::STOCKPILE_THREAD_METAL))
supply[M_ADAMANTINE] += ss;
else
{
std::string d;
i->getItemDescription(&d, 0);
WARN(cycle).print("tailor: weird cloth item found: %s (%d)\n", d.c_str(), i->id);
DEBUG(cycle).print("tailor: weird cloth item found: %s (%d)\n", d.c_str(), i->id);
}
}
}
@ -224,7 +228,8 @@ public:
supply[M_LEATHER] += i->getStackSize();
}
DEBUG(cycle).print("tailor: available silk %d yarn %d cloth %d leather %d\n", supply[M_SILK], supply[M_YARN], supply[M_CLOTH], supply[M_LEATHER]);
DEBUG(cycle).print("tailor: available silk %d yarn %d cloth %d leather %d adamantine %d\n",
supply[M_SILK], supply[M_YARN], supply[M_CLOTH], supply[M_LEATHER], supply[M_ADAMANTINE]);
}
void scan_replacements()
@ -253,8 +258,8 @@ public:
wearing.insert(inv->item->getType());
}
int size = world->raws.creatures.all[u->race]->adultsize;
sizes[size] = u->race;
int usize = world->raws.creatures.all[u->race]->adultsize;
sizes[usize] = u->race;
for (auto ty : std::set<df::item_type>{ df::item_type::ARMOR, df::item_type::PANTS, df::item_type::SHOES })
{
@ -262,9 +267,9 @@ public:
{
TRACE(cycle).print("tailor: one %s of size %d needed to cover %s\n",
ENUM_KEY_STR(item_type, ty).c_str(),
size,
usize,
Translation::TranslateName(&u->name, false).c_str());
needed[std::make_pair(ty, size)] += 1;
needed[std::make_pair(ty, usize)] += 1;
}
}
@ -278,11 +283,11 @@ public:
}
const df::job_type o = oo->second;
int size = world->raws.creatures.all[w->getMakerRace()]->adultsize;
int isize = world->raws.creatures.all[w->getMakerRace()]->adultsize;
std::string description;
w->getItemDescription(&description, 0);
if (available[std::make_pair(ty, size)] > 0)
if (available[std::make_pair(ty, usize)] > 0)
{
if (w->flags.bits.owned)
{
@ -298,10 +303,10 @@ public:
if (wearing.count(ty) == 0)
{
DEBUG(cycle).print("tailor: allocating a %s to %s\n",
ENUM_KEY_STR(item_type, ty).c_str(),
DEBUG(cycle).print("tailor: allocating a %s (size %d) to %s\n",
ENUM_KEY_STR(item_type, ty).c_str(), usize,
Translation::TranslateName(&u->name, false).c_str());
available[std::make_pair(ty, size)] -= 1;
available[std::make_pair(ty, usize)] -= 1;
}
if (w->getWear() > 1)
@ -309,10 +314,10 @@ public:
}
else
{
DEBUG(cycle).print ("tailor: %s worn by %s needs replacement, but none available\n",
description.c_str(),
Translation::TranslateName(&u->name, false).c_str());
orders[std::make_tuple(o, w->getSubtype(), size)] += 1;
DEBUG(cycle).print ("tailor: %s (size %d) worn by %s (size %d) needs replacement, but none available\n",
description.c_str(), isize,
Translation::TranslateName(&u->name, false).c_str(), usize);
orders[std::make_tuple(o, w->getSubtype(), usize)] += 1;
}
}
}
@ -405,6 +410,13 @@ public:
std::tie(ty, sub, size) = o.first;
int count = o.second;
if (sizes.count(size) == 0)
{
WARN(cycle).print("tailor: cannot determine race for clothing of size %d, skipped\n",
size);
continue;
}
if (count > 0)
{
std::vector<int16_t> v;
@ -573,6 +585,8 @@ static void set_material_order() {
material_order.push_back(M_YARN);
else if (i == (size_t)get_config_val(config, CONFIG_LEATHER_IDX))
material_order.push_back(M_LEATHER);
else if (i == (size_t)get_config_val(config, CONFIG_ADAMANTINE_IDX))
material_order.push_back(M_ADAMANTINE);
}
if (!material_order.size())
std::copy(all_materials.begin(), all_materials.end(), std::back_inserter(material_order));
@ -689,7 +703,8 @@ static void tailor_doCycle(color_ostream &out) {
// remember, these are ONE-based indices from Lua
static void tailor_setMaterialPreferences(color_ostream &out, int32_t silkIdx,
int32_t clothIdx, int32_t yarnIdx, int32_t leatherIdx) {
int32_t clothIdx, int32_t yarnIdx, int32_t leatherIdx,
int32_t adamantineIdx) {
DEBUG(config,out).print("entering tailor_setMaterialPreferences\n");
// it doesn't really matter if these are invalid. set_material_order will do
@ -698,6 +713,7 @@ static void tailor_setMaterialPreferences(color_ostream &out, int32_t silkIdx,
set_config_val(config, CONFIG_CLOTH_IDX, clothIdx - 1);
set_config_val(config, CONFIG_YARN_IDX, yarnIdx - 1);
set_config_val(config, CONFIG_LEATHER_IDX, leatherIdx - 1);
set_config_val(config, CONFIG_ADAMANTINE_IDX, adamantineIdx - 1);
set_material_order();
}

@ -1 +1 @@
Subproject commit e4ba126f6e1193d0a18386c1f1efedb9faf1458f
Subproject commit f2c2f6aa7e7fe94871adf0a22d6966ddcac38afc