Skip to content

Commit ee958c0

Browse files
committed
Update some plugins/scripts for 0.40.22
* autolabor, manipulator: Add BUILD_CONSTRUCTION and BUILD_ROAD labors * mousequery: Support "toggle engravings" sidebar mode * devel/export-dt-ini.lua: Add body_part_flags Conflicts: plugins/mousequery.cpp
1 parent 5fc8a1f commit ee958c0

4 files changed

Lines changed: 29 additions & 15 deletions

File tree

plugins/autolabor.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -477,7 +477,9 @@ static const struct labor_default default_labor_infos[] = {
477477
/* PULL_LEVER */ {HAULERS, false, 1, 200, 0},
478478
/* REMOVE_CONSTRUCTION */ {HAULERS, false, 1, 200, 0},
479479
/* HAUL_WATER */ {HAULERS, false, 1, 200, 0},
480-
/* GELD */ {AUTOMATIC, false, 1, 200, 0}
480+
/* GELD */ {AUTOMATIC, false, 1, 200, 0},
481+
/* BUILD_ROAD */ {AUTOMATIC, false, 1, 200, 0},
482+
/* BUILD_CONSTRUCTION */ {AUTOMATIC, false, 1, 200, 0}
481483
};
482484

483485
static const int responsibility_penalties[] = {

plugins/manipulator.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,9 @@ const SkillColumn columns[] = {
189189
{12, 4, profession::ALCHEMIST, unit_labor::ALCHEMIST, job_skill::ALCHEMY, "Al"},
190190
{12, 4, profession::NONE, unit_labor::CLEAN, job_skill::NONE, "Cl"},
191191
{12, 4, profession::NONE, unit_labor::PULL_LEVER, job_skill::NONE, "Lv"},
192-
{12, 4, profession::NONE, unit_labor::REMOVE_CONSTRUCTION, job_skill::NONE, "Co"},
192+
{12, 4, profession::NONE, unit_labor::BUILD_ROAD, job_skill::NONE, "Ro"},
193+
{12, 4, profession::NONE, unit_labor::BUILD_CONSTRUCTION, job_skill::NONE, "Co"},
194+
{12, 4, profession::NONE, unit_labor::REMOVE_CONSTRUCTION, job_skill::NONE, "CR"},
193195
// Military - Weapons
194196
{13, 7, profession::WRESTLER, unit_labor::NONE, job_skill::WRESTLING, "Wr"},
195197
{13, 7, profession::AXEMAN, unit_labor::NONE, job_skill::AXE, "Ax"},
@@ -1219,7 +1221,7 @@ void viewscreen_unitlaborsst::render()
12191221

12201222
OutputString(10, x, y, Screen::getKeyDisplay(interface_key::OPTION20));
12211223
OutputString(15, x, y, ": Toggle View, ");
1222-
1224+
12231225
OutputString(10, x, y, Screen::getKeyDisplay(interface_key::SECONDSCROLL_DOWN));
12241226
OutputString(10, x, y, Screen::getKeyDisplay(interface_key::SECONDSCROLL_UP));
12251227
OutputString(15, x, y, ": Sort by Skill, ");

plugins/mousequery.cpp

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ static vector<df::unit *> get_units_at(const df::coord pos, bool only_one)
9999
{
100100
df::unit *unit = world->units.active[i];
101101

102-
if(unit->pos.x == pos.x && unit->pos.y == pos.y && unit->pos.z == pos.z &&
102+
if(unit->pos.x == pos.x && unit->pos.y == pos.y && unit->pos.z == pos.z &&
103103
!(unit->flags1.whole & bad_flags.whole) &&
104104
unit->profession != profession::THIEF && unit->profession != profession::MASTER_THIEF)
105105
{
@@ -169,7 +169,7 @@ static df::interface_key get_default_query_mode(const df::coord pos)
169169
{
170170
// For containers use item view, for everything else, query view
171171
return (type == building_type::Box || type == building_type::Cabinet ||
172-
type == building_type::Weaponrack || type == building_type::Armorstand)
172+
type == building_type::Weaponrack || type == building_type::Armorstand)
173173
? df::interface_key::D_BUILDITEM : df::interface_key::D_BUILDJOB;
174174
}
175175
}
@@ -210,13 +210,22 @@ struct mousequery_hook : public df::viewscreen_dwarfmodest
210210
case DesignateCarveTrack:
211211
case DesignateEngrave:
212212
case DesignateCarveFortification:
213+
case DesignateItemsClaim:
214+
case DesignateItemsForbid:
215+
case DesignateItemsMelt:
216+
case DesignateItemsUnmelt:
217+
case DesignateItemsDump:
218+
case DesignateItemsUndump:
219+
case DesignateItemsHide:
220+
case DesignateItemsUnhide:
213221
case DesignateChopTrees:
214222
case DesignateToggleEngravings:
215-
case DesignateRemoveConstruction:
223+
case DesignateToggleMarker:
216224
case DesignateTrafficHigh:
217225
case DesignateTrafficNormal:
218226
case DesignateTrafficLow:
219227
case DesignateTrafficRestricted:
228+
case DesignateRemoveConstruction:
220229
return true;
221230

222231
case Burrows:
@@ -268,7 +277,7 @@ struct mousequery_hook : public df::viewscreen_dwarfmodest
268277

269278
bool isInAreaSelectionMode()
270279
{
271-
bool selectableMode =
280+
bool selectableMode =
272281
isInDesignationMenu() ||
273282
ui->main.mode == Stockpiles ||
274283
ui->main.mode == Zones;
@@ -357,13 +366,13 @@ struct mousequery_hook : public df::viewscreen_dwarfmodest
357366

358367
enabler->mouse_lbut = 0;
359368

360-
// Can't check limits earlier as we must be sure we are in query or default mode
369+
// Can't check limits earlier as we must be sure we are in query or default mode
361370
// (so we can clear the button down flag)
362371
int right_bound = (dims.menu_x1 > 0) ? dims.menu_x1 - 2 : gps->dimx - 2;
363372
if (mx < 1 || mx > right_bound || my < 1 || my > gps->dimy - 2)
364373
return false;
365374

366-
if (ui->main.mode == df::ui_sidebar_mode::Zones ||
375+
if (ui->main.mode == df::ui_sidebar_mode::Zones ||
367376
ui->main.mode == df::ui_sidebar_mode::Stockpiles)
368377
{
369378
int32_t x, y, z;
@@ -414,7 +423,7 @@ struct mousequery_hook : public df::viewscreen_dwarfmodest
414423

415424
using namespace df::enums::ui_sidebar_mode;
416425
if ((ui->main.mode == QueryBuilding || ui->main.mode == BuildingItems ||
417-
ui->main.mode == ViewUnits || ui->main.mode == LookAround) ||
426+
ui->main.mode == ViewUnits || ui->main.mode == LookAround) ||
418427
(isInTrackableMode() && tracking_enabled))
419428
{
420429
sendKey(df::interface_key::LEAVESCREEN);
@@ -549,7 +558,7 @@ struct mousequery_hook : public df::viewscreen_dwarfmodest
549558
mpos_valid = false;
550559

551560
// Check if in lever binding mode
552-
if (Gui::getFocusString(Core::getTopViewscreen()) ==
561+
if (Gui::getFocusString(Core::getTopViewscreen()) ==
553562
"dwarfmode/QueryBuilding/Some/Lever/AddJob")
554563
{
555564
return;
@@ -651,7 +660,7 @@ struct mousequery_hook : public df::viewscreen_dwarfmodest
651660
if (Gui::getDesignationCoords(x, y, z))
652661
{
653662
color = COLOR_WHITE;
654-
if (ui->main.mode == df::ui_sidebar_mode::Zones ||
663+
if (ui->main.mode == df::ui_sidebar_mode::Zones ||
655664
ui->main.mode == df::ui_sidebar_mode::Stockpiles)
656665
{
657666
auto dX = abs(x - mpos.x);
@@ -670,8 +679,8 @@ struct mousequery_hook : public df::viewscreen_dwarfmodest
670679

671680
if (shouldTrack())
672681
{
673-
if (delta_t <= scroll_delay && (mx < scroll_buffer ||
674-
mx > dims.menu_x1 - scroll_buffer ||
682+
if (delta_t <= scroll_delay && (mx < scroll_buffer ||
683+
mx > dims.menu_x1 - scroll_buffer ||
675684
my < scroll_buffer ||
676685
my > gps->dimy - scroll_buffer))
677686
{
@@ -831,7 +840,7 @@ DFhackCExport command_result plugin_init ( color_ostream &out, std::vector <Plug
831840
commands.push_back(
832841
PluginCommand(
833842
"mousequery", "Add mouse functionality to Dwarf Fortress",
834-
mousequery_cmd, false,
843+
mousequery_cmd, false,
835844
"mousequery [plugin|rbutton|track|edge|live] [enabled|disabled]\n"
836845
" plugin: enable/disable the entire plugin\n"
837846
" rbutton: enable/disable right mouse button\n"

scripts/devel/export-dt-ini.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,7 @@ address('shape_name_plural',df.descriptor_shape,'name_plural')
269269

270270
header('health_offsets')
271271
address('parent_id',df.body_part_raw,'con_part_id')
272+
address('body_part_flags',df.body_part_raw,'flags')
272273
address('layers_vector',df.body_part_raw,'layers')
273274
address('number',df.body_part_raw,'number')
274275
address('names_vector',df.body_part_raw,'name_singular')

0 commit comments

Comments
 (0)