mirror of
https://gitea.your-land.de/Sokomine/yl_speak_up.git
synced 2025-06-22 07:08:03 +02:00
determining owner of blocks acting as npc by using metadata
This commit is contained in:
parent
e57d9cb5c3
commit
0417483fb3
@ -575,12 +575,22 @@ function yl_speak_up.talk(self, clicker)
|
||||
-- we are not dealing with an NPC but with a position/block on the map
|
||||
if(self.is_block) then
|
||||
id_prefix = "p"
|
||||
local owner = "- unknown -"
|
||||
local talk_name = "- unknown -"
|
||||
if(self.pos and self.pos and self.pos.x) then
|
||||
local meta = minetest.get_meta(self.pos)
|
||||
if(meta) then
|
||||
owner = meta:get_string("owner") or ""
|
||||
talk_name = meta:get_string("talk_name") or ""
|
||||
end
|
||||
end
|
||||
self.yl_speak_up = {
|
||||
is_block = true,
|
||||
talk = true,
|
||||
id = minetest.pos_to_string(self.pos, 0),
|
||||
textures = {},
|
||||
owner = "TODO_owner_name", -- TODO
|
||||
npc_name = "TODO_npc_name", -- TODO
|
||||
owner = owner,
|
||||
npc_name = talk_name,
|
||||
object = nil, -- blocks don't have an object
|
||||
}
|
||||
-- TODO: remember somewhere that this block is relevant
|
||||
|
Loading…
Reference in New Issue
Block a user