Page 1 of 1

[Mod] mobs interacting with world [mob_world_interaction]

PostPosted: Fri Jun 16, 2017 16:45
by Sokomine
This collection of functions is intended to be a library for (humanoid) mobs/npc that want to interact with certain nodes in their environment in a way the player would expect it to act, i.e. open doors and gates, close them after the mob walked through, sleep in beds, sit on chairs and benches and the like. It's not intended for animals as those don't really know how to use furniture, and it's not intended for hostile mobs as those need to act faster and in a diffrent way.

The pathfinder was written by burli. The original can be found in burlis thread about his pathfinder mod. As it is implemented in lua it was easy to add needed functionality. The pathfinder can now plot paths through doors, gates and (to some degree) trapdoors from the doors mod. Doorlike nodes from my cottages and gates_long mod are supported. The goal of the mod is to support all door- and gatelike nodes that can be made to work.

Some of the houses of my mg_villages use very slim slabs for ceilings and sometimes even walls. The pathfinder has been modified so that it can at least accept slabs up to 2/16 thinkness if they are used as a ceiling. I've yet to teach it to accept such nodes when placed on top of the floor (and thus acting as floor) as well. There will still be situations where the pathfinder can't find a way through (i.e. 1/2 slab on ground, air, 1/2 slab on ceiling -> no chance; or: 1/2 slab upright on left wall, air to the right, and to the right 1/2 slab upright on right wall -> no chance either).

Functions for identifying, opening and closing doors are included. They need to be integrated into the mob's movement code in order for the mob to be able to follow the path the pathfinder provided.

Beds are less simple than they seem. Sleeping in the bed requires - apart from the right animation - also the right yaw. And once the mob wants to leave its bed it needs to find a place where it can stand and from where it can start searching for a path. Doing so from the bed position will only work if there's enough room for the mob to actually stand on the bed. Which may not always be the case. This is also useful for more complex arrangements of chairs, benches and the like.

Sitting on furniture is not implemented yet. I did write functions for that a long time ago and need to check in how far that can still be used. Further nodes that will get support sooner or later are farming related nodes (soil, plants). Also digging/placing might be of general use. My citybuilder mod comes with special "dig here" indicators and scaffolding nodes which supply information about which nodes ought to be placed where and how. This is also something that ought to be supported here.

The mod is far from complete. Some parts definitely need changes. But it's a start. There are far too many mods out there who all more or less attempt the same. And a lot of diffrent nodes with which there aren't that many ways your mob might wish to interact with (i.e. doors, beds, chairs, ...). That's all not mob-specific but node-specific.

Browse code:
Version: 0.1
Licence: GPLv3
Depends on: nothing (but is of no use without a mob mod that makes use of it)

Re: mobs interacting with the world [mob_world_interaction][

PostPosted: Sat Jun 17, 2017 10:49
by azekill_DIABLO
it's awesome!

Re: mobs interacting with the world [mob_world_interaction][

PostPosted: Sat Jun 17, 2017 13:36
by maikerumine
Whoah! I'm excited to see how this works. Great work!!

Re: mobs interacting with the world [mob_world_interaction][

PostPosted: Thu Jun 21, 2018 16:38
by csirolli
Any new development with this mod?