From ec7f97bb7a85a1d317c5fdba602e8bbc43eb44cd Mon Sep 17 00:00:00 2001 From: PatrikLundell Date: Sat, 2 May 2020 17:37:10 +0200 Subject: [PATCH 01/16] adapted to enum value name change --- library/modules/Units.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/modules/Units.cpp b/library/modules/Units.cpp index c4b9e60fa..43eb9026c 100644 --- a/library/modules/Units.cpp +++ b/library/modules/Units.cpp @@ -209,7 +209,7 @@ void Units::setNickname(df::unit *unit, std::string nick) case df::identity_type::FalseIdentity: break; // We want the nickname to end up in the identity - case df::identity_type::Unk_1: // Guess, but that's how it worked in the past + case df::identity_type::Impersonating: case df::identity_type::TrueName: case df::identity_type::Unk_4: // Pure guess, as this is a new case, still unseen id_hfig = df::historical_figure::find(identity->histfig_id); From d5b5b81450fca0394e378420c13be64a02828f78 Mon Sep 17 00:00:00 2001 From: PatrikLundell Date: Tue, 2 Jun 2020 15:03:59 +0200 Subject: [PATCH 02/16] changes --- library/modules/Units.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/library/modules/Units.cpp b/library/modules/Units.cpp index 43eb9026c..458a09ea3 100644 --- a/library/modules/Units.cpp +++ b/library/modules/Units.cpp @@ -204,14 +204,15 @@ void Units::setNickname(df::unit *unit, std::string nick) df::historical_figure *id_hfig = NULL; switch (identity->type) { + case df::identity_type::None: case df::identity_type::HidingCurse: - case df::identity_type::Identity: case df::identity_type::FalseIdentity: + case df::identity_type::InfiltrationIdentity: + case df::identity_type::Identity: break; // We want the nickname to end up in the identity case df::identity_type::Impersonating: case df::identity_type::TrueName: - case df::identity_type::Unk_4: // Pure guess, as this is a new case, still unseen id_hfig = df::historical_figure::find(identity->histfig_id); break; } From a04c609980ae5205dc11c7c4748b1b71a0ae4c40 Mon Sep 17 00:00:00 2001 From: PatrikLundell Date: Fri, 3 Jul 2020 13:46:32 +0200 Subject: [PATCH 03/16] fixed getplants, issue #1479 --- plugins/getplants.cpp | 109 +++++++++++++++++++++++++++++++++++++++++- 1 file changed, 108 insertions(+), 1 deletion(-) diff --git a/plugins/getplants.cpp b/plugins/getplants.cpp index d1ee79a04..b722776c0 100644 --- a/plugins/getplants.cpp +++ b/plugins/getplants.cpp @@ -9,11 +9,16 @@ #include "TileTypes.h" #include "df/map_block.h" +#include "df/map_block_column.h" #include "df/plant.h" #include "df/plant_growth.h" #include "df/plant_raw.h" #include "df/tile_dig_designation.h" +#include "df/ui.h" #include "df/world.h" +#include "df/world_data.h" +#include "df/world_object_data.h" +#include "df/world_site.h" #include "modules/Designations.h" #include "modules/Maps.h" @@ -27,7 +32,9 @@ using namespace DFHack; using namespace df::enums; DFHACK_PLUGIN("getplants"); +REQUIRE_GLOBAL(ui); REQUIRE_GLOBAL(world); +REQUIRE_GLOBAL(cur_year); REQUIRE_GLOBAL(cur_year_tick); enum class selectability { @@ -224,6 +231,106 @@ selectability selectablePlant(const df::plant_raw *plant, bool farming) } } +// Formula for determination of the variance in plant growth maturation time, determined via disassembly. +// The x and y parameters are in tiles relative to the embark. +bool ripe(int32_t x, int32_t y, int32_t start, int32_t end) { + int32_t time = ((435522653 - (((y + 3) * x + 5) * ((y + 7) * y * 400181475 + 289700012))) & 0x3FFFFFFF) % 2000 + (*cur_year_tick % 403200); + + return time >= start && (end == -1 || time <= end); +} + +// Looks in the picked growths vector to see if a matching growth has been marked as picked. +bool picked(const df::plant *plant, int32_t growth_subtype) { + df::world_data *world_data = world->world_data; + df::world_site *site = df::world_site::find(ui->site_id); + int32_t pos_x = site->global_min_x + plant->pos.x / 48; + int32_t pos_y = site->global_min_y + plant->pos.y / 48; + size_t id = pos_x + pos_y * 16 * world_data->world_width; + df::world_object_data *object_data = df::world_object_data::find(id); + df::map_block_column *column = world->map.map_block_columns[(plant->pos.x / 16) * world->map.x_count_block + (plant->pos.y / 16)]; + + for (size_t i = 0; i < object_data->picked_growths.x.size(); i++) { + if (object_data->picked_growths.x[i] == plant->pos.x && + object_data->picked_growths.y[i] == plant->pos.y && + object_data->picked_growths.z[i] - column->z_base == plant->pos.z && + object_data->picked_growths.subtype[i] == growth_subtype && + object_data->picked_growths.year[i] == *cur_year) { + return true; + } + } + + return false; +} + +bool designate(const df::plant *plant, bool farming) { + df::plant_raw *plant_raw = world->raws.plants.all[plant->material]; + const DFHack::MaterialInfo basic_mat = DFHack::MaterialInfo(plant_raw->material_defs.type_basic_mat, plant_raw->material_defs.idx_basic_mat); + + if (basic_mat.material->flags.is_set(material_flags::EDIBLE_RAW) || + basic_mat.material->flags.is_set(material_flags::EDIBLE_COOKED)) + { + return Designations::markPlant(plant); + } + + if (plant_raw->flags.is_set(plant_raw_flags::THREAD) || + plant_raw->flags.is_set(plant_raw_flags::MILL) || + plant_raw->flags.is_set(plant_raw_flags::EXTRACT_VIAL) || + plant_raw->flags.is_set(plant_raw_flags::EXTRACT_BARREL) || + plant_raw->flags.is_set(plant_raw_flags::EXTRACT_STILL_VIAL)) + { + if (!farming) { + return Designations::markPlant(plant); + } + } + + if (basic_mat.material->reaction_product.id.size() > 0 || + basic_mat.material->reaction_class.size() > 0) + { + if (!farming) { + return Designations::markPlant(plant); + } + } + + for (size_t i = 0; i < plant_raw->growths.size(); i++) + { + if (plant_raw->growths[i]->item_type == df::item_type::SEEDS || // Only trees have seed growths in vanilla, but raws can be modded... + plant_raw->growths[i]->item_type == df::item_type::PLANT_GROWTH) + { + const DFHack::MaterialInfo growth_mat = DFHack::MaterialInfo(plant_raw->growths[i]->mat_type, plant_raw->growths[i]->mat_index); + if ((plant_raw->growths[i]->item_type == df::item_type::SEEDS && + (growth_mat.material->flags.is_set(material_flags::EDIBLE_COOKED) || + growth_mat.material->flags.is_set(material_flags::EDIBLE_RAW))) || + (plant_raw->growths[i]->item_type == df::item_type::PLANT_GROWTH && + growth_mat.material->flags.is_set(material_flags::LEAF_MAT))) // Will change name to STOCKPILE_PLANT_GROWTH any day now... + { + bool seedSource = plant_raw->growths[i]->item_type == df::item_type::SEEDS; + + if (plant_raw->growths[i]->item_type == df::item_type::PLANT_GROWTH) + { + for (size_t k = 0; growth_mat.material->reaction_product.material.mat_type.size(); k++) + { + if (growth_mat.material->reaction_product.material.mat_type[k] == plant_raw->material_defs.type_seed && + growth_mat.material->reaction_product.material.mat_index[k] == plant_raw->material_defs.idx_seed) + { + seedSource = true; + break; + } + } + } + + if ((!farming || seedSource) && + ripe(plant->pos.x, plant->pos.y, plant_raw->growths[i]->timing_1, plant_raw->growths[i]->timing_2) && + !picked(plant, i)) + { + return Designations::markPlant(plant); + } + } + } + } + + return false; +} + command_result df_getplants (color_ostream &out, vector & parameters) { string plantMatStr = ""; @@ -448,7 +555,7 @@ command_result df_getplants (color_ostream &out, vector & parameters) collectionCount[plant->material]++; ++count; } - if (!deselect && Designations::markPlant(plant)) + if (!deselect && designate(plant, farming)) { // out.print("Designated %s at (%i, %i, %i), %d\n", world->raws.plants.all[plant->material]->id.c_str(), plant->pos.x, plant->pos.y, plant->pos.z, (int)i); collectionCount[plant->material]++; From 0a2a16d29c401a7fbf606b9cf842385104c0cb30 Mon Sep 17 00:00:00 2001 From: PatrikLundell Date: Fri, 3 Jul 2020 15:50:18 +0200 Subject: [PATCH 04/16] corrected ripeness calculation --- plugins/getplants.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/getplants.cpp b/plugins/getplants.cpp index b722776c0..db283d808 100644 --- a/plugins/getplants.cpp +++ b/plugins/getplants.cpp @@ -234,7 +234,7 @@ selectability selectablePlant(const df::plant_raw *plant, bool farming) // Formula for determination of the variance in plant growth maturation time, determined via disassembly. // The x and y parameters are in tiles relative to the embark. bool ripe(int32_t x, int32_t y, int32_t start, int32_t end) { - int32_t time = ((435522653 - (((y + 3) * x + 5) * ((y + 7) * y * 400181475 + 289700012))) & 0x3FFFFFFF) % 2000 + (*cur_year_tick % 403200); + int32_t time = (((435522653 - (((y + 3) * x + 5) * ((y + 7) * y * 400181475 + 289700012))) & 0x3FFFFFFF) % 2000 + *cur_year_tick) % 403200; return time >= start && (end == -1 || time <= end); } From bb66ef32a7f4ba6c66fca854482de092b8e447cd Mon Sep 17 00:00:00 2001 From: lethosor Date: Sun, 2 Aug 2020 12:55:36 -0400 Subject: [PATCH 05/16] Tone down a couple warnings There have been a few cases of people thinking these are more important than they actually are --- library/DataDefs.cpp | 2 +- library/PluginManager.cpp | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/library/DataDefs.cpp b/library/DataDefs.cpp index f8f65b108..28761efa3 100644 --- a/library/DataDefs.cpp +++ b/library/DataDefs.cpp @@ -334,7 +334,7 @@ virtual_identity *virtual_identity::find(void *vtable) return p; } - std::cerr << "UNKNOWN CLASS '" << name << "': vtable = 0x" + std::cerr << "Class not in symbols.xml: '" << name << "': vtable = 0x" << std::hex << uintptr_t(vtable) << std::dec << std::endl; known[vtable] = NULL; diff --git a/library/PluginManager.cpp b/library/PluginManager.cpp index 05db0521d..db42c5c84 100644 --- a/library/PluginManager.cpp +++ b/library/PluginManager.cpp @@ -313,8 +313,12 @@ bool Plugin::load(color_ostream &con) if (plug_git_desc_ptr) { if (strcmp(dfhack_git_desc, plug_git_desc) != 0) - con.printerr("Warning: Plugin %s compiled for DFHack %s, running DFHack %s\n", + { + std::string msg = stl_sprintf("Warning: Plugin %s compiled for DFHack %s, running DFHack %s\n", *plug_name, plug_git_desc, dfhack_git_desc); + con << msg; + cerr << msg; + } } else con.printerr("Warning: Plugin %s missing git information\n", *plug_name); From dba7df7ab8ba562726f10f6b9a5f6312e0637b70 Mon Sep 17 00:00:00 2001 From: lethosor Date: Sun, 2 Aug 2020 23:10:35 -0400 Subject: [PATCH 06/16] Add "delete word" support to Console-posix --- docs/changelog.txt | 1 + library/Console-posix.cpp | 24 ++++++++++++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/docs/changelog.txt b/docs/changelog.txt index 8a45ba5b7..bf953d562 100644 --- a/docs/changelog.txt +++ b/docs/changelog.txt @@ -55,6 +55,7 @@ changelog.txt uses a syntax similar to RST, with a few special sequences: - Extended ``Filesystem::listdir_recursive`` to optionally make returned filenames relative to the start directory ## Internals +- Linux/macOS: Added console keybindings for deleting words (Alt+Backspace and Alt+d in most terminals) - Added support for splitting scripts into multiple files in the ``scripts/internal`` folder without polluting the output of `ls` ## Lua diff --git a/library/Console-posix.cpp b/library/Console-posix.cpp index 6fb1cbff3..595f50e97 100644 --- a/library/Console-posix.cpp +++ b/library/Console-posix.cpp @@ -541,6 +541,7 @@ namespace DFHack return Console::SHUTDOWN; } lock->lock(); + const int old_cursor = raw_cursor; /* Only autocomplete when the callback is set. It returns < 0 when * there was an error reading from fd. Otherwise it will return the * character that should be handled next. */ @@ -597,6 +598,29 @@ namespace DFHack { forward_word(); } + else if (seq[0] == 127 || seq[0] == 8) // backspace || ctrl-h + { + // delete word + back_word(); + if (old_cursor > raw_cursor) + { + yank_buffer = raw_buffer.substr(raw_cursor, old_cursor - raw_cursor); + raw_buffer.erase(raw_cursor, old_cursor - raw_cursor); + prompt_refresh(); + } + } + else if (seq[0] == 'd') + { + // delete word forward + forward_word(); + if (old_cursor < raw_cursor) + { + yank_buffer = raw_buffer.substr(old_cursor, raw_cursor - old_cursor); + raw_buffer.erase(old_cursor, raw_cursor - old_cursor); + raw_cursor = old_cursor; + prompt_refresh(); + } + } else if(seq[0] == '[') { if (!read_char(seq[1])) From 00a240fcaf55f6141153f97aba0ea63e6d2b95f3 Mon Sep 17 00:00:00 2001 From: lethosor Date: Tue, 4 Aug 2020 16:44:34 -0400 Subject: [PATCH 07/16] Update scripts (dfhack/scripts#114) --- scripts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts b/scripts index a50a72a14..70ce0a12b 160000 --- a/scripts +++ b/scripts @@ -1 +1 @@ -Subproject commit a50a72a143cab62348909c3568ddbe63745e5451 +Subproject commit 70ce0a12bc0eb14b3782abe7033a6d2dd31863fe From 2b26117685dbcab50106a46b6a05e71f4f338ff4 Mon Sep 17 00:00:00 2001 From: Myk Taylor Date: Wed, 5 Aug 2020 15:44:00 -0700 Subject: [PATCH 08/16] update quickfort docs and configs --- data/blueprints/README.md | 15 + data/blueprints/README.txt | 14 - data/quickfort/aliases-common.txt | 497 ++++++++++++++++++++------ dfhack-config/quickfort/aliases.txt | 97 +++-- dfhack-config/quickfort/quickfort.txt | 26 +- 5 files changed, 501 insertions(+), 148 deletions(-) create mode 100644 data/blueprints/README.md delete mode 100644 data/blueprints/README.txt diff --git a/data/blueprints/README.md b/data/blueprints/README.md new file mode 100644 index 000000000..d81f0e3b4 --- /dev/null +++ b/data/blueprints/README.md @@ -0,0 +1,15 @@ +This directory is for quickfort blueprints. You can apply them to your fortress +map with the DFHack +[quickfort script](https://docs.dfhack.org/en/stable/docs/_auto/base.html#quickfort). + +You can create blueprints by hand or by using any spreadsheet application, +saving them as .xlsx or .csv files. You can also build your plan "for real" in +Dwarf Fortress, and then export your map using the DFHack +[blueprint plugin](https://docs.dfhack.org/en/stable/docs/Plugins.html#blueprint) +for later replay in a different fort. + +DFHack blueprints are compatible with the original Quickfort 2.0 syntax. If you +have existing blueprints that worked with https://github.com/joelpt/quickfort, +then they should work just fine in DFHack quickfort. + +There are many ready-to-use examples of blueprints in the library subfolder. diff --git a/data/blueprints/README.txt b/data/blueprints/README.txt deleted file mode 100644 index 2096476c5..000000000 --- a/data/blueprints/README.txt +++ /dev/null @@ -1,14 +0,0 @@ -This directory is for quickfort blueprints. You can apply them to your fortress -map with the DFHack quickfort plugin. See -https://docs.dfhack.org/en/stable/docs/Scripts.html#quickfort for details. - -You can create blueprints by hand or by using any spreadsheet application, -saving them as .xlsx or .csv files. You can also build your plan "for real" in -Dwarf Fortress, and then export your map using the DFHack blueprint for later -replay in a different fort. See -https://docs.dfhack.org/en/stable/docs/Plugins.html#blueprint for more info. - -DFHack blueprints follow the original Quickfort 2.0 syntax. See -https://github.com/joelpt/quickfort for joelpt's excellent documentation. - -There are many ready-to-use examples of blueprints in the library subfolder. diff --git a/data/quickfort/aliases-common.txt b/data/quickfort/aliases-common.txt index b4e19c782..09bb7e3f0 100644 --- a/data/quickfort/aliases-common.txt +++ b/data/quickfort/aliases-common.txt @@ -1,135 +1,428 @@ -# quickfort aliases common baseline configuration file +# Common baseline for aliases for quickfort query mode blueprints. # -# Defines custom keycode shortcuts for blueprints. Please DO NOT EDIT this file -# directly. Instead, custom aliases should be added to -# dfhack-config/quickfort/aliases.txt. +# Please DO NOT EDIT this file directly. Instead, custom aliases should be added +# to dfhack-config/quickfort/aliases.txt. See that file for syntax +# documentation. # -# Syntax: -# aliasname: keystrokes -# -# Special keys: -# {Right}, {Left}, {Up}, {Down}, >, < move the DF cursor -# {/}, {*}, {+}, {-} can be used to navigate some DF menus -# {Enter}, +{Enter}, {ExitMenu} - Enter, Shift+Enter, and Escape, respectively -# {Wait} pauses playback briefly -# -# Special keys can be repeated by adding a number inside the curly braces, for -# example: {Down 5} +# The aliases in this file were tested in DF 0.47.04 on 2020 Jul 18. # -# Some shorthand: -# & expands to {Enter} -# @ expands to +{Enter} -# ^ expands to {ExitMenu} -# % expands to {Wait} +# The aliases are generally split into three categories: +# 1) The aliases that name a type disables everything else for that stockpile +# category and enable only that type. For example, "preparedfood" enables +# prepared food and disables all other types of food. +# 2) The aliases that start with "forbid" only forbid (or toggle) the named type +# and leave the rest of the stockpile untouched. +# 3) The aliases that start with "permit" only permit (or toggle) the named type +# and leave the rest of the stockpile untouched. # -# The aliases in this file were tested in DF 0.47.04 on 2020 Jul 18. +# Aliases that don't fit into those two categories have comments explaining +# their usage. + + +######################################## +# general purpose stockpile adjustments +######################################## + +linksonly: a +nocontainers: CE + +# for configuring stockpiles to give to other nearby stockpiles/workshops +give2up: g{Up 2}& +give2down: g{Down 2}& +give2left: g{Left 2}& +give2right: g{Right 2}& +give10up: g{Up 10}& +give10down: g{Down 10}& +give10left: g{Left 10}& +give10right: g{Right 10}& + +# use to toggle a sequence of stockpile options. for example: {togglesequence 5} +togglesequence: &{Down} +togglesequence2: &{Down 2} +enablesequence: e{Down} + +# Enables everything but corpses and refuse. Refuse is excluded since otherwise +# clothes and armor in this quantum stockpile will rot away. If you want bones +# in your quantum stockpile, apply this alias to a refuse stockpile (but don't +# put useful clothes or armor in there!) +quantum: {linksonly}{nocontainers}{enableanimals}{enablefood}{furnitureprefix}{enablestone}{enableammo}{enablecoins}{enablebars}{enablegems}{enablefinishedgoods}{enableleather}{enablecloth}{enablewood}}{enableweapons}{enablearmor}{enablesheet} + +# Run one of the quantumstopfrom* aliases over a track stop that is set to dump +# into a quantum stockpile. The alias will set up the stop to accept all types +# (the actual types stored in the quantum stockpile is controlled by the feeder +# stockpile) and link the indicated adjacent feeder stockpile. All you need to +# do afterwards is assign a vehicle to the stop (and optionally give the route a +# name). The track stop does not need to be constructed yet, but the stockpile +# needs to be in place so we can link to it. +quantumstopprefix: ^hrs&xxx&{enablesequence 17}^ +quantumstopfromeast: {quantumstopprefix}s{Right}p^{Left}^q +quantumstopfromsouth: {quantumstopprefix}s{Down}p^{Up}^q +quantumstopfromwest: {quantumstopprefix}s{Left}p^{Right}^q +quantumstopfromnorth: {quantumstopprefix}s{Up}p^{Down}^q + + +################################## +# animal stockpile adjustments +################################## + +animalsprefix: s +enableanimals: {animalsprefix}e^ +disableanimals: {animalsprefix}d^ + +# enables only the specified type (and disables everything else) +cages: {animalsprefix}bu^ +traps: {animalsprefix}bj^ + +# forbids specific items in an already-configured stockpile +forbidcages: {animalsprefix}u^ +forbidtraps: {animalsprefix}j^ + ################################## # food stockpile adjustments ################################## -seeds: s{Down}deb{Right}{Down 9}p^ -noseeds: s{Down}dea{Right}{Down 9}f^ -booze: s{Down}deb{Right}{Down 5}p{Down}p^ -food: s{Down}dea{Right}{Down 5}f{Down}f{Down 3}f^ -plants: s{Down}deb{Right}{Down 4}p^ +foodprefix: s{Down} +enablefood: {foodprefix}e^ +disablefood: {foodprefix}d^ + +preparedfood: {foodprefix}bu^ +unpreparedfish: {foodprefix}b{Right}{Down 2}p^ +plants: {foodprefix}b{Right}{Down 4}p^ +booze: {foodprefix}b{Right}{Down 5}p{Down}p^ +seeds: {foodprefix}b{Right}{Down 9}p^ +dye: {foodprefix}b{Right}{Down 11}{Right}{Down 28}{togglesequence 4}^ +tallow: {foodprefix}b{Right}{Down 13}{Right}{Down}{togglesequence2 811}^ +miscliquid: {foodprefix}b{Right}{Down 18}p^ + +forbidpreparedfood: {foodprefix}u^ +forbidunpreparedfish: {foodprefix}{Right}{Down 2}f^ +forbidplants: {foodprefix}{Right}{Down 4}f^ +forbidbooze: {foodprefix}{Right}{Down 5}f{Down}f^ +forbidseeds: {foodprefix}{Right}{Down 9}f^ +forbiddye: {foodprefix}{Right}{Down 11}{Right}{Down 28}{togglesequence 4}^ +forbidtallow: {foodprefix}{Right}{Down 13}{Right}{Down}{togglesequence2 811}^ +forbidmiscliquid: {foodprefix}{Right}{Down 18}f^ + +permitpreparedfood: {forbidpreparedfood} +permitunpreparedfish: {foodprefix}{Right}{Down 2}p^ +permitplants: {foodprefix}{Right}{Down 4}p^ +permitbooze: {foodprefix}{Right}{Down 5}p{Down}p^ +permitseeds: {foodprefix}{Right}{Down 9}p^ +permitdye: {forbiddye} +permittallow: {forbidtallow} +permitmiscliquid: {foodprefix}{Right}{Down 18}p^ + +# enables everything but seeds +noseeds: {disablefood}{enablefood}{forbidseeds} + +# enables all food except for the types listed above +food: {noseeds}{forbidpreparedfood}{forbidunpreparedfish}{forbidplants}{forbidbooze}{forbiddye}{forbidtallow}{forbidmiscliquid} + ################################## -# refuse stockpile adjustments +# furniture stockpile adjustments ################################## -corpses: s{Down 4}deb{Right 2}&{Down 2}&{Left}{Down}p{Down}p^ -bones: s{Down 4}deb{Right}{Down 3}p{Down}p^ -rawhides: s{Down 4}deb{Right 2}{Down}&^ -tannedhides: s{Down 4}deb{Right 2}{Down 53}&^ +furnitureprefix: s{Down 2} +enablefurniture: {furnitureprefix}e^ +disablefurniture: {furnitureprefix}d^ + +pots: {furnitureprefix}de{Right}f{Right}{Up 5}&^ +bags: {furnitureprefix}de{Right}f{Right}{Up 10}&{Left}{Down}f{Down}f{Down}f{Right}{Down}&{Down 6}&{Down}&{Down 6}&^ +buckets: {furnitureprefix}de{Right}f{Right}{Up 12}&^ +sand: {furnitureprefix}de{Right}f{Right}{Up}&^ + + +########################################### +# corpses and refuse stockpile adjustments +########################################### + +corpsesprefix: s{Down 3} +enablecorpses: {corpsesprefix}e^ +disablecorpses: {corpsesprefix}d{Up}d^ + +refuseprefix: s{Down 4} +enablerefuse: {refuseprefix}e^ +disablerefuse: {refuseprefix}d^ + +# bodyparts include remains/corpses and rotten rawhdes +bodyparts: {refuseprefix}b{Right 2}&{Down 2}&{Left}{Down}p{Down}p^ +rawhides: {refuseprefix}b{Right 2}{Down}&^ +tannedhides: {refuseprefix}b{Right 2}{Down 53}&^ +skulls: {refuseprefix}b{Right}{Down 3}p^ +bones: {refuseprefix}b{Right}{Down 4}p^ +shells: {refuseprefix}b{Right}{Down 5}p^ +teeth: {refuseprefix}b{Right}{Down 6}p^ +horns: {refuseprefix}b{Right}{Down 7}p^ +hair: {refuseprefix}b{Right}{Down 8}p^ +craftrefuse: {skulls}{permitbones}{permitshells}{permitteeth}{permithorns}{permithair} + +forbidbodyparts: {refuseprefix}{Right 2}&{Down 2}&{Left}{Down}f{Down}f^ +forbidrawhides: {refuseprefix}{Right 2}{Down}&^ +forbidtannedhides: {refuseprefix}{Right 2}{Down 53}&^ +forbidskulls: {refuseprefix}{Right}{Down 3}f^ +forbidbones: {refuseprefix}{Right}{Down 4}f^ +forbidshells: {refuseprefix}{Right}{Down 5}f^ +forbidteeth: {refuseprefix}{Right}{Down 6}f^ +forbidhorns: {refuseprefix}{Right}{Down 7}f^ +forbidhair: {refuseprefix}{Right}{Down 8}f^ +forbidcraftrefuse: {forbidskulls}{forbidbones}{forbidshells}{forbidteeth}{forbidhorns}{forbidhair} + +permitbodyparts: {refuseprefix}{Right 2}&{Down 2}&{Left}{Down}p{Down}p^ +permitrawhides: {forbidrawhides} +permittannedhides: {forbidtannedhides} +permitskulls: {refuseprefix}{Right}{Down 3}p^ +permitbones: {refuseprefix}{Right}{Down 4}p^ +permitshells: {refuseprefix}{Right}{Down 5}p^ +permitteeth: {refuseprefix}{Right}{Down 6}p^ +permithorns: {refuseprefix}{Right}{Down 7}p^ +permithair: {refuseprefix}{Right}{Down 8}p^ +permitcraftrefuse: {permitskulls}{permitbones}{permitshells}{permitteeth}{permithorns}{permithair} + ################################## # stone stockpile adjustments ################################## -metal: s{Down 5}deb{Right}p^ -nometal: s{Down 5}dea{Right}f^ -bauxite: s{Down 5}deb{Right}{Down 2}{Right}{Down 42}&^ +stoneprefix: s{Down 5} +enablestone: {stoneprefix}e^ +disablestone: {stoneprefix}d^ + +metal: {stoneprefix}b{Right}p^ +iron: {stoneprefix}b{Right}{Right}&{Down}&{Down 13}&^ +economic: {stoneprefix}b{Right}{Down}p^ +flux: {stoneprefix}b{Right}{Down}{Right}{togglesequence 4}{Down 4}&^ +plaster: {stoneprefix}b{Right}{Down}{Right}{Down 6}&{Down 3}{togglesequence 3}^ +coalproducing: {stoneprefix}b{Right}{Down}{Right}{Down 4}{togglesequence 2}^ +otherstone: {stoneprefix}b{Right}{Down 2}p^ +bauxite: {stoneprefix}b{Right}{Down 2}{Right}{Down 42}&^ +clay: {stoneprefix}b{Right}{Down 3}p^ + +forbidmetal: {stoneprefix}{Right}f^ +forbidiron: {stoneprefix}{Right}{Right}&{Down}&{Down 13}&^ +forbideconomic: {stoneprefix}{Right}{Down}f^ +forbidflux: {stoneprefix}{Right}{Down}{Right}{togglesequence 4}{Down 4}&^ +forbidplaster: {stoneprefix}{Right}{Down}{Right}{Down 6}&{Down 3}{togglesequence 3}^ +forbidcoalproducing: {stoneprefix}{Right}{Down}{Right}{Down 4}{togglesequence 2}^ +forbidotherstone: {stoneprefix}{Right}{Down 2}f^ +forbidbauxite: {stoneprefix}{Right}{Down 2}{Right}{Down 42}&^ +forbidclay: {stoneprefix}{Right}{Down 3}f^ + +permitmetal: {stoneprefix}{Right}p^ +permitiron: {forbidiron} +permiteconomic: {stoneprefix}{Right}{Down}p^ +permitflux: {forbidflux} +permitplaster: {forbidplaster} +permitcoalproducing: {forbidcoalproducing} +permitotherstone: {stoneprefix}{Right}{Down 2}p^ +permitbauxite: {forbidbauxite} +permitclay: {stoneprefix}{Right}{Down 3}p^ + + +################################## +# ammo stockpile adjustments +################################## + +ammoprefix: s{Down 6} +enableammo: {ammoprefix}e^ +disableammo: {ammoprefix}d^ + +bolts: {ammoprefix}a{Right 2}{Down}{togglesequence 2}^ + +forbidmetalbolts: {ammoprefix}{Right}{Down}f^ +forbidwoodenbolts: {ammoprefix}{Right}{Down 2}{Right}&^ +forbidbonebolts: {ammoprefix}{Right}{Down 2}{Right}{Down}&^ + + +################################## +# bar stockpile adjustments +################################## + +barsprefix: s{Down 8} +enablebars: {barsprefix}e^ +disablebars: {barsprefix}d^ + +bars: {barsprefix}b{Right}p{Down}p^ +metalbars: {barsprefix}b{Right}p^ +ironbars: {barsprefix}b{Right 2}&^ +steelbars: {barsprefix}b{Right 2}{Down 8}&^ +pigironbars: {barsprefix}b{Right 2}{Down 9}&^ +otherbars: {barsprefix}b{Right}{Down}p^ +coal: {barsprefix}b{Right}{Down}{Right}&^ +potash: {barsprefix}b{Right}{Down}{Right}{Down}&^ +ash: {barsprefix}b{Right}{Down}{Right}{Down 2}&^ +pearlash: {barsprefix}b{Right}{Down}{Right}{Down 3}&^ +soap: {barsprefix}b{Right}{Down}{Right}{Down 4}&^ +blocks: {barsprefix}b{Down 2}p{Down}p{Down}p^ + +forbidbars: {barsprefix}{Right}f{Down}f^ +forbidmetalbars: {barsprefix}{Right}f^ +forbidironbars: {barsprefix}{Right 2}&^ +forbidsteelbars: {barsprefix}{Right 2}{Down 8}&^ +forbidpigironbars: {barsprefix}{Right 2}{Down 9}&^ +forbidotherbars: {barsprefix}{Right}{Down}f^ +forbidcoal: {barsprefix}{Right}{Down}{Right}&^ +forbidpotash: {barsprefix}{Right}{Down}{Right}{Down}&^ +forbidash: {barsprefix}{Right}{Down}{Right}{Down 2}&^ +forbidpearlash: {barsprefix}{Right}{Down}{Right}{Down 3}&^ +forbidsoap: {barsprefix}{Right}{Down}{Right}{Down 4}&^ +forbidblocks: {barsprefix}{Down 2}f{Down}f{Down}f^ + + +################################## +# gem stockpile adjustments +################################## + +gemsprefix: s{Down 9} +enablegems: {gemsprefix}e^ +disablegems: {gemsprefix}d^ + +roughgems: {gemsprefix}b{Right}p^ +roughglass: {gemsprefix}b{Right}{Down}p^ +cutgems: {gemsprefix}b{Right}{Down 2}p^ +cutglass: {gemsprefix}b{Right}{Down 3}p^ +cutstone: {gemsprefix}b{Right}{Down 4}p^ + +forbidroughgems: {gemsprefix}{Right}f^ +forbidroughglass: {gemsprefix}{Right}{Down}f^ +forbidcutgems: {gemsprefix}{Right}{Down 2}f^ +forbidcutglass: {gemsprefix}{Right}{Down 3}f^ +forbidcutstone: {gemsprefix}{Right}{Down 4}f^ + + +####################################### +# finished goods stockpile adjustments +####################################### + +finishedgoodsprefix: s{Down 10} +enablefinishedgoods: {finishedgoodsprefix}e^ +disablefinishedgoods: {finishedgoodsprefix}d^ + +jugs: {finishedgoodsprefix}{Right}f{Right}{Up 2}&{Left}{Down 2}f{Down}f{Down}f^ -# Only use nobauxite on stone piles that you want to accept all "Other Stone" on. -# This alias works by permitting all "Other Stone",then forbidding just bauxite. -# Thus you wouldn't want to use this on a metal-only pile, for example. -nobauxite: s{Down 5}{Right}{Down 2}p{Right}{Down 42}&^ ################################## -# misc stockpile adjustments +# cloth ################################## -# Artifacts-only stockpile, usable on any type of existing pile. -artifacts: sd{Down}d{Down}d{Down}d{Down}d{Down}d{Down}d{Down}d{Down}d{Down}d{Down}d{Down}d{Down}d{Down}d{Down}d{Down}d{Down 4}deu{Right}{Up}f{Right}{Up}&{Left 2}{Down 4}e{Right}{Up}f{Right}{Up}&{Left 2}{Down 4}e{Right}{Up}f{Right}{Up}&{Left 2}{Down 4}e{Right}{Up}f{Right}{Up}&{Left 2}{Down}e{Right}{Up}f{Right}{Up}&{Left 2}^ +clothprefix: s{Down 12} +enablecloth: {clothprefix}e^ +disablecloth: {clothprefix}d^ -# Bans artifacts on any pile (or rather, allows items of any quality except Artifact quality). -# This should be safe to run on any type of pile. -noartifacts: sd{Down 2}{Right}{Up}fp{Right}{Up}&{Down 2}{Left 2}{Down 4}{Right}{Up}fp{Right}{Up}&{Down 2}{Left 2}{Down 4}{Right}{Up}fp{Right}{Up}&{Down 2}{Left 2}{Down 4}{Right}{Up}fp{Right}{Up}&{Down 2}{Left 2}{Down}{Right}{Up}fp{Right}{Up}&{Down 2}{Left 2}^ +thread: {clothprefix}b{Right}p{Down}p{Down}p^ +adamantinethread: {clothprefix}b{Right}{Down 3}p^ +cloth: {clothprefix}b{Right}{Down 4}p{Down}p{Down}p^ +adamantinecloth: {clothprefix}b{Right}{Up}p^ + + +################################## +# weapon stockpile adjustments +################################## + +weaponsprefix: s{Down 14} +enableweapons: {weaponsprefix}e^ +disableweapons: {weaponsprefix}d^ + +metalweapons: {forbidtrapcomponents}{forbidstoneweapons}{forbidotherweapons} +ironweapons: {metalweapons}{forbidweapons}{permitironweapons} +copperweapons: {metalweapons}{forbidweapons}{permitcopperweapons} +steelweapons: {metalweapons}{forbidweapons}{permitsteelweapons} + +forbidweapons: {weaponsprefix}{Right}f^ +forbidtrapcomponents: {weaponsprefix}{Right}{Down}f^ +forbidmetalweapons: {weaponsprefix}{Right}{Down 2}f^ +forbidstoneweapons: {weaponsprefix}{Right}{Down 3}f^ +forbidotherweapons: {weaponsprefix}{Right}{Down 4}f^ +forbidironweapons: {weaponsprefix}{Right}{Down 2}{Right}&^ +forbidcopperweapons: {weaponsprefix}{Right}{Down 2}{Right}{Down 3}&^ +forbidsteelweapons: {weaponsprefix}{Right}{Down 2}{Right}{Down 8}&^ + +permitweapons: {weaponsprefix}{Right}p^ +permittrapcomponents: {weaponsprefix}{Right}{Down}p^ +permitmetalweapons: {weaponsprefix}{Right}{Down 2}p^ +permitstoneweapons: {weaponsprefix}{Right}{Down 3}p^ +permitotherweapons: {weaponsprefix}{Right}{Down 4}p^ +permitironweapons: {forbidironweapons} +permitcopperweapons: {forbidcopperweapons} +permitsteelweapons: {forbidsteelweapons} + +masterworkweapons: {weaponsprefix}{Right}{Down 5}f{Right}{Down 5}&^ +artifactweapons: {weaponsprefix}{Right}{Down 5}f{Right}{Down 6}&^ + +forbidmasterworkweapons: {weaponsprefix}{Right}{Down 5}{Right}{Down 5}&^ +forbidartifactweapons: {weaponsprefix}{Right}{Down 5}{Right}{Down 6}&^ + +permitmasterworkweapons: {forbidmasterworkweapons} +permitartifactweapons: {forbidartifactweapons} + + +################################## +# armor stockpile adjustments +################################## + +armorprefix: s{Down 15} +enablearmor: {armorprefix}e^ +disablearmor: {armorprefix}d^ + +metalarmor: {forbidotherarmor} +otherarmor: {forbidmetalarmor} +ironarmor: {metalarmor}{forbidmetalarmor}{permitironarmor} +copperarmor: {metalarmor}{forbidmetalarmor}{permitcopperarmor} +steelarmor: {metalarmor}{forbidmetalarmor}{permitsteelarmor} + +forbidmetalarmor: {armorprefix}{Right}{Down 6}f^ +forbidotherarmor: {armorprefix}{Right}{Down 7}f^ +forbidironarmor: {armorprefix}{Right}{Down 6}{Right}&^ +forbidcopperarmor: {armorprefix}{Right}{Down 6}{Right}{Down 3}&^ +forbidsteelarmor: {armorprefix}{Right}{Down 6}{Right}{Down 8}&^ + +permitmetalarmor: {armorprefix}{Right}{Down 6}p^ +permitotherarmor: {armorprefix}{Right}{Down 7}p^ +permitironarmor: {forbidironarmor} +permitcopperarmor: {forbidcopperarmor} +permitsteelarmor: {forbidsteelarmor} + +masterworkarmor: {armorprefix}{Right}{Down 8}f{Right}{Down 5}&^ +artifactarmor: {armorprefix}{Right}{Down 8}f{Right}{Down 6}&^ + +forbidmasterworkarmor: {armorprefix}{Right}{Down 8}{Right}{Down 5}&^ +forbidartifactarmor: {armorprefix}{Right}{Down 8}{Right}{Down 6}&^ + +permitmasterworkarmor: {forbidmasterworkarmor} +permitartifactarmor: {forbidartifactarmor} + + +################################## +# others +################################## + +coinsprefix: s{Down 7} +enablecoins: {coinsprefix}e^ +disablecoins: {coinsprefix}d^ + +leatherprefix: s{Down 11} +enableleather: {leatherprefix}e^ +disableleather: {leatherprefix}d^ + +woodprefix: s{Down 13} +enablewood: {woodprefix}e^ +disablewood: {woodprefix}d^ + +sheetprefix: s{Down 16} +enablesheet: {sheetprefix}e^ +disablesheet: {sheetprefix}d^ -# Set a finished goods stockpile to crappy low-quality trade goods only. -# Position such a stockpile near fort entrances to (hopefully) let thieves steal low quality junk. -junkgoods: s{Down 10}de{Right 2}&{Down 5}&{Down}&{Down}&{Down}&{Down 8}&{Down 2}&{Down}&{Down}&{Down}&{Down}&{Down}&{Left}{Down}f{Right}{Down}&{Down}&{Left}{Down}f{Down 2}f{Right}&{Down}&^ ################################## # farm plots ################################## -# Sets a farm plot to grow the LAST type of seed in the list of available seeds, for all 4 seasons. -# The last seed is used because it's usually Plump helmet spawn, suitable for post-embark. If you -# only have 1 seed type, that'll be grown. -growlastcropall: a{/}&b{/}&c{/}&d{/}& +# Sets a farm plot to grow the LAST type of seed in the list of available seeds +# for all 4 seasons. The last seed is used because it's usually Plump helmet +# spawn, suitable for post-embark. If you only have 1 seed type, that'll be +# grown. +growlastcropall: a/&b/&c/&d/& # Like growlastcropall but grows the first one in the list instead. growfirstcropall: a&b&c&d& - -################################## -# mining tracks -################################## - -# The following aliases make it more convenient to build the various types of mine tracks. -# For example, to build a north/south track 'Track (NS)', you would put trackNS in a cell(s). -trackN: CT{Enter} -trackS: CT{+ 1}{Enter} -trackE: CT{+ 2}{Enter} -trackW: CT{+ 3}{Enter} -trackNS: CT{+ 4}{Enter} -trackNE: CT{+ 5}{Enter} -trackNW: CT{+ 6}{Enter} -trackSE: CT{+ 7}{Enter} -trackSW: CT{+ 8}{Enter} -trackEW: CT{+ 9}{Enter} -trackNSE: CT{+ 10}{Enter} -trackNSW: CT{+ 11}{Enter} -trackNEW: CT{+ 12}{Enter} -trackSEW: CT{+ 13}{Enter} -trackNSEW: CT{+ 14}{Enter} -trackrampN: CT{+ 15}{Enter} -trackrampS: CT{+ 15}{+ 1}{Enter} -trackrampE: CT{+ 15}{+ 2}{Enter} -trackrampW: CT{+ 15}{+ 3}{Enter} -trackrampNS: CT{+ 15}{+ 4}{Enter} -trackrampNE: CT{+ 15}{+ 5}{Enter} -trackrampNW: CT{+ 15}{+ 6}{Enter} -trackrampSE: CT{+ 15}{+ 7}{Enter} -trackrampSW: CT{+ 15}{+ 8}{Enter} -trackrampEW: CT{+ 15}{+ 9}{Enter} -trackrampNSE: CT{+ 15}{+ 10}{Enter} -trackrampNSW: CT{+ 15}{+ 11}{Enter} -trackrampNEW: CT{+ 15}{+ 12}{Enter} -trackrampSEW: CT{+ 15}{+ 13}{Enter} -trackrampNSEW: CT{+ 15}{+ 14}{Enter} - -# Aliases for building track rollers; use e.g. rollerHqqq to make a low-speed horizontal roller -rollerH: Mrs -rollerV: Mr -rollerNS: Mr -rollerSN: Mrss -rollerEW: Mrs -rollerWE: Mrsss - -# Aliases for building track stops that dump in each of the four directions -trackstopN: CSd -trackstopS: CSdd -trackstopE: CSddd -trackstopW: CSdddd diff --git a/dfhack-config/quickfort/aliases.txt b/dfhack-config/quickfort/aliases.txt index 52cdb2893..05f2833f5 100644 --- a/dfhack-config/quickfort/aliases.txt +++ b/dfhack-config/quickfort/aliases.txt @@ -1,30 +1,83 @@ -# quickfort aliases configuration file +# aliases for quickfort query mode blueprints # -# Defines custom keycode shortcuts for blueprints. Definitions in this file take -# precedence over any definitions in the baseline aliases configuration file at -# hack/data/quickfort/aliases-common.txt. See that file for aliases that are -# already defined. +# This file defines custom keycode shortcuts for query mode blueprints. +# Definitions in this file take precedence over any definitions in the baseline +# aliases configuration file at hack/data/quickfort/aliases-common.txt. See that +# file for aliases that are already defined. # -# This file can be used to simplify repetitive tasks, such as building minecart -# tracks or adjusting a food stockpile to accept seeds only. Making new aliases -# is just a matter of mimicking the keys used to navigate through the menus and -# select options. +# If possible, build on the baseline aliases when defining your own aliases. If +# the DF UI screens change, updated baseline aliases may allow your aliases to +# automatically adapt to the new UI. For example, if you create an alias to +# modify particular furniture stockpile settings, start your alias with +# "{furnitureprefix}" instead of manually writing "s{Down 2}". Then, if the +# location of the furniture setting changes, your alias will automatically +# inherit the updated position when DFHack is updated. # -# Syntax: +# Aliases simplify repetitive tasks, such as configuring workshop profiles or +# adjusting a food stockpile to accept only seeds. Making new aliases is just a +# matter of mimicking the keys used to navigate through the menus and select +# options. Use the aliases in your blueprint spreadsheets by writing an alias by +# itself in a cell, like "nocontainers", or reference an alias in a larger +# sequence by enclosing in in curly brackets, like "{nocontainers}{linksonly}" +# +# For example, say you have the following build and place blueprints: +# +# #build start(4;1;upper left corner of stockpile) mason stockpile +# ~, ~, ~, `, `, ` +# ~, wm, ~, `, `, ` +# ~, ~, ~, `, `, ` +# +# #place start(4;1;upper left corner of stockpile) build mason +# ~, ~, ~, s, s, s +# ~, ~, ~, s, s, s +# ~, ~, ~, s, s, s +# +# and you want to configure the stockpile to hold only non-economic ("other") +# stone and to give to the adjacent mason workshop. You could write the +# keystrokes directly: +# +# #query start(4;1;upper left corner of stockpile) configure mason +# ~, ~, ~, s{Down 5}deb{Right}{Down 2}p^, `, ` +# ~, ~, ~, g{Left 2}&, `, ` +# ~, ~, ~, `, `, ` +# +# or you could use alias names: +# +# #query start(4;1;upper left corner of stockpile) configure mason +# ~, ~, ~, otherstone, `, ` +# ~, ~, ~, give2left, `, ` +# ~, ~, ~, `, `, ` +# +# +# The syntax for defining aliases is: # aliasname: keystrokes # -# Special keys: -# {Right}, {Left}, {Up}, {Down}, >, < move the DF cursor -# {/}, {*}, {+}, {-} can be used to navigate some DF menus -# {Enter}, +{Enter}, {ExitMenu} - Enter, Shift+Enter, and Escape, respectively -# {Wait} pauses playback briefly +# Where aliasname is at least two letters or digits long and keystrokes are +# whatever you would type into the DF UI. A keystroke can also be a named +# keycode from the DF interface definition file (data/init/interface.txt), +# enclosed in curly brackets like an alias, like: "{Right}" or "{Enter}". In +# order to avoid naming conflicts between aliases and keycodes, the convention +# is to start aliases with a lowercase letter. You can add spaces in between +# keystrokes to make them easier to read. Spaces in keystroke sequences will be +# ignored. To insert a literal space, use "{Space}" # -# Special keys can be repeated by adding a number inside the curly braces, for -# example: {Down 5} +# Anything enclosed within curly brackets can also have a number after it, +# indicating how many times that alias or keycode should be repeated. For +# example: "{buildblocks 9}" or "{Down 5}". # -# Some shorthand: +# Ctrl, Alt, and Shift modifiers can be specified for the next keycode by adding +# them as keycodes. For example, Alt-h is written as "{Alt}h". +# +# Some frequently-used keystrokes are assigned shorthand characters. Think of +# them as single-character aliases that don't need to be surrounded in curly +# brackets: # & expands to {Enter} -# @ expands to +{Enter} -# ^ expands to {ExitMenu} -# % expands to {Wait} - +# @ expands to {Shift}{Enter} +# + expands to {Shift} +# ~ expands to {Alt} +# ! expands to {Ctrl} +# ^ expands to {ESC} +# +# If you need literal verisons of the shorthand characters, surround them in +# curly brackets, for example: "{+}" +# diff --git a/dfhack-config/quickfort/quickfort.txt b/dfhack-config/quickfort/quickfort.txt index 683c1da7d..8a30124a1 100644 --- a/dfhack-config/quickfort/quickfort.txt +++ b/dfhack-config/quickfort/quickfort.txt @@ -1,20 +1,26 @@ # quickfort main configuration file # # Set startup defaults for the quickfort script in this file. Settings can be -# dynamically overridden in the active session with the `quickfort set` command. +# temporarily overridden in the active session with the `quickfort set` command. +# +# If you have edited this file but want to revert to "factory defaults", delete +# this file and a fresh one will be copied from +# dfhack-config/default/quickfort/qickfort.txt the next time you start DFHack. -# Directory to search for blueprints. Can be set to an absolute or relative +# Directory tree to search for blueprints. Can be set to an absolute or relative # path. If set to a relative path, resolves to a directory under the DF folder. blueprints_dir=blueprints # Set to "true" or "false". If true, will designate dig blueprints in marker -# mode. If false, only cells with dig codes prefixed with ``m`` will be -# designated in marker mode. +# mode. If false, only cells with dig codes explicitly prefixed with an "m" will +# be designated in marker mode. force_marker_mode=false -# Allows you to manually select building materials for each -# building/construction when running (or creating orders for) build blueprints. -# Materials in selection dialogs are ordered according to preferences in -# materials.txt. If false, will only prompt for materials that have :labels. -# See https://github.com/joelpt/quickfort#manual-material-selection for details. -force_interactive_build=false +# Set to the maximum number of resources you want assigned to stockpiles of the +# relevant types. Set to -1 for DF defaults (number of stockpile tiles for +# stockpiles that take barrels and bins, 1 wheelbarrow for stone stockpiles). +# The default here for wheelbarrows is 0 since using wheelbarrows normally +# *decreases* the efficiency of your fort. +stockpiles_max_barrels=-1 +stockpiles_max_bins=-1 +stockpiles_max_wheelbarrows=0 From 02c0a6c8f64bea5d823f3fc9f271fd25761c7d6c Mon Sep 17 00:00:00 2001 From: lethosor Date: Thu, 6 Aug 2020 00:53:06 -0400 Subject: [PATCH 09/16] Update getplants to use new plant_raw.material_defs layout a9f219baf9dda6d8cc300251fc040420e84bbc49 applied to #1564 --- plugins/getplants.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/plugins/getplants.cpp b/plugins/getplants.cpp index 2f12029f6..cfe499a9b 100644 --- a/plugins/getplants.cpp +++ b/plugins/getplants.cpp @@ -264,7 +264,7 @@ bool picked(const df::plant *plant, int32_t growth_subtype) { bool designate(const df::plant *plant, bool farming) { df::plant_raw *plant_raw = world->raws.plants.all[plant->material]; - const DFHack::MaterialInfo basic_mat = DFHack::MaterialInfo(plant_raw->material_defs.type_basic_mat, plant_raw->material_defs.idx_basic_mat); + const DFHack::MaterialInfo basic_mat = DFHack::MaterialInfo(plant_raw->material_defs.type[plant_material_def::basic_mat], plant_raw->material_defs.idx[plant_material_def::basic_mat]); if (basic_mat.material->flags.is_set(material_flags::EDIBLE_RAW) || basic_mat.material->flags.is_set(material_flags::EDIBLE_COOKED)) @@ -309,8 +309,8 @@ bool designate(const df::plant *plant, bool farming) { { for (size_t k = 0; growth_mat.material->reaction_product.material.mat_type.size(); k++) { - if (growth_mat.material->reaction_product.material.mat_type[k] == plant_raw->material_defs.type_seed && - growth_mat.material->reaction_product.material.mat_index[k] == plant_raw->material_defs.idx_seed) + if (growth_mat.material->reaction_product.material.mat_type[k] == plant_raw->material_defs.type[plant_material_def::seed] && + growth_mat.material->reaction_product.material.mat_index[k] == plant_raw->material_defs.idx[plant_material_def::seed]) { seedSource = true; break; From 7c2af344a1e10f93c966da3b2a4a02a76544677e Mon Sep 17 00:00:00 2001 From: lethosor Date: Thu, 6 Aug 2020 02:04:23 -0400 Subject: [PATCH 10/16] Update changelog (#1564) and xml (dfhack/df-structures#400) --- docs/changelog.txt | 1 + library/xml | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/changelog.txt b/docs/changelog.txt index bf953d562..95d18693f 100644 --- a/docs/changelog.txt +++ b/docs/changelog.txt @@ -40,6 +40,7 @@ changelog.txt uses a syntax similar to RST, with a few special sequences: - Fixed a segfault when attempting to start a headless session with a graphical PRINT_MODE setting - Fixed an issue with the macOS launcher failing to un-quarantine some files - Linux: fixed ``dfhack.getDFPath()`` (Lua) and ``Process::getPath()`` (C++) to always return the DF root path, even if the working directory has changed +- `getplants`: fixed issues causing plants to be collected even if they have no growths (or unripe growths) - `labormanager`: fixed handling of new jobs in 0.47 - `embark-assistant`: fixed a couple of incursion handling bugs. - Fixed ``Units::isEggLayer``, ``Units::isGrazer``, ``Units::isMilkable``, ``Units::isTrainableHunting``, ``Units::isTrainableWar``, and ``Units::isTamable`` ignoring the unit's caste diff --git a/library/xml b/library/xml index ecd6bcc9e..9fca46ccc 160000 --- a/library/xml +++ b/library/xml @@ -1 +1 @@ -Subproject commit ecd6bcc9ed67c62fa605561b27574467df792342 +Subproject commit 9fca46ccca28e0948014b9d56a096ad7343473f1 From bdb9433822685b519d26144be805acf0b74be75a Mon Sep 17 00:00:00 2001 From: lethosor Date: Thu, 6 Aug 2020 02:30:17 -0400 Subject: [PATCH 11/16] Update/expand Contributing.rst regarding pull requests --- docs/Contributing.rst | 45 ++++++++++++++++++++++++++++++++++--------- 1 file changed, 36 insertions(+), 9 deletions(-) diff --git a/docs/Contributing.rst b/docs/Contributing.rst index ab92d0571..0619e8ba3 100644 --- a/docs/Contributing.rst +++ b/docs/Contributing.rst @@ -13,7 +13,7 @@ Contributing Code ================= Several things should be kept in mind when contributing code to DFHack. -Code Format +Code format ----------- * Four space indents for C++. Never use tabs for indentation in any language. * LF (Unix style) line terminators @@ -26,18 +26,45 @@ Code Format * #includes should be sorted. C++ libraries first, then dfhack modules, then df structures, then local includes. Within each category they should be sorted alphabetically. -How to get new code into DFHack +Pull request guidelines +----------------------- +* Pull requests should be based on (and submitted to) the default branch of the + relevant repo, which is the branch you see when you access the repo on GitHub + or clone the repo without specifying a branch. As of 0.47.04-r1, this is + ``develop`` for the main DFHack repo and ``master`` for other repos. +* Use a new branch for each feature or bugfix so that your changes can be merged + independently (i.e. not the ``master`` or ``develop`` branch of your fork). + + * An exception: for a collection of small miscellaneous changes (e.g. + structures research), one branch instead of many small branches is fine. It + is still preferred that this branch be dedicated to this purpose, i.e. not + ``master`` or ``develop``. Your pull request may be merged at any point + unless you indicate that it isn't ready (see below), but you can continue to + push to the same branch and open new pull requests as needed. + +* Try to keep pull requests relatively small so that they are easier to review + and merge. + + * If you expect to make a large number of related additions or changes (e.g. + adding a large new plugin), multiple PRs are preferred, as they allow more + frequent (and easier) feedback. If development of this feature is expected + to take a while, we may create a dedicated branch to merge your pull + requests into instead of the repo's default branch. + +* If you plan to make additional changes to your pull request in the near + future, or if it isn't quite ready to be merged, mark it as a + `draft pull request `_ + or add "WIP" to the title. Otherwise, your pull request may be reviewed and/or + merged prematurely. + +General contribution guidelines ------------------------------- -* Submit pull requests to the ``develop`` branch, not the ``master`` branch. - (The ``master`` branch always points at the most recent release) -* Use a new branch for each feature or bugfix so that your changes can be merged independently - (i.e. not the master or develop branch of your fork). -* If possible, compile on multiple platforms when changing anything that compiles -* It must pass CI - run ``python travis/all.py`` to check this. +* If convenient, compile on multiple platforms when changing anything that + compiles. Our CI should catch anything that fails to build, but checking in + advance can be faster. * Update documentation when applicable - see `docs-standards` for details. * Update ``changelog.txt`` and ``docs/Authors.rst`` when applicable. See `build-changelog` for more information on the changelog format. -* Create a GitHub pull request once finished * Submit ideas and bug reports as :issue:`issues on GitHub <>`. Posts in the forum thread can easily get missed or forgotten. * Work on :issue:`reported problems ` From 0c53b2b6c5e26899af7eaa1d7d6b44bf8672bed7 Mon Sep 17 00:00:00 2001 From: lethosor Date: Thu, 6 Aug 2020 22:30:29 -0400 Subject: [PATCH 12/16] Add do-job-now tweak Forum thread: http://www.bay12forums.com/smf/index.php?topic=176700 Original source: https://github.com/dlmarquis/dfhack/blob/dojobnow-r1/plugins/dojobnow.cpp Co-authored-by: dlmarquis --- docs/Authors.rst | 1 + docs/Plugins.rst | 1 + docs/changelog.txt | 1 + plugins/tweak/tweak.cpp | 6 +++++ plugins/tweak/tweaks/do-job-now.h | 43 +++++++++++++++++++++++++++++++ 5 files changed, 52 insertions(+) create mode 100644 plugins/tweak/tweaks/do-job-now.h diff --git a/docs/Authors.rst b/docs/Authors.rst index 55ecbb17c..31789aa52 100644 --- a/docs/Authors.rst +++ b/docs/Authors.rst @@ -110,6 +110,7 @@ Nikolay Amiantov abbradar nocico nocico Omniclasm OwnageIsMagic OwnageIsMagic +palenerd dlmarquis Patrik Lundell PatrikLundell Paul Fenwick pjf PeridexisErrant PeridexisErrant diff --git a/docs/Plugins.rst b/docs/Plugins.rst index 3a4133873..120dae1d4 100644 --- a/docs/Plugins.rst +++ b/docs/Plugins.rst @@ -305,6 +305,7 @@ Subcommands that persist until disabled or DF quits: :craft-age-wear: Fixes the behavior of crafted items wearing out over time (:bug:`6003`). With this tweak, items made from cloth and leather will gain a level of wear every 20 years. +:do-job-now: Adds a job priority toggle to the jobs list :embark-profile-name: Allows the use of lowercase letters when saving embark profiles :eggs-fertile: Displays a fertility indicator on nestboxes :farm-plot-select: Adds "Select all" and "Deselect all" options to farm plot menus diff --git a/docs/changelog.txt b/docs/changelog.txt index 95d18693f..e7a01f4fe 100644 --- a/docs/changelog.txt +++ b/docs/changelog.txt @@ -34,6 +34,7 @@ changelog.txt uses a syntax similar to RST, with a few special sequences: # Future ## New Tweaks +- `tweak` do-job-now: adds a job priority toggle to the jobs list - `tweak` reaction-gloves: adds an option to make reactions produce gloves in sets with correct handedness ## Fixes diff --git a/plugins/tweak/tweak.cpp b/plugins/tweak/tweak.cpp index 13e08f174..2c15c3903 100644 --- a/plugins/tweak/tweak.cpp +++ b/plugins/tweak/tweak.cpp @@ -86,6 +86,7 @@ #include "tweaks/civ-agreement-ui.h" #include "tweaks/condition-material.h" #include "tweaks/craft-age-wear.h" +#include "tweaks/do-job-now.h" #include "tweaks/eggs-fertile.h" #include "tweaks/embark-profile-name.h" #include "tweaks/farm-plot-select.h" @@ -200,6 +201,8 @@ DFhackCExport command_result plugin_init (color_ostream &out, std::vector *input) { + if (input->count(interface_key::CUSTOM_N)) { + df::job *job = vector_get(jobs, cursor_pos); + if (job) { + job->flags.bits.do_now = !job->flags.bits.do_now; + } + + return true; + } + + return false; + } + + DEFINE_VMETHOD_INTERPOSE(void, feed, (std::set *input)) { + if (!handleInput(input)) { + INTERPOSE_NEXT(feed)(input); + } + } + + DEFINE_VMETHOD_INTERPOSE(void, render, ()) { + INTERPOSE_NEXT(render)(); + int x = 32; + auto dim = Screen::getWindowSize(); + int y = dim.y - 2; + bool do_now = false; + + df::job *job = vector_get(jobs, cursor_pos); + if (job) { + do_now = job->flags.bits.do_now; + } + + OutputHotkeyString(x, y, (!do_now ? "Do job now!" : "Normal priority"), + interface_key::CUSTOM_N, false, x, COLOR_WHITE, COLOR_LIGHTRED); + } +}; + +IMPLEMENT_VMETHOD_INTERPOSE(do_job_now_hook, feed); +IMPLEMENT_VMETHOD_INTERPOSE(do_job_now_hook, render); From c7e4c724e848696b4854010f2b20bcfb9ecb3756 Mon Sep 17 00:00:00 2001 From: lethosor Date: Thu, 6 Aug 2020 22:34:39 -0400 Subject: [PATCH 13/16] Sort tweaks alphabetically --- docs/Plugins.rst | 6 +++++- plugins/tweak/tweak.cpp | 6 ++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/docs/Plugins.rst b/docs/Plugins.rst index 120dae1d4..6699163c2 100644 --- a/docs/Plugins.rst +++ b/docs/Plugins.rst @@ -291,6 +291,8 @@ One-shot subcommands: Subcommands that persist until disabled or DF quits: +.. comment: sort these alphabetically + :adamantine-cloth-wear: Prevents adamantine clothing from wearing out while being worn (:bug:`6481`). :advmode-contained: Works around :bug:`6202`, custom reactions with container inputs in advmode. The issue is that the screen tries to force you to select @@ -336,12 +338,14 @@ Subcommands that persist until disabled or DF quits: i.e. stop the rightmost list of the Positions page of the military screen from constantly resetting to the top. :nestbox-color: Fixes the color of built nestboxes +:reaction-gloves: Fixes reactions to produce gloves in sets with correct handedness (:bug:`6273`) :shift-8-scroll: Gives Shift-8 (or :kbd:`*`) priority when scrolling menus, instead of scrolling the map :stable-cursor: Saves the exact cursor position between t/q/k/d/b/etc menus of fortress mode. :stone-status-all: Adds an option to toggle the economic status of all stones :title-start-rename: Adds a safe rename option to the title screen "Start Playing" menu :tradereq-pet-gender: Displays pet genders on the trade request screen -:reaction-gloves: Fixes reactions to produce gloves in sets with correct handedness (:bug:`6273`) + +.. comment: sort these alphabetically .. _fix-armory: diff --git a/plugins/tweak/tweak.cpp b/plugins/tweak/tweak.cpp index 2c15c3903..237014209 100644 --- a/plugins/tweak/tweak.cpp +++ b/plugins/tweak/tweak.cpp @@ -183,6 +183,7 @@ DFhackCExport command_result plugin_init (color_ostream &out, std::vector Date: Thu, 6 Aug 2020 22:44:49 -0400 Subject: [PATCH 14/16] Use BUILDJOB_NOW key, dim text when no job is selected --- plugins/tweak/tweaks/do-job-now.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/plugins/tweak/tweaks/do-job-now.h b/plugins/tweak/tweaks/do-job-now.h index 74d4c36da..a498b1f8b 100644 --- a/plugins/tweak/tweaks/do-job-now.h +++ b/plugins/tweak/tweaks/do-job-now.h @@ -4,7 +4,7 @@ struct do_job_now_hook : public df::viewscreen_joblistst { typedef df::viewscreen_joblistst interpose_base; bool handleInput(std::set *input) { - if (input->count(interface_key::CUSTOM_N)) { + if (input->count(interface_key::BUILDJOB_NOW)) { df::job *job = vector_get(jobs, cursor_pos); if (job) { job->flags.bits.do_now = !job->flags.bits.do_now; @@ -34,8 +34,8 @@ struct do_job_now_hook : public df::viewscreen_joblistst { do_now = job->flags.bits.do_now; } - OutputHotkeyString(x, y, (!do_now ? "Do job now!" : "Normal priority"), - interface_key::CUSTOM_N, false, x, COLOR_WHITE, COLOR_LIGHTRED); + OutputHotkeyString(x, y, (!do_now ? "Do job now!" : "Reset priority"), + interface_key::BUILDJOB_NOW, false, x, job ? COLOR_WHITE : COLOR_DARKGREY, COLOR_LIGHTRED); } }; From 498fd9a1a67b2a609b912f911dd3848bb9ef4b00 Mon Sep 17 00:00:00 2001 From: lethosor Date: Thu, 6 Aug 2020 22:45:46 -0400 Subject: [PATCH 15/16] Flush plugin warning messages --- library/PluginManager.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/library/PluginManager.cpp b/library/PluginManager.cpp index db42c5c84..a1b1bd293 100644 --- a/library/PluginManager.cpp +++ b/library/PluginManager.cpp @@ -316,8 +316,8 @@ bool Plugin::load(color_ostream &con) { std::string msg = stl_sprintf("Warning: Plugin %s compiled for DFHack %s, running DFHack %s\n", *plug_name, plug_git_desc, dfhack_git_desc); - con << msg; - cerr << msg; + con << msg << flush; + cerr << msg << flush; } } else From 939e97caa0021c6782d99a1763f8052764b17c2f Mon Sep 17 00:00:00 2001 From: lethosor Date: Thu, 6 Aug 2020 22:46:21 -0400 Subject: [PATCH 16/16] Update scripts/list-agreements --- scripts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts b/scripts index 70ce0a12b..823d47c4d 160000 --- a/scripts +++ b/scripts @@ -1 +1 @@ -Subproject commit 70ce0a12bc0eb14b3782abe7033a6d2dd31863fe +Subproject commit 823d47c4d181ac5b754dce5d605f3e7f242aed26