Introduce compatibility with mcl_rubber mod

Closes #1
This commit is contained in:
mrkubax10 2024-02-26 17:06:11 +01:00
parent 7df191097d
commit d2346f65aa
7 changed files with 334 additions and 309 deletions

View File

@ -160,16 +160,16 @@ minetest.register_craft({
output="industrialtest:insulated_tin_cable",
recipe={
"industrialtest:tin_cable",
"industrialtest:rubber"
industrialtest.elementKeys.rubber
}
})
minetest.register_craft({
type="shaped",
output="industrialtest:insulated_tin_cable 6",
recipe={
{"industrialtest:rubber","industrialtest:rubber","industrialtest:rubber"},
{industrialtest.elementKeys.rubber,industrialtest.elementKeys.rubber,industrialtest.elementKeys.rubber},
{industrialtest.elementKeys.tinIngot,industrialtest.elementKeys.tinIngot,industrialtest.elementKeys.tinIngot},
{"industrialtest:rubber","industrialtest:rubber","industrialtest:rubber"}
{industrialtest.elementKeys.rubber,industrialtest.elementKeys.rubber,industrialtest.elementKeys.rubber}
}
})
industrialtest.api.registerCableFormerRecipe({
@ -191,16 +191,16 @@ minetest.register_craft({
output="industrialtest:insulated_copper_cable",
recipe={
"industrialtest:copper_cable",
"industrialtest:rubber"
industrialtest.elementKeys.rubber
}
})
minetest.register_craft({
type="shaped",
output="industrialtest:insulated_copper_cable 6",
recipe={
{"industrialtest:rubber","industrialtest:rubber","industrialtest:rubber"},
{industrialtest.elementKeys.rubber,industrialtest.elementKeys.rubber,industrialtest.elementKeys.rubber},
{industrialtest.elementKeys.copperIngot,industrialtest.elementKeys.copperIngot,industrialtest.elementKeys.copperIngot},
{"industrialtest:rubber","industrialtest:rubber","industrialtest:rubber"}
{industrialtest.elementKeys.rubber,industrialtest.elementKeys.rubber,industrialtest.elementKeys.rubber}
}
})
industrialtest.api.registerCableFormerRecipe({
@ -221,16 +221,16 @@ minetest.register_craft({
output="industrialtest:insulated_gold_cable",
recipe={
"industrialtest:gold_cable",
"industrialtest:rubber"
industrialtest.elementKeys.rubber
}
})
minetest.register_craft({
type="shaped",
output="industrialtest:insulated_gold_cable 6",
recipe={
{"industrialtest:rubber","industrialtest:rubber","industrialtest:rubber"},
{industrialtest.elementKeys.rubber,industrialtest.elementKeys.rubber,industrialtest.elementKeys.rubber},
{industrialtest.elementKeys.goldIngot,industrialtest.elementKeys.goldIngot,industrialtest.elementKeys.goldIngot},
{"industrialtest:rubber","industrialtest:rubber","industrialtest:rubber"}
{industrialtest.elementKeys.rubber,industrialtest.elementKeys.rubber,industrialtest.elementKeys.rubber}
}
})
industrialtest.api.registerCableFormerRecipe({
@ -251,16 +251,16 @@ minetest.register_craft({
output="industrialtest:insulated_iron_cable",
recipe={
"industrialtest:iron_cable",
"industrialtest:rubber"
industrialtest.elementKeys.rubber
}
})
minetest.register_craft({
type="shaped",
output="industrialtest:insulated_iron_cable 6",
recipe={
{"industrialtest:rubber","industrialtest:rubber","industrialtest:rubber"},
{industrialtest.elementKeys.rubber,industrialtest.elementKeys.rubber,industrialtest.elementKeys.rubber},
{"industrialtest:refined_iron_ingot","industrialtest:refined_iron_ingot","industrialtest:refined_iron_ingot"},
{"industrialtest:rubber","industrialtest:rubber","industrialtest:rubber"}
{industrialtest.elementKeys.rubber,industrialtest.elementKeys.rubber,industrialtest.elementKeys.rubber}
}
})
industrialtest.api.registerCableFormerRecipe({

View File

@ -33,7 +33,14 @@ for _,mod in ipairs(requiredMclModules) do
end
end
if industrialtest.mtgAvailable and not minetest.get_modpath("3d_armor") then
industrialtest.mods={}
if industrialtest.mtgAvailable then
industrialtest.mods._3dArmor=minetest.get_modpath("3d_armor")
elseif industrialtest.mclAvailable then
industrialtest.mods.mclRubber=minetest.get_modpath("mcl_rubber")
end
if industrialtest.mtgAvailable and not industrialtest then
error("IndustrialTest requires 3D Armor when used with Minetest Game")
end
@ -552,6 +559,11 @@ if industrialtest.mclAvailable then
industrialtest.elementKeys.cactus="mcl_core:cactus"
industrialtest.elementKeys.groupSapling="group:sapling"
industrialtest.elementKeys.groupLeaves="group:leaves"
industrialtest.elementKeys.stickyResin=(industrialtest.mods.mclRubber and "mcl_rubber:rubber_raw" or "industrialtest:sticky_resin")
industrialtest.elementKeys.rubber=(industrialtest.mods.mclRubber and "mcl_rubber:rubber" or "industrialtest:rubber")
industrialtest.elementKeys.rubberWood=(industrialtest.mods.mclRubber and "mcl_rubber:rubbertree" or "industrialtest:rubber_wood")
industrialtest.elementKeys.rubberSapling=(industrialtest.mods.mclRubber and "mcl_rubber:rubbersapling" or "industrialtest:rubber_sapling")
industrialtest.elementKeys.treetap=(industrialtest.mods.mclRubber and "mcl_rubber:treetap" or "industrialtest:treetap")
-- register required minerals that are not available in MCL
industrialtest.registerMetal("tin","Tin",3,3)
@ -781,6 +793,11 @@ elseif industrialtest.mtgAvailable then
industrialtest.elementKeys.cactus="default:cactus"
industrialtest.elementKeys.groupSapling="group:sapling"
industrialtest.elementKeys.groupLeaves="group:leaves"
industrialtest.elementKeys.stickyResin="industrialtest:sticky_resin"
industrialtest.elementKeys.rubber="industrialtest:rubber"
industrialtest.elementKeys.rubberWood="industrialtest:rubber_wood"
industrialtest.elementKeys.rubberSapling="industrialtest:rubber_sapling"
industrialtest.elementKeys.treetap="industrialtest:treetap"
else
error("No compatible games found!")
end

View File

@ -117,6 +117,7 @@ minetest.register_craft({
}
})
if not industrialtest.mods.mclRubber then
minetest.register_craftitem("industrialtest:sticky_resin",{
description=S("Sticky Resin"),
inventory_image="industrialtest_sticky_resin.png"
@ -131,17 +132,18 @@ minetest.register_craft({
output="industrialtest:rubber",
recipe="industrialtest:sticky_resin"
})
end
industrialtest.api.registerExtractorRecipe({
output="industrialtest:rubber",
recipe="industrialtest:rubber_wood"
output=industrialtest.elementKeys.rubber,
recipe=industrialtest.elementKeys.rubberWood
})
industrialtest.api.registerExtractorRecipe({
output="industrialtest:rubber",
recipe="industrialtest:rubber_sapling"
output=industrialtest.elementKeys.rubber,
recipe=industrialtest.elementKeys.rubberSapling
})
industrialtest.api.registerExtractorRecipe({
output="industrialtest:rubber 3",
recipe="industrialtest:sticky_resin"
output=industrialtest.elementKeys.rubber.." 3",
recipe=industrialtest.elementKeys.stickyResin
})
minetest.register_craftitem("industrialtest:raw_carbon_fibre",{

View File

@ -31,7 +31,7 @@ minetest.register_craft({
type="shaped",
output="industrialtest:extractor",
recipe={
{"industrialtest:treetap","industrialtest:machine_block","industrialtest:treetap"},
{"industrialtest:treetap","industrialtest:electronic_circuit","industrialtest:treetap"}
{industrialtest.elementKeys.treetap,"industrialtest:machine_block",industrialtest.elementKeys.treetap},
{industrialtest.elementKeys.treetap,"industrialtest:electronic_circuit",industrialtest.elementKeys.treetap}
}
})

View File

@ -15,7 +15,7 @@
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
minetest.register_on_generated(function(minp,maxp,seed)
if industrialtest.random:next(1,100)>40 then
if industrialtest.mods.mclRubber or industrialtest.random:next(1,100)>40 then
return
end
local center=vector.new((maxp.x-minp.x)/2+ minp.x,(maxp.y-minp.y)/2+minp.y,(maxp.z-minp.z)/2+minp.z)

View File

@ -66,6 +66,7 @@ minetest.register_craft({
}
})
if not industrialtest.mods.mclRubber then
definition={
description=S("Rubber Wood"),
tiles={
@ -372,3 +373,4 @@ if industrialtest.mtgAvailable then
end
})
end
end

View File

@ -14,6 +14,10 @@
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
if industrialtest.mods.mclRubber then
return
end
local S=minetest.get_translator("industrialtest")
local function onTreetapUse(user,pointed)