[Mod] mobs interacting with world [mob_world_interaction]

Post Reply
User avatar
Posts: 4046
Joined: Sun Sep 09, 2012 17:31
GitHub: Sokomine

[Mod] mobs interacting with world [mob_world_interaction]

by Sokomine » Post

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.

Download: https://github.com/Sokomine/mob_world_interaction/archive/master.zip
Browse code: https://github.com/Sokomine/mob_world_interaction
Version: 0.1
Licence: GPLv3
Depends on: nothing (but is of no use without a mob mod that makes use of it)
Last edited by Sokomine on Fri Jul 06, 2018 12:20, edited 1 time in total.
A list of my mods can be found here.

User avatar
Posts: 7494
Joined: Wed Oct 29, 2014 20:05
GitHub: azekillDIABLO
In-game: azekill_DIABLO
Location: OMICRON

Re: mobs interacting with the world [mob_world_interaction][

by azekill_DIABLO » Post

it's awesome!

User avatar
Posts: 1364
Joined: Mon Aug 04, 2014 14:27
GitHub: maikerumine
In-game: maikerumine

Re: mobs interacting with the world [mob_world_interaction][

by maikerumine » Post

Whoah! I'm excited to see how this works. Great work!!
Extreme Survival Minetest-->viewtopic.php?f=10&t=12959

User avatar
Posts: 129
Joined: Mon Jan 15, 2018 21:46
GitHub: ChristianSirolli
IRC: CSirolli
In-game: CSirolli
Location: Florida, USA

Re: mobs interacting with the world [mob_world_interaction][

by csirolli » Post

Any new development with this mod?
Jesus is the only Way to heaven, the only saving Truth, and the only Life that is worth living.

Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests