units

units.unit_flags1

<bitfield-type type-name="unit_flags1" base-type="uint32_t">
  <flag-bit name="move_state">
    Can the dwarf move or are they waiting for their movement timer
  </flag-bit>
  <flag-bit name="dead">
    Dead (might also be set for incoming/leaving critters that are
    alive)
  </flag-bit>
  <flag-bit name="has_mood">
    Currently in mood
  </flag-bit>
  <flag-bit name="had_mood">
    Had a mood already
  </flag-bit>
  <flag-bit name="marauder">
    wide class of invader/inside creature attackers
  </flag-bit>
  <flag-bit name="drowning">
    Is currently drowning
  </flag-bit>
  <flag-bit name="merchant">
    An active merchant
  </flag-bit>
  <flag-bit name="forest">
    used for units no longer linked to merchant/diplomacy, they just
    try to leave mostly
  </flag-bit>
  <flag-bit name="left">
    left the map
  </flag-bit>
  <flag-bit name="rider">
    Is riding an another creature
  </flag-bit>
  <flag-bit name="incoming"/>
  <flag-bit name="diplomat"/>
  <flag-bit name="zombie"/>
  <flag-bit name="skeleton"/>
  <flag-bit name="can_swap">
    Can swap tiles during movement (prevents multiple swaps)
  </flag-bit>
  <flag-bit name="on_ground">
    The creature is laying on the floor, can be conscious
  </flag-bit>
  <flag-bit name="projectile">
    Launched into the air? Funny.
  </flag-bit>
  <flag-bit name="active_invader">
    Active invader (for organized ones)
  </flag-bit>
  <flag-bit name="hidden_in_ambush"/>
  <flag-bit name="invader_origin">
    Invader origin (could be inactive and fleeing)
  </flag-bit>
  <flag-bit name="coward">
    Will flee if invasion turns around
  </flag-bit>
  <flag-bit name="hidden_ambusher">
    Active marauder/invader moving inward?
  </flag-bit>
  <flag-bit name="invades">
    Marauder resident/invader moving in all the way
  </flag-bit>
  <flag-bit name="check_flows">
    Check against flows next time you get a chance
  </flag-bit>
  <flag-bit name="ridden"/>
  <flag-bit name="caged"/>
  <flag-bit name="tame"/>
  <flag-bit name="chained"/>
  <flag-bit name="royal_guard"/>
  <flag-bit name="fortress_guard"/>
  <flag-bit name="suppress_wield"/>
  <flag-bit name="important_historical_figure">
    Is an important historical figure
  </flag-bit>
</bitfield-type>

units.unit_flags2

<bitfield-type type-name="unit_flags2" base-type="uint32_t">
  <flag-bit name="swimming"/>
  <flag-bit name="sparring"/>
  <flag-bit name="no_notify">
    Do not notify about level gains (for embark etc)
  </flag-bit>
  <flag-bit name="unused"/>
  <flag-bit name="calculated_nerves"/>
  <flag-bit name="calculated_bodyparts"/>
  <flag-bit name="important_historical_figure">
    Is important historical figure (slight variation)
  </flag-bit>
  <flag-bit name="killed">
    Has been killed by kill function (slightly different from dead,
    not necessarily violent death)
  </flag-bit>
  <flag-bit name="cleanup_1">
    Must be forgotten by forget function (just cleanup)
  </flag-bit>
  <flag-bit name="cleanup_2">
    Must be deleted (cleanup)
  </flag-bit>
  <flag-bit name="cleanup_3">
    Recently forgotten (cleanup)
  </flag-bit>
  <flag-bit name="for_trade">
    Offered for trade
  </flag-bit>
  <flag-bit name="trade_resolved"/>
  <flag-bit name="has_breaks"/>
  <flag-bit name="gutted"/>
  <flag-bit name="circulatory_spray"/>
  <flag-bit name="locked_in_for_trading">
    Locked in for trading (it's a projectile on the other set of
    flags, might be what the flying was)
  </flag-bit>
  <flag-bit name="slaughter">
    marked for slaughter
  </flag-bit>
  <flag-bit name="underworld">
    Underworld creature
  </flag-bit>
  <flag-bit name="resident">
    Current resident
  </flag-bit>
  <flag-bit name="cleanup_4">
    Marked for special cleanup as unused load from unit block on disk
  </flag-bit>
  <flag-bit name="calculated_insulation">
    Insulation from clothing calculated
  </flag-bit>
  <flag-bit name="visitor_uninvited">
    Uninvited guest
  </flag-bit>
  <flag-bit name="visitor"/>
  <flag-bit name="calculated_inventory">
    Inventory order calculated
  </flag-bit>
  <flag-bit name="vision_good">
    Vision -- have good part
  </flag-bit>
  <flag-bit name="vision_damaged">
    Vision -- have damaged part
  </flag-bit>
  <flag-bit name="vision_missing">
    Vision -- have missing part
  </flag-bit>
  <flag-bit name="breathing_good">
    Breathing -- have good part
  </flag-bit>
  <flag-bit name="breathing_problem">
    Breathing -- having a problem
  </flag-bit>
  <flag-bit name="roaming_wilderness_population_source"/>
  <flag-bit
      name="roaming_wilderness_population_source_not_a_map_feature"/>
</bitfield-type>

units.unit_flags3

<bitfield-type type-name="unit_flags3" base-type="uint32_t">
  <flag-bit name="body_part_relsize_computed"/>
  <flag-bit name="size_modifier_computed"/>
  <flag-bit name="stuck_weapon_computed">
    cleared if removing StuckIn item to recompute wound flags.
  </flag-bit>
  <flag-bit name="compute_health">
    causes the health structure to be created or updated
  </flag-bit>
  <flag-bit name="announce_titan">
    Announces creature like an FB or titan.
  </flag-bit>
  <flag-bit name="unk5"/>
  <flag-bit name="on_crutch"/>
  <flag-bit name="weight_computed"/>
  <flag-bit name="body_temp_in_range">
    Is set to 1 every tick for non-dead creatures.
  </flag-bit>
  <flag-bit name="wait_until_reveal">
    Blocks all kind of things until tile is revealed.
  </flag-bit>
  <flag-bit name="scuttle">
    Scuttle creature: causes creature to be killed, leaving a behind
    corpse and generating negative thoughts like a real kill.
  </flag-bit>
  <flag-bit name="unk11"/>
  <flag-bit name="ghostly"/>
  <flag-bit name="unk13"/>
  <flag-bit name="unk14"/>
  <flag-bit name="unk15">
    dropped when znew >= zold
  </flag-bit>
  <flag-bit name="unk16">
    something to do with werewolves?
  </flag-bit>
  <flag-bit name="no_meandering">
    for active_invaders
  </flag-bit>
  <flag-bit name="floundering"/>
  <flag-bit name="exit_vehicle1">
    trapavoid
  </flag-bit>
  <flag-bit name="exit_vehicle2">
    trapavoid
  </flag-bit>
  <flag-bit name="dangerous_terrain"/>
  <flag-bit name="adv_yield"/>
  <flag-bit name="unk23"/>
  <flag-bit name="unk24"/>
  <flag-bit name="emotionally_overloaded">
    v0.40.01
  </flag-bit>
  <flag-bit name="unk26"/>
  <flag-bit name="available_for_adoption"/>
  <flag-bit name="gelded"/>
  <flag-bit name="unk29"/>
  <flag-bit name="injury_thought"/>
  <flag-bit name="unk31"/>
</bitfield-type>

units.unit_flags4

<bitfield-type type-name="unit_flags4" base-type="uint32_t">
  <flag-bit name="unk0"/>
  <flag-bit name="unk1"/>
  <flag-bit name="unk2"/>
  <flag-bit name="unk3"/>
</bitfield-type>

units.value_type

<enum-type type-name="value_type">
  <enum-item name="LAW"/>
  <enum-item name="LOYALTY"/>
  <enum-item name="FAMILY"/>
  <enum-item name="FRIENDSHIP"/>
  <enum-item name="POWER"/>
  <enum-item name="TRUTH"/>
  <enum-item name="CUNNING"/>
  <enum-item name="ELOQUENCE"/>
  <enum-item name="FAIRNESS"/>
  <enum-item name="DECORUM"/>
  <enum-item name="TRADITION"/>
  <enum-item name="ARTWORK"/>
  <enum-item name="COOPERATION"/>
  <enum-item name="INDEPENDENCE"/>
  <enum-item name="STOICISM"/>
  <enum-item name="INTROSPECTION"/>
  <enum-item name="SELF_CONTROL"/>
  <enum-item name="TRANQUILITY"/>
  <enum-item name="HARMONY"/>
  <enum-item name="MERRIMENT"/>
  <enum-item name="CRAFTSMANSHIP"/>
  <enum-item name="MARTIAL_PROWESS"/>
  <enum-item name="SKILL"/>
  <enum-item name="HARD_WORK"/>
  <enum-item name="SACRIFICE"/>
  <enum-item name="COMPETITION"/>
  <enum-item name="PERSEVERENCE"/>
  <enum-item name="LEISURE_TIME"/>
  <enum-item name="COMMERCE"/>
  <enum-item name="ROMANCE"/>
  <enum-item name="NATURE"/>
  <enum-item name="PEACE"/>
  <enum-item name="KNOWLEDGE"/>
</enum-type>

units.goal_type

<enum-type type-name="goal_type" base-type="int32_t">
  <enum-item name="STAY_ALIVE"/>
  <enum-item name="MAINTAIN_ENTITY_STATUS"/>
  <enum-item name="START_A_FAMILY"/>
  <enum-item name="RULE_THE_WORLD"/>
  <enum-item name="CREATE_A_GREAT_WORK_OF_ART"/>
  <enum-item name="CRAFT_A_MASTERWORK"/>
  <enum-item name="BRING_PEACE_TO_THE_WORLD"/>
  <enum-item name="BECOME_A_LEGENDARY_WARRIOR"/>
  <enum-item name="MASTER_A_SKILL"/>
  <enum-item name="FALL_IN_LOVE"/>
  <enum-item name="SEE_THE_GREAT_NATURAL_SITES"/>
  <enum-item name="IMMORTALITY"/>
</enum-type>

units.personality_facet_type

