diff --git a/docs/changelog.txt b/docs/changelog.txt index c2d958d28..df78568b5 100644 --- a/docs/changelog.txt +++ b/docs/changelog.txt @@ -38,11 +38,13 @@ changelog.txt uses a syntax similar to RST, with a few special sequences: ## Fixes -@ `nestboxes`: fixed bug causing nestboxes themselves to be forbidden, which prevented citizens from using them to lay eggs. Now only eggs are forbidden. - `autobutcher`: implemented work-around for Dwarf Fortress not setting nicknames properly, so that nicknames created in the in-game interface are detected & protect animals from being butchered properly. Note that nicknames for unnamed units are not currently saved by dwarf fortress - use ``enable fix/protect-nicks`` to fix any nicknames created/removed within dwarf fortress so they can be saved/reloaded when you reload the game. -- `seedwatch`: fix saving and loading of seed stock targets +-@ `seedwatch`: fix saving and loading of seed stock targets - `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 ## 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) ## Documentation diff --git a/docs/plugins/strangemood.rst b/docs/plugins/strangemood.rst index a5b2b6e1f..def862a4b 100644 --- a/docs/plugins/strangemood.rst +++ b/docs/plugins/strangemood.rst @@ -22,18 +22,18 @@ Examples Options ------- -``-force`` +``--force`` Ignore normal strange mood preconditions (no recent mood, minimum moodable population, artifact limit not reached, etc.). -``-unit`` +``--unit`` Make the strange mood strike the selected unit instead of picking one randomly. Unit eligibility is still enforced (unless ``-force`` is also specified). -``-type `` +``--type `` Force the mood to be of a particular type instead of choosing randomly based on happiness. Valid values are "fey", "secretive", "possessed", "fell", and "macabre". -``-skill `` +``--skill `` Force the mood to use a specific skill instead of choosing the highest moodable skill. Valid values are "miner", "carpenter", "engraver", "mason", "tanner", "weaver", "clothier", "weaponsmith", "armorsmith", "metalsmith", diff --git a/plugins/CMakeLists.txt b/plugins/CMakeLists.txt index 7d4ff760e..7940c3994 100644 --- a/plugins/CMakeLists.txt +++ b/plugins/CMakeLists.txt @@ -158,7 +158,7 @@ dfhack_plugin(showmood showmood.cpp) #dfhack_plugin(stockflow stockflow.cpp LINK_LIBRARIES lua) #add_subdirectory(stockpiles) #dfhack_plugin(stocks stocks.cpp) -#dfhack_plugin(strangemood strangemood.cpp) +dfhack_plugin(strangemood strangemood.cpp) dfhack_plugin(tailor tailor.cpp LINK_LIBRARIES lua) dfhack_plugin(tiletypes tiletypes.cpp Brushes.h LINK_LIBRARIES lua) #dfhack_plugin(title-folder title-folder.cpp) diff --git a/plugins/autochop.cpp b/plugins/autochop.cpp index 3a433f7a9..cb703cf47 100644 --- a/plugins/autochop.cpp +++ b/plugins/autochop.cpp @@ -857,12 +857,11 @@ static int autochop_getTreeCountsAndBurrowConfigs(lua_State *L) { for (auto &burrow : plotinfo->burrows.list) { int id = burrow->id; - if (watched_burrows_indices.count(id)) { - // push_burrow_config(L, watched_burrows[watched_burrows_indices[id]]); - emplace_bulk_burrow_config(L, burrow_config_map, watched_burrows[watched_burrows_indices[id]]); - } else { + if (watched_burrows_indices.count(id)) + emplace_bulk_burrow_config(L, burrow_config_map, + watched_burrows[watched_burrows_indices[id]]); + else emplace_bulk_burrow_config(L, burrow_config_map, id); - } } Lua::Push(L, burrow_config_map); diff --git a/plugins/lua/autochop.lua b/plugins/lua/autochop.lua index e9bad2eef..cda91b32d 100644 --- a/plugins/lua/autochop.lua +++ b/plugins/lua/autochop.lua @@ -100,13 +100,19 @@ function getTreeCountsAndBurrowConfigs() ret.burrow_configs = {} for idx,c in pairs(unparsed_burrow_configs) do - c.name = df.burrow.find(c.id).name + local burrow = df.burrow.find(c.id) + if not burrow then goto continue end + c.name = burrow.name + if #c.name == 0 then + c.name = ('Burrow %d'):format(c.id + 1) + end c.chop = c.chop ~= 0 c.clearcut = c.clearcut ~= 0 c.protect_brewable = c.protect_brewable ~= 0 c.protect_edible = c.protect_edible ~= 0 c.protect_cookable = c.protect_cookable ~= 0 table.insert(ret.burrow_configs, c) + ::continue:: end return ret end diff --git a/plugins/showmood.cpp b/plugins/showmood.cpp index abeb2e98e..79a733b7b 100644 --- a/plugins/showmood.cpp +++ b/plugins/showmood.cpp @@ -275,17 +275,29 @@ command_result df_showmood (color_ostream &out, vector & parameters) // count how many items of this type the crafter already collected { int count_got = 0; + int dimension_got = 0; + int divisor = 1; + bool has_dims = false; + if (item->item_type == item_type::BAR) { + divisor = 150; + has_dims = true; + } else if (item->item_type == item_type::CLOTH) { + divisor = 10000; + has_dims = true; + } for (size_t j = 0; j < job->items.size(); j++) { if(job->items[j]->job_item_idx == int32_t(i)) { - if (item->item_type == item_type::BAR || item->item_type == item_type::CLOTH) - count_got += job->items[j]->item->getTotalDimension(); - else - count_got += 1; + if (has_dims) + dimension_got += job->items[j]->item->getTotalDimension(); + count_got += 1; } } - out.print(", quantity %i (got %i)\n", item->quantity, count_got); + out.print(", got %i of %i", count_got, item->quantity/divisor); + if (has_dims) + out.print(" (%i of %i sub-units)", dimension_got, item->quantity); + out.print("\n"); } } } diff --git a/plugins/strangemood.cpp b/plugins/strangemood.cpp index f6dd1f747..b300eb795 100644 --- a/plugins/strangemood.cpp +++ b/plugins/strangemood.cpp @@ -80,7 +80,7 @@ df::job_skill getMoodSkill (df::unit *unit) { case job_skill::MINING: case job_skill::CARPENTRY: - case job_skill::DETAILSTONE: + case job_skill::ENGRAVE_STONE: case job_skill::MASONRY: case job_skill::TANNER: case job_skill::WEAVING: @@ -288,15 +288,15 @@ command_result df_strangemood (color_ostream &out, vector & parameters) { if(parameters[i] == "help" || parameters[i] == "?") return CR_WRONG_USAGE; - else if(parameters[i] == "-force") + else if(parameters[i] == "--force") force = true; - else if(parameters[i] == "-unit") + else if(parameters[i] == "--unit") { unit = DFHack::Gui::getSelectedUnit(out); if (!unit) return CR_FAILURE; } - else if (parameters[i] == "-type") + else if (parameters[i] == "--type") { i++; if (i == parameters.size()) @@ -320,7 +320,7 @@ command_result df_strangemood (color_ostream &out, vector & parameters) return CR_WRONG_USAGE; } } - else if (parameters[i] == "-skill") + else if (parameters[i] == "--skill") { i++; if (i == parameters.size()) @@ -333,7 +333,7 @@ command_result df_strangemood (color_ostream &out, vector & parameters) else if (parameters[i] == "carpenter") skill = job_skill::CARPENTRY; else if (parameters[i] == "engraver") - skill = job_skill::DETAILSTONE; + skill = job_skill::ENGRAVE_STONE; else if (parameters[i] == "mason") skill = job_skill::MASONRY; else if (parameters[i] == "tanner") @@ -549,9 +549,9 @@ command_result df_strangemood (color_ostream &out, vector & parameters) if (type == mood_type::None) { if (soul && ( - (soul->personality.stress_level >= 500000) || - (soul->personality.stress_level >= 250000 && !rng.df_trandom(2)) || - (soul->personality.stress_level >= 100000 && !rng.df_trandom(10)) + (soul->personality.stress >= 500000) || + (soul->personality.stress >= 250000 && !rng.df_trandom(2)) || + (soul->personality.stress >= 100000 && !rng.df_trandom(10)) )) { switch (rng.df_trandom(2)) @@ -639,7 +639,7 @@ command_result df_strangemood (color_ostream &out, vector & parameters) case job_skill::CARPENTRY: job->job_type = job_type::StrangeMoodCarpenter; break; - case job_skill::DETAILSTONE: + case job_skill::ENGRAVE_STONE: case job_skill::WOODCRAFT: case job_skill::STONECRAFT: case job_skill::BONECARVE: @@ -749,7 +749,7 @@ command_result df_strangemood (color_ostream &out, vector & parameters) switch (skill) { case job_skill::MINING: - case job_skill::DETAILSTONE: + case job_skill::ENGRAVE_STONE: case job_skill::MASONRY: case job_skill::STONECRAFT: case job_skill::MECHANICS: @@ -1040,7 +1040,7 @@ command_result df_strangemood (color_ostream &out, vector & parameters) switch (skill) { case job_skill::MINING: - case job_skill::DETAILSTONE: + case job_skill::ENGRAVE_STONE: case job_skill::MASONRY: case job_skill::STONECRAFT: avoid_type = item_type::BLOCKS;