Add refined iron, machine block and generator craft

This commit is contained in:
mrkubax10 2023-03-04 16:01:06 +01:00
parent f82170b5e5
commit d268618cff
5 changed files with 93 additions and 1 deletions

View File

@ -461,6 +461,7 @@ if industrialtest.mclAvailable then
}
})
end
industrialtest.gameTexturePrefix="mcl"
-- FIXME: Formspecs when used with MCL are misaligned, to fix that and also preserve compatibilty
-- with MTG MCL has to stop using legacy formspec coordinates ~mrkubax10
industrialtest.formspecVersion=function()
@ -474,7 +475,9 @@ if industrialtest.mclAvailable then
end
-- assign element keys for elements that are required later
industrialtest.elementKeys.stick="mcl_core:stick"
industrialtest.elementKeys.ironIngot="mcl_core:iron_ingot"
industrialtest.elementKeys.powerCarrier="mesecons:mesecon"
industrialtest.elementKeys.furnace="mcl_furnaces:furnace"
-- register required minerals that are not available in MCL
industrialtest.registerMetal("tin","Tin",3,3)
@ -630,10 +633,13 @@ elseif industrialtest.mtgAvailable then
industrialtest.formspecPlayerInv=function()
return "list[current_player;main;0.5,6.25;8,1]list[current_player;main;0.5,7.5;8,3;8]"
end
industrialtest.gameTexturePrefix="mtg"
industrialtest.elementKeys.tinIngot="default:tin_ingot"
industrialtest.elementKeys.bronzeIngot="default:bronze_ingot"
industrialtest.elementKeys.ironIngot="default:steel_ingot"
industrialtest.elementKeys.stick="default:stick"
industrialtest.elementKeys.powerCarrier="default:mese_crystal_fragment"
industrialtest.elementKeys.furnace="default:furnace"
else
error("No compatible games found!")
end

View File

@ -35,6 +35,24 @@ minetest.register_craft({
}
})
-- Other resources
minetest.register_craftitem("industrialtest:refined_iron_ingot",{
description=S("Refined Iron Ingot"),
inventory_image="industrialtest_"..industrialtest.gameTexturePrefix.."_refined_iron_ingot.png",
})
minetest.register_craft({
type="cooking",
output="industrialtest:refined_iron_ingot",
recipe=industrialtest.elementKeys.ironIngot
})
minetest.register_craft({
type="shapeless",
output="industrialtest:refined_iron_ingot 8",
recipe={
"industrialtest:machine_block"
}
})
-- Item callbacks
minetest.register_on_player_inventory_action(function(player,action,inventory,info)
if action=="put" then

View File

@ -26,3 +26,4 @@ dofile(modpath.."/api.lua")
dofile(modpath.."/minerals.lua")
dofile(modpath.."/machines.lua")
dofile(modpath.."/craftitems.lua")
dofile(modpath.."/nodes.lua")

View File

@ -139,3 +139,30 @@ elseif industrialtest.mclAvailable then
definition._mcl_hardness=3.9
end
minetest.register_node("industrialtest:generator",definition)
minetest.register_craft({
type="shaped",
output="industrialtest:generator",
recipe={
{"industrialtest:re_battery","",""},
{"industrialtest:machine_block","",""},
{industrialtest.elementKeys.furnace,"",""}
}
})
minetest.register_craft({
type="shaped",
output="industrialtest:generator",
recipe={
{"","industrialtest:re_battery",""},
{"","industrialtest:machine_block",""},
{"",industrialtest.elementKeys.furnace,""}
}
})
minetest.register_craft({
type="shaped",
output="industrialtest:generator",
recipe={
{"","","industrialtest:re_battery"},
{"","","industrialtest:machine_block"},
{"","",industrialtest.elementKeys.furnace}
}
})

40
nodes.lua Normal file
View File

@ -0,0 +1,40 @@
-- IndustrialTest
-- Copyright (C) 2023 mrkubax10
-- This program is free software: you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation, either version 3 of the License, or
-- (at your option) any later version.
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
local S=minetest.get_translator("industrialtest")
local definition={
description=S("Machine Block"),
tiles={"industrialtest_machine_block.png"},
}
if industrialtest.mtgAvailable then
definition.sound=default.node_sound_metal_defaults()
definition.groups={cracky=1,level=2}
elseif industrialtest.mclAvailable then
definition.sound=mcl_sounds.node_sound_metal_defaults()
definition._mcl_blast_resistance=6
definition._mcl_hardness=5
end
minetest.register_node("industrialtest:machine_block",definition)
minetest.register_craft({
type="shaped",
output="industrialtest:machine_block",
recipe={
{"industrialtest:refined_iron_ingot","industrialtest:refined_iron_ingot","industrialtest:refined_iron_ingot"},
{"industrialtest:refined_iron_ingot","","industrialtest:refined_iron_ingot"},
{"industrialtest:refined_iron_ingot","industrialtest:refined_iron_ingot","industrialtest:refined_iron_ingot"}
}
})