forked from your-land/yl_canned_food_mtg
Implements feature unified_inventory integration
This commit is contained in:
parent
84282965b1
commit
76fae9a185
15
config.lua
15
config.lua
@ -1,12 +1,15 @@
|
||||
|
||||
-- Setting a configuration, switch the order in which the settings shall take precedence. First valid one taken.
|
||||
|
||||
yl_canned_food_mtg.settings = {}
|
||||
|
||||
yl_canned_food_mtg.settings.debug = minetest.settings:get_bool("yl_canned_food_mtg.debug", false)
|
||||
yl_canned_food_mtg.settings.debug = minetest.settings:get_bool(
|
||||
"yl_canned_food_mtg.debug", false)
|
||||
|
||||
yl_canned_food_mtg.settings.enable_recipes = "mod_default" or minetest.settings:get_bool("yl_canned_food_mtg.enable_recipes", true)
|
||||
yl_canned_food_mtg.settings.enable_recipes =
|
||||
minetest.settings:get_bool("yl_canned_food_mtg.enable_recipes", true)
|
||||
|
||||
yl_canned_food_mtg.settings.enable_eat = "yl_canned_food_mtg" or minetest.settings:get_bool("yl_canned_food_mtg.enable_eat", true)
|
||||
yl_canned_food_mtg.settings.enable_eat =
|
||||
minetest.settings:get_bool("yl_canned_food_mtg.enable_eat", true)
|
||||
|
||||
yl_canned_food_mtg.settings.enable_unified_inventory = "admin_priv" or minetest.settings:get_bool("yl_canned_food_mtg.enable_unified_inventory", true)
|
||||
yl_canned_food_mtg.settings.enable_unified_inventory =
|
||||
minetest.settings:get_bool("yl_canned_food_mtg.enable_unified_inventory",
|
||||
true)
|
||||
|
||||
7
data.lua
7
data.lua
@ -1,14 +1,13 @@
|
||||
yl_canned_food_mtg.recipes = {
|
||||
|
||||
{
|
||||
out = "canned_food:apple_jam",
|
||||
out = "yl_canned_food:apple_jam",
|
||||
base_mod = "group",
|
||||
base_item = "food_apple",
|
||||
base_amount = 3,
|
||||
additives = {}
|
||||
},
|
||||
{
|
||||
out = "canned_food:banana_jam",
|
||||
}, {
|
||||
out = "yl_canned_food:banana_jam",
|
||||
base_mod = "group",
|
||||
base_item = "food_banana",
|
||||
base_amount = 5,
|
||||
|
||||
@ -1 +1,35 @@
|
||||
-- unified_inventory
|
||||
|
||||
if (yl_canned_food_mtg.settings.enable_unified_inventory ~= true) then
|
||||
return false
|
||||
end
|
||||
|
||||
-- unified_inventory
|
||||
if (minetest.get_modpath("unified_inventory") == nil) then
|
||||
yl_canned_food_mtg.log("feature unfied_inventory enabled, but mod unfied_inventory not found")
|
||||
return false
|
||||
end
|
||||
|
||||
assert((type(unified_inventory.register_craft_type) == "function"), "register_craft_type does not exist in unified_inventory")
|
||||
assert((type(unified_inventory.register_craft) == "function"), "register_craft does not exist in unified_inventory")
|
||||
|
||||
unified_inventory.register_craft_type("yl_canned_food", {
|
||||
description = yl_canned_food_mtg.t(
|
||||
"unified_inventory_register_craft_type_description"),
|
||||
icon = "yl_canned_food_mtg_unified_inventory_craft.png",
|
||||
width = 1,
|
||||
height = 1,
|
||||
uses_crafting_grid = false
|
||||
})
|
||||
|
||||
local amount = 0
|
||||
|
||||
for _, recipe in ipairs(yl_canned_food_mtg.recipes) do
|
||||
unified_inventory.register_craft({
|
||||
output = recipe.out .. "_plus",
|
||||
type = "yl_canned_food",
|
||||
items = {recipe.out}
|
||||
})
|
||||
amount = amount + 1
|
||||
end
|
||||
|
||||
yl_canned_food_mtg.log("unfied_inventory integration: " .. dump(amount))
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
-- Use this file to initialize variables once after server start and check everything is in place
|
||||
|
||||
local function run_each_serverstart()
|
||||
yl_canned_food_mtg.data = {}
|
||||
yl_canned_food_mtg.data = yl_canned_food_mtg.recipes
|
||||
end
|
||||
|
||||
run_each_serverstart()
|
||||
|
||||
2
mod.conf
2
mod.conf
@ -1,5 +1,5 @@
|
||||
name = yl_canned_food_mtg
|
||||
description = Craft and eat yl_canned_food in mtg
|
||||
optional_depends = default
|
||||
optional_depends = default, unified_inventory
|
||||
author = AliasAlreadyTaken
|
||||
title = Canned Food MTG
|
||||
@ -19,6 +19,9 @@ texts["log_prefix"] = "[MOD] @1 : @2"
|
||||
|
||||
texts["information_additional"] = "Craft and eat yl_canned_food in mtg"
|
||||
|
||||
texts["unified_inventory_register_craft_type_description"] = "Place in a dark room"
|
||||
|
||||
|
||||
texts["chatcommand_admin_description"] = "Admin Chatcommand description"
|
||||
texts["chatcommand_admin_parameters"] = "<name> <privilege>"
|
||||
texts["chatcommand_admin_success_message"] = "Sucess message"
|
||||
|
||||
BIN
textures/yl_canned_food_mtg_unified_inventory_craft.png
Normal file
BIN
textures/yl_canned_food_mtg_unified_inventory_craft.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 850 B |
Loading…
Reference in New Issue
Block a user