2019-10-23 03:57:37 +02:00
|
|
|
-- LUALOCALS < ---------------------------------------------------------
|
|
|
|
local minetest, nodecore, pairs
|
|
|
|
= minetest, nodecore, pairs
|
|
|
|
-- LUALOCALS > ---------------------------------------------------------
|
|
|
|
|
|
|
|
local modname = minetest.get_current_modname()
|
|
|
|
local wmodname = "nc_woodwork"
|
|
|
|
|
|
|
|
local side = "nc_tree_tree_side.png"
|
|
|
|
local top = wmodname.. "_plank.png"
|
|
|
|
local top_sieve = wmodname .. "_plank.png^[mask:"..modname.."_sieve.png^nc_tree_leaves.png"
|
|
|
|
|
2019-10-25 03:48:34 +02:00
|
|
|
local stop = "nc_terrain_stone.png"
|
2019-10-23 03:57:37 +02:00
|
|
|
local sside = "nc_terrain_stone.png"
|
|
|
|
local stop_sieve = "nc_terrain_stone.png^[mask:"..modname.."_sieve.png^nc_terrain_cobble.png"
|
|
|
|
|
2019-10-25 03:48:34 +02:00
|
|
|
function regsieve(suff,top,side,top_sieve,groups)
|
2019-12-06 19:59:37 +01:00
|
|
|
local mname = #suff == 0 and "Wooden" or suff:sub(1,1):upper()..suff:sub(2)
|
|
|
|
suff = #suff == 0 and suff or "_"..suff
|
2019-10-25 03:48:34 +02:00
|
|
|
minetest.register_node(modname .. ":table"..suff, {
|
2019-12-06 19:59:37 +01:00
|
|
|
description = mname.." Table",
|
2019-10-23 03:57:37 +02:00
|
|
|
drawtype = "nodebox",
|
|
|
|
node_box = nodecore.fixedbox(
|
|
|
|
{-0.5, 7/16, -0.5, 0.5, 0.5, 0.5},
|
|
|
|
{-0.5, -0.5, -0.5, -7/16, 7/16, -7/16},
|
|
|
|
{-0.5, -0.5, 7/16, -7/16, 7/16, 0.5},
|
|
|
|
{7/16, -0.5, -0.5, 0.5, 7/16, -7/16},
|
|
|
|
{7/16, -0.5, 7/16, 0.5, 7/16, 0.5}
|
|
|
|
),
|
|
|
|
selection_box = nodecore.fixedbox(),
|
|
|
|
collision_box = nodecore.fixedbox(),
|
|
|
|
tiles = { top, top, side },
|
2019-10-25 03:48:34 +02:00
|
|
|
groups = groups,
|
2019-10-23 03:57:37 +02:00
|
|
|
paramtype = "light",
|
|
|
|
sounds = nodecore.sounds("nc_tree_woody"),
|
|
|
|
})
|
|
|
|
|
2019-10-25 03:48:34 +02:00
|
|
|
minetest.register_node(modname .. ":table_broken"..suff, {
|
2019-12-06 19:59:37 +01:00
|
|
|
description = "Broken "..mname.." Table",
|
2019-10-23 03:57:37 +02:00
|
|
|
drawtype = "nodebox",
|
|
|
|
node_box = nodecore.fixedbox(
|
|
|
|
{-0.5, 7/16, -0.5, -0.5+4/16,0.5,0.5},
|
|
|
|
{0.5-4/16, 7/16, -0.5, 0.5, 0.5, 0.5},
|
|
|
|
{-8/32, 7/16, 8/32, 8/32, 0.5, 0.5},
|
|
|
|
{-8/32, 7/16, -0.5, 8/32, 0.5, -8/32},
|
|
|
|
{-0.5, -0.5, -0.5, -7/16, 7/16, -7/16},
|
|
|
|
{-0.5, -0.5, 7/16, -7/16, 7/16, 0.5},
|
|
|
|
{7/16, -0.5, -0.5, 0.5, 7/16, -7/16},
|
|
|
|
{7/16, -0.5, 7/16, 0.5, 7/16, 0.5}
|
|
|
|
),
|
|
|
|
selection_box = nodecore.fixedbox(),
|
|
|
|
collision_box = nodecore.fixedbox(),
|
|
|
|
tiles = { top, top, side },
|
2019-10-25 03:48:34 +02:00
|
|
|
groups = groups,
|
2019-10-23 03:57:37 +02:00
|
|
|
paramtype = "light",
|
|
|
|
sounds = nodecore.sounds("nc_tree_woody"),
|
|
|
|
})
|
2019-10-25 03:48:34 +02:00
|
|
|
minetest.register_node(modname .. ":sieve"..suff, {
|
2019-12-06 19:59:37 +01:00
|
|
|
description = mname.." Sieve",
|
2019-10-23 03:57:37 +02:00
|
|
|
drawtype = "nodebox",
|
|
|
|
use_texture_alpha = true,
|
|
|
|
node_box = nodecore.fixedbox(
|
|
|
|
{-4/16,7/16,-4/16,4/16,0.5,4/16},
|
|
|
|
{-0.5, 7/16, -0.5, -0.5+4/16,0.5,0.5},
|
|
|
|
{0.5-4/16, 7/16, -0.5, 0.5, 0.5, 0.5},
|
|
|
|
{-8/32, 7/16, 8/32, 8/32, 0.5, 0.5},
|
|
|
|
{-8/32, 7/16, -0.5, 8/32, 0.5, -8/32},
|
|
|
|
{-0.5, -0.5, -0.5, -7/16, 7/16, -7/16},
|
|
|
|
{-0.5, -0.5, 7/16, -7/16, 7/16, 0.5},
|
|
|
|
{7/16, -0.5, -0.5, 0.5, 7/16, -7/16},
|
|
|
|
{7/16, -0.5, 7/16, 0.5, 7/16, 0.5}
|
|
|
|
),
|
|
|
|
selection_box = nodecore.fixedbox(),
|
|
|
|
collision_box = nodecore.fixedbox(),
|
|
|
|
tiles = { top_sieve, top_sieve, side },
|
2019-10-25 03:48:34 +02:00
|
|
|
groups = groups,
|
2019-10-23 03:57:37 +02:00
|
|
|
paramtype = "light",
|
|
|
|
sounds = nodecore.sounds("nc_tree_woody"),
|
|
|
|
})
|
2019-10-25 03:48:34 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
regsieve("",top,side,top_sieve,{
|
|
|
|
choppy = 1,
|
|
|
|
flammable = 2,
|
|
|
|
fire_fuel = 3,
|
|
|
|
})
|
|
|
|
|
2019-12-06 19:59:37 +01:00
|
|
|
regsieve("stone",stop,sside,stop_sieve,{
|
2019-10-25 03:48:34 +02:00
|
|
|
cracky = 2,
|
|
|
|
})
|
2019-10-23 03:57:37 +02:00
|
|
|
|
|
|
|
minetest.register_craftitem(modname..":random_dust",{
|
|
|
|
description = "Dust of random minerals",
|
|
|
|
inventory_image = modname.."_random_dust.png"
|
|
|
|
})
|
|
|
|
|
2019-12-06 19:59:37 +01:00
|
|
|
minetest.register_craftitem(modname..":super_random_dust",{
|
|
|
|
description = "Dust of very random minerals",
|
|
|
|
inventory_image = modname.."_random_dust.png"
|
|
|
|
})
|
|
|
|
|
2019-10-23 03:57:37 +02:00
|
|
|
nodecore.register_craft({
|
2019-12-05 06:01:18 +01:00
|
|
|
label = "break a wooden table",
|
2019-10-23 03:57:37 +02:00
|
|
|
action = "pummel",
|
|
|
|
toolgroups = {choppy = 1},
|
|
|
|
nodes = {
|
|
|
|
{match = modname .. ":table", replace = modname .. ":table_broken"}
|
|
|
|
},
|
|
|
|
})
|
|
|
|
|
2019-10-25 03:48:34 +02:00
|
|
|
nodecore.register_craft({
|
2019-12-05 06:01:18 +01:00
|
|
|
label = "break a stone table",
|
2019-10-25 03:48:34 +02:00
|
|
|
action = "pummel",
|
2019-12-05 06:01:18 +01:00
|
|
|
toolgroups = {cracky = 4},
|
2019-10-25 03:48:34 +02:00
|
|
|
nodes = {
|
|
|
|
{match = modname .. ":table_stone", replace = modname .. ":table_broken_stone"}
|
|
|
|
},
|
|
|
|
})
|
|
|
|
|
2019-10-23 03:57:37 +02:00
|
|
|
|
|
|
|
local duo = {
|
|
|
|
items={{name = modname..":random_dust", count = 1, scatter = 2}}
|
|
|
|
}
|
|
|
|
|
|
|
|
local duo2 = {
|
|
|
|
items={{name = modname..":random_dust", count = 2, scatter = 2}}
|
|
|
|
}
|
|
|
|
|
|
|
|
local duo3 = {
|
2019-12-06 19:59:37 +01:00
|
|
|
items={{name = modname..":super_random_dust", count = 2, scatter = 2}}
|
|
|
|
}
|
|
|
|
|
|
|
|
local duo4 = {
|
|
|
|
items={{name = modname..":super_random_dust", count = 4, scatter = 2}}
|
2019-10-23 03:57:37 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
local dirts = {
|
|
|
|
["nc_terrain:gravel"] = duo,
|
|
|
|
["nc_terrain:gravel_loose"] = duo,
|
|
|
|
["nc_terrain:sand"] = duo2,
|
|
|
|
["nc_terrain:sand_loose"] = duo2,
|
2019-12-05 06:01:18 +01:00
|
|
|
["nc_tree:leaves_loose"] = {node = "nc_sky_liquids:hm_water_source"}
|
2019-10-23 03:57:37 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
local dirtss = {
|
2019-12-06 19:59:37 +01:00
|
|
|
["nc_terrain:gravel"] = duo3,
|
|
|
|
["nc_terrain:gravel_loose"] = duo3,
|
|
|
|
["nc_terrain:sand"] = duo4,
|
|
|
|
["nc_terrain:sand_loose"] = duo4,
|
2019-12-05 06:01:18 +01:00
|
|
|
["nc_tree:leaves_loose"] = {node = "nc_sky_liquids:hm_water_source"},
|
2019-10-23 03:57:37 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
for k,v in pairs(dirts) do
|
|
|
|
|
|
|
|
nodecore.register_craft({
|
|
|
|
label = "use a sieve with "..k,
|
|
|
|
action = "pummel",
|
|
|
|
toolgroups = {crumbly = 1},
|
|
|
|
nodes = {
|
|
|
|
{match = {name = k}, replace = v.node or "air"},
|
|
|
|
{y=-1,match = modname .. ":sieve"}
|
|
|
|
},
|
|
|
|
items = v.items
|
|
|
|
})
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
for k,v in pairs(dirtss) do
|
|
|
|
|
|
|
|
nodecore.register_craft({
|
|
|
|
label = "use a stone sieve with "..k,
|
|
|
|
action = "pummel",
|
|
|
|
toolgroups = {crumbly = 1},
|
|
|
|
nodes = {
|
|
|
|
{match = {name = k}, replace = v.node or "air"},
|
|
|
|
{y=-1,match = modname .. ":sieve_stone"}
|
|
|
|
},
|
|
|
|
items = v.items
|
|
|
|
})
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
local ores = {
|
2019-12-06 19:59:37 +01:00
|
|
|
["nc_lode:cobble_loose"] = 10,
|
|
|
|
["nc_lux:cobble1_loose"] = 1,
|
2019-10-23 03:57:37 +02:00
|
|
|
["nc_sponge:sponge_living"]=1
|
|
|
|
}
|
|
|
|
|
2019-12-06 19:59:37 +01:00
|
|
|
local sores = {
|
|
|
|
["nc_lode:cobble_loose"] = 50,
|
|
|
|
["nc_lux:cobble1_loose"] = 5,
|
|
|
|
["nc_sponge:sponge_living"]=5,
|
|
|
|
["rdust"]=1
|
|
|
|
}
|
|
|
|
|
2019-10-23 03:57:37 +02:00
|
|
|
nodecore.register_craft({
|
|
|
|
label = "pack random dust into cobble",
|
|
|
|
action = "pummel",
|
|
|
|
toolgroups = {thumpy = 2},
|
|
|
|
nodes = {
|
|
|
|
{match = {name = modname..":random_dust",count=8},replace = "nc_terrain:cobble"}
|
|
|
|
},
|
|
|
|
after = function(pos)
|
|
|
|
local chances = {}
|
|
|
|
local mc = 1
|
|
|
|
for k,v in pairs(ores) do
|
|
|
|
for n=mc,mc-1+v do
|
|
|
|
chances[n] = k
|
|
|
|
end
|
|
|
|
mc=mc+v
|
|
|
|
end
|
|
|
|
local ore = chances[math.random(1,mc-1)]
|
|
|
|
minetest.set_node(pos,{name=ore})
|
|
|
|
end
|
|
|
|
})
|
2019-12-06 19:59:37 +01:00
|
|
|
nodecore.register_craft({
|
|
|
|
label = "pack very random dust into cobble",
|
|
|
|
action = "pummel",
|
|
|
|
toolgroups = {thumpy = 2},
|
|
|
|
nodes = {
|
|
|
|
{match = {name = modname..":super_random_dust",count=8},replace = "nc_terrain:cobble"}
|
|
|
|
},
|
|
|
|
after = function(pos)
|
|
|
|
local chances = {}
|
|
|
|
local mc = 1
|
|
|
|
for k,v in pairs(sores) do
|
|
|
|
for n=mc,mc-1+v do
|
|
|
|
chances[n] = k
|
|
|
|
end
|
|
|
|
mc=mc+v
|
|
|
|
end
|
|
|
|
local ore = chances[math.random(1,mc-1)]
|
|
|
|
if ore == "rdust" then
|
|
|
|
nodecore.item_eject(pos,modname..":super_random_dust",5,10)
|
|
|
|
else
|
|
|
|
minetest.set_node(pos,{name=ore})
|
|
|
|
end
|
|
|
|
end
|
|
|
|
})
|
2019-10-23 03:57:37 +02:00
|
|
|
|
|
|
|
nodecore.register_craft({
|
|
|
|
label = "assemble wood sieve",
|
|
|
|
norotate = true,
|
|
|
|
nodes = {
|
|
|
|
{y = -1, match = modname .. ":table_broken", replace = modname .. ":sieve"},
|
|
|
|
{match = "nc_tree:leaves_loose", replace = "air"},
|
|
|
|
}
|
|
|
|
})
|
|
|
|
|
|
|
|
nodecore.register_craft({
|
|
|
|
label = "assemble stone sieve",
|
|
|
|
norotate = true,
|
|
|
|
nodes = {
|
2019-10-25 03:48:34 +02:00
|
|
|
{y = -1, match = modname .. ":table_broken_stone", replace = modname .. ":sieve_stone"},
|
2019-10-23 03:57:37 +02:00
|
|
|
{match = "nc_terrain:cobble_loose", replace = "air"},
|
|
|
|
}
|
|
|
|
})
|
|
|
|
|
|
|
|
nodecore.register_craft({
|
|
|
|
label = "assemble wood table",
|
|
|
|
norotate = true,
|
|
|
|
nodes = {
|
|
|
|
{match = wmodname .. ":plank", replace = modname .. ":table"},
|
|
|
|
{x = -1, z = -1, match = wmodname .. ":staff", replace = "air"},
|
|
|
|
{x = 1, z = -1, match = wmodname .. ":staff", replace = "air"},
|
|
|
|
{x = -1, z = 1, match = wmodname .. ":staff", replace = "air"},
|
|
|
|
{x = 1, z = 1, match = wmodname .. ":staff", replace = "air"},
|
|
|
|
}
|
|
|
|
})
|
|
|
|
|
|
|
|
nodecore.register_craft({
|
|
|
|
label = "assemble wood table",
|
|
|
|
norotate = true,
|
|
|
|
nodes = {
|
|
|
|
{match = wmodname .. ":plank", replace = modname .. ":table"},
|
|
|
|
{x = 0, z = -1, match = wmodname .. ":staff", replace = "air"},
|
|
|
|
{x = 0, z = 1, match = wmodname .. ":staff", replace = "air"},
|
|
|
|
{x = -1, z = 0, match = wmodname .. ":staff", replace = "air"},
|
|
|
|
{x = 1, z = 0, match = wmodname .. ":staff", replace = "air"},
|
|
|
|
}
|
|
|
|
})
|
2019-10-25 03:48:34 +02:00
|
|
|
|
|
|
|
|
|
|
|
nodecore.register_craft({
|
|
|
|
label = "assemble stone table",
|
|
|
|
action = "pummel",
|
2019-12-05 06:01:18 +01:00
|
|
|
toolgroups = {thumpy = 4},
|
2019-10-25 03:48:34 +02:00
|
|
|
priority = 1,
|
|
|
|
norotate = true,
|
|
|
|
nodes = {
|
|
|
|
{match = "nc_terrain:cobble_loose", replace = modname .. ":table_stone"},
|
|
|
|
{x = -1, z = -1, match = "nc_lode:rod_annealed", replace = "air"},
|
|
|
|
{x = 1, z = -1, match = "nc_lode:rod_annealed", replace = "air"},
|
|
|
|
{x = -1, z = 1, match = "nc_lode:rod_annealed", replace = "air"},
|
|
|
|
{x = 1, z = 1, match = "nc_lode:rod_annealed", replace = "air"},
|
|
|
|
}
|
|
|
|
})
|
|
|
|
|
|
|
|
nodecore.register_craft({
|
|
|
|
label = "assemble stone table",
|
|
|
|
action = "pummel",
|
2019-12-05 06:01:18 +01:00
|
|
|
toolgroups = {thumpy = 4},
|
2019-10-25 03:48:34 +02:00
|
|
|
priority = 1,
|
|
|
|
norotate = true,
|
|
|
|
nodes = {
|
|
|
|
{match = "nc_terrain:cobble_loose", replace = modname .. ":table_stone"},
|
|
|
|
{x = 0, z = -1, match = "nc_lode:rod_annealed", replace = "air"},
|
|
|
|
{x = 0, z = 1, match = "nc_lode:rod_annealed", replace = "air"},
|
|
|
|
{x = -1, z = 0, match = "nc_lode:rod_annealed", replace = "air"},
|
|
|
|
{x = 1, z = 0, match = "nc_lode:rod_annealed", replace = "air"},
|
|
|
|
}
|
|
|
|
})
|