New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HOOK_SPAWNED_MONSTER not called in some cases #4193

jonathathan opened this Issue Mar 7, 2018 · 0 comments


None yet
1 participant
Copy link

jonathathan commented Mar 7, 2018

Expected behavior

I expect that any time HOOK_SPAWNED_ENTITY is called for an entity with GetEntityType() == etMob, then there will be a corresponding HOOK_SPAWNED_MONSTER

Actual behavior

This is true in most cases, but sometimes I observe a HOOK_SPAWNED_ENTITY without a HOOK_SPAWNED_MONSTER

Steps to reproduce the behavior

Hard to reliably reproduce, but occurs for me when I move around the map forcing entities to spawn, usually within a minute or two of moving.

Some Initial Research

Looking through the code, it seems that mobs can be spawned either through cWorld::SpawnMobFinalize, which calls both hooks, or through cWorld::SetChunkData (after the mob is created in cFinishGenPassiveMobs::TrySpawnAnimals), which calls cEntity::Initialize which calls CallHookSpawnedEntity but not CallHookSpawnedMob. I'm not familiar with this code, so I may be misreading something, but if I'm right, it looks like HOOK_SPAWNED_MONSTER is not called for monsters spawned during chunk generation, which seems off to me.

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