uses skinsdb in order to get mesh and texture for npc_talk:npc
This commit is contained in:
parent
5524ce849b
commit
dad2e50e71
@ -65,11 +65,29 @@ local function add_skins_and_capes(temp, races, modname)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
npc_talk.add_skins_from_skinsdb = function(mob_name_string)
|
||||
-- read skins from skinsdb
|
||||
if(not(minetest.get_modpath("skinsdb"))) then
|
||||
return
|
||||
end
|
||||
local list = skins.get_skinlist_for_player()
|
||||
for _, skin in ipairs(list) do
|
||||
-- avoid duplicate entries
|
||||
if(table.indexof(yl_speak_up.mob_skins[mob_name_string], skin:get_texture()) == -1) then
|
||||
table.insert(yl_speak_up.mob_skins[mob_name_string], skin:get_texture())
|
||||
end
|
||||
end
|
||||
minetest.log("action","[MOD] npc_talk uses "..tostring(#list).." skins from skinsdb ")
|
||||
end
|
||||
|
||||
|
||||
-- called at startup and on reload of yl_speak_up
|
||||
npc_talk.add_textures = function()
|
||||
-- do all the things that have to be done when yl_speak_up is initialized or reloaded
|
||||
add_skins_and_capes(npc_talk.file_list, {"npc"}, "npc_talk:")
|
||||
minetest.log("action","[MOD] npc_talk loaded textures for yl_speak_up")
|
||||
npc_talk.add_skins_from_skinsdb("npc_talk:npc")
|
||||
end
|
||||
|
||||
-- this has to be called *once* when the file is initialized
|
||||
|
@ -81,8 +81,8 @@ npc_talk.enable_talk_to_example_npc = function()
|
||||
|
||||
end
|
||||
|
||||
-- TODO: may require 3darmor?
|
||||
if(minetest.get_modpath("mobs_npc")) then
|
||||
-- we need a suitable mesh and skins from somewhere
|
||||
if(minetest.get_modpath("mobs") and minetest.get_modpath("skinsdb")) then
|
||||
-- register the NPC once
|
||||
npc_talk.register_example_npc()
|
||||
-- make sure it gets called once now and in the future whenever yl_speak_up is reloaded
|
||||
|
7
init.lua
7
init.lua
@ -4,10 +4,13 @@ local modpath = minetest.get_modpath("npc_talk")..DIR_DELIM
|
||||
|
||||
npc_talk = {}
|
||||
|
||||
-- a very basic NPC that doesn't require any other mods (apart from default)
|
||||
-- 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")
|
||||
|
||||
-- register an example mob and a spawn egg (requires mobs_redo)
|
||||
-- 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")
|
||||
-- add textures from textures/npc_talk_main_TEXTURE_NAME.png for the example npc
|
||||
dofile(modpath .. "add_skins_and_capes.lua")
|
||||
|
2
mod.conf
2
mod.conf
@ -4,4 +4,4 @@ description = NPC for yl_speak_up
|
||||
release = 202309030000
|
||||
title = NPC you can talk to (in combination with yl_speak_up)
|
||||
depends = yl_speak_up
|
||||
optional_depends = mobs, mobs_npc, mobs_animal, default, player_api
|
||||
optional_depends = mobs, mobs_npc, mobs_animal, default, player_api, skinsdb
|
||||
|
13
readme.md
13
readme.md
@ -10,9 +10,12 @@ Recommends:
|
||||
* <a href="https://content.minetest.net/packages/TenPlus1/mobs/">mobs_redo</a>
|
||||
* <a href="https://content.minetest.net/packages/TenPlus1/mobs_npc/">mobs_npc</a>
|
||||
* <a href="https://content.minetest.net/packages/TenPlus1/mobs_animal/">mobs_animal</a>
|
||||
* <a href="https://content.minetest.net/packages/bell07/skinsdb/">skinsdb</a>
|
||||
|
||||
Remember that you need the `npc_talk_owner` priv in order to configure your NPC!
|
||||
|
||||
This mod adds actual NPC to the game. They can be talked to on rightclick.
|
||||
|
||||
## Table of Content
|
||||
|
||||
1. [Basic talking NPC (no other mods required)](#talking_npc)
|
||||
@ -29,7 +32,7 @@ This basic NPC is available even if you install no other mods.
|
||||
|
||||
The model - `character.b3d` - is part of `minetest_game`. You can either get it from there
|
||||
(you will likely have it already) or change the entry in `talking_npc.lua` to the model
|
||||
your game uses.
|
||||
your game uses. You will also need a texture called `character.png`.
|
||||
|
||||
There is no spawning implemented. Type `/giveme npc_talk:talking_npc` to get one.
|
||||
|
||||
@ -50,13 +53,14 @@ This feature is highly experimental.
|
||||
|
||||
The position of the sign acts as ID.
|
||||
|
||||
You may have to set the owner manually after placing.
|
||||
|
||||
|
||||
### 3. Example NPC (requires mobs\_redo)<a name="mobs_redo"></a>
|
||||
|
||||
This is very close to the NPC used on the Your Land server. They're basicly
|
||||
`mobs_redo` based NPC.
|
||||
`mobs_redo` based NPC. You also need to install the `skinsdb` mod so that
|
||||
a mesh and textures are available. Technicly, `skinsdb` isn't really
|
||||
necessary - but a mesh and textures are. They have to come from *somewhere*.
|
||||
|
||||
There is no spawning implemented. Type `/giveme npc_talk:npc` to get one.
|
||||
|
||||
@ -71,7 +75,8 @@ Features:
|
||||
### 4. Talk to existing NPC (requires mobs\_npc)<a name="mobs_npc"></a>
|
||||
|
||||
These mobs come from a mod that already adds some NPC. They spawn in the world,
|
||||
can be tamed with bread, and you can even breed them.
|
||||
can be tamed with bread, and you can even breed them. Said mod is called
|
||||
`mobs_npc`.
|
||||
|
||||
Just right-click them to talk to and use all other features as you're used to
|
||||
from that mod.
|
||||
|
Loading…
Reference in New Issue
Block a user