Update strangemood plugin according to actual game code

develop
Quietust 2015-12-12 13:46:35 -06:00
parent 3083b01525
commit eb1092da6e
2 changed files with 15 additions and 8 deletions

@ -1 +1 @@
Subproject commit 6e2e8731d2c10a4a5394046ae48cc0cd16e9a049
Subproject commit 739101518a8d9bb676851de3a07ff82f4cc26832

@ -56,6 +56,8 @@ bool isUnitMoodable (df::unit *unit)
return false;
if (!ENUM_ATTR(profession,moodable,unit->profession))
return false;
if (!Units::casteFlagSet(unit->race, unit->caste, caste_raw_flags::STRANGE_MOODS))
return false;
return true;
}
@ -104,11 +106,11 @@ df::job_skill getMoodSkill (df::unit *unit)
}
if (!skills.size() && civ)
{
if (civ->entity_raw->jobs.permitted_job[profession::WOODCRAFTER])
if (civ->resources.permitted_skill[job_skill::WOODCRAFT])
skills.push_back(job_skill::WOODCRAFT);
if (civ->entity_raw->jobs.permitted_job[profession::STONECRAFTER])
if (civ->resources.permitted_skill[job_skill::STONECRAFT])
skills.push_back(job_skill::STONECRAFT);
if (civ->entity_raw->jobs.permitted_job[profession::BONE_CARVER])
if (civ->resources.permitted_skill[job_skill::BONECARVE])
skills.push_back(job_skill::BONECARVE);
}
if (!skills.size())
@ -728,6 +730,8 @@ command_result df_strangemood (color_ostream &out, vector <string> & parameters)
case job_skill::WOODCRAFT:
case job_skill::STONECRAFT:
case job_skill::BONECARVE:
case job_skill::PAPERMAKING: // These aren't actually moodable skills
case job_skill::BOOKBINDING: // but the game still checks for them anyways
job->job_type = job_type::StrangeMoodCrafter;
break;
case job_skill::TANNER:
@ -861,6 +865,8 @@ command_result df_strangemood (color_ostream &out, vector <string> & parameters)
case job_skill::CARPENTRY:
case job_skill::WOODCRAFT:
case job_skill::BOWYER:
case job_skill::PAPERMAKING:
case job_skill::BOOKBINDING:
job->job_items.push_back(item = new df::job_item());
item->item_type = item_type::WOOD;
item->quantity = base_item_count;
@ -960,6 +966,7 @@ command_result df_strangemood (color_ostream &out, vector <string> & parameters)
case job_skill::FORGE_WEAPON:
case job_skill::FORGE_ARMOR:
// there are actually 2 distinct cases here, but they're identical
case job_skill::FORGE_FURNITURE:
case job_skill::METALCRAFT:
filter = NULL;
@ -990,7 +997,7 @@ command_result df_strangemood (color_ostream &out, vector <string> & parameters)
item->item_type = item_type::BAR;
item->mat_type = filter->getMaterial();
item->mat_index = filter->getMaterialIndex();
item->quantity = base_item_count * 150;
item->quantity = base_item_count * 150; // BUGFIX - the game does not adjust here!
item->min_dimension = 150;
}
else
@ -1012,7 +1019,7 @@ command_result df_strangemood (color_ostream &out, vector <string> & parameters)
}
if (mats.size())
item->mat_index = mats[rng.df_trandom(mats.size())];
item->quantity = base_item_count * 150;
item->quantity = base_item_count * 150; // BUGFIX - the game does not adjust here!
item->min_dimension = 150;
}
break;
@ -1264,12 +1271,12 @@ command_result df_strangemood (color_ostream &out, vector <string> & parameters)
item->quantity = 1;
if (item_type == item_type::BAR)
{
item->quantity *= 150;
item->quantity *= 150; // BUGFIX - the game does not adjust here!
item->min_dimension = 150;
}
if (item_type == item_type::CLOTH)
{
item->quantity *= 10000;
item->quantity *= 10000; // BUGFIX - the game does not adjust here!
item->min_dimension = 10000;
}
}