hkzorman / advanced_npc

Advanced NPC for Minetest, using mobs_redo API
Other
17 stars 5 forks source link

Allow other mods to register their node functionality for compatibility #1

Open hkzorman opened 7 years ago

hkzorman commented 7 years ago

While Advanced NPC provides compatibility with Sokomine's cottages mod, other mods that provide nodes usable by NPCs (like doors, beds, chairs, differently-operated furnaces, etc.) and want to support this mod should be able to do so by registering how their nodes work.

For example, if a mod has doors that do not use the default doors API, then a mod can tell advanced_npc how to detect their own doors are open/closed, by using some kind of register function like the following:

npc.actions.register_door({
  name_prefix: "other_mod:door",
  is_door_open = function(pos) {
    local node_meta = minetest.get_meta(pos)
    return meta:get_string("door_state") == "open"
  }
}