<enum-type type-name="personality_facet_type" base-type="uint16_t">
  <enum-item name="LOVE_PROPENSITY"/>
  <enum-item name="HATE_PROPENSITY"/>
  <enum-item name="ENVY_PROPENSITY"/>
  <enum-item name="CHEER_PROPENSITY"/>
  <enum-item name="DEPRESSION_PROPENSITY"/>
  <enum-item name="ANGER_PROPENSITY"/>
  <enum-item name="ANXIETY_PROPENSITY"/>
  <enum-item name="LUST_PROPENSITY"/>
  <enum-item name="STRESS_VULNERABILITY"/>
  <enum-item name="GREED"/>
  <enum-item name="IMMODERATION"/>
  <enum-item name="VIOLENT"/>
  <enum-item name="PERSEVERENCE"/>
  <enum-item name="WASTEFULNESS"/>
  <enum-item name="DISCORD"/>
  <enum-item name="FRIENDLINESS"/>
  <enum-item name="POLITENESS"/>
  <enum-item name="DISDAIN_ADVICE"/>
  <enum-item name="BRAVERY"/>
  <enum-item name="CONFIDENCE"/>
  <enum-item name="VANITY"/>
  <enum-item name="AMBITION"/>
  <enum-item name="GRATITUDE"/>
  <enum-item name="IMMODESTY"/>
  <enum-item name="HUMOR"/>
  <enum-item name="VENGEFUL"/>
  <enum-item name="PRIDE"/>
  <enum-item name="CRUELTY"/>
  <enum-item name="SINGLEMINDED"/>
  <enum-item name="HOPEFUL"/>
  <enum-item name="CURIOUS"/>
  <enum-item name="BASHFUL"/>
  <enum-item name="PRIVACY"/>
  <enum-item name="PERFECTIONIST"/>
  <enum-item name="CLOSEMINDED"/>
  <enum-item name="TOLERANT"/>
  <enum-item name="EMOTIONALLY_OBSESSIVE"/>
  <enum-item name="SWAYED_BY_EMOTIONS"/>
  <enum-item name="ALTRUISM"/>
  <enum-item name="DUTIFULNESS"/>
  <enum-item name="THOUGHTLESSNESS"/>
  <enum-item name="ORDERLINESS"/>
  <enum-item name="TRUST"/>
  <enum-item name="GREGARIOUSNESS"/>
  <enum-item name="ASSERTIVENESS"/>
  <enum-item name="ACTIVITY_LEVEL"/>
  <enum-item name="EXCITEMENT_SEEKING"/>
  <enum-item name="IMAGINATION"/>
  <enum-item name="ABSTRACT_INCLINED"/>
  <enum-item name="ART_INCLINED"/>
</enum-type>

units.physical_attribute_type

<enum-type type-name="physical_attribute_type">
  <enum-item name="STRENGTH"/>
  <enum-item name="AGILITY"/>
  <enum-item name="TOUGHNESS"/>
  <enum-item name="ENDURANCE"/>
  <enum-item name="RECUPERATION"/>
  <enum-item name="DISEASE_RESISTANCE"/>
</enum-type>

units.mental_attribute_type

<enum-type type-name="mental_attribute_type">
  <enum-item name="ANALYTICAL_ABILITY"/>
  <enum-item name="FOCUS"/>
  <enum-item name="WILLPOWER"/>
  <enum-item name="CREATIVITY"/>
  <enum-item name="INTUITION"/>
  <enum-item name="PATIENCE"/>
  <enum-item name="MEMORY"/>
  <enum-item name="LINGUISTIC_ABILITY"/>
  <enum-item name="SPATIAL_SENSE"/>
  <enum-item name="MUSICALITY"/>
  <enum-item name="KINESTHETIC_SENSE"/>
  <enum-item name="EMPATHY"/>
  <enum-item name="SOCIAL_AWARENESS"/>
</enum-type>

units.mood_type

<enum-type type-name="mood_type" base-type="int16_t">
  <enum-item name="None" value="-1"/>
  <enum-item name="Fey"/>
  <enum-item name="Secretive"/>
  <enum-item name="Possessed"/>
  <enum-item name="Macabre"/>
  <enum-item name="Fell"/>
  <enum-item name="Melancholy"/>
  <enum-item name="Raving"/>
  <enum-item name="Berserk"/>
  <enum-item name="Baby"/>
  <enum-item name="Traumatized"/>
</enum-type>

units.ghost_type

<enum-type type-name="ghost_type" base-type="int16_t">
  <enum-item name="MurderousGhost"/>
  <enum-item name="SadisticGhost"/>
  <enum-item name="SecretivePoltergeist"/>
  <enum-item name="EnergeticPoltergeist"/>
  <enum-item name="AngryGhost"/>
  <enum-item name="ViolentGhost"/>
  <enum-item name="MoaningSpirit"/>
  <enum-item name="HowlingSpirit"/>
  <enum-item name="TroublesomePoltergeist"/>
  <enum-item name="RestlessHaunt"/>
  <enum-item name="ForlornHaunt"/>
</enum-type>

units.animal_training_level

<enum-type type-name="animal_training_level" base-type="int32_t">
  <enum-item name="SemiWild"/>
  <enum-item name="Trained"/>
  <enum-item name="WellTrained"/>
  <enum-item name="SkilfullyTrained"/>
  <enum-item name="ExpertlyTrained"/>
  <enum-item name="ExceptionallyTrained"/>
  <enum-item name="MasterfullyTrained"/>
  <enum-item name="Domesticated"/>
  <enum-item name="Unk8"/>
  <enum-item name="WildUntamed">
    Seems to be used as default when not flags1.tame
  </enum-item>
</enum-type>

units.unit_report_type

<enum-type type-name="unit_report_type" base-type="int16_t">
  <enum-item name="Combat"/>
  <enum-item name="Sparring"/>
  <enum-item name="Hunting"/>
</enum-type>

units.skill_rating

<enum-type type-name="skill_rating" base-type="int32_t">
  <enum-attr name="xp_threshold" type-name="uint32_t"/>
  <enum-attr name="caption"/>
  <enum-item name="Dabbling">
    <item-attr name="xp_threshold" value="500"/>
    <item-attr name="caption" value="Dabbling"/>
  </enum-item>
  <enum-item name="Novice">
    <item-attr name="xp_threshold" value="600"/>
    <item-attr name="caption" value="Novice"/>
  </enum-item>
  <enum-item name="Adequate">
    <item-attr name="xp_threshold" value="700"/>
    <item-attr name="caption" value="Adequate"/>
  </enum-item>
  <enum-item name="Competent">
    <item-attr name="xp_threshold" value="800"/>
    <item-attr name="caption" value="Competent"/>
  </enum-item>
  <enum-item name="Skilled">
    <item-attr name="xp_threshold" value="900"/>
    <item-attr name="caption" value="Skilled"/>
  </enum-item>
  <enum-item name="Proficient">
    <item-attr name="xp_threshold" value="1000"/>
    <item-attr name="caption" value="Proficient"/>
  </enum-item>
  <enum-item name="Talented">
    <item-attr name="xp_threshold" value="1100"/>
    <item-attr name="caption" value="Talented"/>
  </enum-item>
  <enum-item name="Adept">
    <item-attr name="xp_threshold" value="1200"/>
    <item-attr name="caption" value="Adept"/>
  </enum-item>
  <enum-item name="Expert">
    <item-attr name="xp_threshold" value="1300"/>
    <item-attr name="caption" value="Expert"/>
  </enum-item>
  <enum-item name="Professional">
    <item-attr name="xp_threshold" value="1400"/>
    <item-attr name="caption" value="Professional"/>
  </enum-item>
  <enum-item name="Accomplished">
    <item-attr name="xp_threshold" value="1500"/>
    <item-attr name="caption" value="Accomplished"/>
  </enum-item>
  <enum-item name="Great">
    <item-attr name="xp_threshold" value="1600"/>
    <item-attr name="caption" value="Great"/>
  </enum-item>
  <enum-item name="Master">
    <item-attr name="xp_threshold" value="1700"/>
    <item-attr name="caption" value="Master"/>
  </enum-item>
  <enum-item name="HighMaster">
    <item-attr name="xp_threshold" value="1800"/>
    <item-attr name="caption" value="High Master"/>
  </enum-item>
  <enum-item name="GrandMaster">
    <item-attr name="xp_threshold" value="1900"/>
    <item-attr name="caption" value="Grand Master"/>
  </enum-item>
  <enum-item name="Legendary">
    <item-attr name="xp_threshold" value="2000"/>
    <item-attr name="caption" value="Legendary"/>
  </enum-item>
  <enum-item name="Legendary1">
    <item-attr name="xp_threshold" value="2100"/>
    <item-attr name="caption" value="Legendary+1"/>
  </enum-item>
  <enum-item name="Legendary2">
    <item-attr name="xp_threshold" value="2200"/>
    <item-attr name="caption" value="Legendary+2"/>
  </enum-item>
  <enum-item name="Legendary3">
    <item-attr name="xp_threshold" value="2300"/>
    <item-attr name="caption" value="Legendary+3"/>
  </enum-item>
  <enum-item name="Legendary4">
    <item-attr name="xp_threshold" value="2400"/>
    <item-attr name="caption" value="Legendary+4"/>
  </enum-item>
  <enum-item name="Legendary5">
    <item-attr name="caption" value="Legendary+5"/>
  </enum-item>
</enum-type>

units.unit_relationship_type

<enum-type type-name="unit_relationship_type" base-type="int16_t">
  -- Can be checked through viewscreen_layer_unit_relationshipst
  <enum-item name="None" value="-1"/>
  <enum-item name="Pet"/>
  <enum-item name="Spouse"/>
  <enum-item name="Mother"/>
  <enum-item name="Father"/>
  <enum-item name="LastAttacker"/>
  <enum-item name="GroupLeader"/>
  <enum-item name="Draggee"/>
  <enum-item name="Dragger"/>
  <enum-item name="RiderMount"/>
  <enum-item name="Lover"/>
  <enum-item name="unk10"/>
  <enum-item name="Sibling"/>
  <enum-item name="Child"/>
  <enum-item name="Friend"/>
  <enum-item name="Grudge"/>
  <enum-item name="Worship"/>
  <enum-item name="AcquaintanceLong"/>
  <enum-item name="AcquaintancePassing"/>
  <enum-item name="Bonded"/>
  <enum-item name="Hero"/>
  <enum-item name="ConsidersViolent"/>
  <enum-item name="ConsidersPsychotic"/>
  <enum-item name="GoodForBusiness"/>
  <enum-item name="FriendlyTerms"/>
  <enum-item name="ConsidersKiller"/>
  <enum-item name="ConsidersMurderer"/>
  <enum-item name="Comrade"/>
  <enum-item name="MemberOfRespectedGroup"/>
  <enum-item name="MemberOfHatedGroup"/>
  <enum-item name="EnemyFighter"/>
  <enum-item name="FriendlyFighter"/>
  <enum-item name="ConsidersBully"/>
  <enum-item name="ConsidersBrigand"/>
  <enum-item name="LoyalSoldier"/>
  <enum-item name="ConsidersMonster"/>
  <enum-item name="ConsidersStoryteller"/>
  <enum-item name="ConsidersPoet"/>
  <enum-item name="ConsidersBard"/>
  <enum-item name="ConsidersDancer"/>
  <enum-item name="Master"/>
  <enum-item name="Apprentice"/>
  <enum-item name="Companion"/>
  <enum-item name="FormerMaster"/>
  <enum-item name="FormerApprentice"/>
  <enum-item name="ConsidersQuarreler"/>
  <enum-item name="ConsidersFlatterer"/>
  <enum-item name="Hunter"/>
  <enum-item name="ProtectorOfTheWeak"/>
  Used in unit.relations
</enum-type>

units.need_type

<enum-type type-name="need_type" base-type="int32_t">
  <enum-item name="Socialize"/>
  <enum-item name="DrinkAlcohol"/>
  <enum-item name="PrayOrMedidate"/>
  <enum-item name="StayOccupied"/>
  <enum-item name="BeCreative"/>
  <enum-item name="Excitement"/>
  <enum-item name="LearnSomething"/>
  <enum-item name="BeWithFamily"/>
  <enum-item name="BeWithFriends"/>
  <enum-item name="HearEloquence"/>
  <enum-item name="UpholdTradition"/>
  <enum-item name="SelfExamination"/>
  <enum-item name="MakeMerry"/>
  <enum-item name="CraftObject"/>
  <enum-item name="MartialTraining"/>
  <enum-item name="PracticeSkill"/>
  <enum-item name="TakeItEasy"/>
  <enum-item name="MakeRomance"/>
  <enum-item name="SeeAnimal"/>
  <enum-item name="SeeGreatBeast"/>
  <enum-item name="AcquireObject"/>
  <enum-item name="EatGoodMeal"/>
  <enum-item name="Fight"/>
  <enum-item name="CauseTrouble"/>
  <enum-item name="Argue"/>
  <enum-item name="BeExtravagant"/>
  <enum-item name="Wander"/>
  <enum-item name="HelpSomebody"/>
  <enum-item name="ThinkAbstractly"/>
  <enum-item name="AdmireArt"/>
