Skip to content

Dogs lose their selected corpse after locking it and never enter Eat/Drag state #668

Description

@vangorn1011-coder

Engine version

xray-monolith 2026.8.17, standard DX11-AVX build
Anomaly 1.5.3 / GAMMA-based modpack

Problem

Blind dogs kill a regular stalker, then move away and remain idle instead of eating or dragging the corpse.

The actor was hidden with the Debug Menu before spawning the NPCs, so the dogs had no active enemy after combat. The victim was an ordinary stalker, not a zombie. The result is reproducible with newly spawned dogs and a newly spawned stalker.

After combat:

ENEMY=nil
CORPSE=nil

The human model has valid human_captures.ltx data and the required capture bones.

Possible cause in the engine code

CBaseMonster::on_kill_enemy() correctly adds the killed entity to CorpseMemory.

In dog_state_manager.cpp, when the dog selects the Eat state, it stores the corpse and locks it:

object->EatedCorpse = object->CorpseMan.get_corpse();
const_cast<CEntityAlive *>(object->EatedCorpse)->set_lock_corpse(true);

However, CMonsterCorpseMemory::remove_non_actual() removes every locked corpse from the monster's corpse memory:

if (const_cast<CEntityAlive *>(it->first)->is_locked_corpse())
{
m_objects.erase(it);
continue;
}

Then CBaseMonster::UpdateCL() clears the dog's own selected corpse because it is no longer present in CorpseMemory:

if (EatedCorpse && !CorpseMemory.is_valid_corpse(EatedCorpse))
{
EatedCorpse = NULL;
}

This appears to create the following loop:

Dog selects a corpse.
Dog locks its selected corpse.
Corpse memory removes the locked corpse.
EatedCorpse is cleared.
The dog leaves the Eat state and returns to Rest.
Possible minimal fix

Keep the corpse in this monster's memory when it is locked by the same monster:

  • if (const_cast<CEntityAlive *>(it->first)->is_locked_corpse())
  • if (const_cast<CEntityAlive *>(it->first)->is_locked_corpse() &&
  • monster->EatedCorpse != it->first)
    

{
m_objects.erase(it);
continue;
}

This should preserve the dog's own EatedCorpse while still preventing other monsters from selecting a corpse that is already occupied.

Could you please verify whether this is the reason dogs rarely or never enter the Eat/Drag behavior?

Additional note

Changing satiety_threshold in m_dog.ltx does not affect this behavior in the current source. CStateGroupEat::hungry() uses the hardcoded TIME_NOT_HUNGRY = 20000 timer instead.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions