2023-02-23 12:14:10 +01:00
|
|
|
-- 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/>.
|
|
|
|
|
2023-02-23 12:09:46 +01:00
|
|
|
local S=minetest.get_translator("industrialtest")
|
|
|
|
|
2023-02-23 18:57:04 +01:00
|
|
|
industrialtest.mtgAvailable=minetest.get_modpath("default")
|
2023-02-26 20:21:09 +01:00
|
|
|
local requiredMclModules={"mcl_core","mcl_copper","mcl_armor"}
|
|
|
|
industrialtest.mclAvailable=true
|
|
|
|
for _,mod in ipairs(requiredMclModules) do
|
|
|
|
if not minetest.get_modpath(mod) then
|
|
|
|
industrialtest.mclAvailable=false
|
|
|
|
break
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
if industrialtest.mtgAvailable and not minetest.get_modpath("3d_armor") then
|
|
|
|
error("IndustrialTest requires 3D Armor when used with Minetest Game")
|
|
|
|
end
|
2023-02-23 12:09:46 +01:00
|
|
|
|
2023-02-23 14:54:39 +01:00
|
|
|
industrialtest.elementKeys={}
|
|
|
|
|
2023-02-23 12:09:46 +01:00
|
|
|
-- compatibilty that adds not existing elements
|
2023-02-23 18:57:04 +01:00
|
|
|
if industrialtest.mclAvailable then
|
|
|
|
industrialtest.registerMetal=function(name,displayName,oreBlastResistance,oreHardness,rawBlockBlastResistance,rawBlockHardness,blockBlastResistance,blockHardness)
|
2023-02-23 14:54:39 +01:00
|
|
|
minetest.register_craftitem("industrialtest:raw_"..name,{
|
|
|
|
description=S("Raw "..displayName),
|
|
|
|
inventory_image="industrialtest_mcl_raw_"..name..".png"
|
|
|
|
})
|
|
|
|
minetest.register_craftitem("industrialtest:"..name.."_ingot",{
|
|
|
|
description=S(displayName.." Ingot"),
|
|
|
|
inventory_image="industrialtest_mcl_"..name.."_ingot.png"
|
|
|
|
})
|
|
|
|
minetest.register_node("industrialtest:stone_with_"..name,{
|
|
|
|
description=S(displayName.." Ore"),
|
|
|
|
tiles={"default_stone.png^industrialtest_mcl_stone_with_"..name..".png"},
|
|
|
|
sounds=mcl_sounds.node_sound_stone_defaults(),
|
|
|
|
drop="industrialtest:raw_"..name,
|
|
|
|
groups={pickaxey=3,building_block=1,material_stone=1,blast_furnace_smeltable=1},
|
|
|
|
_mcl_blast_resistance = oreBlastResistance,
|
|
|
|
_mcl_hardness = oreHardness,
|
|
|
|
_mcl_silk_touch_drop = true,
|
|
|
|
_mcl_fortune_drop = mcl_core.fortune_drop_ore,
|
|
|
|
})
|
|
|
|
minetest.register_node("industrialtest:raw_"..name.."_block",{
|
|
|
|
description=S("Raw "..displayName.." Block"),
|
|
|
|
tiles={"industrialtest_mcl_raw_"..name.."_block.png"},
|
|
|
|
groups={pickaxey=2,building_block=1,blast_furnace_smeltable=1},
|
|
|
|
sounds=mcl_sounds.node_sound_metal_defaults(),
|
|
|
|
_mcl_blast_resistance=rawBlockBlastResistance,
|
|
|
|
_mcl_hardness=rawBlockHardness,
|
|
|
|
})
|
|
|
|
minetest.register_node("industrialtest:"..name.."_block",{
|
|
|
|
description=S("Block of "..displayName),
|
2023-02-23 18:57:04 +01:00
|
|
|
tiles={"industrialtest_"..name.."_block.png"},
|
2023-02-23 14:54:39 +01:00
|
|
|
groups={pickaxey=2,building_block=1},
|
|
|
|
sounds=mcl_sounds.node_sound_metal_defaults(),
|
|
|
|
_mcl_blast_resistance=blockBlastResistance,
|
|
|
|
_mcl_hardness=blockHardness,
|
|
|
|
})
|
|
|
|
minetest.register_craft({
|
|
|
|
type="cooking",
|
|
|
|
output="industrialtest:"..name.."_ingot",
|
|
|
|
recipe="industrialtest:raw_"..name
|
|
|
|
})
|
|
|
|
minetest.register_craft({
|
|
|
|
type="shaped",
|
|
|
|
output="industrialtest:raw_"..name.."_block",
|
|
|
|
recipe={
|
|
|
|
{"industrialtest:raw"..name,"industrialtest:raw"..name,"industrialtest:raw"..name},
|
|
|
|
{"industrialtest:raw"..name,"industrialtest:raw"..name,"industrialtest:raw"..name},
|
|
|
|
{"industrialtest:raw"..name,"industrialtest:raw"..name,"industrialtest:raw"..name}
|
|
|
|
}
|
|
|
|
})
|
|
|
|
minetest.register_craft({
|
|
|
|
type="shaped",
|
|
|
|
output="industrialtest:"..name.."_block",
|
|
|
|
recipe={
|
|
|
|
{"industrialtest:"..name.."_ingot","industrialtest:"..name.."_ingot","industrialtest:"..name.."_ingot"},
|
|
|
|
{"industrialtest:"..name.."_ingot","industrialtest:"..name.."_ingot","industrialtest:"..name.."_ingot"},
|
|
|
|
{"industrialtest:"..name.."_ingot","industrialtest:"..name.."_ingot","industrialtest:"..name.."_ingot"}
|
|
|
|
}
|
|
|
|
})
|
2023-02-23 18:15:12 +01:00
|
|
|
minetest.register_craft({
|
|
|
|
type="shaped",
|
|
|
|
output="industrialtest:raw_"..name.."_block",
|
|
|
|
recipe={
|
|
|
|
{"industrialtest:raw_"..name,"industrialtest:raw_"..name,"industrialtest:raw_"..name},
|
|
|
|
{"industrialtest:raw_"..name,"industrialtest:raw_"..name,"industrialtest:raw_"..name},
|
|
|
|
{"industrialtest:raw_"..name,"industrialtest:raw_"..name,"industrialtest:raw_"..name}
|
|
|
|
}
|
|
|
|
})
|
|
|
|
minetest.register_craft({
|
|
|
|
type="shapeless",
|
|
|
|
output="industrialtest:"..name.."_ingot 9",
|
|
|
|
recipe={
|
|
|
|
"industrialtest:"..name.."_block"
|
|
|
|
}
|
|
|
|
})
|
|
|
|
minetest.register_craft({
|
|
|
|
type="shapeless",
|
|
|
|
output="industrialtest:raw_"..name.." 9",
|
|
|
|
recipe={
|
|
|
|
"industrialtest:raw_"..name.."_block"
|
|
|
|
}
|
|
|
|
})
|
2023-02-23 14:54:39 +01:00
|
|
|
end
|
2023-02-26 20:21:09 +01:00
|
|
|
industrialtest.registerToolset=function(material,materialItem,materialDisplayName,config)
|
|
|
|
minetest.register_tool("industrialtest:"..material.."_pickaxe",{
|
|
|
|
description=S(materialDisplayName.." Pickaxe"),
|
|
|
|
inventory_image="industrialtest_mcl_"..material.."_pickaxe.png",
|
|
|
|
groups={tool=1,pickaxe=1,dig_speed_class=config.digSpeedClass},
|
|
|
|
tool_capabilities={
|
|
|
|
full_punch_interval=1,
|
|
|
|
max_drop_level=config.dropLevel,
|
|
|
|
damage_groups={fleshy=config.damage},
|
|
|
|
},
|
|
|
|
sound={breaks="default_tool_breaks"},
|
|
|
|
_repair_material="industrialtest:"..material,
|
|
|
|
_mcl_toollike_wield=true,
|
|
|
|
_mcl_diggroups={
|
|
|
|
pickaxey={speed=config.speed,level=config.level,uses=config.uses}
|
|
|
|
}
|
|
|
|
})
|
|
|
|
minetest.register_tool("industrialtest:"..material.."_shovel",{
|
|
|
|
description=S(materialDisplayName.." Shovel"),
|
|
|
|
inventory_image="industrialtest_mcl_"..material.."_shovel.png",
|
|
|
|
groups={tool=1,shovel=1,dig_speed_class=config.digSpeedClass},
|
|
|
|
tool_capabilities={
|
|
|
|
full_punch_interval=1,
|
|
|
|
max_drop_level=config.dropLevel,
|
|
|
|
damage_groups={fleshy=config.damage}
|
|
|
|
},
|
|
|
|
on_place=function(itemstack,placer,pointedThing)
|
|
|
|
-- Taken from https://git.minetest.land/MineClone2/MineClone2/src/branch/master/mods/ITEMS/mcl_tools/init.lua#L159
|
|
|
|
-- Use pointed node's on_rightclick function first, if present
|
|
|
|
local node = minetest.get_node(pointedThing.under)
|
|
|
|
if placer and not placer:get_player_control().sneak then
|
|
|
|
if minetest.registered_nodes[node.name] and minetest.registered_nodes[node.name].on_rightclick then
|
|
|
|
return minetest.registered_nodes[node.name].on_rightclick(pointedThing.under, node, placer, itemstack) or itemstack
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
-- Only make grass path if tool used on side or top of target node
|
|
|
|
if pointedThing.above.y < pointedThing.under.y then
|
|
|
|
return itemstack
|
|
|
|
end
|
|
|
|
|
|
|
|
if (minetest.get_item_group(node.name, "path_creation_possible") == 1) then
|
|
|
|
local above = table.copy(pointedThing.under)
|
|
|
|
above.y = above.y + 1
|
|
|
|
if minetest.get_node(above).name == "air" then
|
|
|
|
if minetest.is_protected(pointedThing.under, placer:get_player_name()) then
|
|
|
|
minetest.record_protection_violation(pointedThing.under, placer:get_player_name())
|
|
|
|
return itemstack
|
|
|
|
end
|
|
|
|
|
|
|
|
if not minetest.is_creative_enabled(placer:get_player_name()) then
|
|
|
|
-- Add wear (as if digging a shovely node)
|
|
|
|
local toolname = itemstack:get_name()
|
|
|
|
local wear = mcl_autogroup.get_wear(toolname, "shovely")
|
|
|
|
itemstack:add_wear(wear)
|
|
|
|
end
|
|
|
|
minetest.sound_play({name="default_grass_footstep", gain=1}, {pos = above}, true)
|
|
|
|
minetest.swap_node(pointedThing.under, {name="mcl_core:grass_path"})
|
|
|
|
end
|
|
|
|
end
|
|
|
|
return itemstack
|
|
|
|
end,
|
|
|
|
sound={breaks="default_tool_breaks"},
|
|
|
|
_repair_material="industrialtest:"..material,
|
|
|
|
_mcl_toollike_wield=true,
|
|
|
|
_mcl_diggroups={
|
|
|
|
shovely={speed=config.speed,level=config.level,uses=config.uses}
|
|
|
|
}
|
|
|
|
})
|
|
|
|
minetest.register_tool("industrialtest:"..material.."_axe",{
|
|
|
|
description=S(materialDisplayName.." Axe"),
|
|
|
|
inventory_image="industrialtest_mcl_"..material.."_axe.png",
|
|
|
|
groups={tool=1,axe=1,dig_speed_class=config.digSpeedClass},
|
|
|
|
tool_capabilities={
|
|
|
|
full_punch_interval=1,
|
|
|
|
max_level_drop=config.levelDrop,
|
|
|
|
damage_groups={fleshy=config.damage+3},
|
|
|
|
},
|
|
|
|
on_place=function(itemstack,placer,pointedThing)
|
|
|
|
-- Taken from https://git.minetest.land/MineClone2/MineClone2/src/branch/master/mods/ITEMS/mcl_tools/init.lua#L360
|
|
|
|
if pointedThing.type ~= "node" then return end
|
|
|
|
|
|
|
|
local node = minetest.get_node(pointedThing.under)
|
|
|
|
local noddef = minetest.registered_nodes[minetest.get_node(pointedThing.under).name]
|
|
|
|
|
|
|
|
if not placer:get_player_control().sneak and noddef.on_rightclick then
|
|
|
|
return minetest.item_place(itemstack, placer, pointedThing)
|
|
|
|
end
|
|
|
|
if minetest.is_protected(pointedThing.under, placer:get_player_name()) then
|
|
|
|
minetest.record_protection_violation(pointedThing.under, placer:get_player_name())
|
|
|
|
return itemstack
|
|
|
|
end
|
|
|
|
|
|
|
|
if noddef._mcl_stripped_variant == nil then
|
|
|
|
return itemstack
|
|
|
|
else
|
|
|
|
minetest.swap_node(pointedThing.under, {name=noddef._mcl_stripped_variant, param2=node.param2})
|
|
|
|
if not minetest.is_creative_enabled(placer:get_player_name()) then
|
|
|
|
-- Add wear (as if digging a axey node)
|
|
|
|
local toolname = itemstack:get_name()
|
|
|
|
local wear = mcl_autogroup.get_wear(toolname, "axey")
|
|
|
|
itemstack:add_wear(wear)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
return itemstack
|
|
|
|
end,
|
|
|
|
sound={breaks="default_tool_breaks"},
|
|
|
|
_repair_material="industrialtest:"..material,
|
|
|
|
_mcl_toollike_wield=true,
|
|
|
|
_mcl_diggroups={
|
|
|
|
axey={speed=config.speed,level=config.level,uses=config.uses}
|
|
|
|
}
|
|
|
|
})
|
|
|
|
minetest.register_tool("industrialtest:"..material.."_sword",{
|
|
|
|
description=S(materialDisplayName.." Sword"),
|
|
|
|
inventory_image="industrialtest_mcl_"..material.."_sword.png",
|
|
|
|
groups={weapon=1,sword=1,dig_speed_class=config.digSpeedClass},
|
|
|
|
tool_capabilities={
|
|
|
|
full_punch_interval=0.625,
|
|
|
|
max_drop_level=config.maxDropLevel,
|
|
|
|
damage_groups={fleshy=config.damage+2},
|
|
|
|
},
|
|
|
|
sound={breaks="default_tool_breaks"},
|
|
|
|
_repair_material="industrialtest:"..material,
|
|
|
|
_mcl_toollike_wield=true,
|
|
|
|
_mcl_diggroups={
|
|
|
|
swordy={speed=config.speed,level=config.level,uses=config.uses},
|
|
|
|
swordy_cobweb={speed=config.speed,level=config.level,uses=config.uses}
|
|
|
|
}
|
|
|
|
})
|
|
|
|
minetest.register_tool("industrialtest:"..material.."_hoe",{
|
|
|
|
description=S(materialDisplayName.." Hoe"),
|
|
|
|
inventory_image="industrialtest_mcl_"..material.."_hoe.png",
|
|
|
|
groups={tool=1,hoe=1},
|
|
|
|
tool_capabilities={
|
|
|
|
full_punch_interval=1,
|
|
|
|
damage_groups={fleshy=1}
|
|
|
|
},
|
|
|
|
on_place=function(itemstack,user,pointedThing)
|
|
|
|
-- Taken from https://git.minetest.land/MineClone2/MineClone2/src/branch/master/mods/ITEMS/mcl_farming/hoes.lua#L3
|
|
|
|
local function create_soil(pos, inv)
|
|
|
|
if pos == nil then
|
|
|
|
return false
|
|
|
|
end
|
|
|
|
local node = minetest.get_node(pos)
|
|
|
|
local name = node.name
|
|
|
|
local above = minetest.get_node({x=pos.x, y=pos.y+1, z=pos.z})
|
|
|
|
if minetest.get_item_group(name, "cultivatable") == 2 then
|
|
|
|
if above.name == "air" then
|
|
|
|
node.name = "mcl_farming:soil"
|
|
|
|
minetest.set_node(pos, node)
|
|
|
|
minetest.sound_play("default_dig_crumbly", { pos = pos, gain = 0.5 }, true)
|
|
|
|
return true
|
|
|
|
end
|
|
|
|
elseif minetest.get_item_group(name, "cultivatable") == 1 then
|
|
|
|
if above.name == "air" then
|
|
|
|
node.name = "mcl_core:dirt"
|
|
|
|
minetest.set_node(pos, node)
|
|
|
|
minetest.sound_play("default_dig_crumbly", { pos = pos, gain = 0.6 }, true)
|
|
|
|
return true
|
|
|
|
end
|
|
|
|
end
|
|
|
|
return false
|
|
|
|
end
|
|
|
|
|
|
|
|
-- Taken from https://git.minetest.land/MineClone2/MineClone2/src/branch/master/mods/ITEMS/mcl_farming/hoes.lua#L29
|
|
|
|
-- Call on_rightclick if the pointed node defines it
|
|
|
|
local node = minetest.get_node(pointedThing.under)
|
|
|
|
if user and not user:get_player_control().sneak then
|
|
|
|
if minetest.registered_nodes[node.name] and minetest.registered_nodes[node.name].on_rightclick then
|
|
|
|
return minetest.registered_nodes[node.name].on_rightclick(pointedThing.under, node, user, itemstack) or itemstack
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
if minetest.is_protected(pointedThing.under, user:get_player_name()) then
|
|
|
|
minetest.record_protection_violation(pointedThing.under, user:get_player_name())
|
|
|
|
return itemstack
|
|
|
|
end
|
|
|
|
|
|
|
|
if create_soil(pointedThing.under, user:get_inventory()) then
|
|
|
|
if not minetest.is_creative_enabled(user:get_player_name()) then
|
|
|
|
itemstack:add_wear(65535/config.uses)
|
|
|
|
end
|
|
|
|
return itemstack
|
|
|
|
end
|
|
|
|
end,
|
|
|
|
_repair_material="industrialtest:"..material,
|
|
|
|
_mcl_toollike_wield=true,
|
|
|
|
_mcl_diggroups={
|
|
|
|
hoey={speed=config.speed,level=config.level,uses=config.uses}
|
|
|
|
}
|
|
|
|
})
|
|
|
|
mcl_armor.register_set({
|
|
|
|
name=material,
|
|
|
|
description=materialDisplayName,
|
|
|
|
durability=config.uses,
|
|
|
|
points=config.armorPoints,
|
|
|
|
craft_material="industrialtest:"..material,
|
|
|
|
cook_material=config.armorCookMaterial,
|
|
|
|
sound_equip=config.armorEquipSound,
|
|
|
|
sound_unequip=config.armorUnequipSound,
|
|
|
|
textures={
|
|
|
|
head="industrialtest_mcl_"..material.."_helmet.png",
|
|
|
|
torso="industrialtest_mcl_"..material.."_chestplate.png",
|
|
|
|
legs="industrialtest_mcl_"..material.."_leggings.png",
|
|
|
|
feet="industrialtest_mcl_"..material.."_boots.png"
|
|
|
|
}
|
|
|
|
})
|
|
|
|
minetest.register_craft({
|
|
|
|
type="shaped",
|
|
|
|
output="industrialtest:"..material.."_pickaxe",
|
|
|
|
recipe={
|
|
|
|
{"industrialtest:"..material,"industrialtest:"..material,"industrialtest:"..material},
|
|
|
|
{"","mcl_core:stick",""},
|
|
|
|
{"","mcl_core:stick",""}
|
|
|
|
}
|
|
|
|
})
|
|
|
|
minetest.register_craft({
|
|
|
|
type="shaped",
|
|
|
|
output="industrialtest:"..material.."_shovel",
|
|
|
|
recipe={
|
|
|
|
{"","industrialtest:"..material,""},
|
|
|
|
{"","mcl_core:stick",""},
|
|
|
|
{"","mcl_core:stick",""}
|
|
|
|
}
|
|
|
|
})
|
|
|
|
minetest.register_craft({
|
|
|
|
type="shaped",
|
|
|
|
output="industrialtest:"..material.."_shovel",
|
|
|
|
recipe={
|
|
|
|
{"industrialtest:"..material,"",""},
|
|
|
|
{"mcl_core:stick","",""},
|
|
|
|
{"mcl_core:stick","",""}
|
|
|
|
}
|
|
|
|
})
|
|
|
|
minetest.register_craft({
|
|
|
|
type="shaped",
|
|
|
|
output="industrialtest:"..material.."_shovel",
|
|
|
|
recipe={
|
|
|
|
{"","","industrialtest:"..material},
|
|
|
|
{"","","mcl_core:stick"},
|
|
|
|
{"","","mcl_core:stick"}
|
|
|
|
}
|
|
|
|
})
|
|
|
|
minetest.register_craft({
|
|
|
|
type="shaped",
|
|
|
|
output="industrialtest:"..material.."_axe",
|
|
|
|
recipe={
|
|
|
|
{"industrialtest:"..material,"industrialtest:"..material,""},
|
|
|
|
{"industrialtest:"..material,"mcl_core:stick",""},
|
|
|
|
{"","mcl_core:stick",""}
|
|
|
|
}
|
|
|
|
})
|
|
|
|
minetest.register_craft({
|
|
|
|
type="shaped",
|
|
|
|
output="industrialtest:"..material.."_axe",
|
|
|
|
recipe={
|
|
|
|
{"","industrialtest:"..material,"industrialtest:"..material},
|
|
|
|
{"","mcl_core:stick","industrialtest:"..material},
|
|
|
|
{"","mcl_core:stick",""}
|
|
|
|
}
|
|
|
|
})
|
|
|
|
minetest.register_craft({
|
|
|
|
type="shaped",
|
|
|
|
output="industrialtest:"..material.."_axe",
|
|
|
|
recipe={
|
|
|
|
{"industrialtest:"..material,"industrialtest:"..material,""},
|
|
|
|
{"mcl_core:stick","industrialtest:"..material,""},
|
|
|
|
{"mcl_core:stick","",""}
|
|
|
|
}
|
|
|
|
})
|
|
|
|
minetest.register_craft({
|
|
|
|
type="shaped",
|
|
|
|
output="industrialtest:"..material.."_axe",
|
|
|
|
recipe={
|
|
|
|
{"","industrialtest:"..material,"industrialtest:"..material},
|
|
|
|
{"","mcl_core:stick","industrialtest:"..material},
|
|
|
|
{"","","mcl_core:stick"}
|
|
|
|
}
|
|
|
|
})
|
|
|
|
minetest.register_craft({
|
|
|
|
type="shaped",
|
|
|
|
output="industrialtest:"..material.."_sword",
|
|
|
|
recipe={
|
|
|
|
{"industrialtest:"..material,"",""},
|
|
|
|
{"industrialtest:"..material,"",""},
|
|
|
|
{"mcl_core:stick","",""}
|
|
|
|
}
|
|
|
|
})
|
|
|
|
minetest.register_craft({
|
|
|
|
type="shaped",
|
|
|
|
output="industrialtest:"..material.."_sword",
|
|
|
|
recipe={
|
|
|
|
{"","industrialtest:"..material,""},
|
|
|
|
{"","industrialtest:"..material,""},
|
|
|
|
{"","mcl_core:stick",""}
|
|
|
|
}
|
|
|
|
})
|
|
|
|
minetest.register_craft({
|
|
|
|
type="shaped",
|
|
|
|
output="industrialtest:"..material.."_sword",
|
|
|
|
recipe={
|
|
|
|
{"","","industrialtest:"..material},
|
|
|
|
{"","","industrialtest:"..material},
|
|
|
|
{"","","mcl_core:stick"}
|
|
|
|
}
|
|
|
|
})
|
|
|
|
minetest.register_craft({
|
|
|
|
type="shaped",
|
|
|
|
output="industrialtest:"..material.."_hoe",
|
|
|
|
recipe={
|
|
|
|
{"industrialtest:"..material,"industrialtest:"..material,""},
|
|
|
|
{"","mcl_core:stick",""},
|
|
|
|
{"","mcl_core:stick",""}
|
|
|
|
}
|
|
|
|
})
|
|
|
|
minetest.register_craft({
|
|
|
|
type="shaped",
|
|
|
|
output="industrialtest:"..material.."_hoe",
|
|
|
|
recipe={
|
|
|
|
{"","industrialtest:"..material,"industrialtest:"..material},
|
|
|
|
{"","","mcl_core:stick"},
|
|
|
|
{"","","mcl_core:stick"}
|
|
|
|
}
|
|
|
|
})
|
|
|
|
minetest.register_craft({
|
|
|
|
type="shaped",
|
|
|
|
output="industrialtest:"..material.."_hoe",
|
|
|
|
recipe={
|
|
|
|
{"","industrialtest:"..material,"industrialtest:"..material},
|
|
|
|
{"","mcl_core:stick",""},
|
|
|
|
{"","mcl_core:stick",""}
|
|
|
|
}
|
|
|
|
})
|
|
|
|
minetest.register_craft({
|
|
|
|
type="shaped",
|
|
|
|
output="industrialtest:"..material.."_hoe",
|
|
|
|
recipe={
|
|
|
|
{"industrialtest:"..material,"industrialtest:"..material,""},
|
|
|
|
{"mcl_core:stick","",""},
|
|
|
|
{"mcl_core:stick","",""}
|
|
|
|
}
|
|
|
|
})
|
|
|
|
end
|
2023-03-01 14:35:20 +01:00
|
|
|
-- 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()
|
|
|
|
return ""
|
|
|
|
end
|
|
|
|
industrialtest.formspecList=function(ctx,name,x,y,w,h)
|
|
|
|
return "list["..ctx..";"..name..";"..x..","..y..";"..w..","..h.."]"..mcl_formspec.get_itemslot_bg(x,y,w,h)
|
|
|
|
end
|
|
|
|
industrialtest.formspecPlayerInv=function()
|
|
|
|
return "list[current_player;main;0.5,5.5;9,3;9]"..mcl_formspec.get_itemslot_bg(0.5,5.5,9,3).."list[current_player;main;0.5,8.74;9,1]"..mcl_formspec.get_itemslot_bg(0.5,8.74,9,1)
|
|
|
|
end
|
2023-02-26 20:21:09 +01:00
|
|
|
-- assign element keys for elements that are required later
|
|
|
|
industrialtest.elementKeys.stick="mcl_core:stick"
|
|
|
|
|
2023-02-23 14:54:39 +01:00
|
|
|
-- register required minerals that are not available in MCL
|
2023-02-23 18:57:04 +01:00
|
|
|
industrialtest.registerMetal("tin","Tin",3,3)
|
2023-02-23 18:15:12 +01:00
|
|
|
industrialtest.elementKeys.tinIngot="industrialtest:tin_ingot"
|
2023-02-23 21:47:40 +01:00
|
|
|
|
|
|
|
--register other items that are not available in MCL
|
|
|
|
minetest.register_craftitem("industrialtest:bronze_ingot",{
|
|
|
|
description=S("Bronze Ingot"),
|
|
|
|
inventory_image="industrialtest_mcl_bronze_ingot.png"
|
|
|
|
})
|
2023-02-26 20:21:09 +01:00
|
|
|
minetest.register_craftitem("industrialtest:bronze_nugget",{
|
|
|
|
description=S("Bronze Nugget"),
|
|
|
|
inventory_image="industrialtest_mcl_bronze_nugget.pngn"
|
|
|
|
})
|
2023-02-23 21:47:40 +01:00
|
|
|
minetest.register_craft({
|
|
|
|
type="shaped",
|
|
|
|
output="industrialcraft:bronze_ingot 9",
|
|
|
|
recipe={
|
|
|
|
{"mcl_copper:copper_ingot","mcl_copper:copper_ingot","mcl_copper:copper_ingot"},
|
|
|
|
{"mcl_copper:copper_ingot","industrialtest:tin_ingot","mcl_copper:copper_ingot"},
|
|
|
|
{"mcl_copper:copper_ingot","mcl_copper:copper_ingot","mcl_copper:copper_ingot"}
|
|
|
|
}
|
|
|
|
})
|
2023-02-26 20:21:09 +01:00
|
|
|
minetest.register_craft({
|
|
|
|
type="shapeless",
|
|
|
|
output="industrialtest:bronze_ingot 9",
|
|
|
|
recipe={
|
|
|
|
"industrialtest:bronze_block"
|
|
|
|
}
|
|
|
|
})
|
|
|
|
minetest.register_craft({
|
|
|
|
type="shaped",
|
|
|
|
output="industrialtest:bronze_ingot",
|
|
|
|
recipe={
|
|
|
|
{"industrialtest:bronze_nugget","industrialtest:bronze_nugget","industrialtest:bronze_nugget"},
|
|
|
|
{"industrialtest:bronze_nugget","industrialtest:bronze_nugget","industrialtest:bronze_nugget"},
|
|
|
|
{"industrialtest:bronze_nugget","industrialtest:bronze_nugget","industrialtest:bronze_nugget"},
|
|
|
|
}
|
|
|
|
})
|
|
|
|
minetest.register_craft({
|
|
|
|
type="shapeless",
|
|
|
|
output="industrialtest:bronze_nugget 9",
|
|
|
|
recipe={
|
|
|
|
"industrialtest:bronze_ingot"
|
|
|
|
}
|
|
|
|
})
|
2023-02-23 21:47:40 +01:00
|
|
|
industrialtest.elementKeys.bronzeIngot="industrialtest:bronze_ingot"
|
2023-02-26 20:21:09 +01:00
|
|
|
industrialtest.registerToolset("bronze","bronze_ingot","Bronze",{
|
|
|
|
digSpeedClass=4,
|
|
|
|
dropLevel=4,
|
|
|
|
speed=6,
|
|
|
|
level=4,
|
|
|
|
uses=200,
|
|
|
|
damage=4,
|
|
|
|
armorPoints={
|
|
|
|
head=2,
|
|
|
|
torso=6,
|
|
|
|
legs=5,
|
|
|
|
feet=2
|
|
|
|
},
|
|
|
|
armorCookMaterial="industrialtest:bronze_nugget",
|
|
|
|
armorEquipSound="mcl_armor_equip_iron",
|
|
|
|
armorUnequipSound="mcl_armor_unequip_iron"
|
|
|
|
})
|
2023-02-23 21:47:40 +01:00
|
|
|
|
|
|
|
--register other blocks that are not availabe in MCL
|
|
|
|
minetest.register_node("industrialtest:bronze_block",{
|
|
|
|
description=S("Block of Bronze"),
|
|
|
|
tiles={"industrialtest_mcl_bronze_block.png"},
|
|
|
|
groups={pickaxey=2,building_block=1},
|
|
|
|
sounds=mcl_sounds.node_sound_metal_defaults(),
|
|
|
|
_mcl_blast_resistance=3,
|
|
|
|
_mcl_hardness=3,
|
|
|
|
})
|
|
|
|
minetest.register_craft({
|
|
|
|
type="shaped",
|
|
|
|
output="industrialtest:bronze_block",
|
|
|
|
recipe={
|
|
|
|
{"industrialtest:bronze_ingot","industrialtest:bronze_ingot","industrialtest:bronze_ingot"},
|
|
|
|
{"industrialtest:bronze_ingot","industrialtest:bronze_ingot","industrialtest:bronze_ingot"},
|
|
|
|
{"industrialtest:bronze_ingot","industrialtest:bronze_ingot","industrialtest:bronze_ingot"}
|
|
|
|
}
|
|
|
|
})
|
2023-02-23 12:09:46 +01:00
|
|
|
|
|
|
|
minetest.register_ore({
|
|
|
|
ore_type="scatter",
|
2023-02-23 13:49:13 +01:00
|
|
|
ore="industrialtest:stone_with_tin",
|
|
|
|
wherein=stonelike,
|
|
|
|
clust_scarcity=10*10*10,
|
2023-02-23 12:09:46 +01:00
|
|
|
clust_num_ores=5,
|
|
|
|
clust_size=3,
|
|
|
|
y_max=mcl_worlds.layer_to_y(39),
|
|
|
|
y_min=mcl_vars.mg_overworld_min
|
|
|
|
})
|
2023-02-23 18:57:04 +01:00
|
|
|
elseif industrialtest.mtgAvailable then
|
2023-02-27 20:18:20 +01:00
|
|
|
industrialtest.registerMetal=function(name,displayName,hardness)
|
2023-02-23 18:57:04 +01:00
|
|
|
minetest.register_craftitem("industrialtest:"..name.."_lump",{
|
|
|
|
description=S(displayName.." Lump"),
|
|
|
|
inventory_image="industrialtest_mtg_"..name.."_lump.png"
|
|
|
|
})
|
|
|
|
minetest.register_craftitem("industrialtest:"..name.."_ingot",{
|
|
|
|
description=S(displayName.." Ingot"),
|
|
|
|
inventory_image="industrialtest_mtg_"..name.."_ingot.png"
|
|
|
|
})
|
|
|
|
minetest.register_node("industrialtest:stone_with_"..name,{
|
|
|
|
description=S(displayName.." Ore"),
|
|
|
|
tiles={"default_stone.png^industrialtest_mtg_stone_with_"..name..".png"},
|
|
|
|
sounds=default.node_sound_stone_defaults(),
|
|
|
|
drop="industrialtest:"..name.."_lump",
|
2023-02-27 20:18:20 +01:00
|
|
|
groups={cracky=hardness},
|
2023-02-23 18:57:04 +01:00
|
|
|
})
|
|
|
|
minetest.register_node("industrialtest:"..name.."_block",{
|
|
|
|
description=S("Block of "..displayName),
|
|
|
|
tiles={"industrialtest_"..name.."_block.png"},
|
2023-02-27 20:18:20 +01:00
|
|
|
groups={cracky=hardness,level=2},
|
2023-02-23 18:57:04 +01:00
|
|
|
sounds=default.node_sound_metal_defaults(),
|
|
|
|
})
|
|
|
|
minetest.register_craft({
|
|
|
|
type="cooking",
|
|
|
|
output="industrialtest:"..name.."_ingot",
|
|
|
|
recipe="industrialtest:"..name.."_lump"
|
|
|
|
})
|
|
|
|
minetest.register_craft({
|
|
|
|
type="shaped",
|
|
|
|
output="industrialtest:"..name.."_block",
|
|
|
|
recipe={
|
|
|
|
{"industrialtest:"..name.."_ingot","industrialtest:"..name.."_ingot","industrialtest:"..name.."_ingot"},
|
|
|
|
{"industrialtest:"..name.."_ingot","industrialtest:"..name.."_ingot","industrialtest:"..name.."_ingot"},
|
|
|
|
{"industrialtest:"..name.."_ingot","industrialtest:"..name.."_ingot","industrialtest:"..name.."_ingot"}
|
|
|
|
}
|
|
|
|
})
|
|
|
|
minetest.register_craft({
|
|
|
|
type="shapeless",
|
|
|
|
output="industrialtest:"..name.."_ingot 9",
|
|
|
|
recipe={
|
|
|
|
"industrialtest:"..name.."_block"
|
|
|
|
}
|
|
|
|
})
|
|
|
|
minetest.register_craft({
|
|
|
|
type="shapeless",
|
|
|
|
output="industrialtest:raw_"..name.." 9",
|
|
|
|
recipe={
|
|
|
|
"industrialtest:raw_"..name.."_block"
|
|
|
|
}
|
|
|
|
})
|
|
|
|
end
|
2023-03-01 14:35:20 +01:00
|
|
|
industrialtest.formspecVersion=function()
|
|
|
|
return "formspec_version[4]"
|
|
|
|
end
|
|
|
|
industrialtest.formspecList=function(ctx,name,x,y,w,h)
|
|
|
|
return "list["..ctx..";"..name..";"..x..","..y..";"..w..","..h.."]"
|
|
|
|
end
|
|
|
|
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
|
2023-02-23 18:57:04 +01:00
|
|
|
industrialtest.elementKeys.tinIngot="default:tin_ingot"
|
2023-02-23 21:47:40 +01:00
|
|
|
industrialtest.elementKeys.bronzeIngot="default:bronze_ingot"
|
2023-02-26 20:21:09 +01:00
|
|
|
industrialtest.elementKeys.stick="default:stick"
|
2023-03-03 22:28:05 +01:00
|
|
|
industrialtest.elementKeys.powerCarrier="default:mese_crystal_fragment"
|
2023-02-23 18:57:04 +01:00
|
|
|
else
|
|
|
|
error("No compatible games found!")
|
2023-02-23 13:49:13 +01:00
|
|
|
end
|