</enum-type>

units.unit

<struct-type type-name="unit" key-field="id"
    instance-vector="$global.world.units.all">
  <compound type-name="language_name" name="name"/>
  <stl-string name="custom_profession"/>
  <enum base-type="int16_t" name="profession" type-name="profession"
      init-value="STANDARD"/>
  <enum base-type="int16_t" name="profession2" type-name="profession"
      init-value="STANDARD"/>
  <int32_t name="race" ref-target="creature_raw"/>
  <compound name="pos" type-name="coord"/>
  <compound name="idle_area" type-name="coord">
    E.g. for a dead miner, holds the place where he was likely hanging
     around when he got the command to mine in an aquifer.
  </compound>
  <int32_t name="idle_area_threshold" init-value="3"/>
  <enum base-type="int16_t" name="idle_area_type"
      type-name="unit_station_type"/>
  <int32_t name="follow_distance"/>
  <compound name="path">
    <compound name="dest" type-name="coord"/>
    <enum base-type="int16_t" name="goal" type-name="unit_path_goal"/>
    <compound name="path" type-name="coord_path"/>
  </compound>
  <compound name="flags1" type-name="unit_flags1"/>
  <compound name="flags2" type-name="unit_flags2"/>
  <compound name="flags3" type-name="unit_flags3"/>
  <compound name="flags4" type-name="unit_flags4"/>
  <compound name="meeting">
    <enum name="state" base-type="int8_t">
      <enum-item name="SelectNoble" value="0"/>
      <enum-item name="FollowNoble" value="1"/>
      <enum-item name="DoMeeting" value="2"/>
      <enum-item name="LeaveMap" value="3"/>
    </enum>
    <int32_t name="target_entity" ref-target="historical_entity"/>
    <enum name="target_role"
        type-name="entity_position_responsibility"
        base-type="int16_t"/>
    <padding size="2"/>
  </compound>
  <int16_t name="caste" ref-target="caste_raw" aux-value="$$.race"/>
  <int8_t name="sex" init-value="-1">
    -1 n/a, 0 female, 1 male
  </int8_t>
  <int32_t name="id"/>
  <int16_t name="unk_100"/>
  <enum name="training_level" base-type="int32_t"
      type-name="animal_training_level" init-value="WildUntamed"/>
  <int32_t name="schedule_id" ref-target="schedule_info"/>
  <int32_t name="civ_id" ref-target="historical_entity"/>
  <int32_t name="population_id" ref-target="entity_population"/>
  <int32_t name="unk_c0" init-value="-1">
    v0.34.01
  </int32_t>
  <int32_t name="cultural_identity" ref-target="cultural_identity">
    v0.40.01
  </int32_t>
  <int32_t name="invasion_id" ref-target="invasion_info"/>
  <compound name="patrol_route" type-name="coord_path">
    used by necromancers for corpse locations, siegers etc
  </compound>
  <int32_t name="patrol_index">
    from 23a
  </int32_t>
  <stl-vector name="specific_refs" pointer-type="specific_ref"/>
  <stl-vector name="general_refs" pointer-type="general_ref"/>
  <compound name="military">
    <int32_t name="squad_id" ref-target="squad"/>
    <int32_t name="squad_position" init-value="-1"/>
    <int32_t name="patrol_cooldown"/>
    <int32_t name="patrol_timer"/>
    <int16_t name="cur_uniform"/>
    <stl-vector name="unk_items" type-name="int32_t"
        ref-target="item">
      v0.34.06
    </stl-vector>
    <static-array name="uniforms" count="4">
      <stl-vector type-name="int32_t" ref-target="item"/>
    </static-array>
    <bitfield name="pickup_flags">
      <flag-bit name="update"/>
    </bitfield>
    <stl-vector name="uniform_pickup" type-name="int32_t"
        ref-target="item"/>
    <stl-vector name="uniform_drop" type-name="int32_t"
        ref-target="item"/>
    <stl-vector name="individual_drills" type-name="int32_t"
        ref-target="activity_entry"/>
  </compound>
  <stl-vector name="social_activities" type-name="int32_t"
      ref-target="activity_entry"/>
  <stl-vector type-name="int32_t">
    v0.40.01
  </stl-vector>
  <stl-vector name="activities" type-name="int32_t"
      ref-target="activity_entry"/>
  <stl-vector type-name="int32_t">
    v0.40.01
  </stl-vector>
  <compound name="animal">
    <compound name="population" type-name="world_population_ref"/>
    <int32_t name="leave_countdown">
      once 0, it heads for the edge and leaves
    </int32_t>
    <int32_t name="vanish_countdown">
      once 0, it vanishes in a puff of smoke
    </int32_t>
  </compound>
  <compound name="opponent">
    This was used by a vampire scared of cave creatures and doing
    FleeFromOpponent panic
    <int32_t name="unit_id" ref-target="unit">
      v0.40.01
    </int32_t>
    <compound name="unit_pos" type-name="coord">
      v0.40.01
    </compound>
    <int32_t>
      v0.40.01
    </int32_t>
  </compound>
  <enum base-type="int16_t" name="mood" type-name="mood_type"
      init-value="None"/>
  <int16_t name="unk_18e"/>
  <uint32_t name="pregnancy_timer"/>
  <pointer name="pregnancy_genes" type-name="unit_genes">
    genes from mate
  </pointer>
  <int16_t name="pregnancy_caste" init-value="-1"
      ref-target="caste_raw" aux-value="$$._global.race">
    caste of mate
  </int16_t>
  <int32_t name="pregnancy_spouse" ref-target="historical_figure"/>
  <enum base-type="int16_t" name="mood_copy" type-name="mood_type"
      init-value="None">
    copied from mood type upon entering strange mood
  </enum>
  <pointer name="ghost_info" type-name="unit_ghost_info"/>
  <int32_t name="unk_9" init-value="-1">
    v0.34.01
  </int32_t>
  <int32_t name="birth_year" init-value="-1"/>
  <int32_t name="birth_time" init-value="-1"/>
  <int32_t name="curse_year" init-value="-1">
    v0.34.01
  </int32_t>
  <int32_t name="curse_time" init-value="-1">
    v0.34.01
  </int32_t>
  <int32_t name="birth_year_bias" init-value="0">
    v0.34.01
  </int32_t>
  <int32_t name="birth_time_bias" init-value="0">
    v0.34.01
  </int32_t>
  <int32_t name="old_year" init-value="-1">
    could there be a death of old age time??
  </int32_t>
  <int32_t name="old_time" init-value="-1"/>
  <pointer name="following" type-name="unit"/>
  <uint16_t name="unk_238">
    invalid unless following
  </uint16_t>
  <static-array name="relationship_ids" type-name="int32_t" count="10"
       index-enum="unit_relationship_type"/>
  <int16_t name="mount_type">
    0 = riding, 1 = being carried, 2/3 = wagon horses, 4 = wagon
    merchant
  </int16_t>
  <compound name="last_hit" type-name="history_hit_item"/>
  <int32_t name="riding_item_id" ref-target="item">
    v0.34.08
  </int32_t>
  <stl-vector name="inventory" pointer-type="unit_inventory_item"/>
  <stl-vector name="owned_items" type-name="int32_t"
      ref-target="item"/>
  <stl-vector name="traded_items" type-name="int32_t"
      ref-target="item">
    items brought to trade depot
  </stl-vector>
  <stl-vector name="owned_buildings" pointer-type="building"/>
  <stl-vector name="corpse_parts" type-name="int32_t"
      ref-target="item">
    entries remain even when items are destroyed
  </stl-vector>
  <compound name="job">
    <int32_t name="account"/>
    <int32_t name="satisfaction">
      amount earned recently for jobs
    </int32_t>
    <pointer type-name="unit" name="hunt_target"/>
    <int32_t name="unk_v4305_1"/>
    <pointer type-name="building" name="destroy_target"/>
    <int32_t name="unk_v40_1">
      v0.40.01
    </int32_t>
    <int32_t name="unk_v40_2">
      v0.40.01
    </int32_t>
    <int32_t name="unk_v40_3">
      v0.40.01
    </int32_t>
    <int32_t name="unk_v40_4">
      v0.40.01
    </int32_t>
    <int8_t name="unk_v40_5">
      v0.40.01
    </int8_t>
    <int32_t name="gait_buildup"/>
    <compound name="climb_hold" type-name="coord"/>
    <int32_t name="unk_v4014_1" init-value="-1">
      v0.40.14
    </int32_t>
    <pointer name="current_job" type-name="job">
      df_job
    </pointer>
    <enum base-type="int16_t" type-name="job_skill"
        name="mood_skill"/>
    <int32_t name="mood_timeout">
      counts down from 50000, insanity upon reaching zero
    </int32_t>
    <int32_t name="unk_39c"/>
  </compound>
  <compound name="body">
    <compound name="components" type-name="body_component_info"/>
    <stl-vector name="wounds" pointer-type="unit_wound"/>
    <int32_t name="wound_next_id" init-value="1"/>
    <static-array name="unk_39c" count="10">
      <int32_t init-value="-1"/>
    </static-array>
    <pointer name="body_plan" type-name="caste_body_info"/>
    <int16_t name="weapon_bp"
        refers-to="$$._parent.body_plan.body_parts[$]"
        init-value="-1"/>
    <static-array type-name="unit_attribute" name="physical_attrs"
        count="6" index-enum="physical_attribute_type"/>
    <compound name="size_info" type-name="body_size_info"/>
    <uint32_t name="blood_max"/>
    <uint32_t name="blood_count"/>
    <int32_t name="infection_level">
      GETS_INFECTIONS_FROM_ROT sets; DISEASE_RESISTANCE reduces; >=300
       causes bleeding
    </int32_t>
    <stl-vector name="spatters" pointer-type="spatter"/>
  </compound>
  <compound name="appearance">
    <stl-vector name="body_modifiers" type-name="int32_t" index-refers
        -to="$$._global.caste.ref-target.body_appearance_modifiers[$]"
        />
    <stl-vector name="bp_modifiers" type-name="int32_t" index-refers-t
        o="$$._global.caste.ref-target.bp_appearance.modifier_idx[$].r
        efers-to"/>
    <int32_t name="size_modifier">
      product of all H/B/LENGTH body modifiers, in %
    </int32_t>
    <stl-vector type-name="int16_t" name="tissue_style" index-refers-t
        o="$$._global.caste.ref-target.bp_appearance.style_layer_idx[$
        ].refers-to"/>
    <stl-vector type-name="int32_t" name="tissue_style_civ_id"
        ref-target="historical_entity"
        index-refers-to="$$._parent.tissue_style.index-refers-to[$]"/>
    <stl-vector type-name="int32_t" name="tissue_style_id"
        ref-target="entity_tissue_style"
        aux-value="$$._parent.tissue_style_civ_id[$._key]"
        index-refers-to="$$._parent.tissue_style.index-refers-to[$]"/>
    <stl-vector type-name="int32_t" name="tissue_style_type"
        refers-to="(find-by-id
        $$._global.caste.ref-target.tissue_styles $id $)"
        index-refers-to="$$._parent.tissue_style.index-refers-to[$]"/>
    <stl-vector type-name="int32_t" name="tissue_length"
        index-refers-to="$$._parent.tissue_style.index-refers-to[$]">
      description uses bp_modifiers[style_list_idx[index]]
    </stl-vector>
    <compound name="genes" type-name="unit_genes"/>
    <stl-vector name="colors" type-name="int32_t"/>
  </compound>
  <stl-vector name="actions" pointer-type="unit_action"/>
  <int32_t name="next_action_id"/>
  <compound name="counters">
    <int32_t name="think_counter"/>
    <int32_t name="job_counter"/>
    <int32_t name="swap_counter">
      dec per job_counter reroll, can_swap if 0
    </int32_t>
    <enum name="death_cause" base-type="int16_t"
        type-name="death_type"/>
    <int32_t name="death_id" ref-target="incident"/>
    <int16_t name="winded"/>
    <int16_t name="stunned"/>
    <int16_t name="unconscious"/>
    <int16_t name="suffocation">
      counts up while winded, results in death
    </int16_t>
    <int16_t name="webbed"/>
    <compound name="guts_trail1" type-name="coord"/>
    <compound name="guts_trail2" type-name="coord"/>
    <int16_t name="soldier_mood_countdown" init-value="300">
      plus a random amount
    </int16_t>
    <enum name="soldier_mood" base-type="int16_t" init-value="None">
      <enum-item name="None" value="-1"/>
      <enum-item name="MartialTrance"/>
      <enum-item name="Enranged"/>
      <enum-item name="Tantrum"/>
      <enum-item name="Depressed"/>
      <enum-item name="Oblivious"/>
    </enum>
    <uint32_t name="pain"/>
    <uint32_t name="nausea"/>
    <uint32_t name="dizziness"/>
  </compound>
  <compound name="curse">
    <int32_t name="unk_0">
      moved from end of counters in 0.43.05
    </int32_t>
    <compound name="add_tags1" type-name="cie_add_tag_mask1"/>
    <compound name="rem_tags1" type-name="cie_add_tag_mask1"/>
    <compound name="add_tags2" type-name="cie_add_tag_mask2"/>
    <compound name="rem_tags2" type-name="cie_add_tag_mask2"/>
    <bool name="name_visible">
      v0.34.01
    </bool>
    <stl-string name="name">
      v0.34.01
    </stl-string>
    <stl-string name="name_plural">
      v0.34.01
    </stl-string>
    <stl-string name="name_adjective">
      v0.34.01
    </stl-string>
    <uint32_t name="sym_and_color1" init-value="0x400">
      v0.34.01
    </uint32_t>
    <uint32_t name="sym_and_color2" init-value="0x400">
      v0.34.01
    </uint32_t>
    <uint32_t name="flash_period">
      v0.34.01
    </uint32_t>
    <uint32_t name="flash_time2">
      v0.34.01
    </uint32_t>
    <stl-vector name="body_appearance" type-name="int32_t" index-refer
        s-to="$$._global.caste.ref-target.body_appearance_modifiers[$]
        "/>
    <stl-vector name="bp_appearance" type-name="int32_t" index-refers-
        to="$$._global.caste.ref-target.bp_appearance.modifier_idx[$].
        refers-to">
      v0.34.01; guess!
    </stl-vector>
    <uint32_t name="speed_add">
      v0.34.01
    </uint32_t>
    <uint32_t name="speed_mul_percent" init-value="100">
      v0.34.01
    </uint32_t>
    <pointer name="attr_change" type-name="curse_attr_change">
      v0.34.01
    </pointer>
    <uint32_t name="luck_mul_percent" init-value="100">
      v0.34.01
    </uint32_t>
    <int32_t>
      v0.42.01
    </int32_t>
    <stl-vector name="interaction_id" type-name="int32_t"
        ref-target="creature_interaction_effect">
      v0.34.01
    </stl-vector>
    <stl-vector name="interaction_time" type-name="int32_t">
      v0.34.01
    </stl-vector>
    <stl-vector name="interaction_delay" type-name="int32_t">
      v0.34.01
    </stl-vector>
    <int32_t name="time_on_site">
      v0.34.01
    </int32_t>
    <stl-vector name="own_interaction" type-name="int32_t"
        refers-to="$$._global.body.body_plan.interactions[$]">
      v0.34.01
    </stl-vector>
    <stl-vector name="own_interaction_delay" type-name="int32_t">
      v0.34.01
    </stl-vector>
  </compound>
  <compound name="counters2">
    <uint32_t name="paralysis"/>
    <uint32_t name="numbness"/>
    <uint32_t name="fever"/>
    <uint32_t name="exhaustion"/>
    <uint32_t name="hunger_timer"/>
    <uint32_t name="thirst_timer"/>
    <uint32_t name="sleepiness_timer"/>
    <uint32_t name="stomach_content"/>
    <uint32_t name="stomach_food"/>
    <uint32_t name="vomit_timeout">
      blocks nausea causing vomit
    </uint32_t>
    <uint32_t name="stored_fat">
      hunger leads to death only when 0
    </uint32_t>
  </compound>
  <compound name="status">
    <stl-vector name="misc_traits" pointer-type="unit_misc_trait"/>
    <pointer name="eat_history">
      <compound name="food">
        <stl-vector name="item_type">
          <enum base-type="int16_t" type-name="item_type"/>
        </stl-vector>
        <stl-vector name="item_subtype" type-name="int16_t"/>
        <compound name="material" type-name="material_vec_ref"/>
        <stl-vector name="year" type-name="int32_t"/>
        <stl-vector name="year_time" type-name="int32_t"/>
      </compound>
      <compound name="drink">
        <stl-vector name="item_type">
          <enum base-type="int16_t" type-name="item_type"/>
        </stl-vector>
        <stl-vector name="item_subtype" type-name="int16_t"/>
        <compound name="material" type-name="material_vec_ref"/>
        <stl-vector name="year" type-name="int32_t"/>
        <stl-vector name="year_time" type-name="int32_t"/>
      </compound>
    </pointer>
    <int32_t name="demand_timeout" init-value="1000"/>
    <int32_t name="mandate_timeout" init-value="1000"/>
    <stl-vector name="attacker_ids" type-name="int32_t"
        ref-target="unit"/>
    <stl-vector name="attacker_cntdn" type-name="int16_t"/>
    <uint8_t name="face_direction">
      for wagons
    </uint8_t>
    <compound type-name="language_name" name="artifact_name"/>
    <stl-vector name="souls" pointer-type="unit_soul"/>
    <pointer name="current_soul" type-name="unit_soul"/>
    <stl-vector name="demands" pointer-type="unit_demand"/>
    <static-array type-name="bool" name="labors"
        index-enum="unit_labor" count="94"/>
    <stl-vector name="wrestle_items"
        pointer-type="unit_item_wrestle"/>
    <stl-vector name="observed_traps" type-name="int32_t"
        ref-target="building"/>
    <stl-vector name="complaints" pointer-type="unit_complaint"/>
    <stl-vector name="requests" pointer-type="unit_request"/>
    <stl-vector name="coin_debts" pointer-type="unit_coin_debt"/>
    <int16_t name="adv_sleep_timer"/>
    <compound name="recent_job_area" type-name="coord"/>
    <compound name="recent_jobs" type-name="coord_path"/>
  </compound>
  <int32_t name="hist_figure_id" ref-target="historical_figure"/>
  <int32_t name="hist_figure_id2" ref-target="historical_figure">
    used for ghost in AttackedByDead thought
  </int32_t>
  <compound name="status2">
    <int16_t name="limbs_stand_max"/>
    <int16_t name="limbs_stand_count"/>
    <int16_t name="limbs_grasp_max"/>
    <int16_t name="limbs_grasp_count"/>
    <int16_t name="limbs_fly_max"/>
    <int16_t name="limbs_fly_count"/>
    <stl-vector name="body_part_temperature"
        pointer-type="temperaturest"/>
    <uint32_t name="add_path_flags">
      pathing flags to OR, set to 0 after move
    </uint32_t>
    <compound type-name="tile_designation" name="liquid_type"/>
    <uint8_t name="liquid_depth"/>
    <int32_t name="unk_7c0" init-value="-1"/>
  </compound>
  <compound name="unknown7">
    <stl-vector name="unk_7c4"/>
    <stl-vector>
      v0.34.01
    </stl-vector>
  </compound>
  <compound name="syndromes">
    -- Sorted by type:
    <stl-vector name="active" pointer-type="unit_syndrome"/>
    <stl-vector name="reinfection_type" type-name="int32_t"
        ref-target="syndrome"/>
    <stl-vector name="reinfection_count" type-name="int16_t"/>
  </compound>
  <compound name="reports">
    <static-array name="log" count="3" index-enum="unit_report_type">
      <stl-vector type-name="int32_t" ref-target="report"/>
    </static-array>
    <static-array type-name="int32_t" name="last_year" count="3"
        index-enum="unit_report_type"/>
    <static-array type-name="int32_t" name="last_year_tick" count="3"
        index-enum="unit_report_type"/>
  </compound>
  <pointer name="health" type-name="unit_health_info"/>
  <stl-vector name="used_items" pointer-type="unit_item_use">
    Contains worn clothes, armor, weapons, arrows fired by archers
  </stl-vector>
  <stl-vector name='adventurer_knows' comment='if not, no names'
      type-name='int32_t' ref-target='unit'/>
  <compound name="enemy">
    <stl-vector name="sound_cooldown" type-name="int32_t"
        index-refers-to="$$._global.caste.ref-target.sound[$]">
      v0.34.01
    </stl-vector>
    <pointer name="undead">
      <compound>
        <int32_t/>
        <int32_t/>
        <int32_t/>
        <int32_t/>
        <int32_t/>
        <int16_t/>
        <stl-string/>
        <int32_t name="unk_v43_1">
          v0.43.01
        </int32_t>
        <int32_t name="unk_v43_2">
          v0.43.01
        </int32_t>
      </compound>
      v0.34.01
    </pointer>
    <int32_t name="were_race" ref-target="creature_raw"/>
    <int32_t name="were_caste" ref-target="caste_raw"
        aux-value="$$.were_race"/>
    <int32_t name="normal_race" ref-target="creature_raw"/>
    <int32_t name="normal_caste" ref-target="caste_raw"
        aux-value="$$.normal_race"/>
    <int32_t name="interaction"
        refers-to="$$._global.body.body_plan.interactions[$]">
      v0.34.01
    </int32_t>
    <stl-vector name="unk_850"/>
    <stl-vector name="witness_reports">
      <pointer>
        <int32_t name="death_id" ref-target="incident"/>
        <int32_t name="crime_id" ref-target="crime"/>
        <int32_t name="unk1">
          0 accuses, 1 corpse
        </int32_t>
        <int32_t name="year"/>
        <int32_t name="year_tick"/>
        <int32_t name="unk2">
          bit 0 accuses
        </int32_t>
      </pointer>
    </stl-vector>
    <stl-vector name="unk_a5c" pointer-type="entity_event"/>
    <static-array name="gait_index" type-name="int32_t" count="5"
        index-enum="gait_type"/>
    <static-array name="unk_v40_1a" type-name="int32_t" count="10">
      v0.40.01
    </static-array>
    <static-array name="unk_v40_1b" type-name="int32_t" count="10">
      v0.40.01
    </static-array>
    <static-array name="unk_v40_1c" type-name="int32_t" count="10">
      v0.40.01
    </static-array>
    <static-array name="unk_v40_1d" type-name="int32_t" count="10">
      v0.40.01
    </static-array>
    <static-array name="unk_v40_1e" type-name="int32_t" count="10">
      v0.40.01
    </static-array>
    <static-array name="unk_v40_2" type-name="int32_t" count="20">
      v0.40.01
    </static-array>
    <static-array type-name="int32_t" count="180">
      v0.40.24
    </static-array>
    <int32_t name="unk_v40_2_count">
      v0.40.01
    </int32_t>
    <pointer>
      v0.40.01
    </pointer>
    <pointer>
      v0.40.01
    </pointer>
    <int32_t>
      v0.40.01
    </int32_t>
    <int32_t>
      v0.40.01
    </int32_t>
    <int32_t>
      v0.40.01
    </int32_t>
    <compound name="unk_v40_sub3">
      <int32_t>
        v0.40.01
      </int32_t>
      <pointer>
        v0.40.01
      </pointer>
      <stl-vector>
        v0.40.01
      </stl-vector>
      <stl-vector>
        v0.40.01
      </stl-vector>
      <stl-vector type-name="int32_t">
        v0.40.01
      </stl-vector>
      <pointer>
        <stl-vector name="unk_0" type-name="int32_t"/>
        <stl-vector name="unk_10" type-name="int32_t"/>
      </pointer>
      <pointer>
        <stl-vector name="unk_sub1">
          <pointer>
            <int32_t name="unk_sub1_1"/>
            <int32_t name="unk_sub1_2"/>
            <int32_t name="unk_sub1_3"/>
            <int32_t name="unk_sub1_4"/>
            <int32_t name="unk_sub1_5"/>
            <int32_t name="unk_sub1_6"/>
            <int32_t name="unk_sub1_7"/>
            <int32_t name="unk_sub1_8"/>
            <int32_t name="unk_sub1_9"/>
          </pointer>
        </stl-vector>
        <int32_t name="unk_1"/>
        <int32_t name="unk_2"/>
        <int32_t name="unk_3"/>
        <int32_t name="unk_4"/>
        <int32_t name="unk_5"/>
        <int32_t name="unk_6"/>
        <int32_t name="unk_7"/>
        v0.42.01
      </pointer>
      v0.40.01
    </compound>
    <int32_t name="enemy_status_slot" init-value="-1"/>
    <int32_t name="unk_v4206_1"/>
    <int32_t name="unk_874_cntr"/>
    <stl-vector name="body_part_878" type-name="uint8_t"/>
    <stl-vector name="body_part_888" type-name="uint8_t"/>
    <stl-vector name="body_part_relsize" type-name="int32_t">
      with modifiers
    </stl-vector>
    <stl-vector name="body_part_8a8" type-name="uint8_t"/>
    <stl-vector name="body_part_base_ins" type-name="uint16_t"/>
    <stl-vector name="body_part_clothing_ins" type-name="uint16_t"/>
    <stl-vector name="body_part_8d8" type-name="uint16_t"/>
    <stl-vector name="unk_8e8"/>
    <stl-vector type-name="uint16_t" name="unk_8f8"/>
  </compound>
  <stl-vector name="healing_rate" type-name="int32_t"/>
  <int32_t name="effective_rate" init-value="-1"/>
  <int32_t name="tendons_heal"/>
  <int32_t name="ligaments_heal"/>
  <int32_t name="weight"/>
  <int32_t name="weight_fraction">
    1e-6
  </int32_t>
  <stl-vector name="burrows" type-name="int32_t" ref-target="burrow"/>
  <int32_t name="combat_side_id"/>
  <stl-vector name="occupations" pointer-type="occupation">
    v0.42.01
  </stl-vector>
  <stl-string name="adjective">
    from physical descriptions for use in adv
  </stl-string>
