forked from Sokomine/yl_speak_up
added yl_speak_up.enable_yl_mobs config option
This commit is contained in:
parent
dad8ebb81c
commit
6e35b01bd5
@ -14,6 +14,9 @@
|
|||||||
-- Set this only if you need to force-mute an NPC or something like that.
|
-- Set this only if you need to force-mute an NPC or something like that.
|
||||||
yl_speak_up.enable_staff_based_editing = true
|
yl_speak_up.enable_staff_based_editing = true
|
||||||
|
|
||||||
|
-- enable/disable special mobs in the yl_speak_up-namespace (mobs_redo based)
|
||||||
|
yl_speak_up.enable_yl_mobs = true
|
||||||
|
|
||||||
-- Do the NPCs talk right after they spawned?
|
-- Do the NPCs talk right after they spawned?
|
||||||
|
|
||||||
yl_speak_up.talk_after_spawn = true
|
yl_speak_up.talk_after_spawn = true
|
||||||
|
@ -399,10 +399,24 @@ function yl_speak_up.talk(self, clicker)
|
|||||||
if not self then
|
if not self then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
if not self.yl_speak_up or not self.yl_speak_up.id then
|
|
||||||
return
|
-- initialize the mob if necessary; this happens at the time of first talk, not at spawn time!
|
||||||
|
if(not(self.yl_speak_up) or not(self.yl_speak_up.id)) then
|
||||||
|
local m_id = yl_speak_up.number_of_npcs + 1
|
||||||
|
yl_speak_up.number_of_npcs = m_id
|
||||||
|
yl_speak_up.modstorage:set_int("amount", m_id)
|
||||||
|
|
||||||
|
self.yl_speak_up = {
|
||||||
|
talk = true,
|
||||||
|
id = m_id,
|
||||||
|
textures = self.textures
|
||||||
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- create a detached inventory for the npc and load its inventory
|
||||||
|
yl_speak_up.load_npc_inventory("n_"..tostring(self.yl_speak_up.id))
|
||||||
|
|
||||||
|
|
||||||
local npc_id = self.yl_speak_up.id
|
local npc_id = self.yl_speak_up.id
|
||||||
local n_id = "n_" .. npc_id
|
local n_id = "n_" .. npc_id
|
||||||
|
|
||||||
|
11
init.lua
11
init.lua
@ -36,8 +36,6 @@ dofile(modpath .. "command_npc_talk_privs.lua")
|
|||||||
dofile(modpath .. "add_generic_dialogs.lua")
|
dofile(modpath .. "add_generic_dialogs.lua")
|
||||||
-- the actual command to add or remove generic npc dialogs
|
-- the actual command to add or remove generic npc dialogs
|
||||||
dofile(modpath .. "command_npc_talk_generic.lua")
|
dofile(modpath .. "command_npc_talk_generic.lua")
|
||||||
-- react to right-click etc.
|
|
||||||
dofile(modpath .. "interface_mobs_api.lua")
|
|
||||||
-- handle on_player_receive_fields and showing of formspecs
|
-- handle on_player_receive_fields and showing of formspecs
|
||||||
dofile(modpath .. "show_fs.lua")
|
dofile(modpath .. "show_fs.lua")
|
||||||
-- general decoration part for main formspec, trade window etc.
|
-- general decoration part for main formspec, trade window etc.
|
||||||
@ -113,8 +111,13 @@ dofile(modpath .. "register_node_punch.lua")
|
|||||||
if(yl_speak_up.enable_staff_based_editing) then
|
if(yl_speak_up.enable_staff_based_editing) then
|
||||||
dofile(modpath .. "tools.lua")
|
dofile(modpath .. "tools.lua")
|
||||||
end
|
end
|
||||||
-- the actual mobs, using mobs_redo
|
-- mobs registered as yl_speak_up-mobs (based on mobs_redo)
|
||||||
dofile(modpath .. "mobs.lua")
|
if(yl_speak_up.enable_yl_mobs) then
|
||||||
|
-- react to right-click etc.
|
||||||
|
dofile(modpath .. "interface_mobs_api.lua")
|
||||||
|
-- the actual mobs, using mobs_redo
|
||||||
|
dofile(modpath .. "mobs.lua")
|
||||||
|
end
|
||||||
--dofile(modpath .. "debug.lua")
|
--dofile(modpath .. "debug.lua")
|
||||||
|
|
||||||
minetest.mkdir(yl_speak_up.worldpath..yl_speak_up.path)
|
minetest.mkdir(yl_speak_up.worldpath..yl_speak_up.path)
|
||||||
|
@ -30,12 +30,14 @@ end
|
|||||||
function yl_speak_up.on_spawn(self)
|
function yl_speak_up.on_spawn(self)
|
||||||
--Let's assign an ID
|
--Let's assign an ID
|
||||||
|
|
||||||
|
-- TODO make this global mute available
|
||||||
local m_talk = yl_speak_up.talk_after_spawn or true
|
local m_talk = yl_speak_up.talk_after_spawn or true
|
||||||
local m_id = yl_speak_up.number_of_npcs + 1
|
local m_id = yl_speak_up.number_of_npcs + 1
|
||||||
|
|
||||||
yl_speak_up.number_of_npcs = m_id
|
yl_speak_up.number_of_npcs = m_id
|
||||||
yl_speak_up.modstorage:set_int("amount", m_id)
|
yl_speak_up.modstorage:set_int("amount", m_id)
|
||||||
|
|
||||||
|
-- TODO currently. mob_table doesn't really do anything
|
||||||
yl_speak_up.mob_table[m_id] = "yl_speak_up:test_npc"
|
yl_speak_up.mob_table[m_id] = "yl_speak_up:test_npc"
|
||||||
|
|
||||||
self.yl_speak_up = {
|
self.yl_speak_up = {
|
||||||
@ -60,11 +62,11 @@ function yl_speak_up.on_spawn(self)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function yl_speak_up.after_activate(self, staticdata, def, dtime)
|
function yl_speak_up.after_activate(self, staticdata, def, dtime)
|
||||||
minetest.log(
|
-- minetest.log(
|
||||||
"action",
|
-- "action",
|
||||||
"[MOD] yl_speak_up: NPC with ID n_" ..
|
-- "[MOD] yl_speak_up: NPC with ID n_" ..
|
||||||
self.yl_speak_up.id .. " activated at " .. minetest.pos_to_string(self.object:get_pos(), 0)
|
-- self.yl_speak_up.id .. " activated at " .. minetest.pos_to_string(self.object:get_pos(), 0)
|
||||||
)
|
-- )
|
||||||
|
|
||||||
if yl_speak_up.status == 2 then
|
if yl_speak_up.status == 2 then
|
||||||
self.object:remove()
|
self.object:remove()
|
||||||
@ -89,7 +91,4 @@ function yl_speak_up.after_activate(self, staticdata, def, dtime)
|
|||||||
end
|
end
|
||||||
|
|
||||||
yl_speak_up.update_nametag(self)
|
yl_speak_up.update_nametag(self)
|
||||||
|
|
||||||
-- create a detached inventory for the npc and load its inventory
|
|
||||||
yl_speak_up.load_npc_inventory("n_"..tostring(self.yl_speak_up.id))
|
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user