From 8cc4bea0d4c6ad830088b189730c7e6a39b20923 Mon Sep 17 00:00:00 2001 From: expwnent Date: Sat, 17 May 2014 17:59:41 -0400 Subject: [PATCH 01/15] Added petcapRemover plugin. --- NEWS | 2 + Readme.rst | 5 + plugins/CMakeLists.txt | 1 + plugins/petcapRemover.cpp | 213 ++++++++++++++++++++++++++++++++++++++ 4 files changed, 221 insertions(+) create mode 100644 plugins/petcapRemover.cpp diff --git a/NEWS b/NEWS index 2a7508f5f..a3f959786 100644 --- a/NEWS +++ b/NEWS @@ -2,6 +2,8 @@ DFHack future - Is not yet known. +New command: petcapRemover - raise the pet population cap from 50 to whatever you want + DFHack v0.34.11-r4 New commands: diff --git a/Readme.rst b/Readme.rst index a2b400206..7232a7300 100644 --- a/Readme.rst +++ b/Readme.rst @@ -1947,6 +1947,11 @@ See the bay12 thread for details: http://www.bay12forums.com/smf/index.php?topic * Some of the DFusion plugins aren't completely ported yet. This can lead to crashes. * The game will be suspended while you're using dfusion. Don't panic when it doesn't respond. +petcapRemover +------------- + +This plugin allows you to remove or raise the pet population cap. In vanilla DF, pets will not reproduce unless the population is below 50 and the number of children of that species is below a certain percentage. This plugin allows removing the second restriction and removing or raising the first. Pets still require PET or PET_EXOTIC tags in order to reproduce. Type help petcapRemover for exact usage. In order to make population more stable and avoid sudden population booms as you go below the raised population cap, this plugin counts pregnancies toward the new population cap. It can still go over, but only in the case of multiple births. + misery ------ When enabled, every new negative dwarven thought will be multiplied by a factor (2 by default). diff --git a/plugins/CMakeLists.txt b/plugins/CMakeLists.txt index 4de3c68bf..efd86b589 100644 --- a/plugins/CMakeLists.txt +++ b/plugins/CMakeLists.txt @@ -162,6 +162,7 @@ if (BUILD_SUPPORTED) DFHACK_PLUGIN(treefarm treefarm.cpp) DFHACK_PLUGIN(cleanconst cleanconst.cpp) DFHACK_PLUGIN(3dveins 3dveins.cpp) + DFHACK_PLUGIN(petcapRemover petcapRemover.cpp) endif() # this is the skeleton plugin. If you want to make your own, make a copy and then change it diff --git a/plugins/petcapRemover.cpp b/plugins/petcapRemover.cpp new file mode 100644 index 000000000..f0116131e --- /dev/null +++ b/plugins/petcapRemover.cpp @@ -0,0 +1,213 @@ + +#include "Console.h" +#include "Core.h" +#include "DataDefs.h" +#include "Export.h" +#include "PluginManager.h" +#include "modules/EventManager.h" +#include "modules/Maps.h" + +#include "df/caste_raw.h" +#include "df/caste_raw_flags.h" +#include "df/creature_raw.h" +#include "df/profession.h" +#include "df/unit.h" +#include "df/world.h" + +#include +#include + +using namespace DFHack; +using namespace std; + +static int32_t howOften = 10000; +static int32_t popcap = 100; +static int32_t pregtime = 200000; +DFHACK_PLUGIN_IS_ENABLED(is_enabled); + +command_result petcapRemover (color_ostream &out, std::vector & parameters); + +DFHACK_PLUGIN("petcapRemover"); + +DFhackCExport command_result plugin_init ( color_ostream &out, std::vector &commands) +{ + commands.push_back(PluginCommand( + "petcapRemover", + "Removes the pet population cap by causing pregnancies.", + petcapRemover, + false, //allow non-interactive use + "petcapRemover\n" + " does pregnancies now and schedules the next check\n" + "petcapRemover every n\n" + " set how often in ticks the plugin checks for possible pregnancies\n" + "petcapRemover cap n\n" + " sets the new cap to n. if n = 0, no cap. Caps between 1 and 50 effectively don't do anything because normal DF pregnancies will continue to happen below that cap.\n" + "petcapRemover pregtime n\n" + " sets the pregnancy duration to n ticks. Natural pregnancies are 300000 ticks for the current race and 200000 ticks for everyone else.\n" + )); + return CR_OK; +} + +DFhackCExport command_result plugin_shutdown ( color_ostream &out ) +{ + return CR_OK; +} + +bool impregnate(df::unit* female, df::unit* male); +void impregnateMany() { + map > males; + map > females; + map popcount; + auto units = df::global::world->units.all; + for ( size_t a = 0; a < units.size(); a++ ) { + df::unit* unit = units[a]; + if ( unit->flags1.bits.dead || unit->flags1.bits.active_invader || unit->flags2.bits.underworld || unit->flags2.bits.visitor_uninvited || unit->flags2.bits.visitor ) + continue; + popcount[unit->race]++; + if ( unit->relations.pregnancy_genes ) { + //already pregnant + //for player convenience and population stability, count the fetus toward the population cap + popcount[unit->race]++; + continue; + } + if ( unit->flags1.bits.caged ) + continue; + int32_t race = unit->race; + int16_t caste = unit->caste; + df::creature_raw* creatureRaw = df::global::world->raws.creatures.all[race]; + df::caste_raw* casteRaw = creatureRaw->caste[caste]; + //must have PET or PET_EXOTIC + if ( !(casteRaw->flags.is_set(df::enums::caste_raw_flags::PET) || casteRaw->flags.is_set(df::enums::caste_raw_flags::PET_EXOTIC) ) ) + continue; + //check for adulthood + if ( unit->profession == df::enums::profession::CHILD || unit->profession == df::enums::profession::BABY ) + continue; + if ( unit->sex == 1 ) + males[unit->race].push_back(a); + else + females[unit->race].push_back(a); + } + + for ( auto i = females.begin(); i != females.end(); i++ ) { + int32_t race = i->first; + vector& femalesList = i->second; + for ( size_t a = 0; a < femalesList.size(); a++ ) { + if ( popcap > 0 && popcount[race] >= popcap ) + break; + vector compatibles; + df::coord pos1 = units[femalesList[a]]->pos; + + if ( males.find(i->first) == males.end() ) + continue; + + vector& malesList = males[i->first]; + for ( size_t b = 0; b < malesList.size(); b++ ) { + df::coord pos2 = units[malesList[b]]->pos; + if ( Maps::canWalkBetween(pos1,pos2) ) + compatibles.push_back(malesList[b]); + } + if ( compatibles.empty() ) + continue; + + size_t maleIndex = (size_t)(compatibles.size()*((float)rand() / (1+(float)RAND_MAX))); + if ( impregnate(units[femalesList[a]], units[compatibles[maleIndex]]) ) + popcount[race]++; + } + } +} + +bool impregnate(df::unit* female, df::unit* male) { + if ( !female || !male ) + return false; + if ( female->relations.pregnancy_genes ) + return false; + + df::unit_genes* preg = new df::unit_genes; + *preg = male->appearance.genes; + female->relations.pregnancy_genes = preg; + female->relations.pregnancy_timer = pregtime; //300000 for dwarves + female->relations.pregnancy_caste = male->caste; + return true; +} + +void tickHandler(color_ostream& out, void* data) { + if ( !is_enabled ) + return; + CoreSuspender suspend; + impregnateMany(); + + EventManager::unregisterAll(plugin_self); + EventManager::EventHandler handle(tickHandler, howOften); + EventManager::registerTick(handle, howOften, plugin_self); +} + +command_result petcapRemover (color_ostream &out, std::vector & parameters) +{ + CoreSuspender suspend; + + for ( size_t a = 0; a < parameters.size(); a++ ) { + if ( parameters[a] == "every" ) { + if ( a+1 >= parameters.size() ) + return CR_WRONG_USAGE; + int32_t old = howOften; + howOften = atoi(parameters[a+1].c_str()); + if (howOften < -1) { + howOften = old; + return CR_WRONG_USAGE; + } + a++; + continue; + } else if ( parameters[a] == "cap" ) { + if ( a+1 >= parameters.size() ) + return CR_WRONG_USAGE; + int32_t old = popcap; + popcap = atoi(parameters[a+1].c_str()); + if ( popcap < 0 ) { + popcap = old; + return CR_WRONG_USAGE; + } + a++; + continue; + } else if ( parameters[a] == "pregtime" ) { + if ( a+1 >= parameters.size() ) + return CR_WRONG_USAGE; + int32_t old = pregtime; + pregtime = atoi(parameters[a+1].c_str()); + if ( pregtime <= 0 ) { + pregtime = old; + return CR_WRONG_USAGE; + } + a++; + continue; + } + out.print("%s, line %d: invalid argument: %s\n", __FILE__, __LINE__, parameters[a].c_str()); + return CR_WRONG_USAGE; + } + + if ( howOften < 0 ) { + is_enabled = false; + return CR_OK; + } + + is_enabled = true; + EventManager::unregisterAll(plugin_self); + EventManager::EventHandler handle(tickHandler, howOften); + EventManager::registerTick(handle, howOften, plugin_self); + out.print("petcapRemover: howOften = every %d ticks, popcap per species = %d, preg time = %d ticks.\n", howOften, popcap, pregtime); + + return CR_OK; +} + +DFhackCExport command_result plugin_enable(color_ostream &out, bool enable) +{ + if (enable != is_enabled) + { + is_enabled = enable; + if ( !is_enabled ) { + EventManager::unregisterAll(plugin_self); + } + } + + return CR_OK; +} + From 055afafedca4c3294569e2e7cc6343777218b1a7 Mon Sep 17 00:00:00 2001 From: lethosor Date: Mon, 9 Jun 2014 16:50:01 -0400 Subject: [PATCH 02/15] command-prompt: Basic line editing Left/right arrows, Ctrl-A, Ctrl-E --- plugins/command-prompt.cpp | 56 ++++++++++++++++++++++++++++++++++---- 1 file changed, 50 insertions(+), 6 deletions(-) diff --git a/plugins/command-prompt.cpp b/plugins/command-prompt.cpp index 3cdd83ab3..140cc6f4d 100644 --- a/plugins/command-prompt.cpp +++ b/plugins/command-prompt.cpp @@ -17,6 +17,7 @@ #include "df/ui.h" #include "df/graphic.h" #include "df/enabler.h" + using namespace DFHack; using namespace df::enums; @@ -50,6 +51,7 @@ public: { show_fps=df::global::gps->display_frames; df::global::gps->display_frames=0; + cursor_pos = 0; } ~viewscreen_commandpromptst() { @@ -67,8 +69,10 @@ public: } protected: std::list > responses; + int cursor_pos; bool is_response; bool show_fps; + int frame; void submit(); std::string entry; }; @@ -82,6 +86,9 @@ void prompt_ostream::flush_proxy() } void viewscreen_commandpromptst::render() { + ++frame; + if (frame >= df::global::enabler->gfps) + frame = 0; if (Screen::isDismissed(this)) return; @@ -103,12 +110,22 @@ void viewscreen_commandpromptst::render() { Screen::fillRect(Screen::Pen(' ', 7, 0),0,0,dim.x,0); Screen::paintString(Screen::Pen(' ', 7, 0), 0, 0,"[DFHack]#"); - if(entry.size()gfps / 2) ? "_" : " "; + if(cursor_pos < (dim.x - 10)) + { Screen::paintString(Screen::Pen(' ', 7, 0), 10,0 , entry); + if (entry.size() > dim.x - 10) + Screen::paintTile(Screen::Pen('\032', 7, 0), dim.x - 1, 0); + if (cursor != " ") + Screen::paintString(Screen::Pen(' ', 10, 0), 10 + cursor_pos, 0, cursor); + } else { - Screen::paintTile(Screen::Pen('>', 7, 0), 9, 0); - Screen::paintString(Screen::Pen(' ', 7, 0), 10, 0, entry.substr(entry.size()-dim.x)); + size_t start = cursor_pos - dim.x + 10 + 1; + Screen::paintTile(Screen::Pen('\033', 7, 0), 9, 0); + Screen::paintString(Screen::Pen(' ', 7, 0), 10, 0, entry.substr(start)); + if (cursor != " ") + Screen::paintString(Screen::Pen(' ', 10, 0), dim.x - 1, 0, cursor); } } } @@ -158,14 +175,41 @@ void viewscreen_commandpromptst::feed(std::set *events) auto key = *it; if (key==interface_key::STRING_A000) //delete? { - if(entry.size()) - entry.resize(entry.size()-1); + if(entry.size() && cursor_pos > 0) + { + entry.erase(cursor_pos - 1, 1); + cursor_pos--; + } + if(cursor_pos > entry.size()) + cursor_pos = entry.size(); continue; } if (key >= interface_key::STRING_A000 && key <= interface_key::STRING_A255) { - entry.push_back(char(key - interface_key::STRING_A000)); + entry.insert(cursor_pos, 1, char(key - interface_key::STRING_A000)); + cursor_pos++; + } + // Prevent number keys from moving cursor + else if(events->count(interface_key::CURSOR_RIGHT)) + { + cursor_pos++; + if (cursor_pos > entry.size()) cursor_pos = entry.size(); + break; + } + else if(events->count(interface_key::CURSOR_LEFT)) + { + cursor_pos--; + if (cursor_pos < 0) cursor_pos = 0; + break; + } + else if(events->count(interface_key::CUSTOM_CTRL_A)) + { + cursor_pos = 0; + } + else if(events->count(interface_key::CUSTOM_CTRL_E)) + { + cursor_pos = entry.size(); } } } From aafcd6c43aff79e5939960f7f0d8a0ca47b7796b Mon Sep 17 00:00:00 2001 From: lethosor Date: Mon, 9 Jun 2014 17:00:26 -0400 Subject: [PATCH 03/15] Fix 4/6 behavior --- plugins/command-prompt.cpp | 41 +++++++++++++++++++------------------- 1 file changed, 20 insertions(+), 21 deletions(-) diff --git a/plugins/command-prompt.cpp b/plugins/command-prompt.cpp index 140cc6f4d..c4bbd615d 100644 --- a/plugins/command-prompt.cpp +++ b/plugins/command-prompt.cpp @@ -189,28 +189,27 @@ void viewscreen_commandpromptst::feed(std::set *events) { entry.insert(cursor_pos, 1, char(key - interface_key::STRING_A000)); cursor_pos++; + return; } - // Prevent number keys from moving cursor - else if(events->count(interface_key::CURSOR_RIGHT)) - { - cursor_pos++; - if (cursor_pos > entry.size()) cursor_pos = entry.size(); - break; - } - else if(events->count(interface_key::CURSOR_LEFT)) - { - cursor_pos--; - if (cursor_pos < 0) cursor_pos = 0; - break; - } - else if(events->count(interface_key::CUSTOM_CTRL_A)) - { - cursor_pos = 0; - } - else if(events->count(interface_key::CUSTOM_CTRL_E)) - { - cursor_pos = entry.size(); - } + } + // Prevent number keys from moving cursor + if(events->count(interface_key::CURSOR_RIGHT)) + { + cursor_pos++; + if (cursor_pos > entry.size()) cursor_pos = entry.size(); + } + else if(events->count(interface_key::CURSOR_LEFT)) + { + cursor_pos--; + if (cursor_pos < 0) cursor_pos = 0; + } + else if(events->count(interface_key::CUSTOM_CTRL_A)) + { + cursor_pos = 0; + } + else if(events->count(interface_key::CUSTOM_CTRL_E)) + { + cursor_pos = entry.size(); } } DFHACK_PLUGIN("command-prompt"); From cc07a373f3b48918060da2800e83d4f37eeb34a5 Mon Sep 17 00:00:00 2001 From: lethosor Date: Mon, 9 Jun 2014 19:38:21 -0400 Subject: [PATCH 04/15] Command-prompt history Creates duplicate entries occasionally Also disabled movies --- plugins/command-prompt.cpp | 45 +++++++++++++++++++++++++++++++++++--- 1 file changed, 42 insertions(+), 3 deletions(-) diff --git a/plugins/command-prompt.cpp b/plugins/command-prompt.cpp index c4bbd615d..345eee603 100644 --- a/plugins/command-prompt.cpp +++ b/plugins/command-prompt.cpp @@ -12,6 +12,7 @@ #include #include #include +#include #include "df/interface_key.h" #include "df/ui.h" @@ -25,6 +26,8 @@ using df::global::ui; using df::global::gps; using df::global::enabler; +std::vector command_history; + class viewscreen_commandpromptst; class prompt_ostream:public buffered_color_ostream { @@ -47,11 +50,15 @@ public: void help() { } std::string getFocusString() { return "commandprompt"; } + int8_t movies_okay() { return 0; } viewscreen_commandpromptst(std::string entry):is_response(false),entry(entry) { show_fps=df::global::gps->display_frames; df::global::gps->display_frames=0; cursor_pos = 0; + frame = 0; + history_idx = command_history.size(); + command_history.push_back(""); } ~viewscreen_commandpromptst() { @@ -70,6 +77,7 @@ public: protected: std::list > responses; int cursor_pos; + int history_idx; bool is_response; bool show_fps; int frame; @@ -140,6 +148,8 @@ void viewscreen_commandpromptst::submit() //color_ostream_proxy out(Core::getInstance().getConsole()); prompt_ostream out(this); Core::getInstance().runCommand(out, entry); + command_history.pop_back(); + command_history.push_back(entry); if(out.empty() && responses.empty()) Screen::dismiss(this); else @@ -149,7 +159,7 @@ void viewscreen_commandpromptst::submit() } void viewscreen_commandpromptst::feed(std::set *events) { - + int old_pos = cursor_pos; bool leave_all = events->count(interface_key::LEAVESCREEN_ALL); if (leave_all || events->count(interface_key::LEAVESCREEN)) { @@ -196,12 +206,14 @@ void viewscreen_commandpromptst::feed(std::set *events) if(events->count(interface_key::CURSOR_RIGHT)) { cursor_pos++; - if (cursor_pos > entry.size()) cursor_pos = entry.size(); + if (cursor_pos > entry.size()) + cursor_pos = entry.size(); } else if(events->count(interface_key::CURSOR_LEFT)) { cursor_pos--; - if (cursor_pos < 0) cursor_pos = 0; + if (cursor_pos < 0) + cursor_pos = 0; } else if(events->count(interface_key::CUSTOM_CTRL_A)) { @@ -211,6 +223,32 @@ void viewscreen_commandpromptst::feed(std::set *events) { cursor_pos = entry.size(); } + else if(events->count(interface_key::CURSOR_UP)) + { + if (command_history.back() == "") + { + command_history.pop_back(); + command_history.push_back(entry); + } + history_idx--; + if (history_idx < 0) + history_idx = 0; + entry = command_history[history_idx]; + cursor_pos = entry.size(); + } + else if(events->count(interface_key::CURSOR_DOWN)) + { + if (history_idx < command_history.size() - 1) + { + history_idx++; + if (history_idx >= command_history.size()) + history_idx = command_history.size() - 1; + entry = command_history[history_idx]; + cursor_pos = entry.size(); + } + } + if (old_pos != cursor_pos) + frame = 0; } DFHACK_PLUGIN("command-prompt"); command_result show_prompt(color_ostream &out, std::vector & parameters) @@ -235,6 +273,7 @@ DFhackCExport command_result plugin_init ( color_ostream &out, std::vector Date: Tue, 17 Jun 2014 12:34:57 -0400 Subject: [PATCH 05/15] Remove (broken) command history This reverts commit cc07a373f3b48918060da2800e83d4f37eeb34a5. --- plugins/command-prompt.cpp | 42 ++++---------------------------------- 1 file changed, 4 insertions(+), 38 deletions(-) diff --git a/plugins/command-prompt.cpp b/plugins/command-prompt.cpp index 345eee603..5815af59b 100644 --- a/plugins/command-prompt.cpp +++ b/plugins/command-prompt.cpp @@ -12,7 +12,6 @@ #include #include #include -#include #include "df/interface_key.h" #include "df/ui.h" @@ -26,8 +25,6 @@ using df::global::ui; using df::global::gps; using df::global::enabler; -std::vector command_history; - class viewscreen_commandpromptst; class prompt_ostream:public buffered_color_ostream { @@ -48,17 +45,15 @@ public: void render(); void help() { } + int8_t movies_okay() { return 0; } std::string getFocusString() { return "commandprompt"; } - int8_t movies_okay() { return 0; } viewscreen_commandpromptst(std::string entry):is_response(false),entry(entry) { show_fps=df::global::gps->display_frames; df::global::gps->display_frames=0; cursor_pos = 0; frame = 0; - history_idx = command_history.size(); - command_history.push_back(""); } ~viewscreen_commandpromptst() { @@ -77,7 +72,6 @@ public: protected: std::list > responses; int cursor_pos; - int history_idx; bool is_response; bool show_fps; int frame; @@ -148,8 +142,6 @@ void viewscreen_commandpromptst::submit() //color_ostream_proxy out(Core::getInstance().getConsole()); prompt_ostream out(this); Core::getInstance().runCommand(out, entry); - command_history.pop_back(); - command_history.push_back(entry); if(out.empty() && responses.empty()) Screen::dismiss(this); else @@ -173,12 +165,12 @@ void viewscreen_commandpromptst::feed(std::set *events) } return; } - if(events->count(interface_key::SELECT)) + if (events->count(interface_key::SELECT)) { submit(); return; } - if(is_response) + if (is_response) return; for (auto it = events->begin(); it != events->end(); ++it) { @@ -212,8 +204,7 @@ void viewscreen_commandpromptst::feed(std::set *events) else if(events->count(interface_key::CURSOR_LEFT)) { cursor_pos--; - if (cursor_pos < 0) - cursor_pos = 0; + if (cursor_pos < 0) cursor_pos = 0; } else if(events->count(interface_key::CUSTOM_CTRL_A)) { @@ -223,30 +214,6 @@ void viewscreen_commandpromptst::feed(std::set *events) { cursor_pos = entry.size(); } - else if(events->count(interface_key::CURSOR_UP)) - { - if (command_history.back() == "") - { - command_history.pop_back(); - command_history.push_back(entry); - } - history_idx--; - if (history_idx < 0) - history_idx = 0; - entry = command_history[history_idx]; - cursor_pos = entry.size(); - } - else if(events->count(interface_key::CURSOR_DOWN)) - { - if (history_idx < command_history.size() - 1) - { - history_idx++; - if (history_idx >= command_history.size()) - history_idx = command_history.size() - 1; - entry = command_history[history_idx]; - cursor_pos = entry.size(); - } - } if (old_pos != cursor_pos) frame = 0; } @@ -273,7 +240,6 @@ DFhackCExport command_result plugin_init ( color_ostream &out, std::vector Date: Tue, 17 Jun 2014 16:49:43 -0400 Subject: [PATCH 06/15] Reimplement command-prompt history Also add shift-left/right for back/forward one word --- plugins/command-prompt.cpp | 80 ++++++++++++++++++++++++++++++++++++-- 1 file changed, 76 insertions(+), 4 deletions(-) diff --git a/plugins/command-prompt.cpp b/plugins/command-prompt.cpp index 5815af59b..44f55b5e0 100644 --- a/plugins/command-prompt.cpp +++ b/plugins/command-prompt.cpp @@ -12,6 +12,7 @@ #include #include #include +#include #include "df/interface_key.h" #include "df/ui.h" @@ -25,6 +26,8 @@ using df::global::ui; using df::global::gps; using df::global::enabler; +std::vector command_history; + class viewscreen_commandpromptst; class prompt_ostream:public buffered_color_ostream { @@ -48,12 +51,14 @@ public: int8_t movies_okay() { return 0; } std::string getFocusString() { return "commandprompt"; } - viewscreen_commandpromptst(std::string entry):is_response(false),entry(entry) + viewscreen_commandpromptst(std::string entry):is_response(false) { show_fps=df::global::gps->display_frames; df::global::gps->display_frames=0; cursor_pos = 0; frame = 0; + history_idx = command_history.size(); + command_history.push_back(entry); } ~viewscreen_commandpromptst() { @@ -69,14 +74,50 @@ public: responses.push_back(std::make_pair(v, part + '\n')); } } + std::string get_entry() + { + return command_history[history_idx]; + } + void set_entry(std::string entry) + { + command_history[history_idx] = entry; + } + void back_word() + { + std::string entry = get_entry(); + if (cursor_pos == 0) + return; + cursor_pos--; + while (cursor_pos > 0 && !isalnum(entry[cursor_pos])) + cursor_pos--; + while (cursor_pos > 0 && isalnum(entry[cursor_pos])) + cursor_pos--; + if (!isalnum(entry[cursor_pos]) && cursor_pos != 0) + cursor_pos++; + } + void forward_word() + { + std::string entry = get_entry(); + int len = entry.size(); + if (cursor_pos == len) + return; + cursor_pos++; + while (cursor_pos <= len && !isalnum(entry[cursor_pos])) + cursor_pos++; + while (cursor_pos <= len && isalnum(entry[cursor_pos])) + cursor_pos++; + if (cursor_pos > len) + cursor_pos = len; + } + protected: std::list > responses; int cursor_pos; + int history_idx; bool is_response; bool show_fps; int frame; void submit(); - std::string entry; }; void prompt_ostream::flush_proxy() { @@ -110,6 +151,7 @@ void viewscreen_commandpromptst::render() } else { + std::string entry = get_entry(); Screen::fillRect(Screen::Pen(' ', 7, 0),0,0,dim.x,0); Screen::paintString(Screen::Pen(' ', 7, 0), 0, 0,"[DFHack]#"); std::string cursor = (frame < df::global::enabler->gfps / 2) ? "_" : " "; @@ -139,9 +181,8 @@ void viewscreen_commandpromptst::submit() Screen::dismiss(this); return; } - //color_ostream_proxy out(Core::getInstance().getConsole()); prompt_ostream out(this); - Core::getInstance().runCommand(out, entry); + Core::getInstance().runCommand(out, get_entry()); if(out.empty() && responses.empty()) Screen::dismiss(this); else @@ -152,6 +193,7 @@ void viewscreen_commandpromptst::submit() void viewscreen_commandpromptst::feed(std::set *events) { int old_pos = cursor_pos; + std::string entry = get_entry(); bool leave_all = events->count(interface_key::LEAVESCREEN_ALL); if (leave_all || events->count(interface_key::LEAVESCREEN)) { @@ -191,6 +233,7 @@ void viewscreen_commandpromptst::feed(std::set *events) { entry.insert(cursor_pos, 1, char(key - interface_key::STRING_A000)); cursor_pos++; + set_entry(entry); return; } } @@ -206,6 +249,14 @@ void viewscreen_commandpromptst::feed(std::set *events) cursor_pos--; if (cursor_pos < 0) cursor_pos = 0; } + else if(events->count(interface_key::CURSOR_RIGHT_FAST)) + { + forward_word(); + } + else if(events->count(interface_key::CURSOR_LEFT_FAST)) + { + back_word(); + } else if(events->count(interface_key::CUSTOM_CTRL_A)) { cursor_pos = 0; @@ -214,8 +265,29 @@ void viewscreen_commandpromptst::feed(std::set *events) { cursor_pos = entry.size(); } + else if(events->count(interface_key::CURSOR_UP)) + { + history_idx--; + if (history_idx < 0) + history_idx = 0; + entry = get_entry(); + cursor_pos = entry.size(); + } + else if(events->count(interface_key::CURSOR_DOWN)) + { + if (history_idx < command_history.size() - 1) + { + history_idx++; + if (history_idx >= command_history.size()) + history_idx = command_history.size() - 1; + entry = get_entry(); + cursor_pos = entry.size(); + } + } + set_entry(entry); if (old_pos != cursor_pos) frame = 0; + } DFHACK_PLUGIN("command-prompt"); command_result show_prompt(color_ostream &out, std::vector & parameters) From cca605d8b4ae0fe8826b7ed30f73f3ceface2b81 Mon Sep 17 00:00:00 2001 From: lethosor Date: Tue, 17 Jun 2014 17:21:30 -0400 Subject: [PATCH 07/15] Prevent blank lines from being stored in history --- plugins/command-prompt.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/plugins/command-prompt.cpp b/plugins/command-prompt.cpp index 44f55b5e0..f9a3f80bf 100644 --- a/plugins/command-prompt.cpp +++ b/plugins/command-prompt.cpp @@ -58,6 +58,14 @@ public: cursor_pos = 0; frame = 0; history_idx = command_history.size(); + if (history_idx > 0) + { + if (command_history[history_idx - 1] == "") + { + command_history.pop_back(); + history_idx--; + } + } command_history.push_back(entry); } ~viewscreen_commandpromptst() @@ -205,6 +213,8 @@ void viewscreen_commandpromptst::feed(std::set *events) parent->feed(events); events->clear(); } + //if (command_history.size() && !entry.size()) + // command_history.pop_back(); return; } if (events->count(interface_key::SELECT)) From 73fdb8b125e6090085a0e69f7c7d3279784b30c0 Mon Sep 17 00:00:00 2001 From: Lethosor Date: Thu, 19 Jun 2014 21:24:16 -0400 Subject: [PATCH 08/15] Fix Windows compile-time error --- library/modules/Filesystem.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/modules/Filesystem.cpp b/library/modules/Filesystem.cpp index 9f0df3097..2c3cf5dfe 100644 --- a/library/modules/Filesystem.cpp +++ b/library/modules/Filesystem.cpp @@ -88,7 +88,7 @@ bool DFHack::Filesystem::rmdir (std::string path) } #ifdef _WIN32 -_filetype *mode2type (unsigned short mode) { +_filetype mode2type (unsigned short mode) { #else _filetype mode2type (mode_t mode) { #endif From 12d18ca64de7e2961721250bd7cd1efcca222377 Mon Sep 17 00:00:00 2001 From: expwnent Date: Thu, 19 Jun 2014 22:32:02 -0400 Subject: [PATCH 09/15] Fix compile issues on windows. --- library/modules/Filesystem.cpp | 2 +- plugins/tweak.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/library/modules/Filesystem.cpp b/library/modules/Filesystem.cpp index 9f0df3097..2c3cf5dfe 100644 --- a/library/modules/Filesystem.cpp +++ b/library/modules/Filesystem.cpp @@ -88,7 +88,7 @@ bool DFHack::Filesystem::rmdir (std::string path) } #ifdef _WIN32 -_filetype *mode2type (unsigned short mode) { +_filetype mode2type (unsigned short mode) { #else _filetype mode2type (mode_t mode) { #endif diff --git a/plugins/tweak.cpp b/plugins/tweak.cpp index c8052a386..8154b473e 100644 --- a/plugins/tweak.cpp +++ b/plugins/tweak.cpp @@ -407,7 +407,7 @@ struct confirm_embark_hook : df::viewscreen_setupdwarfgamest x = 2, y = 4; int32_t points = this->points_remaining; OutputString(COLOR_WHITE, x, y, "Points left: "); - OutputString((points ? COLOR_YELLOW : COLOR_LIGHTGREEN), x, y, std::to_string(points)); + OutputString((points ? COLOR_YELLOW : COLOR_LIGHTGREEN), x, y, std::to_string((unsigned long long/*won't compile on windows otherwise*/)points)); x = dim.x - 10, y = dim.y - 1; OutputString(COLOR_WHITE, x, y, "DFHack"); } From ec64a787c6ced5e0257b94ae143a54f590be46d1 Mon Sep 17 00:00:00 2001 From: Lethosor Date: Thu, 19 Jun 2014 22:34:40 -0400 Subject: [PATCH 10/15] Use _getcwd on Windows --- library/modules/Filesystem.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/library/modules/Filesystem.cpp b/library/modules/Filesystem.cpp index 2c3cf5dfe..35a48930f 100644 --- a/library/modules/Filesystem.cpp +++ b/library/modules/Filesystem.cpp @@ -58,7 +58,11 @@ char * DFHack::Filesystem::getcwd () { char *path; char buf[LFS_MAXPATHLEN]; +#ifdef _WIN32 + if ((path = ::_getcwd(buf, LFS_MAXPATHLEN)) == NULL) +#else if ((path = ::getcwd(buf, LFS_MAXPATHLEN)) == NULL) +#endif return NULL; else return path; From 036aae060b91a557157c46c718fe2d1f64808f10 Mon Sep 17 00:00:00 2001 From: expwnent Date: Thu, 19 Jun 2014 22:58:17 -0400 Subject: [PATCH 11/15] Merge lethosor stuff. For some reason, git's auto merge message didn't happen because of git-stash shenanigans. Oh well. --- library/include/modules/Filesystem.h | 2 +- library/modules/Filesystem.cpp | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/library/include/modules/Filesystem.h b/library/include/modules/Filesystem.h index d40fd910e..3798bbeb2 100644 --- a/library/include/modules/Filesystem.h +++ b/library/include/modules/Filesystem.h @@ -182,7 +182,7 @@ enum _filetype { namespace DFHack { namespace Filesystem { DFHACK_EXPORT bool chdir (std::string path); - DFHACK_EXPORT char * getcwd (); + DFHACK_EXPORT std::string getcwd (); DFHACK_EXPORT bool mkdir (std::string path); DFHACK_EXPORT bool rmdir (std::string path); DFHACK_EXPORT bool stat (std::string path, STAT_STRUCT &info); diff --git a/library/modules/Filesystem.cpp b/library/modules/Filesystem.cpp index 35a48930f..be1668bcc 100644 --- a/library/modules/Filesystem.cpp +++ b/library/modules/Filesystem.cpp @@ -54,18 +54,18 @@ bool DFHack::Filesystem::chdir (std::string path) return !(bool)::chdir(path.c_str()); } -char * DFHack::Filesystem::getcwd () +std::string DFHack::Filesystem::getcwd () { char *path; char buf[LFS_MAXPATHLEN]; + std::string result = ""; #ifdef _WIN32 - if ((path = ::_getcwd(buf, LFS_MAXPATHLEN)) == NULL) + if ((path = ::_getcwd(buf, LFS_MAXPATHLEN)) != NULL) #else - if ((path = ::getcwd(buf, LFS_MAXPATHLEN)) == NULL) + if ((path = ::getcwd(buf, LFS_MAXPATHLEN)) != NULL) #endif - return NULL; - else - return path; + result = buf; + return result; } bool DFHack::Filesystem::mkdir (std::string path) From 1994603177f75880e5e0ebf0dacec7e0a325d553 Mon Sep 17 00:00:00 2001 From: expwnent Date: Thu, 19 Jun 2014 23:22:51 -0400 Subject: [PATCH 12/15] Reorganized NEWS. --- NEWS | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/NEWS b/NEWS index 44284e18f..4c7de7e4e 100644 --- a/NEWS +++ b/NEWS @@ -8,7 +8,6 @@ DFHack future - Lua API for running arbitrary DFHack commands - support for multiple raw/init.d/*.lua init scripts in one save. - eventful now has a more friendly way of making custom sidebars - - new plugin: building-hacks. Allows to add custom functionality and/or animations to buildings. - on Linux and OSX the console now supports moving the cursor back and forward by a whole word. New scripts: @@ -21,7 +20,6 @@ DFHack future - dfstatus: show an overview of critical stock quantities, including food, drinks, wood, and bars. New commands: - - move the 'grow', 'extirpate' and 'immolate' commands as 'plant' subcommands - 'plant create' - spawn a new shrub under the cursor - command-prompt: a dfhack command prompt in df. @@ -34,8 +32,11 @@ DFHack future - rendermax: replace the renderer with something else. Most interesting is "rendermax light"- a lighting engine for df. - stockflow (by eswald): queues manager jobs of the configured type based on the state of a stockpile. - embark-tools: implementations of Embark Anywhere, Nano Embark, and a few other embark-related utilities + - building-hacks: Allows to add custom functionality and/or animations to buildings. + - petcapRemover: triggers pregnancies in creatures so that you can effectively raise the default pet population cap from the default 50 Misc improvements: + - plant: move the 'grow', 'extirpate' and 'immolate' commands as 'plant' subcommands - digfort: improved csv parsing, add start() comment handling - exterminate: allow specifying a caste (exterminate gob:male) - createitem: in adventure mode it now defaults to the controlled unit as maker. @@ -54,8 +55,6 @@ DFHack future - operators in Prepare To Fire mode are released from duty once hungry/thirsty if there is a free replacement -New command: petcapRemover - raise the pet population cap from 50 to whatever you want - DFHack v0.34.11-r4 New commands: From f1637d3a04d0f98984f5de882ae1441c366b34c1 Mon Sep 17 00:00:00 2001 From: expwnent Date: Thu, 19 Jun 2014 23:27:38 -0400 Subject: [PATCH 13/15] Removed my email from Contributors.rst. --- Contributors.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Contributors.rst b/Contributors.rst index 7f09dce73..6d7ad850a 100644 --- a/Contributors.rst +++ b/Contributors.rst @@ -24,7 +24,7 @@ The following is a list of people who have contributed to **DFHack**. - RossM - Tom Prince - Jared Adams -- expwnent +- expwnent - Erik Youngren - Espen Wiborg - Tim Walberg From f68279f87d9311ae0eeaa007103536dcc3a6bcfa Mon Sep 17 00:00:00 2001 From: expwnent Date: Fri, 20 Jun 2014 02:45:48 -0400 Subject: [PATCH 14/15] Bump version to r5, update documents, include more documentation. --- CMakeLists.txt | 2 +- Contributors.html | 3 +- Readme.html | 264 +++++++++++++++++++++++++--------------------- Readme.rst | 12 +++ 4 files changed, 156 insertions(+), 125 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1662e70bb..df5943a31 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -59,7 +59,7 @@ endif() # set up versioning. set(DF_VERSION "0.34.11") -SET(DFHACK_RELEASE "r4" CACHE STRING "Current release revision.") +SET(DFHACK_RELEASE "r5" CACHE STRING "Current release revision.") set(DFHACK_VERSION "${DF_VERSION}-${DFHACK_RELEASE}") add_definitions(-DDFHACK_VERSION="${DFHACK_VERSION}") diff --git a/Contributors.html b/Contributors.html index 5ca706f86..8f767be69 100644 --- a/Contributors.html +++ b/Contributors.html @@ -364,7 +364,7 @@ ul.auto-toc {
  • RossM <Ross@Gnome>
  • Tom Prince <tom.prince@ualberta.net>
  • Jared Adams <jaxad0127@gmail.com>
  • -
  • expwnent <q309185@gmail.com>
  • +
  • expwnent
  • Erik Youngren <artanis.00@gmail.com>
  • Espen Wiborg <espen.wiborg@telio.no>
  • Tim Walberg <twalberg@comcast.net>
  • @@ -401,6 +401,7 @@ ul.auto-toc {
  • Caldfir <caldfir@hotmail.com>
  • Antalia <tamarakorr@gmail.com>
  • Angus Mezick <amezick@gmail.com>
  • +
  • PeridexisErrant <PeridexisErrant@gmail.com>
  • And those are the cool people who made stonesense.

    -
  • Scripts
      -
    • fix/*
    • -
    • gui/*
    • -
    • binpatch
    • -
    • quicksave
    • -
    • setfps
    • -
    • siren
    • -
    • growcrops
    • -
    • removebadthoughts
    • -
    • exterminate
    • -
    • source
    • -
    • masspit
    • -
    • digfort
    • -
    • invasion-now
    • -
    • digmat
    • -
    • superdwarf
    • -
    • drainaquifer
    • -
    • deathcause
    • -
    • lua
    • -
    • embark
    • -
    • lever
    • -
    • stripcaged
    • -
    • undump-buildings
    • -
    • create-items
    • -
    • locate-ore
    • -
    • soundsense-season
    • -
    • multicmd
    • -
    • dfstatus
    • +
    • Scripts
    • -
    • In-game interface tools
        -
      • Dwarf Manipulator
      • -
      • Search
      • -
      • AutoMaterial
      • -
      • gui/liquids
      • -
      • gui/mechanisms
      • -
      • gui/rename
      • -
      • gui/room-list
      • -
      • gui/choose-weapons
      • -
      • gui/clone-uniform
      • -
      • gui/guide-path
      • -
      • gui/workshop-job
      • -
      • gui/workflow
      • -
      • gui/assign-rack
      • -
      • gui/advfort
      • -
      • gui/companion-order
      • -
      • gui/gm-editor
      • -
      • gui/mod-manager
      • +
      • In-game interface tools
      • -
      • Behavior Mods
          -
        • Siege Engine +
          +

          petcapRemover

          +

          This plugin allows you to remove or raise the pet population cap. In vanilla DF, pets will not reproduce unless the population is below 50 and the number of children of that species is below a certain percentage. This plugin allows removing the second restriction and removing or raising the first. Pets still require PET or PET_EXOTIC tags in order to reproduce. Type help petcapRemover for exact usage. In order to make population more stable and avoid sudden population booms as you go below the raised population cap, this plugin counts pregnancies toward the new population cap. It can still go over, but only in the case of multiple births.

          +
          +
          petcapRemover
          +
          cause pregnancies now and schedule the next check
          +
          petcapRemover every n
          +
          set how often in ticks the plugin checks for possible pregnancies
          +
          petcapRemover cap n
          +
          set the new cap to n. if n = 0, no cap
          +
          petcapRemover pregtime n
          +
          sets the pregnancy duration to n ticks. natural pregnancies are 300000 ticks for the current race and 200000 for everyone else
          +
          +
          -

          misery

          +

          misery

          When enabled, every new negative dwarven thought will be multiplied by a factor (2 by default).

          Usage:

          @@ -2996,7 +3014,7 @@ embark-tools enable/disable tool [tool]...
          -

          strangemood

          +

          strangemood

          Creates a strange mood job the same way the game itself normally does it.

          Options:

          @@ -3020,13 +3038,13 @@ Valid values are "miner", "carpenter", "engraver",

          Known limitations: if the selected unit is currently performing a job, the mood will not be started.

          -

          log-region

          +

          log-region

          When enabled in dfhack.init, each time a fort is loaded identifying information will be written to the gamelog. Assists in parsing the file if you switch between forts, and adds information for story-building.

          -

          Scripts

          +

          Scripts

          Lua or ruby scripts placed in the hack/scripts/ directory are considered for execution as if they were native DFHack commands. They are listed at the end of the 'ls' command output.

          @@ -3035,7 +3053,7 @@ only be listed by ls if called as 'ls -a'. This is intended as a way to hide scripts that are obscure, developer-oriented, or should be used as keybindings.

          Some notable scripts:

          -

          fix/*

          +

          fix/*

          Scripts in this subdirectory fix various bugs and issues, some of them obscure.

          • fix/dead-units

            @@ -3072,12 +3090,12 @@ hopefully avoid jamming it again, and unsuspends them.

          -

          gui/*

          +

          gui/*

          Scripts that implement dialogs inserted into the main game window are put in this directory.

          -

          binpatch

          +

          binpatch

          Checks, applies or removes binary patches directly in memory at runtime:

           binpatch check/apply/remove <patchname>
          @@ -3087,17 +3105,17 @@ script uses hack/patches/<df-v
           the version appropriate for the currently loaded executable.

          -

          quicksave

          +

          quicksave

          If called in dwarf mode, makes DF immediately auto-save the game by setting a flag normally used in seasonal auto-save.

          -

          setfps

          +

          setfps

          Run setfps <number> to set the FPS cap at runtime, in case you want to watch combat in slow motion or something :)

          -

          siren

          +

          siren

          Wakes up sleeping units, cancels breaks and stops parties either everywhere, or in the burrows given as arguments. In return, adds bad thoughts about noise, tiredness and lack of protection. Also, the units with interrupted @@ -3105,7 +3123,7 @@ breaks will go on break again a lot sooner. The script is intended for emergencies, e.g. when a siege appears, and all your military is partying.

          -

          growcrops

          +

          growcrops

          Instantly grow seeds inside farming plots.

          With no argument, this command list the various seed types currently in use in your farming plots. @@ -3117,7 +3135,7 @@ growcrops plump 40

          -

          removebadthoughts

          +

          removebadthoughts

          This script remove negative thoughts from your dwarves. Very useful against tantrum spirals.

          The script can target a single creature, when used with the him argument, @@ -3131,7 +3149,7 @@ but in the short term your dwarves will get much more joyful.

          quickly after you unpause.

          -

          exterminate

          +

          exterminate

          Kills any unit of a given race.

          With no argument, lists the available races and count eligible targets.

          With the special argument him, targets only the selected creature.

          @@ -3163,7 +3181,7 @@ exterminate elve magma
          -

          source

          +

          source

          Create an infinite magma or water source or drain on a tile.

          This script registers a map tile as a liquid source, and every 12 game ticks that tile receives or remove 1 new unit of flow based on the configuration.

          @@ -3185,14 +3203,14 @@ source add water 0 - water drain
          -

          masspit

          +

          masspit

          Designate all creatures in cages on top of a pit/pond activity zone for pitting. Works best with an animal stockpile on top of the zone.

          Works with a zone number as argument (eg Activity Zone #6 -> masspit 6) or with the game cursor on top of the area.

          -

          digfort

          +

          digfort

          A script to designate an area for digging according to a plan in csv format.

          This script, inspired from quickfort, can designate an area for digging. Your plan should be stored in a .csv file like this:

          @@ -3214,7 +3232,7 @@ as an offset for the pattern: instead of starting at the cursor, it will start Dwarf Fortress.exe is found).

          -

          invasion-now

          +

          invasion-now

          Triggers an invasion, or several in the near future.

          invasion-now civName trigger an invasion from the civilization with the id civName, starting in about ten ticks

          invasion-now civName start trigger an invasion from civName in a number of ticks between 10*start and 11*start-1 (inclusive)

          @@ -3222,7 +3240,7 @@ Dwarf Fortress.exe is found).

          Probably fails if the start time of a triggered invasion is later than the start of the next year.

          -

          digmat

          +

          digmat

          Designates a tile for digging. Monitors the tile, and when it is dug out, add surrounding discovered tiles of the same material for digging. Similar to 'digv', but less cheaty. Works for stone layers, soil layers, veins, etc.

          @@ -3231,7 +3249,7 @@ same designation for future digging (eg dig up/downstairs). When digging stairs, also designate tiles on z-1 and z+1 when they are discovered.

          -

          superdwarf

          +

          superdwarf

          Similar to fastdwarf, per-creature.

          To make any creature superfast, target it ingame using 'v' and:

          @@ -3241,17 +3259,17 @@ superdwarf add
           

          This plugin also shortens the 'sleeping' and 'on break' periods of targets.

          -

          drainaquifer

          +

          drainaquifer

          Remove all 'aquifer' tag from the map blocks. Irreversible.

          -

          deathcause

          +

          deathcause

          Focus a body part ingame, and this script will display the cause of death of the creature. Also works when selecting units from the 'u'nitlist viewscreen.

          -

          lua

          +

          lua

          There are the following ways to invoke this command:

          1. lua (without any parameters)

            @@ -3270,11 +3288,11 @@ directory. If the filename is not supplied, it loads "dfhack.lua".

          -

          embark

          +

          embark

          Allows to embark anywhere. Currently windows only.

          -

          lever

          +

          lever

          Allow manipulation of in-game levers from the dfhack console.

          Can list levers, including state and links, with:

          @@ -3288,7 +3306,7 @@ lever pull 42 --now
           
          -

          stripcaged

          +

          stripcaged

          For dumping items inside cages. Will mark selected items for dumping, then a dwarf may come and actually dump it. See also autodump.

          With the items argument, only dumps items laying in the cage, excluding @@ -3306,11 +3324,11 @@ stripcaged weapons 25321 34228

          -

          undump-buildings

          +

          undump-buildings

          Undesignates building base materials for dumping.

          -

          create-items

          +

          create-items

          Spawn arbitrary items under the cursor.

          The first argument gives the item category, the second gives the material, and the optionnal third gives the number of items to create (defaults to 20).

          @@ -3332,7 +3350,7 @@ create-items bar adamantine
          -

          locate-ore

          +

          locate-ore

          Scan the map for metal ores.

          Finds and designate for digging one tile of a specific metal ore. Only works for native metal ores, does not handle reaction stuff (eg STEEL).

          @@ -3345,7 +3363,7 @@ locate-ore iron
          -

          soundsense-season

          +

          soundsense-season

          It is a well known issue that Soundsense cannot detect the correct current season when a savegame is loaded and has to play random season music until a season switch occurs.

          @@ -3354,7 +3372,7 @@ to gamelog.txt on every map load to fix this. For best results call the script from dfhack.init.

          -

          multicmd

          +

          multicmd

          Run multiple dfhack commands. The argument is split around the character ; and all parts are run sequencially as independent dfhack commands. Useful for hotkeys.

          @@ -3364,12 +3382,12 @@ dfhack commands. Useful for hotkeys.

          -

          dfstatus

          +

          dfstatus

          Show a quick overview of critical stock quantities, including food, dirnks, wood, and various bars.

          -

          In-game interface tools

          +

          In-game interface tools

          These tools work by displaying dialogs or overlays in the game window, and are mostly implemented by lua scripts.

          @@ -3384,7 +3402,7 @@ guideline because it arguably just fixes small usability bugs in the game UI.

          -

          Dwarf Manipulator

          +

          Dwarf Manipulator

          Implemented by the 'manipulator' plugin.

          To activate, open the unit screen and press 'l'.

          images/manipulator.png @@ -3425,7 +3443,7 @@ cursor onto that cell instead of toggling it.
        • directly to the main dwarf mode screen.

          -

          AutoMaterial

          +

          AutoMaterial

          Implemented by the 'automaterial' plugin.

          This makes building constructions (walls, floors, fortifications, etc) a little bit easier by saving you from having to trawl through long lists of materials each time @@ -3484,7 +3502,7 @@ materials, it returns you back to this screen. If you use this along with severa enabled materials, you should be able to place complex constructions more conveniently.

          -

          gui/liquids

          +

          gui/liquids

          To use, bind to a key (the example config uses Alt-L) and activate in the 'k' mode.

          images/liquids.png

          This script is a gui front-end to the liquids plugin and works similar to it, @@ -3504,7 +3522,7 @@ rivers power water wheels even when full and technically not flowing.

          After setting up the desired operations using the described keys, use Enter to apply them.

          -

          gui/mechanisms

          +

          gui/mechanisms

          To use, bind to a key (the example config uses Ctrl-M) and activate in the 'q' mode.

          images/mechanisms.png

          Lists mechanisms connected to the building, and their links. Navigating the list centers @@ -3514,7 +3532,7 @@ focus on the current one. Shift-Enter has an effect equivalent to pressing Enter re-entering the mechanisms ui.

          -

          gui/rename

          +

          gui/rename

          Backed by the rename plugin, this script allows entering the desired name via a simple dialog in the game ui.

            @@ -3537,7 +3555,7 @@ their species string.

            unit profession change to Ctrl-Shift-T.

          -

          gui/room-list

          +

          gui/room-list

          To use, bind to a key (the example config uses Alt-R) and activate in the 'q' mode, either immediately or after opening the assign owner page.

          images/room-list.png @@ -3545,7 +3563,7 @@ either immediately or after opening the assign owner page.

          list, and allows unassigning them.

          -

          gui/choose-weapons

          +

          gui/choose-weapons

          Bind to a key (the example config uses Ctrl-W), and activate in the Equip->View/Customize page of the military screen.

          Depending on the cursor location, it rewrites all 'individual choice weapon' entries @@ -3556,14 +3574,14 @@ only that entry, and does it even if it is not 'individual choice'.

          and may lead to inappropriate weapons being selected.

          -

          gui/clone-uniform

          +

          gui/clone-uniform

          Bind to a key (the example config uses Ctrl-C), and activate in the Uniforms page of the military screen with the cursor in the leftmost list.

          When invoked, the script duplicates the currently selected uniform template, and selects the newly created copy.

          -

          gui/guide-path

          +

          gui/guide-path

          Bind to a key (the example config uses Alt-P), and activate in the Hauling menu with the cursor over a Guide order.

          images/guide-path.png @@ -3571,7 +3589,7 @@ the cursor over a Guide order.

          computes it when the order is executed for the first time.

          -

          gui/workshop-job

          +

          gui/workshop-job

          Bind to a key (the example config uses Alt-A), and activate with a job selected in a workshop in the 'q' mode.

          images/workshop-job.png @@ -3607,7 +3625,7 @@ and then try to change the input item type, now it won't let you select plan you have to unset the material first.

          -

          gui/workflow

          +

          gui/workflow

          Bind to a key (the example config uses Alt-W), and activate with a job selected in a workshop in the 'q' mode.

          images/workflow.png @@ -3654,7 +3672,7 @@ the current stock value. The bright green dashed line is the target limit (maximum) and the dark green line is that minus the gap (minimum).

          -

          gui/assign-rack

          +

          gui/assign-rack

          Bind to a key (the example config uses P), and activate when viewing a weapon rack in the 'q' mode.

          images/assign-rack.png @@ -3678,7 +3696,7 @@ the intended user. In order to aid in the choice, it shows the number of currently assigned racks for every valid squad.

          -

          gui/advfort

          +

          gui/advfort

          This script allows to perform jobs in adventure mode. For more complete help press '?' while script is running. It's most confortable to use this as a keybinding. (e.g. keybinding set Ctrl-T gui/advfort). Possible arguments:

          @@ -3697,7 +3715,7 @@ implies -a
          -

          gui/companion-order

          +

          gui/companion-order

          A script to issue orders for companions. Select companions with lower case chars, issue orders with upper case. Must be in look or talk mode to issue command on tile.

          images/companion-order.png @@ -3713,7 +3731,7 @@ case. Must be in look or talk mode to issue command on tile.

        -

        gui/gm-editor

        +

        gui/gm-editor

        There are three ways to open this editor:

        • using gui/gm-editor command/keybinding - opens editor on what is selected @@ -3728,14 +3746,14 @@ the same as version above.
        • in-game help.

        -

        gui/mod-manager

        +

        gui/mod-manager

        A way to simply install and remove small mods. It looks for specially formatted mods in df subfolder 'mods'. Mods are not included, for example mods see: github mini mod repository

        images/mod-manager.png
        -

        Behavior Mods

        +

        Behavior Mods

        These plugins, when activated via configuration UI or by detecting certain structures in RAWs, modify the game engine behavior concerning the target objects to add features not otherwise present.

        @@ -3746,20 +3764,20 @@ technical challenge, and do not represent any long-term plans to produce more similar modifications of the game.

        -

        Siege Engine

        +

        Siege Engine

        The siege-engine plugin enables siege engines to be linked to stockpiles, and aimed at an arbitrary rectangular area across Z levels, instead of the original four directions. Also, catapults can be ordered to load arbitrary objects, not just stones.

        -

        Rationale

        +

        Rationale

        Siege engines are a very interesting feature, but sadly almost useless in the current state because they haven't been updated since 2D and can only aim in four directions. This is an attempt to bring them more up to date until Toady has time to work on it. Actual improvements, e.g. like making siegers bring their own, are something only Toady can do.

        -

        Configuration UI

        +

        Configuration UI

        The configuration front-end to the plugin is implemented by the gui/siege-engine script. Bind it to a key (the example config uses Alt-A) and activate after selecting a siege engine in 'q' mode.

        @@ -3782,7 +3800,7 @@ menu.

        -

        Power Meter

        +

        Power Meter

        The power-meter plugin implements a modified pressure plate that detects power being supplied to gear boxes built in the four adjacent N/S/W/E tiles.

        The configuration front-end is implemented by the gui/power-meter script. Bind it to a @@ -3793,11 +3811,11 @@ in the build menu.

        configuration page, but configures parameters relevant to the modded power meter building.

        -

        Steam Engine

        +

        Steam Engine

        The steam-engine plugin detects custom workshops with STEAM_ENGINE in their token, and turns them into real steam engines.

        -

        Rationale

        +

        Rationale

        The vanilla game contains only water wheels and windmills as sources of power, but windmills give relatively little power, and water wheels require flowing water, which must either be a real river and thus immovable and @@ -3808,7 +3826,7 @@ it can be done just by combining existing features of the game engine in a new way with some glue code and a bit of custom logic.

        -

        Construction

        +

        Construction

        The workshop needs water as its input, which it takes via a passable floor tile below it, like usual magma workshops do. The magma version also needs magma.

        @@ -3832,7 +3850,7 @@ short axles that can be built later than both of the engines.

        -

        Operation

        +

        Operation

        In order to operate the engine, queue the Stoke Boiler job (optionally on repeat). A furnace operator will come, possibly bringing a bar of fuel, and perform it. As a result, a "boiling water" item will appear @@ -3863,7 +3881,7 @@ decrease it by further 4%, and also decrease the whole steam use rate by 10%.

        -

        Explosions

        +

        Explosions

        The engine must be constructed using barrel, pipe and piston from fire-safe, or in the magma version magma-safe metals.

        During operation weak parts get gradually worn out, and @@ -3872,7 +3890,7 @@ toppled during operation by a building destroyer, or a tantruming dwarf.

        -

        Save files

        +

        Save files

        It should be safe to load and view engine-using fortresses from a DF version without DFHack installed, except that in such case the engines won't work. However actually making modifications @@ -3883,7 +3901,7 @@ being generated.

        -

        Add Spatter

        +

        Add Spatter

        This plugin makes reactions with names starting with SPATTER_ADD_ produce contaminants on the items instead of improvements. The produced contaminants are immune to being washed away by water or destroyed by diff --git a/Readme.rst b/Readme.rst index 031c97e29..fde2b5c04 100644 --- a/Readme.rst +++ b/Readme.rst @@ -1397,6 +1397,8 @@ Subcommands that persist until disabled or DF quit: :adamantine-cloth-wear: Prevents adamantine clothing from wearing out while being worn (bug 6481). +:confirm-embark: Adds a prompt before embarking (on the "prepare carefully" screen). + fix-armory ---------- @@ -2067,11 +2069,21 @@ Tools: * ``nano``: An implementation of nano embark - allows resizing below 2x2 when enabled. * ``sand``: Displays an indicator when sand is present in the currently-selected area, similar to the default clay/stone indicators. * ``sticky``: Maintains the selected local area while navigating the world map + petcapRemover ------------- This plugin allows you to remove or raise the pet population cap. In vanilla DF, pets will not reproduce unless the population is below 50 and the number of children of that species is below a certain percentage. This plugin allows removing the second restriction and removing or raising the first. Pets still require PET or PET_EXOTIC tags in order to reproduce. Type help petcapRemover for exact usage. In order to make population more stable and avoid sudden population booms as you go below the raised population cap, this plugin counts pregnancies toward the new population cap. It can still go over, but only in the case of multiple births. +`petcapRemover` + cause pregnancies now and schedule the next check +`petcapRemover every n` + set how often in ticks the plugin checks for possible pregnancies +`petcapRemover cap n` + set the new cap to n. if n = 0, no cap +`petcapRemover pregtime n` + sets the pregnancy duration to n ticks. natural pregnancies are 300000 ticks for the current race and 200000 for everyone else + misery ------ When enabled, every new negative dwarven thought will be multiplied by a factor (2 by default). From 46e452848a21a69846c0efb790f921edac8e181e Mon Sep 17 00:00:00 2001 From: expwnent Date: Fri, 20 Jun 2014 03:09:43 -0400 Subject: [PATCH 15/15] Update NEWS. --- NEWS | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/NEWS b/NEWS index 4c7de7e4e..03332493d 100644 --- a/NEWS +++ b/NEWS @@ -1,5 +1,9 @@ DFHack future +The future has not yet happened. Stay tuned! + +DFHack v0.34.11-r5 + Internals: - support for calling a lua function via a protobuf request (demonstrated by dfhack-run --lua). - support for basic filesystem operations (e.g. chdir, mkdir, rmdir, stat) in C++ and Lua