diff --git a/init.lua b/init.lua index c30eea8..f4dcb6d 100644 --- a/init.lua +++ b/init.lua @@ -4,25 +4,70 @@ local modpath = minetest.get_modpath("npc_talk")..DIR_DELIM npc_talk = {} + +-- find out the right mesh; if the wrong one is used, the traders become invisible +npc_talk.talking_npc_mesh = "character.b3d"; +-- 3darmor/wieldview is great +if( minetest.get_modpath( '3d_armor' )) then + npc_talk.talking_npc_mesh = "3d_armor_character.b3d"; +end +npc_talk.talking_npc_texture = "character.png" +npc_talk.talking_npc_inventory_image = "character.png" + + + -- a very basic NPC that doesn't require any other mods -- (apart from minetest_game/player_api or any other source of -- a mesh named character.b3d and a suitable texture named character.png) -dofile(modpath .. "talking_npc.lua") +if(minetest.settings:get_bool("enable_npc_talk_basic", true)) then + dofile(modpath .. "talking_npc.lua") + if(minetest.settings:get_bool("enable_npc_talk_craft_basic", true)) then + minetest.register_craft({ + output = "npc_talk:talking_npc_item", + recipe = { + {"dye:black"}, + {"default:paper"}, + {"default:goldblock"}, + }, + }) + end +end -- register an example mob and a spawn egg -- (requires mobs_redo and skinsdb as we need some mesh and some textures from somewhere) -dofile(modpath .. "example_npc.lua") +if(minetest.settings:get_bool("enable_npc_talk_mobs_redo", true)) then + dofile(modpath .. "example_npc.lua") + if(minetest.settings:get_bool("enable_npc_talk_craft_mobs_redo", true)) then + minetest.register_craft({ + output = "npc_talk:npc", + recipe = { + {"dye:blue"}, + {"default:paper"}, + {"default:goldblock"}, + }, + }) + end +end + -- add textures from textures/npc_talk_main_TEXTURE_NAME.png for the example npc dofile(modpath .. "add_skins_and_capes.lua") -- demonstration that a node can be used for starting talking as well -dofile(modpath .. "example_talk_sign.lua") +if(minetest.settings:get_bool("enable_npc_talk_sign", true)) then + dofile(modpath .. "example_talk_sign.lua") +end -- make mobs_npc from mobs_redo ready to be talked to (requires mobs_npc) -dofile(modpath .. "talk_to_mobs_npc.lua") +if(minetest.settings:get_bool("enable_npc_talk_mobs_npc", true)) then + dofile(modpath .. "talk_to_mobs_npc.lua") +end -- mostly a demonstration for mobs_animal (allows to talk to white and red sheep and a cow) -- you need to craft a special book/tool to talk to them as they don't offer a suitable interface; -- punch them with npc_talk:talk_tool -dofile(modpath .. "talk_tool.lua") -dofile(modpath .. "talk_to_animals.lua") +if(minetest.settings:get_bool("enable_npc_talk_talk_tool", true)) then + dofile(modpath .. "talk_tool.lua") +end +if(minetest.settings:get_bool("enable_npc_talk_mobs_animal", true)) then + dofile(modpath .. "talk_to_animals.lua") +end diff --git a/settingtypes.txt b/settingtypes.txt new file mode 100644 index 0000000..0c059ba --- /dev/null +++ b/settingtypes.txt @@ -0,0 +1,46 @@ +# Add a very basic NPC that doesn't require any other mods. +# +# You still need minetest_game/player_api or any other source +# for a mesh named character.b3d and a suitable texture named +# character.png. +enable_npc_talk_basic (Enable NPC without dependencies) bool true + + +# Add a craft receipe for the example NPC. +enable_npc_talk_craft_basic (Add a craft receipe for the basic NPC) bool true + + +# Register an example mob and a spawn egg. +# +# Requires mobs_redo and skinsdb as we need some mesh and some +# textures from somewhere. +enable_npc_talk_mobs_redo (Enable NPC based on mobs_redo) bool true + + +# Add a craft receipe for the mobs_redo based NPC. +enable_npc_talk_craft_mobs_redo (Add a craft receipe for the mobs_redo NPC) bool true + + +# Change mobs_npc (requires mobs_redo) NPC so that you can talk to them. +# +# Warning: Doesn't work together with simple_dialogs. +enable_npc_talk_mobs_npc (NPC based on mobs_npc) bool true + + +# Talk to some animals from mob_animals (based on mobs_redo). +# +# This covers only white and red sheep and cows. Mostly for demonstration. +# You need to craft a special book/tool to talk to them as these animals +# already use right-click for other functions. Punch the animals with the +# npc_talk:talk_tool. +enable_npc_talk_mobs_animal (NPC based on mobs_animal) bool true + + +# This is the special tool needed to talk to the above mentionned +# red sheep and cows. Without it you can't talk to them. +enable_npc_talk_talk_tool (Tool for talking to some mobs_animal) bool true + + +# Add a placeable sign that provides the talk interface on right-click. +# Highly experimental. +enable_npc_talk_sign (Placeable sign with talk interface) bool true