</struct-type>

units.ghost_goal

<enum-type type-name="ghost_goal" base-type="int16_t">
  <enum-item name="None" value="-1"/>
  <enum-item name="ScareToDeath"/>
  <enum-item name="Stun"/>
  <enum-item name="Batter"/>
  <enum-item name="Possess"/>
  <enum-item name="MisplaceItem"/>
  <enum-item name="Haunt"/>
  <enum-item name="Torment"/>
  <enum-item name="ToppleBuilding"/>
</enum-type>

units.unit_ghost_info

<struct-type type-name="unit_ghost_info">
  <enum base-type="int16_t" name="type" type-name="ghost_type"/>
  <enum base-type="int16_t" name="type2" type-name="ghost_type">
    seems to have same value as type
  </enum>
  <enum base-type="int16_t" name="goal" type-name="ghost_goal"/>
  <compound name="target" is-union="true">
    <int32_t name="unit" ref-target="unit"/>
    <int32_t name="item" ref-target="item"/>
    <int32_t name="building" ref-target="building"/>
  </compound>
  <compound name="misplace_pos" type-name="coord"/>
  <int32_t name="action_timer" init-value="403200">
    time since last action
  </int32_t>
  <int32_t name="unk_18"/>
  <bitfield name="flags">
    <flag-bit name="announced"/>
    <flag-bit name="was_at_rest"/>
  </bitfield>
  <int32_t name="death_x">
    in tiles, global to world
  </int32_t>
  <int32_t name="death_y"/>
  <int32_t name="death_z"/>
