mobkit icon indicating copy to clipboard operation
mobkit copied to clipboard

mobkit.isinliquid implies any liquid, not just source

Open wsor4035 opened this issue 4 years ago • 6 comments

self.isinliquid -- true if feet submerged in liquid type=source

suggestion that this should be changed to true if in source or flowing, however this might break mods that assume this so as a alternative self.isinflowingliquid could exist for liquid type = source

wsor4035 avatar Mar 24 '21 05:03 wsor4035

This is intentional, the property is used for physics stuff like buoyancy, and for swimming, things that shouldn't happen in flowing liquid as it is. Maybe the name doesn't reflect that so well, but I like to keep names short.

TheTermos avatar Mar 25 '21 19:03 TheTermos

ah, makes sense, is it possible then that self.isinflowingliquid could be implemented in the api then?

wsor4035 avatar Mar 26 '21 02:03 wsor4035

Sure it's possible, the question though is if it's worth it performance wise, because such parameters are evaluated every single step.

Can you describe an use case for this parameter?

TheTermos avatar Mar 26 '21 11:03 TheTermos

Can you describe an use case for this parameter?

sure, here are a few, however they mainly fall into aquatic and non aquatic for aquatic you might want to kill the mob if it is out of water and out of flowing water, or in flowing water trigger a behavior to look for the nearest source block (because players or mapgens can make flowing rivers, or waterfalls, etc)

for non aquatic examples a mob might want to avoid flowing water as well as water sources, etc

wsor4035 avatar Mar 29 '21 01:03 wsor4035

@TheTermos bump on this if you dont mind

wsor4035 avatar May 30 '21 00:05 wsor4035

Ok, isinliquid is important for basic movement, that's why it's evaluated every step, and that's why it's as simple as a single point check.

For the things you mention, you need info about a volume of nodes, and you don't need to run it every step, it may be on demand or interval. Check function lava_dmg() in zombiestrd, might be what you're looking for.

TheTermos avatar Jun 18 '21 08:06 TheTermos