minetest.register_tool("yl_speak_up:staff_of_i_said_so", { description = "Staff of I-said-so", inventory_image = "yl_speak_up_staff_of_i_said_so.png", on_use = function(itemstack, user, pointed_thing) local has_priv = minetest.check_player_privs(user, {npc_master=true}) local p_name = user:get_player_name() if not has_priv then minetest.chat_send_player(p_name,yl_speak_up.message_tool_taken_because_of_lacking_priv) minetest.log("action","[MOD] yl_speak_up: User "..p_name.." used an admin item: "..itemstack:get_name().." at pos "..minetest.pos_to_string(user:get_pos(),0)) itemstack:take_item(1) return itemstack end if (pointed_thing.type == "object") then local obj = pointed_thing.ref local luaentity = obj:get_luaentity() if luaentity ~= nil and luaentity.yl_speak_up == nil then return itemstack end -- Is the thing we clicked really one of our NPCs? yl_speak_up.config(user, obj) return itemstack end end }) minetest.register_tool("yl_speak_up:staff_of_shut_up", { description = "Staff of shut-up", inventory_image = "yl_speak_up_staff_of_shut_up.png", on_use = function(itemstack, user, pointed_thing) local has_priv = minetest.check_player_privs(user, {npc_master=true}) local p_name = user:get_player_name() if not has_priv then minetest.chat_send_player(p_name,yl_speak_up.message_tool_taken_because_of_lacking_priv) minetest.log("action","[MOD] yl_speak_up: User "..p_name.." used an admin item: "..itemstack:get_name().." at pos "..minetest.pos_to_string(user:get_pos(),0)) itemstack:take_item(1) return itemstack end if (pointed_thing.type == "object") then local obj = pointed_thing.ref local luaentity = obj:get_luaentity() if luaentity ~= nil and luaentity.yl_speak_up == nil then return itemstack end -- Is the thing we clicked really one of our NPCs? luaentity.yl_speak_up.talk = false local npc = luaentity.yl_speak_up.id minetest.chat_send_player(p_name,"NPC with ID "..npc.." will shut up at pos "..minetest.pos_to_string(obj:get_pos(),0).." on command of "..p_name) minetest.log("action","[MOD] yl_speak_up: NPC with ID n_"..npc.." will shut up at pos "..minetest.pos_to_string(obj:get_pos(),0).." on command of "..p_name) return itemstack end end }) minetest.register_tool("yl_speak_up:staff_of_dawai_dawai", { description = "Staff of dawai-dawai", inventory_image = "yl_speak_up_staff_of_dawai_dawai.png", on_use = function(itemstack, user, pointed_thing) local has_priv = minetest.check_player_privs(user, {npc_master=true}) local p_name = user:get_player_name() if not has_priv then minetest.chat_send_player(p_name,yl_speak_up.message_tool_taken_because_of_lacking_priv) minetest.log("action","[MOD] yl_speak_up: User "..p_name.." used an admin item: "..itemstack:get_name().." at pos "..minetest.pos_to_string(user:get_pos(),0)) itemstack:take_item(1) return itemstack end if (pointed_thing.type == "object") then local obj = pointed_thing.ref local luaentity = obj:get_luaentity() if luaentity ~= nil and luaentity.yl_speak_up == nil then return itemstack end -- Is the thing we clicked really one of our NPCs? luaentity.yl_speak_up.talk = true local npc = luaentity.yl_speak_up.id minetest.chat_send_player(p_name,"NPC with ID "..npc.." will resume speech at pos "..minetest.pos_to_string(obj:get_pos(),0).." on command of "..p_name) minetest.log("action","[MOD] yl_speak_up: NPC with ID n_"..npc.." will resume speech at pos "..minetest.pos_to_string(obj:get_pos(),0).." on command of "..p_name) return itemstack end end }) minetest.register_tool("yl_speak_up:staff_of_game_over", { description = "Staff of game-over", inventory_image = "yl_speak_up_staff_of_game_over.png", on_use = function(itemstack, user, pointed_thing) local has_priv = minetest.check_player_privs(user, {npc_master=true}) local p_name = user:get_player_name() if not has_priv then minetest.chat_send_player(p_name,yl_speak_up.message_tool_taken_because_of_lacking_priv) minetest.log("action","[MOD] yl_speak_up: User "..p_name.." used an admin item: "..itemstack:get_name().." at pos "..minetest.pos_to_string(user:get_pos(),0)) itemstack:take_item(1) return itemstack end if (pointed_thing.type == "object") then local obj = pointed_thing.ref local luaentity = obj:get_luaentity() if luaentity ~= nil and luaentity.yl_speak_up == nil then return itemstack end -- Is the thing we clicked really one of our NPCs? local npc = luaentity.yl_speak_up.id minetest.chat_send_player(p_name,"NPC with ID "..npc.." removed from position "..minetest.pos_to_string(obj:get_pos(),0).." on command of "..p_name) minetest.log("action","[MOD] yl_speak_up: NPC with ID "..npc.." removed from position "..minetest.pos_to_string(obj:get_pos(),0).." on command of "..p_name) obj:remove() return itemstack end end }) minetest.register_tool("yl_speak_up:staff_of_fashion", { description = "Staff of fashion", inventory_image = "yl_speak_up_staff_of_fashion.png", on_use = function(itemstack, user, pointed_thing) local has_priv = minetest.check_player_privs(user, {npc_master=true}) local p_name = user:get_player_name() if not has_priv then minetest.chat_send_player(p_name,yl_speak_up.message_tool_taken_because_of_lacking_priv) minetest.log("action","[MOD] yl_speak_up: User "..p_name.." used an admin item: "..itemstack:get_name().." at pos "..minetest.pos_to_string(user:get_pos(),0)) itemstack:take_item(1) return itemstack end if (pointed_thing.type == "object") then local obj = pointed_thing.ref local luaentity = obj:get_luaentity() if luaentity ~= nil and luaentity.yl_speak_up == nil then return itemstack end -- Is the thing we clicked really one of our NPCs? yl_speak_up.fashion(user, obj) local npc = luaentity.yl_speak_up.id minetest.chat_send_player(p_name,"NPC with ID n_"..npc.." will redress at pos "..minetest.pos_to_string(obj:get_pos(),0).." on command of "..p_name) minetest.log("action","[MOD] yl_speak_up: NPC with ID n_"..npc.." will redress at pos "..minetest.pos_to_string(obj:get_pos(),0).." on command of "..p_name) return itemstack end end })