</struct-type>

units.unit_genes

<struct-type type-name="unit_genes">
  length matches body_appearance_modifiers +
  tissue_appearance_modifiers
  <df-array name="appearance" type-name="uint8_t"/>
  two items per color modifier
  <df-array name="colors" type-name="int16_t"/>
</struct-type>

units.unit_inventory_item

<struct-type type-name="unit_inventory_item">
  <pointer name="item" type-name="item"/>
  <enum base-type="int16_t" name="mode">
    <enum-item name="Hauled"/>
    <enum-item name="Weapon">
      also shield, crutch
    </enum-item>
    <enum-item name="Worn">
      quiver
    </enum-item>
    <enum-item name="Piercing"/>
    <enum-item name="Flask">
      attached to clothing
    </enum-item>
    <enum-item name="WrappedAround">
      e.g. bandage
    </enum-item>
    <enum-item name="StuckIn"/>
    <enum-item name="InMouth">
      string descr like Worn
    </enum-item>
    <enum-item name="Pet">
      Left shoulder, right shoulder, or head, selected randomly using
      pet_seed
    </enum-item>
    <enum-item name="SewnInto"/>
    <enum-item name="Strapped"/>
  </enum>
  <int16_t name="body_part_id"
      refers-to="$$._global._parent._global.body.body_plan.body_parts[
      $]"/>
  <int32_t name="pet_seed">
    RNG seed for Pet mode
  </int32_t>
  <int32_t name="wound_id" init-value="-1">
    -1 unless suture
  </int32_t>
</struct-type>

units.unit_attribute

<struct-type type-name="unit_attribute">
  <int32_t name="value" init-value="1000">
    effective = value - soft_demotion
  </int32_t>
  <int32_t name="max_value" init-value="2000"/>
  <int32_t name="improve_counter">
    counts to PHYS_ATT_RATES improve cost; then value++
  </int32_t>
  <int32_t name="unused_counter">
    counts to PHYS_ATT_RATES unused rate; then rust_counter++
  </int32_t>
  <int32_t name="soft_demotion">
    0-100; when not 0 blocks improve_counter
  </int32_t>
  <int32_t name="rust_counter">
    counts to PHYS_ATT_RATES rust; then demotion_counter++
  </int32_t>
  <int32_t name="demotion_counter">
    counts to PHYS_ATT_RATES demotion; then value--; soft_demotion++
  </int32_t>
</struct-type>

units.unit_syndrome

<struct-type type-name="unit_syndrome" key-field="type">
  <int32_t name="type" ref-target="syndrome"/>
  <int32_t name="year"/>
  <int32_t name="year_time"/>
  <int32_t name="ticks"/>
  <stl-vector name="wounds" type-name="int32_t">
    refers to unit_wound by id
  </stl-vector>
  <int32_t name="wound_id" init-value="-1"/>
  <stl-vector name="symptoms"
      index-refers-to="$$._global.type.ref-target.ce[$]">
    <pointer>
      <int32_t name="quantity">
        from spatter size
      </int32_t>
      <int32_t name="delay">
        for SIZE_DELAYS
      </int32_t>
      <int32_t name="ticks"/>
      <stl-vector name="target_bp" type-name="int16_t"/>
      <stl-vector name="target_layer" type-name="int16_t"/>
      <stl-vector name="target_quantity" type-name="int32_t"/>
      <stl-vector name="target_delay" type-name="int32_t"/>
      <stl-vector name="target_ticks" type-name="int32_t"/>
      <bitfield name="flags">
        <flag-bit name="disabled">
          if PROB roll fails, or all symptoms expire
        </flag-bit>
        <flag-bit name="active"/>
      </bitfield>
    </pointer>
  </stl-vector>
  <int16_t name="reinfection_count">
    set from unit.reinfection_count[i]++
  </int16_t>
  <bitfield name="flags">
    cause rq_diagnosis:
    <flag-bit name="is_sick">
      causes health.flags.needs_healthcare
    </flag-bit>
    <flag-bit name="is_sick_low">
      less sick? fever: 5-19 low, 20-* full
    </flag-bit>
    <flag-bit/>
    <flag-bit/>
  </bitfield>
  <stl-vector name="unk4" type-name="int32_t"/>
</struct-type>

units.wound_effect_type

<enum-type type-name="wound_effect_type" base-type="int16_t">
  <enum-item name="Bruise"/>
  <enum-item name="Burn"/>
  <enum-item name="Frostbite"/>
  <enum-item name="Burn2"/>
  <enum-item name="Melting"/>
  <enum-item name="Boiling"/>
  <enum-item name="Freezing"/>
  <enum-item name="Condensation"/>
  <enum-item name="Necrosis"/>
  <enum-item name="Blister"/>
</enum-type>

units.wound_damage_flags1

<bitfield-type type-name="wound_damage_flags1">
  <flag-bit name="cut"/>
  <flag-bit name="smashed"/>
  <flag-bit name="scar_cut">
    straight scar
  </flag-bit>
  <flag-bit name="scar_smashed">
    huge dent
  </flag-bit>
  <flag-bit name="tendon_bruised"/>
  <flag-bit name="tendon_strained"/>
  <flag-bit name="tendon_torn"/>
  <flag-bit name="ligament_bruised"/>
  <flag-bit name="ligament_sprained"/>
  <flag-bit name="ligament_torn"/>
  <flag-bit name="motor_nerve_severed"/>
  <flag-bit name="sensory_nerve_severed"/>
  <flag-bit name="edged_damage"/>
  <flag-bit name="smashed_apart">
    ?
  </flag-bit>
  <flag-bit name="major_artery"/>
  <flag-bit name="guts_spilled"/>
  <flag-bit name="edged_shake1"/>
  <flag-bit name="scar_edged_shake1">
    jagged scar
  </flag-bit>
  <flag-bit name="edged_shake2"/>
  <flag-bit name="broken"/>
  <flag-bit name="scar_broken">
    huge dent
  </flag-bit>
  <flag-bit name="gouged"/>
  <flag-bit name="blunt_shake1"/>
  <flag-bit name="scar_blunt_shake1">
    jagged scar
  </flag-bit>
  <flag-bit name="blunt_shake2"/>
  <flag-bit name="joint_bend1"/>
  <flag-bit name="scar_joint_bend1">
    jagged scar
  </flag-bit>
  <flag-bit name="joint_bend2"/>
  <flag-bit name="compound_fracture"/>
  <flag-bit name="diagnosed"/>
  <flag-bit name="artery"/>
  <flag-bit name="overlapping_fracture"/>
