Jump to content

Entity death listener to attract Crystal-Crested Buzzards is potentially missing some checks


hoxi
  • Pending

EDIT: I forgot to clarify that I'm aware that this is currently work in progress and unused!! I'm more just pointing out the slightly different rules, which may or may not be intended!

 

This might be intentional but I feel like it might be worth pointing out to be sure:

local function OnEntityDeath(src, data)
    local deadinst = data ~= nil and data.inst or nil
    if not deadinst then
        return
    end

    local x, y, z = deadinst.Transform:GetWorldPosition()
    local node = _migrationmanager:GetMigrationNodeAtPoint(x, y, z)
    if not node then
        return
    end

    if not EntityHasCorpse(deadinst) then -- We only want to attract if we actually have a corpse
        return
    end

    death_nodes[node] = death_nodes[node] or {}
    table.insert(death_nodes[node], TUNING.MUTATEDBUZZARD_DEATHATTRACTION_TIME)
end

 

When compared to the corpse persist function:

local function CorpsePersistFn(corpse) -- corpse param can also be a creature as it died.
    if corpse:IsOnOcean(true) then
        return false
    end

    -- exclude really tiny insects like bees
    if corpse:HasTag("insect") and corpse:HasAnyTag("smallcreature", "smallcreaturecorpse") then
        return false
    end

    if corpse:HasTag("buzzard") then
        return false
    end

    return _migrationmanager:GetPopulationForNodeAtInst(MIGRATION_TYPES.MUTATED_BUZZARD_GESTALT, corpse) > 0
        or AnyBuzzardInRange(corpse.Transform:GetWorldPosition())
end

 

We can see that Buzzards could be attracted across the world by small insects like bees or so being killed, despite not persisting and being ignored, or by creatures dying on the ocean (but still within a valid migration node).

Either or both of these could be intended for all I know (I'd figure maybe allowing death on the ocean to attract them could be intended at least, not sure on the insect death part though), I just figured it might be worth pointing out in case they aren't. If not, could make a common function to check for being on the ocean and for the tags, and use it in both functions.


Steps to Reproduce
  • Kill small insects that can leave a corpse, like bees, or any creature with a corpse (including bees), on the ocean.
  • Wait (or debug check for migration nodes), and see how Crystal-Crested Buzzards will be attracted to the area.
  • Like 2



User Feedback


There are no comments to display.



Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
  • Create New...