|
|
|
@ -71,7 +71,7 @@ static map<df::unit *, deque<activity_type>> work_history;
|
|
|
|
|
static int misery[] = { 0, 0, 0, 0, 0, 0, 0 };
|
|
|
|
|
static bool misery_upto_date = false;
|
|
|
|
|
|
|
|
|
|
static color_value monitor_colors[] =
|
|
|
|
|
static color_value monitor_colors[] =
|
|
|
|
|
{
|
|
|
|
|
COLOR_LIGHTRED,
|
|
|
|
|
COLOR_RED,
|
|
|
|
@ -84,20 +84,20 @@ static color_value monitor_colors[] =
|
|
|
|
|
|
|
|
|
|
static int get_happiness_cat(df::unit *unit)
|
|
|
|
|
{
|
|
|
|
|
int happy = unit->status.happiness;
|
|
|
|
|
if (happy == 0) // miserable
|
|
|
|
|
int stress = unit->status.current_soul->personality.stress_level;
|
|
|
|
|
if (stress >= 500000)
|
|
|
|
|
return 0;
|
|
|
|
|
else if (happy <= 25) // very unhappy
|
|
|
|
|
else if (stress >= 250000)
|
|
|
|
|
return 1;
|
|
|
|
|
else if (happy <= 50) // unhappy
|
|
|
|
|
else if (stress >= 100000)
|
|
|
|
|
return 2;
|
|
|
|
|
else if (happy <= 75) // fine
|
|
|
|
|
else if (stress >= 60000)
|
|
|
|
|
return 3;
|
|
|
|
|
else if (happy <= 125) // quite content
|
|
|
|
|
else if (stress >= 30000)
|
|
|
|
|
return 4;
|
|
|
|
|
else if (happy <= 150) // happy
|
|
|
|
|
else if (stress >= 0)
|
|
|
|
|
return 5;
|
|
|
|
|
else // ecstatic
|
|
|
|
|
else
|
|
|
|
|
return 6;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -688,7 +688,7 @@ public:
|
|
|
|
|
case job_type::FertilizeField:
|
|
|
|
|
real_activity = JOB_AGRICULTURE;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
case job_type::ButcherAnimal:
|
|
|
|
|
case job_type::PrepareRawFish:
|
|
|
|
|
case job_type::MillPlants:
|
|
|
|
@ -913,7 +913,7 @@ public:
|
|
|
|
|
populateDwarfColumn();
|
|
|
|
|
populateCategoryBreakdownColumn();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -1015,7 +1015,7 @@ private:
|
|
|
|
|
map<activity_type, map<df::unit *, size_t>> dwarf_activity_values;
|
|
|
|
|
size_t fort_activity_count;
|
|
|
|
|
size_t window_days;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vector<activity_type> listed_activities;
|
|
|
|
|
|
|
|
|
|
void validateColumn()
|
|
|
|
@ -1227,7 +1227,7 @@ public:
|
|
|
|
|
if (!unit->status.current_soul)
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
for (auto it = unit->status.current_soul->preferences.begin();
|
|
|
|
|
for (auto it = unit->status.current_soul->preferences.begin();
|
|
|
|
|
it != unit->status.current_soul->preferences.end();
|
|
|
|
|
it++)
|
|
|
|
|
{
|
|
|
|
@ -1639,7 +1639,7 @@ static void update_dwarf_stats(bool is_paused)
|
|
|
|
|
add_work_history(unit, JOB_LEISURE);
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
add_work_history(unit, unit->job.current_job->job_type);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -1654,7 +1654,7 @@ DFhackCExport command_result plugin_onupdate (color_ostream &out)
|
|
|
|
|
return CR_OK;
|
|
|
|
|
|
|
|
|
|
static decltype(world->frame_counter) last_frame_count = 0;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bool is_paused = DFHack::World::ReadPauseState();
|
|
|
|
|
if (is_paused)
|
|
|
|
|
{
|
|
|
|
@ -1841,11 +1841,11 @@ DFhackCExport command_result plugin_init(color_ostream &out, std::vector <Plugin
|
|
|
|
|
activity_labels[JOB_MECHANICAL] = "Mechanics";
|
|
|
|
|
activity_labels[JOB_ANIMALS] = "Animal Handling";
|
|
|
|
|
activity_labels[JOB_PRODUCTIVE] = "Other Productive";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
commands.push_back(
|
|
|
|
|
PluginCommand(
|
|
|
|
|
"dwarfmonitor", "Records dwarf activity to measure fort efficiency",
|
|
|
|
|
dwarfmonitor_cmd, false,
|
|
|
|
|
dwarfmonitor_cmd, false,
|
|
|
|
|
"dwarfmonitor enable <mode>\n"
|
|
|
|
|
" Start monitoring <mode>\n"
|
|
|
|
|
" <mode> can be \"work\", \"misery\", or \"all\"\n"
|
|
|
|
|