</bitfield-type>

units.wound_damage_flags2

<bitfield-type type-name="wound_damage_flags2">
  <flag-bit name="needs_setting"/>
  <flag-bit name="entire_surface"/>
  <flag-bit name="gelded"/>
</bitfield-type>

units.unit_wound

<struct-type type-name="unit_wound" key-field="id">
  <int32_t name="id"/>
  <stl-vector name="parts">
    <pointer>
      <int32_t name="global_layer_idx" refers-to="$$._global._upglobal
          .caste.ref-target.body_info.layer_idx[$].refers-to"/>
      <int16_t name="body_part_id" refers-to="$$._global._upglobal.cas
          te.ref-target.body_info.body_parts[$]"/>
      <int16_t name="layer_idx"
          refers-to="$$._parent.body_part_id.refers-to.layers[$]"/>
      <int32_t name="contact_area"/>
      <int16_t name="surface_perc"/>
      <int32_t name="strain"/>
      <stl-vector name="effect_perc1" type-name="int16_t"/>
      <stl-vector name="effect_perc2" type-name="int16_t"/>
      <stl-vector name="effect_type">
        <enum base-type="int16_t" type-name="wound_effect_type"/>
      </stl-vector>
      <int16_t name="edged_curve_perc"/>
      <compound name="flags1" type-name="wound_damage_flags1"/>
      <compound name="flags2" type-name="wound_damage_flags2"/>
      <int32_t name="bleeding"/>
      <int32_t name="pain"/>
      <int32_t name="nausea"/>
      <int32_t name="dizziness"/>
      <int32_t name="paralysis"/>
      <int32_t name="numbness"/>
      <int32_t name="swelling"/>
      <int32_t name="impaired"/>
      <int32_t name="unk_v42_1">
        v0.42.01
      </int32_t>
      <int32_t name="unk_v42_2">
        v0.42.01
      </int32_t>
      <int32_t name="unk_v42_3">
        v0.42.01
      </int32_t>
      <int16_t name="cur_penetration_perc"/>
      <int16_t name="max_penetration_perc"/>
      <int32_t name="jammed_layer_idx" refers-to="$$._global._upglobal
          .caste.ref-target.body_info.layer_idx[$].refers-to">
        in compound fracture
      </int32_t>
      <int32_t name="unk_v406_1">
        v0.40.06
      </int32_t>
    </pointer>
  </stl-vector>
  <int32_t name="age"/>
  <int32_t name="attacker_unit_id" ref-target="unit"/>
  <int32_t name="attacker_hist_figure_id"
      ref-target="historical_figure"/>
  <bitfield name="flags">
    <flag-bit name="severed_part"/>
    <flag-bit name="mortal_wound"/>
    <flag-bit name="stuck_weapon"/>
    <flag-bit name="diagnosed"/>
    <flag-bit name="sutured"/>
    <flag-bit name="infection"/>
  </bitfield>
  <int32_t name="syndrome_id" ref-target="syndrome"/>
  <int32_t name="pain"/>
  <int32_t name="nausea"/>
  <int32_t name="dizziness"/>
  <int32_t name="paralysis"/>
  <int32_t name="numbness"/>
  <int32_t name="fever"/>
  <pointer name="curse" type-name="wound_curse_info"/>
  <int32_t name="unk_v42_1">
    v0.42.01
  </int32_t>
  <int32_t name="unk_v42_2">
    v0.42.01
  </int32_t>
</struct-type>

units.curse_attr_change

<struct-type type-name="curse_attr_change">
  <static-array name="phys_att_perc" type-name="int32_t" count="6"
      index-enum="physical_attribute_type"/>
  <static-array name="phys_att_add" type-name="int32_t" count="6"
      index-enum="physical_attribute_type"/>
  <static-array name="ment_att_perc" type-name="int32_t" count="13"
      index-enum="mental_attribute_type"/>
  <static-array name="ment_att_add" type-name="int32_t" count="13"
      index-enum="mental_attribute_type"/>
</struct-type>

units.wound_curse_info

<struct-type type-name="wound_curse_info">
  <int32_t name="unk_v40_1">
    v0.40.01
  </int32_t>
  <compound name="add_tags1" type-name="cie_add_tag_mask1"/>
  <compound name="rem_tags1" type-name="cie_add_tag_mask1"/>
  <compound name="add_tags2" type-name="cie_add_tag_mask2"/>
  <compound name="rem_tags2" type-name="cie_add_tag_mask2"/>
  <bool name="name_visible"/>
  <stl-string name="name"/>
  <stl-string name="name_plural"/>
  <stl-string name="name_adjective"/>
  <uint32_t name="sym_and_color1" init-value="0x400"/>
  <uint32_t name="sym_and_color2" init-value="0x400"/>
  <uint32_t name="flash_period"/>
  <uint32_t name="flash_time2"/>
  <uint32_t name="speed_add"/>
  <uint32_t name="speed_mul_percent" init-value="100"/>
  <pointer name="attr_change" type-name="curse_attr_change"/>
  <int32_t name="unk_v42_1">
    v0.42.01
  </int32_t>
  <uint32_t name="luck_mul_percent" init-value="100"/>
  <int32_t name="unk_v42_2">
    v0.42.01
  </int32_t>
  <stl-vector name="interaction_id" type-name="int32_t"
      ref-target="creature_interaction_effect"/>
  <stl-vector name="interaction_time" type-name="int32_t"/>
  <int32_t name="time_counter"/>
  <int32_t name="were_race" ref-target="creature_raw"/>
  <int32_t name="were_caste" ref-target="caste_raw"
      aux-value="$$.were_race"/>
  <stl-vector name="body_appearance" type-name="int32_t"/>
  <stl-vector name="bp_appearance" type-name="int32_t"/>
</struct-type>

units.misc_trait_type

<enum-type base-type="int16_t" type-name="misc_trait_type">
  <enum-attr name="tag"/>
  <enum-item name="RequestWaterCooldown"/>
  <enum-item name="RequestFoodCooldown"/>
  <enum-item name="RequestRescueCooldown"/>
  <enum-item name="RequestHealthcareCooldown"/>
  <enum-item name="GetDrinkCooldown">
    auto-decrement
  </enum-item>
  <enum-item name="GetFoodCooldown">
    auto-decrement
  </enum-item>
  <enum-item name="CleanSelfCooldown">
    auto-decrement
  </enum-item>
  <enum-item name="Migrant">
    auto-decrement
  </enum-item>
  <enum-item name="RoomComplaint">
    auto-decrement
  </enum-item>
  <enum-item name="UnnamedResident">
    upon reaching zero, resident creature gets named
  </enum-item>
  <enum-item name="RentBedroomCooldown">
    auto-decrement
  </enum-item>
  <enum-item name="ClaimTrinketCooldown">
    auto-decrement
  </enum-item>
  <enum-item name="ClaimClothingCooldown">
    auto-decrement
  </enum-item>
  <enum-item name="WantsDrink">
    <item-attr name="tag" value="ALCOHOLIC"/>
    auto-increment to 403200
  </enum-item>
  <enum-item name="LikesOutdoors">
    <item-attr name="tag" value="MOUNTAIN"/>
  </enum-item>
  <enum-item name="Hardened">
    <item-attr name="tag" value="COMBATHARDNESS"/>
  </enum-item>
  <enum-item name="TimeSinceBreak">
    <item-attr name="tag" value="TIME_SINCE_BREAK"/>
  </enum-item>
  <enum-item name="OnBreak">
    <item-attr name="tag" value="ON_BREAK"/>
  </enum-item>
  <enum-item name="PrepareToDie">
    auto-decrement
  </enum-item>
  <enum-item name="CaveAdapt">
    <item-attr name="tag" value="CAVE_ADAPT"/>
  </enum-item>
  <enum-item>
    auto-decrement
  </enum-item>
  <enum-item>
    auto-decrement
  </enum-item>
  <enum-item/>
  <enum-item>
    auto-decrement
  </enum-item>
  <enum-item name="FollowUnitCooldown">
    0-20, 200 on failed path, auto-decrement
  </enum-item>
  <enum-item>
    auto-decrement
  </enum-item>
  <enum-item>
    auto-decrement
  </enum-item>
  <enum-item/>
  <enum-item name="DangerousTerrainCooldown">
    created at 200, blocks repath?, auto-decrement
  </enum-item>
  <enum-item name="Beaching">
    triggered by BEACH_FREQUENCY, auto-decrement
  </enum-item>
  <enum-item name="IdleAreaCooldown">
    auto-decrement
  </enum-item>
  <enum-item>
    auto-decrement
  </enum-item>
  <enum-item name="PartiedOut">
    <item-attr name="tag" value="PARTIED_OUT"/>
    auto-decrement
  </enum-item>
  <enum-item name="DiagnosePatientCooldown">
    0-2000, auto-decrement
  </enum-item>
  <enum-item name="DressWoundCooldown">
    auto-decrement
  </enum-item>
  <enum-item name="CleanPatientCooldown">
    auto-decrement
  </enum-item>
  <enum-item name="SurgeryCooldown">
    auto-decrement
  </enum-item>
  <enum-item name="SutureCooldown">
    auto-decrement
  </enum-item>
  <enum-item name="SetBoneCooldown">
    auto-decrement
  </enum-item>
  <enum-item name="PlaceInTractionCooldown">
    auto-decrement
  </enum-item>
  <enum-item name="ApplyCastCooldown">
    auto-decrement
  </enum-item>
  <enum-item name="ImmobilizeBreakCooldown">
    auto-decrement
  </enum-item>
  <enum-item name="BringCrutchCooldown">
    auto-decrement
  </enum-item>
  <enum-item>
    auto-decrement, set military pickup flag upon reaching zero
  </enum-item>
  <enum-item name="MilkCounter">
    <item-attr name="tag" value="MILK_COUNTER"/>
    auto-decrement
  </enum-item>
  <enum-item name="HadDrill">
    auto-decrement
  </enum-item>
  <enum-item name="CompletedDrill">
    auto-decrement
  </enum-item>
  <enum-item name="EggSpent">
    <item-attr name="tag" value="EGG_SPENT"/>
    auto-decrement
  </enum-item>
  <enum-item name="GroundedAnimalAnger">
    <item-attr name="tag" value="GROUNDED_ANIMAL_ANGER"/>
    auto-decrement
  </enum-item>
  <enum-item>
    auto-decrement
  </enum-item>
  <enum-item name="TimeSinceSuckedBlood">
    <item-attr name="tag" value="TIME_SINCE_SUCKED_BLOOD"/>
  </enum-item>
  <enum-item name="DrinkingBlood">
    <item-attr name="tag" value="DRINKING_BLOOD"/>
    auto-decrement
  </enum-item>
  <enum-item>
    auto-decrement
  </enum-item>
  <enum-item>
    auto-decrement
  </enum-item>
  <enum-item name="RevertWildTimer">
    one trigger => --training_level, auto-decrement
  </enum-item>
  <enum-item>
    auto-decrement
  </enum-item>
  <enum-item name="NoPantsAnger">
    auto-decrement
  </enum-item>
  <enum-item name="NoShirtAnger">
    auto-decrement
  </enum-item>
  <enum-item name="NoShoesAnger">
    auto-decrement
  </enum-item>
</enum-type>

units.unit_misc_trait

<struct-type type-name="unit_misc_trait">
  <enum base-type="int16_t" type-name="misc_trait_type" name="id"/>
  <int32_t name="value"/>
