diff --git a/central_message.lua b/central_message.lua deleted file mode 100644 index b725901..0000000 --- a/central_message.lua +++ /dev/null @@ -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 diff --git a/init.lua b/init.lua index f64e8d1..4ac008d 100644 --- a/init.lua +++ b/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 diff --git a/mod_integrations/central_message.lua b/mod_integrations/central_message.lua new file mode 100644 index 0000000..fd930e2 --- /dev/null +++ b/mod_integrations/central_message.lua @@ -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 + diff --git a/inventory_plus.lua b/mod_integrations/inventory_plus.lua similarity index 100% rename from inventory_plus.lua rename to mod_integrations/inventory_plus.lua diff --git a/mod_integrations/mod_integrations.lua b/mod_integrations/mod_integrations.lua new file mode 100644 index 0000000..d737a2a --- /dev/null +++ b/mod_integrations/mod_integrations.lua @@ -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 diff --git a/unified_inventory.lua b/mod_integrations/unified_inventory.lua similarity index 100% rename from unified_inventory.lua rename to mod_integrations/unified_inventory.lua