mirror of
https://github.com/MinetestForFun/quests.git
synced 2024-11-13 06:00:18 +01:00
Add SFINV support
This commit is contained in:
parent
dc58cb606d
commit
4a005972df
4
mod.conf
4
mod.conf
|
@ -1,3 +1,3 @@
|
|||
name = quests
|
||||
optional_depends = intllib, unified_inventory, inventory_plus, central_message
|
||||
description = Quest framework for Minetest.
|
||||
optional_depends = intllib, unified_inventory, inventory_plus, central_message, sfinv
|
||||
description = Quest framework for Minetest.
|
||||
|
|
|
@ -7,8 +7,11 @@ if minetest.get_modpath("inventory_plus") then
|
|||
dofile(minetest.get_modpath("quests") .. "/mod_integrations/inventory_plus.lua")
|
||||
end
|
||||
|
||||
if minetest.global_exists("sfinv") then
|
||||
dofile(minetest.get_modpath("quests") .. "/mod_integrations/sfinv.lua")
|
||||
end
|
||||
|
||||
--mod that displays notifications in the screen's center
|
||||
-- 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")
|
||||
|
||||
|
|
19
mod_integrations/sfinv.lua
Normal file
19
mod_integrations/sfinv.lua
Normal file
|
@ -0,0 +1,19 @@
|
|||
assert(sfinv.enabled, "Please enable sfinv in order to use it.")
|
||||
local old_func = sfinv.pages["sfinv:crafting"].get
|
||||
sfinv.override_page("sfinv:crafting", {
|
||||
get = function(self, player, context)
|
||||
local fs = old_func(self, player, context)
|
||||
return fs .. "image_button[0,0;1,1;inventory_plus_quests.png;quests;]"
|
||||
end
|
||||
})
|
||||
|
||||
minetest.register_on_player_receive_fields(function(player, formname, fields)
|
||||
if fields.quests then
|
||||
quests.show_formspec(player:get_player_name())
|
||||
return true
|
||||
elseif fields.quests_exit then
|
||||
sfinv.set_page(player, "sfinv:crafting")
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end)
|
Loading…
Reference in New Issue
Block a user