Minetest: Add entity drowning

Created on 29 May 2018  ·  3Comments  ·  Source: minetest/minetest

Issue type
  • Feature request

I suggest that entities get optional breath and can drown, just like players do.

Entities get a new optional attribute: breath_max. By default, this is nil which means drowning is disabled.
breath_max are the maximum breath points with which the entity starts.

Entities also get get_breath and set_breath. If drowning is disabled, get_breath returns nil and set_breath is a no-op.

Apart from that, the drowning mechanics for entities should parrallel player drowning in pretty much every aspect as close as possible. They lose and gain breath like players do, take damage like players do, and so on. Of course, only if drowning is enabled.

The aim of this is to make it easier and more straightforward to add drowning to mobs.

Why not a mod?

The engine is much better and faster in figuring out whether something is drowning or not. Also, it is much easier to ensure consistency with how player drowning works.

Should the drowning mechanic be improved in future, this will both improve drowning for players and drowning entities “for free”, something which would not be possible with a purely mod-based implementation.

@ Script API @ Server / Client / Env. Feature request No core dev support long term

Most helpful comment

Would become even more useful if we end up having biome-defined air nodes, some of which will have 'drowning' if they are unbreathable, like vacuum nodes.

All 3 comments

Would become even more useful if we end up having biome-defined air nodes, some of which will have 'drowning' if they are unbreathable, like vacuum nodes.

IMO thats not general enough. Remember MT aims at being an engine, not a game itself. I think a general node damage system would be good, with an additional stats system : a stat would let you register a certain "bar" for a player/entity, such as breath, hp or armor. Then, there would be node damage groups, such as breath=10, which means node drains 10 breath per sec. This would be far better extendable; imagine ice mobs, having a "cold" bar, which is is reduced by lava :drooling_face:

:-1:

Drowning should have never been an engine feature anyway

The engine is much better and faster

Exactly the same information is available to both the engine and to mods. Checking nodes for drowning happens at most twice a second, and is no where near a critical path.

Also, it is much easier to ensure consistency with how player drowning works.

This is the strongest argument here, however it's worth noting that drowning is a smaller part than player mechanics which you'd need to implement yourself currently. A better approach would be to make this a builtin feature which you'd call from your entity's on_step to check for drowning. An even better approach would be to make this a MTG mod, but it's probably a bit late for that now

Should the drowning mechanic be improved in future, this will both improve drowning for players and drowning entities “for free”, something which would not be possible with a purely mod-based implementation.

Drowning is a trivial part of the


Adding game play specific features like this when we don't need to is how we end up with an even more bloated engine. The power in Minetest is what's possible with modding, not what's in the engine

Was this page helpful?
0 / 5 - 0 ratings

Related issues

FaceDeer picture FaceDeer  ·  3Comments

echosa picture echosa  ·  3Comments

verymilan picture verymilan  ·  3Comments

Fixer-007 picture Fixer-007  ·  3Comments

HybridDog picture HybridDog  ·  3Comments