mirror of
https://github.com/joe7575/techpack.git
synced 2024-08-21 13:44:13 +02:00
V1.06 Grinder recipes with API added
This commit is contained in:
parent
944bccaf5d
commit
12649d2f9b
@ -1,4 +1,4 @@
|
|||||||
# TechPack V1.05
|
# TechPack V1.06
|
||||||
|
|
||||||
TechPack, a Mining, Crafting, & Farming Modpack for Minetest.
|
TechPack, a Mining, Crafting, & Farming Modpack for Minetest.
|
||||||
|
|
||||||
@ -28,7 +28,7 @@ TechPack provides:
|
|||||||
- Several lamp nodes in different colors (can be switched on/off)
|
- Several lamp nodes in different colors (can be switched on/off)
|
||||||
- a Quarry node to dig for stones and other ground nodes
|
- a Quarry node to dig for stones and other ground nodes
|
||||||
- a Harvester node to chop wood, leaves and crops
|
- a Harvester node to chop wood, leaves and crops
|
||||||
- a Grinder node to grind cobble stone to gravel
|
- a Grinder node to grind all kinds of cobblestone to gravel, gravel to sand, and sand to clay
|
||||||
- a Gravelsieve node to sieve ores from gravel
|
- a Gravelsieve node to sieve ores from gravel
|
||||||
- an Autocrafter node for automated crafting of tools and items
|
- an Autocrafter node for automated crafting of tools and items
|
||||||
- a Fermenter node to produce Bio Gas from leaves
|
- a Fermenter node to produce Bio Gas from leaves
|
||||||
@ -78,3 +78,4 @@ Gravelsieve optional: moreores, hopper, pipeworks
|
|||||||
- 2018-03-29 V1.03 * Area protected chest added to tubelib_addons1
|
- 2018-03-29 V1.03 * Area protected chest added to tubelib_addons1
|
||||||
- 2018-03-31 V1.04 * Maintenance, minor issues, Unifieddyes support for Color Lamp, Street Lamp added
|
- 2018-03-31 V1.04 * Maintenance, minor issues, Unifieddyes support for Color Lamp, Street Lamp added
|
||||||
- 2018-04-27 V1.05 * Ceiling lamp added, further improvements
|
- 2018-04-27 V1.05 * Ceiling lamp added, further improvements
|
||||||
|
- 2018-06-09 V1.06 * Recipes with API to grinder added
|
||||||
|
@ -20,6 +20,8 @@ local STOP_STATE = 0
|
|||||||
local STANDBY_STATE = -1
|
local STANDBY_STATE = -1
|
||||||
local FAULT_STATE = -3
|
local FAULT_STATE = -3
|
||||||
|
|
||||||
|
-- Grinder recipes
|
||||||
|
local Recipes = {}
|
||||||
|
|
||||||
local function formspec(state)
|
local function formspec(state)
|
||||||
return "size[8,8]"..
|
return "size[8,8]"..
|
||||||
@ -67,15 +69,20 @@ local function allow_metadata_inventory_take(pos, listname, index, stack, player
|
|||||||
return stack:get_count()
|
return stack:get_count()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local function grinding(inv)
|
||||||
local function convert_stone_to_gravel(inv)
|
for _,stack in ipairs(inv:get_list("src")) do
|
||||||
local cobble = ItemStack("default:cobble")
|
if not stack:is_empty() then
|
||||||
local gravel = ItemStack("default:gravel")
|
local name = stack:get_name()
|
||||||
if inv:room_for_item("dst", gravel) and inv:contains_item("src", cobble) then
|
if Recipes[name] then
|
||||||
inv:add_item("dst", gravel)
|
local output = Recipes[name]
|
||||||
inv:remove_item("src", cobble)
|
if inv:room_for_item("dst", output) then
|
||||||
|
inv:add_item("dst", output)
|
||||||
|
inv:remove_item("src", ItemStack(name))
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -137,7 +144,7 @@ local function keep_running(pos, elapsed)
|
|||||||
local running = meta:get_int("running") - 1
|
local running = meta:get_int("running") - 1
|
||||||
--print("running", running)
|
--print("running", running)
|
||||||
local inv = meta:get_inventory()
|
local inv = meta:get_inventory()
|
||||||
local busy = convert_stone_to_gravel(inv)
|
local busy = grinding(inv)
|
||||||
|
|
||||||
if busy == true then
|
if busy == true then
|
||||||
if running <= STOP_STATE then
|
if running <= STOP_STATE then
|
||||||
@ -293,3 +300,30 @@ tubelib.register_node("tubelib_addons1:grinder", {"tubelib_addons1:grinder_activ
|
|||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
if minetest.global_exists("unified_inventory") then
|
||||||
|
unified_inventory.register_craft_type("grinding", {
|
||||||
|
description = "Grinding",
|
||||||
|
icon = 'tubelib_addons1_grinder.png',
|
||||||
|
width = 1,
|
||||||
|
height = 1,
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
|
function tubelib.add_grinder_recipe(recipe)
|
||||||
|
Recipes[recipe.input] = ItemStack(recipe.output)
|
||||||
|
if minetest.global_exists("unified_inventory") then
|
||||||
|
recipe.items = {recipe.input}
|
||||||
|
recipe.type = "grinding"
|
||||||
|
unified_inventory.register_craft(recipe)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
tubelib.add_grinder_recipe({input="default:cobble", output="default:gravel"})
|
||||||
|
tubelib.add_grinder_recipe({input="default:desert_cobble", output="default:gravel"})
|
||||||
|
tubelib.add_grinder_recipe({input="default:mossycobble", output="default:gravel"})
|
||||||
|
tubelib.add_grinder_recipe({input="default:gravel", output="default:sand"})
|
||||||
|
tubelib.add_grinder_recipe({input="default:sand", output="default:clay"})
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user