tech_additions/techage.lua

123 lines
4.0 KiB
Lua

local S = minetest.get_translator("tech_additions")
minetest.register_node("tech_additions:iron_block", {
description = S("TA1 Iron block"),
tiles = { 'tech_additions_iron_block.png' },
groups = { cracky = 3 }
})
minetest.register_craft({
output = 'tech_additions:iron_block',
recipe = {
{ "techage:iron_ingot", "techage:iron_ingot", "techage:iron_ingot", },
{ "techage:iron_ingot", "techage:iron_ingot", "techage:iron_ingot", },
{ "techage:iron_ingot", "techage:iron_ingot", "techage:iron_ingot", }
}
})
minetest.register_craft({
output = 'techage:iron_ingot 9',
recipe = {
{ 'tech_additions:iron_block', },
}
})
minetest.register_node("tech_additions:baborium_block", {
description = S("Baborium block"),
tiles = { 'tech_additions_baborium_block.png' },
groups = { cracky = 3 }
})
minetest.register_craft({
output = 'tech_additions:baborium_block',
recipe = {
{ "techage:baborium_ingot", "techage:baborium_ingot", "techage:baborium_ingot", },
{ "techage:baborium_ingot", "techage:baborium_ingot", "techage:baborium_ingot", },
{ "techage:baborium_ingot", "techage:baborium_ingot", "techage:baborium_ingot", }
}
})
minetest.register_craft({
output = 'techage:baborium_ingot 9',
recipe = {
{ 'tech_additions:baborium_block', },
}
})
minetest.register_craft({
output = 'techage:ta3_barrel_oil',
recipe = {
{ 'multidecor:consolidated_oil', 'multidecor:consolidated_oil', 'techage:ta3_barrel_empty'},
{ 'multidecor:consolidated_oil', 'multidecor:consolidated_oil', 'multidecor:consolidated_oil'},
{ 'multidecor:consolidated_oil', 'multidecor:consolidated_oil', 'multidecor:consolidated_oil'},
}
})
minetest.register_craft({
output = 'techage:ta4_injector_pas',
recipe = {
{ '', 'techage:aluminum', ''},
{ '', 'techage:ta3_injector_pas', ''},
{ '', 'techage:ta4_wlanchip', ''},
}
})
techage.add_grinder_recipe({input="multidecor:consolidated_oil", output="techage:plastic_granules"})
techage.add_grinder_recipe({input="ethereal:wild_onion_plant 10", output="dye:white"})
techage.add_grinder_recipe({input="default:ice", output="default:snow 3"})
--add extra sieving
dofile(minetest.get_modpath("tech_additions") .. "/sieving.lua")
local OwnerCache = {}
local function is_owner(pos, meta)
local owner = meta:get_string("owner")
local key = minetest.hash_node_position(pos)
if OwnerCache[key] ~= owner then
if not minetest.is_protected(pos, owner) then
OwnerCache[key] = owner
end
end
return OwnerCache[key] == owner
end
if smartshop then
techage.register_node(
{
"smartshop:shop",
"smartshop:shop_full",
"smartshop:shop_empty",
"smartshop:shop_used",
"smartshop:storage",
"smartshop:storage_lacks_refill",
"smartshop:storage_has_send"
},
{
on_inv_request = function(pos, in_dir, access_type)
local meta = minetest.get_meta(pos)
if is_owner(pos, meta) then
return meta:get_inventory(), "main"
end
end,
on_pull_item = function(pos, in_dir, num)
local meta = minetest.get_meta(pos)
if is_owner(pos, meta) then
local inv = meta:get_inventory()
return techage.get_items(pos, inv, "main", num)
end
end,
on_push_item = function(pos, in_dir, stack)
local meta = minetest.get_meta(pos)
local inv = meta:get_inventory()
return techage.put_items(inv, "main", stack)
end,
on_unpull_item = function(pos, in_dir, stack)
local meta = minetest.get_meta(pos)
local inv = meta:get_inventory()
return techage.put_items(inv, "main", stack)
end,
}
)
end