</struct-type>

units.unit_item_wrestle

<struct-type type-name="unit_item_wrestle">
  <int32_t name="unit" ref-target="unit"/>
  <int32_t name="self_bp"
      refers-to="$$._parent._upglobal.body.body_plan.body_parts[$]"/>
  <int32_t name="other_bp"
      refers-to="$$._parent.unit.ref-target.body.body_plan.body_parts[
      $]"/>
  <int32_t name="unk_c" init-value="-1"/>
  <int32_t name="unk_10" init-value="-1"/>
  <int32_t name="item1" ref-target="item"/>
  <int32_t name="item2" ref-target="item"/>
  <int16_t name="unk_1c"/>
  <int8_t name="unk_1e">
    1 grabs, -1 grabbed
  </int8_t>
  <int32_t name="unk_20" init-value="-1"/>
</struct-type>

units.unit_item_use

<struct-type type-name="unit_item_use" key-field="id">
  <int32_t name="id" ref-target="item"/>
  <int32_t name="time_in_use"/>
  <int32_t name="has_grown_attached"/>
  <int32_t name="affection_level">
    min 50 for attached, 1000 for name
  </int32_t>
</struct-type>

units.unit_health_flags

<bitfield-type type-name="unit_health_flags">
  <flag-bit name="rq_diagnosis"/>
  <flag-bit name="needs_recovery">
    needs diagnosis but cannot walk
  </flag-bit>
  <flag-bit name="needs_healthcare">
    ???; set when rq_diagnosis is, and not blocked by having a
    diagnosis
  </flag-bit>
  <flag-bit name="rq_immobilize"/>
  <flag-bit name="rq_dressing"/>
  <flag-bit name="rq_cleaning"/>
  <flag-bit name="rq_surgery"/>
  <flag-bit name="rq_suture"/>
  <flag-bit name="rq_setting"/>
  <flag-bit name="rq_traction"/>
  <flag-bit name="rq_crutch"/>
</bitfield-type>

units.unit_bp_health_flags

<bitfield-type type-name="unit_bp_health_flags">
  <flag-bit name="rq_immobilize"/>
  <flag-bit name="rq_dressing"/>
  <flag-bit name="rq_cleaning"/>
  <flag-bit name="rq_surgery"/>
  <flag-bit name="rq_suture"/>
  <flag-bit name="rq_setting"/>
  <flag-bit name="rq_traction"/>
  <flag-bit name="inoperable_rot"/>
  <flag-bit name="needs_bandage">
    used to remove once not needed
  </flag-bit>
  <flag-bit name="needs_cast">
    used to remove once not needed
  </flag-bit>
</bitfield-type>

units.unit_health_info

<struct-type type-name="unit_health_info">
  <int32_t name="unit_id" ref-target="unit"/>
  <compound name="flags" type-name="unit_health_flags"/>
  <stl-vector name="body_part_flags"
      type-name="unit_bp_health_flags"/>
  <int16_t name="unk_18_cntdn"/>
  <int16_t name="immobilize_cntdn"/>
  <int16_t name="dressing_cntdn"/>
  <int16_t name="suture_cntdn"/>
  <int16_t name="crutch_cntdn"/>
  <stl-vector name="op_history">
    <pointer>
      <enum base-type="int16_t" name="job_type" type-name="job_type"/>
      <compound name="info" is-union="true">
        <compound name="crutch">
          <int32_t name="item_type" refers-to="(enum-to-key $item_type
               $)"/>
          <int32_t name="item_subtype" init-value="-1"/>
          <int32_t name="mat_type" ref-target="material"
              aux-value="$$.mat_index"/>
          <int32_t name="mat_index" init-value="-1"/>
          <int32_t name="item_id" ref-target="item"/>
        </compound>
        <int32_t name="bed_id" ref-target="building"/>
        <compound name="bandage">
          <int32_t name="mat_type" ref-target="material"
              aux-value="$$.mat_index"/>
          <int32_t name="mat_index" init-value="-1"/>
          <int32_t name="body_part_id" init-value="-1"/>
          <int32_t name="item_id" ref-target="item"/>
        </compound>
      </compound>
      <int32_t name="year"/>
      <int32_t name="year_time"/>
      <int32_t name="doctor_id" ref-target="unit"/>
    </pointer>
  </stl-vector>
  <stl-vector name="unk_34"/>
</struct-type>

units.orientation_flags

<bitfield-type type-name="orientation_flags" base-type="uint32_t">
  <flag-bit name="indeterminate">
    only seen on adventurers
  </flag-bit>
  <flag-bit name="romance_male"/>
  <flag-bit name="marry_male"/>
  <flag-bit name="romance_female"/>
  <flag-bit name="marry_female"/>
</bitfield-type>

units.unit_soul

<struct-type type-name="unit_soul">
  <int32_t name="unit_id" ref-target="unit"/>
  <compound name="name" type-name="language_name"/>
  <uint32_t name="race" ref-target="creature_raw"/>
  <int8_t name="sex">
    -1 n/a, 0 female, 1 male
  </int8_t>
  <uint16_t name="caste" ref-target="caste_raw" aux-value="$$.race"/>
  <compound type-name="orientation_flags" name="orientation_flags"/>
  <int32_t name="unk2"/>
  <int32_t name="unk3"/>
  <int32_t name="unk4"/>
  <int32_t>
    v0.34.01
  </int32_t>
  <int32_t>
    v0.34.01
  </int32_t>
  <int32_t>
    v0.34.01
  </int32_t>
  <int32_t>
    v0.34.01
  </int32_t>
  <int32_t>
    v0.40.01
  </int32_t>
  <static-array type-name="unit_attribute" name="mental_attrs"
      count="13" index-enum="mental_attribute_type"/>
  <stl-vector name="skills" pointer-type="unit_skill"/>
  <stl-vector name="preferences" pointer-type="unit_preference"/>
  <compound type-name="unit_personality" name="personality"/>
  <pointer name="perfomance_skills">
    <stl-vector pointer-type="unit_instrument_skill"
        name="musical_instruments"/>
    <stl-vector pointer-type="unit_poetic_skill" name="poetic_forms"/>
    <stl-vector pointer-type="unit_musical_skill"
        name="musical_forms"/>
    <stl-vector pointer-type="unit_dance_skill" name="dance_forms"/>
    v0.42.01
  </pointer>
</struct-type>

units.unit_instrument_skill

<struct-type type-name="unit_instrument_skill">
  <int32_t name="id"
      refers-to="$global.world.raws.itemdefs.instruments[$].name"/>
  <enum base-type="int32_t" name="rating" type-name="skill_rating"/>
  <int32_t name="experience"/>
</struct-type>

units.unit_poetic_skill

<struct-type type-name="unit_poetic_skill">
  <int32_t name="id"
      refers-to="$global.world.poetic_forms.all[$].name"/>
  <enum base-type="int32_t" name="rating" type-name="skill_rating"/>
  <int32_t name="experience"/>
</struct-type>

units.unit_musical_skill

<struct-type type-name="unit_musical_skill">
  <int32_t name="id"
      refers-to="$global.world.musical_forms.all[$].name"/>
  <enum base-type="int32_t" name="rating" type-name="skill_rating"/>
  <int32_t name="experience"/>
</struct-type>

units.unit_dance_skill

<struct-type type-name="unit_dance_skill">
  <int32_t name="id"
      refers-to="$global.world.dance_forms.all[$].name"/>
  <enum base-type="int32_t" name="rating" type-name="skill_rating"/>
  <int32_t name="experience"/>
</struct-type>

units.unit_personality

<struct-type type-name="unit_personality">
  <stl-vector name="values">
    <pointer>
      <enum name="type" base-type="int32_t" type-name="value_type"/>
      <int32_t name="strength"/>
    </pointer>
    v0.40.01
  </stl-vector>
  <stl-vector name="unk_v40_2">
    <pointer>
      <int16_t name="unk1"/>
      <int16_t name="unk2"/>
    </pointer>
    v0.40.01
  </stl-vector>
  <stl-vector name="emotions">
    <pointer>
      <enum name="type" base-type="int32_t" type-name="emotion_type"/>
      <int32_t name="unk2"/>
      <int32_t name="strength"/>
      <enum name="thought" base-type="int32_t"
          type-name="unit_thought_type"/>
      <int32_t name="subthought">
        for certain thoughts
      </int32_t>
      <int32_t name="severity"/>
      <int32_t name="flags"/>
      <int32_t name="unk7"/>
      <int32_t name="year"/>
      <int32_t name="year_tick"/>
    </pointer>
    v0.40.01
  </stl-vector>
  <stl-vector name="dreams">
    <pointer>
      <int32_t name="unk1"/>
      <enum name="type" base-type="int32_t" type-name="goal_type"/>
      <int32_t name="unk3" init-value="-1"/>
      <stl-vector name="unk4" type-name="int32_t"/>
      <int32_t name="unk8"/>
    </pointer>
    v0.40.01
  </stl-vector>
  <int32_t name="next_dream_id">
    v0.40.01
  </int32_t>
  <stl-vector name="unk_v40_6">
    <pointer>
      <int32_t name="unk1" init-value="-1"/>
      <int32_t name="unk2" init-value="-1"/>
      <int32_t name="unk3" init-value="-1"/>
      <int32_t name="unk4" init-value="-1"/>
      <int32_t name="unk5" init-value="-1"/>
      <int32_t name="unk6"/>
    </pointer>
    v0.40.01
  </stl-vector>
  <static-array type-name="uint16_t" name="traits" count="50"
      index-enum="personality_facet_type"/>
  <int32_t name="civ_id" ref-target="historical_entity">
    v0.40.01
  </int32_t>
  <int32_t name="cultural_identity" ref-target="cultural_identity">
    v0.40.01
  </int32_t>
  <stl-vector name="unk5">
    <pointer>
      <int16_t name="unk1"/>
      <int16_t name="unk2"/>
    </pointer>
  </stl-vector>
  <stl-vector type-name="int16_t" name="unk6"/>
  <int32_t name="stress_level"/>
  <int32_t name="unk_v4014_2">
    v0.40.14
  </int32_t>
  <int32_t name="unk_v4014_3">
    v0.40.14
  </int32_t>
  <int32_t name="unk_v4019_1">
    v0.40.17-19
  </int32_t>
  <int32_t name="unk_v4019_2">
    v0.40.17-19
  </int32_t>
  <stl-vector name="needs">
    <pointer>
      <enum base-type="int32_t" name="id" type-name="need_type"/>
      <int32_t name="deity_id" init-value="-1">
        for pray need
      </int32_t>
      <int32_t name="focus_level">
        goes to 400 when unit satisfies need
      </int32_t>
      <int32_t name="need_level">
        how fast focus_level decreases when it below 0
      </int32_t>
    </pointer>
    v0.42.01
  </stl-vector>
  <bitfield name="flags" base-type="uint32_t">
    <flag-bit/>
    <flag-bit name="has_unmet_needs">
      focus_level is below -999 for at least one need
    </flag-bit>
    v0.42.01
  </bitfield>
  <pointer name="temporary_trait_changes">
    <static-array type-name="int16_t" name="traits" count="50"
        index-enum="personality_facet_type"/>
    sum of inebriation or so personality changing effects
  </pointer>
  <int32_t name="unk_v4201_3" init-value="-1">
    v0.42.01
  </int32_t>
  <int32_t name="unk_v4201_4" init-value="-1">
    v0.42.01
  </int32_t>
  <int32_t name="current_focus">
    weighted sum of needs focus_level-s
  </int32_t>
  <int32_t name="undistracted_focus">
    usually number of needs multiplied by 4
  </int32_t>
