A bit of clean up. Moved mod integration lua files to their own folder with a single file designed to check if supported mods are present and load the appropriate local file to setup for it.
This commit is contained in:
parent
765e34bfe5
commit
4b9565e8b6
|
@ -1,12 +0,0 @@
|
|||
if minetest.global_exists("cmsg") then
|
||||
function quests.show_message(t, playername, text)
|
||||
if (quests.hud[playername].central_message_enabled) then
|
||||
local player = minetest.get_player_by_name(playername)
|
||||
cmsg.push_message_player(player, text, quests.colors[t])
|
||||
minetest.sound_play("quests_" .. t, {to_player = playername})
|
||||
end
|
||||
end
|
||||
else
|
||||
function quests.show_message(...)
|
||||
end
|
||||
end
|
8
init.lua
8
init.lua
|
@ -46,17 +46,11 @@ function quests.sorted_pairs(t)
|
|||
return iter
|
||||
end
|
||||
|
||||
dofile(MP .. "/central_message.lua")
|
||||
dofile(MP .. "/core.lua")
|
||||
dofile(MP .. "/hud.lua")
|
||||
dofile(MP .. "/formspecs.lua")
|
||||
dofile(MP .. "/mod_integrations/mod_integrations.lua")
|
||||
|
||||
-- support for unified_inventory
|
||||
if (minetest.get_modpath("unified_inventory") ~= nil) then
|
||||
dofile(minetest.get_modpath("quests") .. "/unified_inventory.lua")
|
||||
elseif (minetest.get_modpath("inventory_plus") ~= nil) then
|
||||
dofile(minetest.get_modpath("quests") .. "/inventory_plus.lua")
|
||||
end
|
||||
|
||||
|
||||
-- write the quests to file
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
|
||||
function quests.show_message(t, playername, text)
|
||||
if (quests.hud[playername].central_message_enabled) then
|
||||
local player = minetest.get_player_by_name(playername)
|
||||
cmsg.push_message_player(player, text, quests.colors[t])
|
||||
minetest.sound_play("quests_" .. t, {to_player = playername})
|
||||
end
|
||||
end
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
-- support for several inventory mods
|
||||
if minetest.get_modpath("unified_inventory") then
|
||||
dofile(minetest.get_modpath("quests") .. "/mod_integrations/unified_inventory.lua")
|
||||
end
|
||||
|
||||
if minetest.get_modpath("inventory_plus") then
|
||||
dofile(minetest.get_modpath("quests") .. "/mod_integrations/inventory_plus.lua")
|
||||
end
|
||||
|
||||
|
||||
--mod that displays notifications in the screen's center
|
||||
if minetest.get_modpath("central_message") then
|
||||
dofile(minetest.get_modpath("quests") .. "/mod_integrations/central_message.lua")
|
||||
|
||||
else -- define blank function so we can still use this in the code later
|
||||
function quests.show_message(...) end
|
||||
end
|
Loading…
Reference in New Issue