parent
7df191097d
commit
d2346f65aa
24
cables.lua
24
cables.lua
@ -160,16 +160,16 @@ minetest.register_craft({
|
|||||||
output="industrialtest:insulated_tin_cable",
|
output="industrialtest:insulated_tin_cable",
|
||||||
recipe={
|
recipe={
|
||||||
"industrialtest:tin_cable",
|
"industrialtest:tin_cable",
|
||||||
"industrialtest:rubber"
|
industrialtest.elementKeys.rubber
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
type="shaped",
|
type="shaped",
|
||||||
output="industrialtest:insulated_tin_cable 6",
|
output="industrialtest:insulated_tin_cable 6",
|
||||||
recipe={
|
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.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({
|
industrialtest.api.registerCableFormerRecipe({
|
||||||
@ -191,16 +191,16 @@ minetest.register_craft({
|
|||||||
output="industrialtest:insulated_copper_cable",
|
output="industrialtest:insulated_copper_cable",
|
||||||
recipe={
|
recipe={
|
||||||
"industrialtest:copper_cable",
|
"industrialtest:copper_cable",
|
||||||
"industrialtest:rubber"
|
industrialtest.elementKeys.rubber
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
type="shaped",
|
type="shaped",
|
||||||
output="industrialtest:insulated_copper_cable 6",
|
output="industrialtest:insulated_copper_cable 6",
|
||||||
recipe={
|
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.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({
|
industrialtest.api.registerCableFormerRecipe({
|
||||||
@ -221,16 +221,16 @@ minetest.register_craft({
|
|||||||
output="industrialtest:insulated_gold_cable",
|
output="industrialtest:insulated_gold_cable",
|
||||||
recipe={
|
recipe={
|
||||||
"industrialtest:gold_cable",
|
"industrialtest:gold_cable",
|
||||||
"industrialtest:rubber"
|
industrialtest.elementKeys.rubber
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
type="shaped",
|
type="shaped",
|
||||||
output="industrialtest:insulated_gold_cable 6",
|
output="industrialtest:insulated_gold_cable 6",
|
||||||
recipe={
|
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.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({
|
industrialtest.api.registerCableFormerRecipe({
|
||||||
@ -251,16 +251,16 @@ minetest.register_craft({
|
|||||||
output="industrialtest:insulated_iron_cable",
|
output="industrialtest:insulated_iron_cable",
|
||||||
recipe={
|
recipe={
|
||||||
"industrialtest:iron_cable",
|
"industrialtest:iron_cable",
|
||||||
"industrialtest:rubber"
|
industrialtest.elementKeys.rubber
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
type="shaped",
|
type="shaped",
|
||||||
output="industrialtest:insulated_iron_cable 6",
|
output="industrialtest:insulated_iron_cable 6",
|
||||||
recipe={
|
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: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({
|
industrialtest.api.registerCableFormerRecipe({
|
||||||
|
@ -33,7 +33,14 @@ for _,mod in ipairs(requiredMclModules) do
|
|||||||
end
|
end
|
||||||
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")
|
error("IndustrialTest requires 3D Armor when used with Minetest Game")
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -552,6 +559,11 @@ if industrialtest.mclAvailable then
|
|||||||
industrialtest.elementKeys.cactus="mcl_core:cactus"
|
industrialtest.elementKeys.cactus="mcl_core:cactus"
|
||||||
industrialtest.elementKeys.groupSapling="group:sapling"
|
industrialtest.elementKeys.groupSapling="group:sapling"
|
||||||
industrialtest.elementKeys.groupLeaves="group:leaves"
|
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
|
-- register required minerals that are not available in MCL
|
||||||
industrialtest.registerMetal("tin","Tin",3,3)
|
industrialtest.registerMetal("tin","Tin",3,3)
|
||||||
@ -781,6 +793,11 @@ elseif industrialtest.mtgAvailable then
|
|||||||
industrialtest.elementKeys.cactus="default:cactus"
|
industrialtest.elementKeys.cactus="default:cactus"
|
||||||
industrialtest.elementKeys.groupSapling="group:sapling"
|
industrialtest.elementKeys.groupSapling="group:sapling"
|
||||||
industrialtest.elementKeys.groupLeaves="group:leaves"
|
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
|
else
|
||||||
error("No compatible games found!")
|
error("No compatible games found!")
|
||||||
end
|
end
|
||||||
|
@ -117,31 +117,33 @@ minetest.register_craft({
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_craftitem("industrialtest:sticky_resin",{
|
if not industrialtest.mods.mclRubber then
|
||||||
description=S("Sticky Resin"),
|
minetest.register_craftitem("industrialtest:sticky_resin",{
|
||||||
inventory_image="industrialtest_sticky_resin.png"
|
description=S("Sticky Resin"),
|
||||||
})
|
inventory_image="industrialtest_sticky_resin.png"
|
||||||
|
})
|
||||||
|
|
||||||
minetest.register_craftitem("industrialtest:rubber",{
|
minetest.register_craftitem("industrialtest:rubber",{
|
||||||
description=S("Rubber"),
|
description=S("Rubber"),
|
||||||
inventory_image="industrialtest_rubber.png"
|
inventory_image="industrialtest_rubber.png"
|
||||||
})
|
})
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
type="cooking",
|
type="cooking",
|
||||||
output="industrialtest:rubber",
|
output="industrialtest:rubber",
|
||||||
recipe="industrialtest:sticky_resin"
|
recipe="industrialtest:sticky_resin"
|
||||||
|
})
|
||||||
|
end
|
||||||
|
industrialtest.api.registerExtractorRecipe({
|
||||||
|
output=industrialtest.elementKeys.rubber,
|
||||||
|
recipe=industrialtest.elementKeys.rubberWood
|
||||||
})
|
})
|
||||||
industrialtest.api.registerExtractorRecipe({
|
industrialtest.api.registerExtractorRecipe({
|
||||||
output="industrialtest:rubber",
|
output=industrialtest.elementKeys.rubber,
|
||||||
recipe="industrialtest:rubber_wood"
|
recipe=industrialtest.elementKeys.rubberSapling
|
||||||
})
|
})
|
||||||
industrialtest.api.registerExtractorRecipe({
|
industrialtest.api.registerExtractorRecipe({
|
||||||
output="industrialtest:rubber",
|
output=industrialtest.elementKeys.rubber.." 3",
|
||||||
recipe="industrialtest:rubber_sapling"
|
recipe=industrialtest.elementKeys.stickyResin
|
||||||
})
|
|
||||||
industrialtest.api.registerExtractorRecipe({
|
|
||||||
output="industrialtest:rubber 3",
|
|
||||||
recipe="industrialtest:sticky_resin"
|
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_craftitem("industrialtest:raw_carbon_fibre",{
|
minetest.register_craftitem("industrialtest:raw_carbon_fibre",{
|
||||||
|
@ -31,7 +31,7 @@ minetest.register_craft({
|
|||||||
type="shaped",
|
type="shaped",
|
||||||
output="industrialtest:extractor",
|
output="industrialtest:extractor",
|
||||||
recipe={
|
recipe={
|
||||||
{"industrialtest:treetap","industrialtest:machine_block","industrialtest:treetap"},
|
{industrialtest.elementKeys.treetap,"industrialtest:machine_block",industrialtest.elementKeys.treetap},
|
||||||
{"industrialtest:treetap","industrialtest:electronic_circuit","industrialtest:treetap"}
|
{industrialtest.elementKeys.treetap,"industrialtest:electronic_circuit",industrialtest.elementKeys.treetap}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
|
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
minetest.register_on_generated(function(minp,maxp,seed)
|
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
|
return
|
||||||
end
|
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)
|
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)
|
||||||
|
548
nodes.lua
548
nodes.lua
@ -66,309 +66,311 @@ minetest.register_craft({
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
definition={
|
if not industrialtest.mods.mclRubber then
|
||||||
description=S("Rubber Wood"),
|
definition={
|
||||||
tiles={
|
description=S("Rubber Wood"),
|
||||||
"industrialtest_rubber_wood_top.png",
|
tiles={
|
||||||
"industrialtest_rubber_wood_top.png",
|
"industrialtest_rubber_wood_top.png",
|
||||||
"industrialtest_rubber_wood_side.png"
|
"industrialtest_rubber_wood_top.png",
|
||||||
},
|
"industrialtest_rubber_wood_side.png"
|
||||||
paramtype2="4dir"
|
},
|
||||||
}
|
paramtype2="4dir"
|
||||||
if industrialtest.mtgAvailable then
|
|
||||||
definition.sounds=default.node_sound_wood_defaults()
|
|
||||||
definition.groups={
|
|
||||||
tree=1,
|
|
||||||
choppy=2,
|
|
||||||
oddly_breakable_by_hand=1,
|
|
||||||
flammable=2
|
|
||||||
}
|
}
|
||||||
elseif industrialtest.mclAvailable then
|
if industrialtest.mtgAvailable then
|
||||||
definition.sounds=mcl_sounds.node_sound_wood_defaults()
|
definition.sounds=default.node_sound_wood_defaults()
|
||||||
definition.groups={
|
definition.groups={
|
||||||
handy=1,
|
tree=1,
|
||||||
axey=1,
|
choppy=2,
|
||||||
tree=1,
|
oddly_breakable_by_hand=1,
|
||||||
flammable=2,
|
flammable=2
|
||||||
building_block=1,
|
|
||||||
material_wood=1,
|
|
||||||
fire_encouragement=5,
|
|
||||||
fire_flammability=5
|
|
||||||
}
|
|
||||||
definition.after_destruct=mcl_core.update_leaves
|
|
||||||
definition._mcl_blast_resistance=1.8
|
|
||||||
definition._mcl_hardness=1.8
|
|
||||||
end
|
|
||||||
definition.groups._industrialtest_rubberWood=1
|
|
||||||
minetest.register_node("industrialtest:rubber_wood",definition)
|
|
||||||
definition=table.copy(definition)
|
|
||||||
definition.description=nil
|
|
||||||
definition.tiles={
|
|
||||||
"industrialtest_rubber_wood_top.png",
|
|
||||||
"industrialtest_rubber_wood_top.png",
|
|
||||||
"industrialtest_rubber_wood_side.png",
|
|
||||||
"industrialtest_rubber_wood_side.png",
|
|
||||||
"industrialtest_rubber_wood_side_with_rubber.png",
|
|
||||||
"industrialtest_rubber_wood_side.png"
|
|
||||||
}
|
|
||||||
definition.drop="industrialtest:rubber_wood"
|
|
||||||
if industrialtest.mclAvailable then
|
|
||||||
definition.groups.not_in_creative_inventory=1
|
|
||||||
definition._doc_items_create_entry=false
|
|
||||||
end
|
|
||||||
minetest.register_node("industrialtest:rubber_wood_with_rubber",definition)
|
|
||||||
minetest.register_abm({
|
|
||||||
label="Rubber forming",
|
|
||||||
nodenames={"industrialtest:rubber_wood"},
|
|
||||||
interval=120,
|
|
||||||
chance=2,
|
|
||||||
action=function(pos)
|
|
||||||
local neighbourPositions={
|
|
||||||
vector.offset(pos,-1,0,0),
|
|
||||||
vector.offset(pos,1,0,0),
|
|
||||||
vector.offset(pos,0,-1,0),
|
|
||||||
vector.offset(pos,0,1,0),
|
|
||||||
vector.offset(pos,0,0,-1),
|
|
||||||
vector.offset(pos,0,0,1)
|
|
||||||
}
|
}
|
||||||
for _,value in ipairs(neighbourPositions) do
|
elseif industrialtest.mclAvailable then
|
||||||
if minetest.get_node(value).name=="industrialtest:rubber_wood_with_rubber" then
|
definition.sounds=mcl_sounds.node_sound_wood_defaults()
|
||||||
return
|
definition.groups={
|
||||||
end
|
handy=1,
|
||||||
end
|
axey=1,
|
||||||
minetest.set_node(pos,{
|
tree=1,
|
||||||
name="industrialtest:rubber_wood_with_rubber",
|
flammable=2,
|
||||||
param2=industrialtest.random:next(0,3)
|
building_block=1,
|
||||||
})
|
material_wood=1,
|
||||||
|
fire_encouragement=5,
|
||||||
|
fire_flammability=5
|
||||||
|
}
|
||||||
|
definition.after_destruct=mcl_core.update_leaves
|
||||||
|
definition._mcl_blast_resistance=1.8
|
||||||
|
definition._mcl_hardness=1.8
|
||||||
end
|
end
|
||||||
})
|
definition.groups._industrialtest_rubberWood=1
|
||||||
minetest.register_craft({
|
minetest.register_node("industrialtest:rubber_wood",definition)
|
||||||
type="shapeless",
|
definition=table.copy(definition)
|
||||||
output=industrialtest.elementKeys.junglePlanks.." 3",
|
definition.description=nil
|
||||||
recipe={"group:_industrialtest_rubberWood"}
|
definition.tiles={
|
||||||
})
|
"industrialtest_rubber_wood_top.png",
|
||||||
definition={
|
"industrialtest_rubber_wood_top.png",
|
||||||
description=S("Rubber Leaves"),
|
"industrialtest_rubber_wood_side.png",
|
||||||
drawtype="allfaces_optional",
|
"industrialtest_rubber_wood_side.png",
|
||||||
tiles={"industrialtest_rubber_leaves.png"},
|
"industrialtest_rubber_wood_side_with_rubber.png",
|
||||||
special_tiles={"industrialtest_rubber_leaves_simple.png"},
|
"industrialtest_rubber_wood_side.png"
|
||||||
paramtype="light",
|
|
||||||
sunlight_propagates=true,
|
|
||||||
waving=1
|
|
||||||
}
|
|
||||||
if industrialtest.mtgAvailable then
|
|
||||||
definition.sounds=default.node_sound_leaves_defaults()
|
|
||||||
definition.groups={
|
|
||||||
snappy=3,
|
|
||||||
leafdecay=3,
|
|
||||||
flammable=2,
|
|
||||||
leaves=1
|
|
||||||
}
|
}
|
||||||
definition.drop={
|
definition.drop="industrialtest:rubber_wood"
|
||||||
max_items=1,
|
if industrialtest.mclAvailable then
|
||||||
items={
|
definition.groups.not_in_creative_inventory=1
|
||||||
{
|
definition._doc_items_create_entry=false
|
||||||
items={"industrialtest:rubber_sapling"},
|
end
|
||||||
rarity=20
|
minetest.register_node("industrialtest:rubber_wood_with_rubber",definition)
|
||||||
},
|
minetest.register_abm({
|
||||||
{items={"industrialtest:rubber_leaves"}}
|
label="Rubber forming",
|
||||||
|
nodenames={"industrialtest:rubber_wood"},
|
||||||
|
interval=120,
|
||||||
|
chance=2,
|
||||||
|
action=function(pos)
|
||||||
|
local neighbourPositions={
|
||||||
|
vector.offset(pos,-1,0,0),
|
||||||
|
vector.offset(pos,1,0,0),
|
||||||
|
vector.offset(pos,0,-1,0),
|
||||||
|
vector.offset(pos,0,1,0),
|
||||||
|
vector.offset(pos,0,0,-1),
|
||||||
|
vector.offset(pos,0,0,1)
|
||||||
|
}
|
||||||
|
for _,value in ipairs(neighbourPositions) do
|
||||||
|
if minetest.get_node(value).name=="industrialtest:rubber_wood_with_rubber" then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
end
|
||||||
|
minetest.set_node(pos,{
|
||||||
|
name="industrialtest:rubber_wood_with_rubber",
|
||||||
|
param2=industrialtest.random:next(0,3)
|
||||||
|
})
|
||||||
|
end
|
||||||
|
})
|
||||||
|
minetest.register_craft({
|
||||||
|
type="shapeless",
|
||||||
|
output=industrialtest.elementKeys.junglePlanks.." 3",
|
||||||
|
recipe={"group:_industrialtest_rubberWood"}
|
||||||
|
})
|
||||||
|
definition={
|
||||||
|
description=S("Rubber Leaves"),
|
||||||
|
drawtype="allfaces_optional",
|
||||||
|
tiles={"industrialtest_rubber_leaves.png"},
|
||||||
|
special_tiles={"industrialtest_rubber_leaves_simple.png"},
|
||||||
|
paramtype="light",
|
||||||
|
sunlight_propagates=true,
|
||||||
|
waving=1
|
||||||
|
}
|
||||||
|
if industrialtest.mtgAvailable then
|
||||||
|
definition.sounds=default.node_sound_leaves_defaults()
|
||||||
|
definition.groups={
|
||||||
|
snappy=3,
|
||||||
|
leafdecay=3,
|
||||||
|
flammable=2,
|
||||||
|
leaves=1
|
||||||
}
|
}
|
||||||
}
|
definition.drop={
|
||||||
definition.after_place_node=default.after_place_leaves
|
|
||||||
elseif industrialtest.mclAvailable then
|
|
||||||
local saplingChances={20,16,12,10}
|
|
||||||
local stickChances={50,45,30,35,10}
|
|
||||||
-- Taken and adapted from https://git.minetest.land/MineClone2/MineClone2/src/branch/master/mods/ITEMS/mcl_core/nodes_trees.lua#L157
|
|
||||||
local function getDrops(fortuneLevel)
|
|
||||||
local drop = {
|
|
||||||
max_items=1,
|
max_items=1,
|
||||||
items = {
|
items={
|
||||||
{
|
{
|
||||||
items = {"industrialtest:rubber_sapling"},
|
items={"industrialtest:rubber_sapling"},
|
||||||
rarity = saplingChances[fortuneLevel+1] or saplingChances[fortuneLevel]
|
rarity=20
|
||||||
},
|
|
||||||
{
|
|
||||||
items = {"mcl_core:stick 1"},
|
|
||||||
rarity = stickChances[fortuneLevel+1]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
items = {"mcl_core:stick 2"},
|
|
||||||
rarity = stickChances[fortuneLevel+1]
|
|
||||||
},
|
},
|
||||||
|
{items={"industrialtest:rubber_leaves"}}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return drop
|
definition.after_place_node=default.after_place_leaves
|
||||||
|
elseif industrialtest.mclAvailable then
|
||||||
|
local saplingChances={20,16,12,10}
|
||||||
|
local stickChances={50,45,30,35,10}
|
||||||
|
-- Taken and adapted from https://git.minetest.land/MineClone2/MineClone2/src/branch/master/mods/ITEMS/mcl_core/nodes_trees.lua#L157
|
||||||
|
local function getDrops(fortuneLevel)
|
||||||
|
local drop = {
|
||||||
|
max_items=1,
|
||||||
|
items = {
|
||||||
|
{
|
||||||
|
items = {"industrialtest:rubber_sapling"},
|
||||||
|
rarity = saplingChances[fortuneLevel+1] or saplingChances[fortuneLevel]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
items = {"mcl_core:stick 1"},
|
||||||
|
rarity = stickChances[fortuneLevel+1]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
items = {"mcl_core:stick 2"},
|
||||||
|
rarity = stickChances[fortuneLevel+1]
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return drop
|
||||||
|
end
|
||||||
|
definition.sounds=mcl_sounds.node_sound_leaves_defaults()
|
||||||
|
definition.groups={
|
||||||
|
handy=1,
|
||||||
|
hoey=1,
|
||||||
|
shearsy=1,
|
||||||
|
swordy=1,
|
||||||
|
dig_by_piston=1,
|
||||||
|
flammable=2,
|
||||||
|
fire_encouragement=30,
|
||||||
|
fire_flammability=60,
|
||||||
|
leaves=1,
|
||||||
|
deco_block=1,
|
||||||
|
compostability=30
|
||||||
|
}
|
||||||
|
definition.drop=getDrops(0)
|
||||||
|
definition.after_place_node=mcl_core.make_player_leaves
|
||||||
|
definition._mcl_shears_drop=true
|
||||||
|
definition._mcl_blast_resistance=0.2
|
||||||
|
definition._mcl_hardness=0.2
|
||||||
|
definition._mcl_silk_touch_drop=true
|
||||||
|
definition._mcl_fortune_drop={getDrops(1),getDrops(2),getDrops(3),getDrops(4)}
|
||||||
end
|
end
|
||||||
definition.sounds=mcl_sounds.node_sound_leaves_defaults()
|
minetest.register_node("industrialtest:rubber_leaves",definition)
|
||||||
definition.groups={
|
if industrialtest.mtgAvailable then
|
||||||
handy=1,
|
default.register_leafdecay({
|
||||||
hoey=1,
|
trunks={"industrialtest:rubber_wood"},
|
||||||
shearsy=1,
|
leaves={"industrialtest:rubber_leaves"},
|
||||||
swordy=1,
|
radius=2
|
||||||
dig_by_piston=1,
|
})
|
||||||
flammable=2,
|
end
|
||||||
fire_encouragement=30,
|
if industrialtest.mclAvailable then
|
||||||
fire_flammability=60,
|
definition=table.copy(definition)
|
||||||
leaves=1,
|
definition._doc_items_create_entry=false
|
||||||
deco_block=1,
|
definition.groups.not_in_creative_inventory=1
|
||||||
compostability=30
|
definition.groups.orphan_leaves=1
|
||||||
}
|
definition._mcl_shears_drop={"industrialtest:rubber_leaves"}
|
||||||
definition.drop=getDrops(0)
|
definition._mcl_silk_touch_drop={"industrialtest:rubber_leaves"}
|
||||||
definition.after_place_node=mcl_core.make_player_leaves
|
minetest.register_node("industrialtest:rubber_leaves_orphan",definition)
|
||||||
definition._mcl_shears_drop=true
|
end
|
||||||
definition._mcl_blast_resistance=0.2
|
industrialtest.makeRubberTree=function(pos)
|
||||||
definition._mcl_hardness=0.2
|
-- FIXME: Replace this with placing schematic
|
||||||
definition._mcl_silk_touch_drop=true
|
-- Taken and adapted from https://github.com/minetest/minetest_game/blob/master/mods/default/trees.lua#L182
|
||||||
definition._mcl_fortune_drop={getDrops(1),getDrops(2),getDrops(3),getDrops(4)}
|
local height=industrialtest.random:next(4,5)
|
||||||
end
|
local tree=minetest.get_content_id("industrialtest:rubber_wood")
|
||||||
minetest.register_node("industrialtest:rubber_leaves",definition)
|
local treeWithRubber=minetest.get_content_id("industrialtest:rubber_wood_with_rubber")
|
||||||
if industrialtest.mtgAvailable then
|
local leaves=minetest.get_content_id("industrialtest:rubber_leaves")
|
||||||
default.register_leafdecay({
|
local air=minetest.get_content_id("air")
|
||||||
trunks={"industrialtest:rubber_wood"},
|
local ignore=minetest.get_content_id("ignore")
|
||||||
leaves={"industrialtest:rubber_leaves"},
|
|
||||||
radius=2
|
|
||||||
})
|
|
||||||
end
|
|
||||||
if industrialtest.mclAvailable then
|
|
||||||
definition=table.copy(definition)
|
|
||||||
definition._doc_items_create_entry=false
|
|
||||||
definition.groups.not_in_creative_inventory=1
|
|
||||||
definition.groups.orphan_leaves=1
|
|
||||||
definition._mcl_shears_drop={"industrialtest:rubber_leaves"}
|
|
||||||
definition._mcl_silk_touch_drop={"industrialtest:rubber_leaves"}
|
|
||||||
minetest.register_node("industrialtest:rubber_leaves_orphan",definition)
|
|
||||||
end
|
|
||||||
industrialtest.makeRubberTree=function(pos)
|
|
||||||
-- FIXME: Replace this with placing schematic
|
|
||||||
-- Taken and adapted from https://github.com/minetest/minetest_game/blob/master/mods/default/trees.lua#L182
|
|
||||||
local height=industrialtest.random:next(4,5)
|
|
||||||
local tree=minetest.get_content_id("industrialtest:rubber_wood")
|
|
||||||
local treeWithRubber=minetest.get_content_id("industrialtest:rubber_wood_with_rubber")
|
|
||||||
local leaves=minetest.get_content_id("industrialtest:rubber_leaves")
|
|
||||||
local air=minetest.get_content_id("air")
|
|
||||||
local ignore=minetest.get_content_id("ignore")
|
|
||||||
|
|
||||||
local manip=minetest.get_voxel_manip()
|
local manip=minetest.get_voxel_manip()
|
||||||
local minp,maxp=manip:read_from_map(vector.new(pos.x-2,pos.y,pos.z),vector.new(pos.x+2,pos.y+height+1,pos.z+2))
|
local minp,maxp=manip:read_from_map(vector.new(pos.x-2,pos.y,pos.z),vector.new(pos.x+2,pos.y+height+1,pos.z+2))
|
||||||
local area=VoxelArea:new({
|
local area=VoxelArea:new({
|
||||||
MinEdge=minp,
|
MinEdge=minp,
|
||||||
MaxEdge=maxp
|
MaxEdge=maxp
|
||||||
})
|
})
|
||||||
local data=manip:get_data()
|
local data=manip:get_data()
|
||||||
|
|
||||||
-- Trunk
|
-- Trunk
|
||||||
data[area:index(pos.x,pos.y,pos.z)]=tree
|
data[area:index(pos.x,pos.y,pos.z)]=tree
|
||||||
for y=pos.y+1,pos.y+height-1 do
|
for y=pos.y+1,pos.y+height-1 do
|
||||||
local index=area:index(pos.x,y,pos.z)
|
local index=area:index(pos.x,y,pos.z)
|
||||||
local id=data[index]
|
local id=data[index]
|
||||||
if id==air or id==ignore or id==leaves then
|
if id==air or id==ignore or id==leaves then
|
||||||
data[index]=(industrialtest.random:next(0,5)==1 and treeWithRubber or tree)
|
data[index]=(industrialtest.random:next(0,5)==1 and treeWithRubber or tree)
|
||||||
end
|
|
||||||
end
|
|
||||||
-- Force leaves near the trunk
|
|
||||||
for dz=-1,1 do
|
|
||||||
for dy=-2,1 do
|
|
||||||
local index=area:index(pos.x-1,pos.y+height+dy,pos.z+dz)
|
|
||||||
for dx=-1,1 do
|
|
||||||
if data[index]==air or data[index]==ignore then
|
|
||||||
data[index]=leaves
|
|
||||||
end
|
|
||||||
index=index+1
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
-- Force leaves near the trunk
|
||||||
-- Randomly add leaves in 2x2x2 clusters.
|
for dz=-1,1 do
|
||||||
for i=1,8 do
|
for dy=-2,1 do
|
||||||
local x=pos.x+industrialtest.random:next(-2,1)
|
local index=area:index(pos.x-1,pos.y+height+dy,pos.z+dz)
|
||||||
local y=pos.y+height+industrialtest.random:next(-2,0)
|
for dx=-1,1 do
|
||||||
local z=pos.z+industrialtest.random:next(-2,1)
|
|
||||||
for dx=0,1 do
|
|
||||||
for dy=0,1 do
|
|
||||||
for dz=0,1 do
|
|
||||||
local index=area:index(x+dx,y+dy,z+dz)
|
|
||||||
if data[index]==air or data[index]==ignore then
|
if data[index]==air or data[index]==ignore then
|
||||||
data[index]=leaves
|
data[index]=leaves
|
||||||
end
|
end
|
||||||
|
index=index+1
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
-- Randomly add leaves in 2x2x2 clusters.
|
||||||
|
for i=1,8 do
|
||||||
|
local x=pos.x+industrialtest.random:next(-2,1)
|
||||||
|
local y=pos.y+height+industrialtest.random:next(-2,0)
|
||||||
|
local z=pos.z+industrialtest.random:next(-2,1)
|
||||||
|
for dx=0,1 do
|
||||||
|
for dy=0,1 do
|
||||||
|
for dz=0,1 do
|
||||||
|
local index=area:index(x+dx,y+dy,z+dz)
|
||||||
|
if data[index]==air or data[index]==ignore then
|
||||||
|
data[index]=leaves
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
manip:set_data(data)
|
||||||
|
manip:write_to_map()
|
||||||
|
manip:update_map()
|
||||||
end
|
end
|
||||||
|
definition={
|
||||||
manip:set_data(data)
|
description=S("Rubber Sapling"),
|
||||||
manip:write_to_map()
|
inventory_image="industrialtest_rubber_sapling.png",
|
||||||
manip:update_map()
|
wield_image="industrialtest_rubber_sapling.png",
|
||||||
end
|
drawtype="plantlike",
|
||||||
definition={
|
tiles={"industrialtest_rubber_sapling.png"},
|
||||||
description=S("Rubber Sapling"),
|
paramtype="light",
|
||||||
inventory_image="industrialtest_rubber_sapling.png",
|
sunlight_propagates=true,
|
||||||
wield_image="industrialtest_rubber_sapling.png",
|
walkable=false,
|
||||||
drawtype="plantlike",
|
waving=1,
|
||||||
tiles={"industrialtest_rubber_sapling.png"},
|
on_timer=function(pos)
|
||||||
paramtype="light",
|
-- Use MTG can_grow function if available
|
||||||
sunlight_propagates=true,
|
local canGrow
|
||||||
walkable=false,
|
if industrialtest.mtgAvailable then
|
||||||
waving=1,
|
canGrow=default.can_grow
|
||||||
on_timer=function(pos)
|
elseif industrialtest.mclAvailable then
|
||||||
-- Use MTG can_grow function if available
|
canGrow=function(pos)
|
||||||
local canGrow
|
local under=minetest.get_node_or_nil(vector.offset(pos,0,-1,0))
|
||||||
if industrialtest.mtgAvailable then
|
if not under then
|
||||||
canGrow=default.can_grow
|
return false
|
||||||
elseif industrialtest.mclAvailable then
|
end
|
||||||
canGrow=function(pos)
|
local lightLevel=minetest.get_node_light(pos)
|
||||||
local under=minetest.get_node_or_nil(vector.offset(pos,0,-1,0))
|
return (minetest.get_item_group(under.name,"soil")>0 and lightLevel and lightLevel>=13)
|
||||||
if not under then
|
|
||||||
return false
|
|
||||||
end
|
end
|
||||||
local lightLevel=minetest.get_node_light(pos)
|
|
||||||
return (minetest.get_item_group(under.name,"soil")>0 and lightLevel and lightLevel>=13)
|
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
if not canGrow(pos) then
|
if not canGrow(pos) then
|
||||||
minetest.get_node_timer(pos):start(300)
|
minetest.get_node_timer(pos):start(300)
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
|
industrialtest.makeRubberTree(pos)
|
||||||
|
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
industrialtest.makeRubberTree(pos)
|
|
||||||
|
|
||||||
return false
|
|
||||||
end
|
|
||||||
}
|
|
||||||
if industrialtest.mtgAvailable then
|
|
||||||
definition.sounds=default.node_sound_leaves_defaults()
|
|
||||||
definition.groups={
|
|
||||||
snappy=2,
|
|
||||||
flammable=2
|
|
||||||
}
|
}
|
||||||
definition.on_construct=function(pos)
|
if industrialtest.mtgAvailable then
|
||||||
minetest.get_node_timer(pos):start(industrialtest.random:next(300,1500))
|
definition.sounds=default.node_sound_leaves_defaults()
|
||||||
end
|
definition.groups={
|
||||||
elseif industrialtest.mclAvailable then
|
snappy=2,
|
||||||
definition.sounds=mcl_sounds.node_sound_leaves_defaults()
|
flammable=2
|
||||||
definition.groups={
|
}
|
||||||
plant=1,
|
definition.on_construct=function(pos)
|
||||||
non_mycelium_plant=1,
|
|
||||||
deco_block=1,
|
|
||||||
dig_by_water=1,
|
|
||||||
dig_by_piston=1,
|
|
||||||
destroy_by_lava_flow=1,
|
|
||||||
compostability=40
|
|
||||||
}
|
|
||||||
definition.on_construct=function(pos)
|
|
||||||
local meta=minetest.get_meta(pos)
|
|
||||||
meta:set_int("stage",0)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
definition.groups.attached_node=1
|
|
||||||
definition.groups.dig_immediate=3
|
|
||||||
definition.groups.sapling=1
|
|
||||||
minetest.register_node("industrialtest:rubber_sapling",definition)
|
|
||||||
if industrialtest.mtgAvailable then
|
|
||||||
minetest.register_lbm({
|
|
||||||
name="industrialtest:rubber_sapling_lbm",
|
|
||||||
nodenames={"industrialtest:rubber_sapling"},
|
|
||||||
action=function(pos)
|
|
||||||
minetest.get_node_timer(pos):start(industrialtest.random:next(300,1500))
|
minetest.get_node_timer(pos):start(industrialtest.random:next(300,1500))
|
||||||
end
|
end
|
||||||
})
|
elseif industrialtest.mclAvailable then
|
||||||
|
definition.sounds=mcl_sounds.node_sound_leaves_defaults()
|
||||||
|
definition.groups={
|
||||||
|
plant=1,
|
||||||
|
non_mycelium_plant=1,
|
||||||
|
deco_block=1,
|
||||||
|
dig_by_water=1,
|
||||||
|
dig_by_piston=1,
|
||||||
|
destroy_by_lava_flow=1,
|
||||||
|
compostability=40
|
||||||
|
}
|
||||||
|
definition.on_construct=function(pos)
|
||||||
|
local meta=minetest.get_meta(pos)
|
||||||
|
meta:set_int("stage",0)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
definition.groups.attached_node=1
|
||||||
|
definition.groups.dig_immediate=3
|
||||||
|
definition.groups.sapling=1
|
||||||
|
minetest.register_node("industrialtest:rubber_sapling",definition)
|
||||||
|
if industrialtest.mtgAvailable then
|
||||||
|
minetest.register_lbm({
|
||||||
|
name="industrialtest:rubber_sapling_lbm",
|
||||||
|
nodenames={"industrialtest:rubber_sapling"},
|
||||||
|
action=function(pos)
|
||||||
|
minetest.get_node_timer(pos):start(industrialtest.random:next(300,1500))
|
||||||
|
end
|
||||||
|
})
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
@ -14,6 +14,10 @@
|
|||||||
-- You should have received a copy of the GNU General Public License
|
-- You should have received a copy of the GNU General Public License
|
||||||
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
|
-- 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 S=minetest.get_translator("industrialtest")
|
||||||
|
|
||||||
local function onTreetapUse(user,pointed)
|
local function onTreetapUse(user,pointed)
|
||||||
|
Loading…
Reference in New Issue
Block a user