</struct-type>

units.unit_action_type

<enum-type type-name="unit_action_type">
  <enum-item name="None" value="-1"/>
  <enum-item name="Move"/>
  <enum-item name="Attack"/>
  <enum-item name="Jump"/>
  <enum-item name="HoldTerrain"/>
  <enum-item name="ReleaseTerrain"/>
  <enum-item name="Climb"/>
  <enum-item name="Job"/>
  <enum-item name="Talk"/>
  <enum-item name="Unsteady"/>
  <enum-item name="Parry"/>
  <enum-item name="Block"/>
  <enum-item name="Dodge"/>
  <enum-item name="Recover"/>
  <enum-item name="StandUp"/>
  <enum-item name="LieDown"/>
  <enum-item name="Job2"/>
  <enum-item name="PushObject"/>
  <enum-item name="SuckBlood"/>
  <enum-item name="HoldItem"/>
  <enum-item name="ReleaseItem"/>
</enum-type>

units.unit_action

<struct-type type-name="unit_action">
  <enum name="type" type-name="unit_action_type" base-type="int32_t"
      init-value="None"/>
  <int32_t name="id" init-value="-1"/>
  <compound name="data" is-union="true">
    <compound name="move">
      <int16_t name="x"/>
      <int16_t name="y"/>
      <int16_t name="z"/>
      <int32_t name="timer"/>
      <int32_t name="timer_init"/>
      <int32_t name="fatigue"/>
      <bitfield name='flags' base-type='int32_t'> <flag-bit
          name='charge'/> </bitfield>
      <int32_t name="flags">
        cannot put bitfields inside unions
      </int32_t>
    </compound>
    <compound name="attack">
      <int32_t name="target_unit_id" ref-target="unit"/>
      <compound name="unk_4">
        <int32_t name="wrestle_type">
          0=wrestle, 1=grab
        </int32_t>
        <int16_t name="unk_4"/>
        <int16_t name="unk_6"/>
        <int32_t name="unk_8"/>
        <int32_t name="unk_c"/>
        <int32_t name="unk_10"/>
        <int16_t name="unk_14"/>
      </compound>
      <int32_t name="attack_item_id" ref-target="item"/>
      <int16_t name="target_body_part_id"/>
      <int16_t name="attack_body_part_id"/>
      <int32_t name="attack_id">
        refers to weapon_attack or caste_attack
      </int32_t>
      <int32_t name="unk_28"/>
      <int32_t name="unk_2c"/>
      <int32_t name="attack_velocity"/>
      <bitfield name='flags' base-type='int32_t'> <flag-bit/>
          <flag-bit/> <flag-bit/> <flag-bit/> <flag-bit/> <flag-bit
          name='quick'/> <flag-bit name='heavy'/> <flag-bit
          name='wild'/> <flag-bit name='precise'/> <flag-bit
          name='charge'/> <flag-bit comment='multi-attack'/>
          </bitfield>
      <int32_t name="flags">
        cannot put bitfields inside unions
      </int32_t>
      <int16_t name="unk_38"/>
      <int32_t name="attack_accuracy"/>
      <int32_t name="timer1">
        prepare
      </int32_t>
      <int32_t name="timer2">
        recover
      </int32_t>
    </compound>
    <compound name="jump">
      <int16_t name="x1"/>
      <int16_t name="y1"/>
      <int16_t name="z1"/>
      <int16_t name="x2"/>
      <int16_t name="y2"/>
      <int16_t name="z2"/>
    </compound>
    <compound name="holdterrain">
      <int16_t name="x1"/>
      <int16_t name="y1"/>
      <int16_t name="z1"/>
      <int16_t name="x2"/>
      <int16_t name="y2"/>
      <int16_t name="z2"/>
      <int16_t name="x3"/>
      <int16_t name="y3"/>
      <int16_t name="z3"/>
      <int32_t name="timer"/>
      <int32_t name="fatigue"/>
    </compound>
    <compound name="releaseterrain">
      <int16_t name="x"/>
      <int16_t name="y"/>
      <int16_t name="z"/>
    </compound>
    <compound name="climb">
      <int16_t name="x1"/>
      <int16_t name="y1"/>
      <int16_t name="z1"/>
      <int16_t name="x2"/>
      <int16_t name="y2"/>
      <int16_t name="z2"/>
      <int16_t name="x3"/>
      <int16_t name="y3"/>
      <int16_t name="z3"/>
      <int32_t name="timer"/>
      <int32_t name="timer_init"/>
      <int32_t name="fatigue"/>
    </compound>
    <compound name="job">
      <int16_t name="x"/>
      <int16_t name="y"/>
      <int16_t name="z"/>
      <int32_t name="timer"/>
    </compound>
    <compound name="talk">
      <int32_t name="unk_0"/>
      <int32_t name="activity_id" ref-target="activity_entry"/>
      <int32_t name="activity_event_idx" ref-target="activity_event"
          aux-value="$$.activity_id"/>
      <compound name='event' type-name='entity_event'/> this fails
          because codegen generates a constructor for entity_event
      <static-array name="event" type-name="int32_t" count="10"/>
      <int32_t name="unk_34"/>
      <int32_t name="timer"/>
      <int32_t name="unk_3c"/>
      <int32_t name="unk_40"/>
      <int32_t name="unk_44"/>
      <int32_t name="unk_48"/>
      <int32_t name="unk_4c"/>
      <int32_t name="unk_50"/>
      <int32_t name="unk_54"/>
    </compound>
    <compound name="unsteady">
      <int32_t name="timer"/>
    </compound>
    <compound name="parry">
      <int32_t name="unit_id" ref-target="unit"/>
      <int32_t name="target_action" ref-target="unit_action"
          aux-value="$$.unit_id"/>
      <int32_t name="parry_item_id" ref-target="item"/>
    </compound>
    <compound name="block">
      <int32_t name="unit_id" ref-target="unit"/>
      <int32_t name="target_action" ref-target="unit_action"
          aux-value="$$.unit_id"/>
      <int32_t name="block_item_id" ref-target="item"/>
    </compound>
    <compound name="dodge">
      <int16_t name="x1"/>
      <int16_t name="y1"/>
      <int16_t name="z1"/>
      <int32_t name="timer"/>
      <int16_t name="x2"/>
      <int16_t name="y2"/>
      <int16_t name="z2"/>
    </compound>
    <compound name="recover">
      <int32_t name="timer"/>
      <int32_t name="unk_4"/>
    </compound>
    <compound name="standup">
      <int32_t name="timer"/>
    </compound>
    <compound name="liedown">
      <int32_t name="timer"/>
    </compound>
    <compound name="job2">
      <int32_t name="timer"/>
    </compound>
    <compound name="pushobject">
      <int16_t name="x1"/>
      <int16_t name="y1"/>
      <int16_t name="z1"/>
      <int16_t name="x2"/>
      <int16_t name="y2"/>
      <int16_t name="z2"/>
      <int16_t name="x3"/>
      <int16_t name="y3"/>
      <int16_t name="z3"/>
      <int32_t name="timer"/>
      <int32_t name="unk_18"/>
    </compound>
    <compound name="suckblood">
      <int32_t name="unit_id" ref-target="unit"/>
      <int32_t name="timer"/>
    </compound>
    <compound name="holditem">
      <int16_t name="x1"/>
      <int16_t name="y1"/>
      <int16_t name="z1"/>
      <int16_t name="x2"/>
      <int16_t name="y2"/>
      <int16_t name="z2"/>
      <int32_t name="unk_c"/>
      <int32_t name="unk_10"/>
      <int32_t name="unk_14"/>
    </compound>
    <compound name="releaseitem">
      <int32_t name="unk_0"/>
    </compound>
    <static-array name="raw_data" count="22" type-name="int32_t"/>
  </compound>
</struct-type>

units.unit_skill

<struct-type type-name="unit_skill">
  <enum base-type="int16_t" name="id" type-name="job_skill"/>
  <enum base-type="int32_t" name="rating" type-name="skill_rating"/>
  <int32_t name="experience"/>
  <int32_t name="unused_counter"/>
  <int32_t name="rusty"/>
  <int32_t name="rust_counter"/>
  <int32_t name="demotion_counter"/>
  <int32_t name="unk_1c"/>
</struct-type>

units.unit_preference

<struct-type type-name="unit_preference">
  <enum base-type="int16_t" name="type">
    <enum-item name="LikeMaterial"/>
    <enum-item name="LikeCreature"/>
    <enum-item name="LikeFood"/>
    <enum-item name="HateCreature"/>
    <enum-item name="LikeItem"/>
    <enum-item name="LikePlant"/>
    <enum-item name="LikeTree">
      holdover from 40d and earlier
    </enum-item>
    <enum-item name="LikeColor"/>
    <enum-item name="LikeShape"/>
    <enum-item name="LikePoeticForm"/>
    <enum-item name="LikeMusicalForm"/>
    <enum-item name="LikeDanceForm"/>
  </enum>
  <compound is-union="true">
    <enum base-type="int16_t" name="item_type" type-name="item_type"/>
    <int16_t name="creature_id" ref-target="creature_raw"/>
    <int16_t name="color_id" ref-target="descriptor_color"/>
    <int16_t name="shape_id" ref-target="descriptor_shape"/>
    <int16_t name="plant_id" ref-target="plant_raw"/>
    <int32_t name="poetic_form_id" ref-target="poetic_form"/>
    <int32_t name="musical_form_id" ref-target="musical_form"/>
    <int32_t name="dance_form_id" ref-target="dance_form"/>
  </compound>
  <int32_t name="item_subtype" refers-to="(item-subtype-target
      $$._parent.item_type $)"/>
  <int32_t name="mattype" ref-target="material"
      aux-value="$$.matindex"/>
  <int32_t name="matindex"/>
  <enum type-name="matter_state" base-type="int16_t"
      name="mat_state"/>
  <bool name="active"/>
  <uint32_t name="prefstring_seed">
    feeds into a simple RNG to choose which prefstring to use
  </uint32_t>
</struct-type>

units.unit_complaint

<struct-type type-name="unit_complaint">
  <enum base-type="int16_t" name="type">
    <enum-item name="SelfUnemployed"/>
    <enum-item name="GuildUnemployed"/>
    <enum-item name="NeedWeapons">
      no longer used
    </enum-item>
    <enum-item name="IsAngry"/>
    <enum-item name="IsSad"/>
  </enum>
  <enum base-type="int16_t" type-name="guild_id" name="guild"/>
  <int32_t name="age"/>
</struct-type>

units.unit_request

<struct-type type-name="unit_request">
  <enum base-type="int16_t" name="type">
    <enum-item name="DoGuildJobs"/>
  </enum>
  <enum base-type="int16_t" type-name="guild_id" name="guild"/>
  <int16_t name="count"/>
</struct-type>

units.unit_coin_debt

<struct-type type-name="unit_coin_debt">
  <int32_t name="recipient" ref-target="unit"/>
  <int32_t name="amount"/>
</struct-type>

units.unit_chunk

<struct-type type-name="unit_chunk"
    instance-vector="$global.world.unit_chunks" key-field="id">
  <int32_t name="id">
    unit_*.dat
  </int32_t>
  <static-array name="units" count="100">
    <stl-vector name="items" pointer-type="item"/>
    <pointer name="unit" type-name="unit"/>
  </static-array>
</struct-type>