diff --git a/dfhack/include/modules/Creatures.h b/dfhack/include/modules/Creatures.h index c25df940e..5a2c0c618 100644 --- a/dfhack/include/modules/Creatures.h +++ b/dfhack/include/modules/Creatures.h @@ -336,6 +336,7 @@ namespace DFHack t_name name; int16_t mood; + int16_t mood_skill; t_name artifact_name; uint8_t profession; diff --git a/dfhack/modules/Creatures.cpp b/dfhack/modules/Creatures.cpp index bd7bbd751..7e2b2e50f 100644 --- a/dfhack/modules/Creatures.cpp +++ b/dfhack/modules/Creatures.cpp @@ -88,6 +88,7 @@ Creatures::Creatures(APIPrivate* _d) creatures.default_soul_offset = minfo->getOffset("creature_default_soul"); creatures.physical_offset = minfo->getOffset("creature_physical"); creatures.mood_offset = minfo->getOffset("creature_mood"); + creatures.mood_skill_offset = minfo->getOffset("creature_mood_skill"); creatures.pickup_equipment_bit = minfo->getOffset("creature_pickup_equipment_bit"); creatures.current_job_offset = minfo->getOffset("creature_current_job"); // soul offsets @@ -185,6 +186,7 @@ bool Creatures::ReadCreature (const int32_t index, t_creature & furball) // mood stuff furball.mood = (int16_t) p->readWord (temp + offs.mood_offset); + furball.mood_skill = p->readWord (temp + offs.mood_skill_offset); d->d->readName(furball.artifact_name, temp + offs.artifact_name_offset); // custom profession diff --git a/dfhack/shm/mod-creature2010.h b/dfhack/shm/mod-creature2010.h index adf4f9e4f..ae9c60ab7 100644 --- a/dfhack/shm/mod-creature2010.h +++ b/dfhack/shm/mod-creature2010.h @@ -50,6 +50,7 @@ typedef struct uint32_t artifact_name_offset; uint32_t physical_offset; uint32_t mood_offset; + uint32_t mood_skill_offset; uint32_t pickup_equipment_bit; uint32_t soul_vector_offset; uint32_t default_soul_offset; diff --git a/examples/creaturedump.cpp b/examples/creaturedump.cpp index 9fc5a84f8..db071c2e7 100644 --- a/examples/creaturedump.cpp +++ b/examples/creaturedump.cpp @@ -243,7 +243,7 @@ void printCreature(DFHack::API & DF, const DFHack::t_creature & creature) if(creature.mood != -1) { - cout << "mood: " << creature.mood << endl; + cout << "mood: " << creature.mood << ", skill: " << mem->getSkill(creature.mood_skill) << endl; vector mat; char * maintype; if(Creatures->ReadJob(&creature, mat))