Skip to content
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

Add a register_on_punch_entity() #14752

Closed
Bebibio opened this issue Jun 13, 2024 · 2 comments
Closed

Add a register_on_punch_entity() #14752

Bebibio opened this issue Jun 13, 2024 · 2 comments
Labels
Feature request Issues that request the addition or enhancement of a feature Low priority

Comments

@Bebibio
Copy link

Bebibio commented Jun 13, 2024

Problem

Currently there is no possibility to track when an entity is dead in a mod (which doesn't add this entity).
There is already a function for player but not for entity.
Exemple: I want to know when an entity from an other mod is killed. But I can't!

Solutions

I'm don't really know how to add this in minetest's files but it will be a function that allows you to know when an entity is punch: minetest.register_on_punch_entity

Alternatives

No idea

Additional context

No response

@Bebibio Bebibio added the Feature request Issues that request the addition or enhancement of a feature label Jun 13, 2024
@appgurueu
Copy link
Contributor

Exemple: I want to know when an entity from an other mod is killed. But I can't!

You can. It's not the prettiest, but simply depending on said mod and "hooking" their entity definition to override the on_death callback works:

local def = minetest.registered_entities["their_mod:their_entity"]
local old_on_death = def.on_death
function def:on_death(killer, ...)
    -- do something
    return old_on_death(self, killer, ...)
end

This reduces this feature request to a lower priority matter of convenience.

@rubenwardy
Copy link
Member

Duplicate of #14577 (which was closed by the author)

@Bebibio Bebibio closed this as completed Jun 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature request Issues that request the addition or enhancement of a feature Low priority
Projects
None yet
Development

No branches or pull requests

3 participants