Compare commits

...

5 Commits

Author SHA1 Message Date
wsor4035 ef23f3ad67
Add optional bakedclay dependency (#7)
This prevents an error when the chisel is used on bakedclay nodes.
2020-07-30 19:21:49 +02:00
SmallJoker a1159aad61 Add forgotten node descriptions 2020-03-22 11:05:30 +01:00
SmallJoker 198120ec33 nodes.lua: Re-indent and simplify code 2020-03-22 10:56:18 +01:00
SmallJoker 918405b967 chisel.lua: Re-indent and simplify the code 2020-03-22 10:31:26 +01:00
Gundul 7eefcf2bcc
Add baked clay support (#5) 2020-03-22 09:19:44 +01:00
5 changed files with 497 additions and 1040 deletions

View File

@ -10,70 +10,86 @@ chisel.active = {}
chisel.program = {}
chisel.mode = {}
local wehavetechnic = minetest.get_modpath("technic")
local default_material = {
{"default:cobble", "default_cobble", "Cobble"},
{"default:sandstone","default_sandstone", "Sandstone"},
{"default:clay","default_clay", "Clay"},
{"default:coalblock","default_coal_block", "Coal Block"},
{"default:stone","default_stone", "Stone"},
{"default:desert_stone","default_desert_stone", "Desert Stone"},
{"default:wood","default_wood", "Wood"},
{"default:acacia_wood","default_acacia_wood", "Acacia Wood"},
{"default:aspen_wood","default_aspen_wood", "Aspen Wood"},
{"default:pine_wood","default_pine_wood", "Pine Wood"},
{"default:desert_cobble","default_desert_cobble", "Desert Cobble"},
{"default:junglewood","default_junglewood", "Jungle Wood"},
{"default:sandstonebrick","default_sandstone_brick", "Sandstone Brick"},
{"default:stonebrick","default_stone_brick", "Stone Brick"},
{"default:desert_stonebrick","default_desert_stone_brick", "Desert Stone Brick"},
{"default:steelblock", "default_steel_block", "Steel Block"},
{"default:copperblock", "default_copper_block", "Copper Block"},
{"default:bronzeblock", "default_bronze_block", "Bronze Block"},
{"default:goldblock", "default_gold_block", "Gold Block"},
{"default:tinblock", "default_tin_block", "Tin Block"},
{"moreblocks:copperpatina", "moreblocks_copperpatina", "Copperpatina"},
{"default:desert_sandstone","default_desert_sandstone", "Desert Sandstone"},
{"default:desert_sandstone_brick","default_desert_sandstone_brick", "Desert Sandstonebrick"},
{"default:silver_sandstone","default_silver_sandstone", "Silver Sandstone"},
{"default:silver_sandstone_brick","default_silver_sandstone_brick", "Silver Sandstonebrick"},
}
{"default:cobble", "default_cobble", "Cobble"},
{"default:sandstone","default_sandstone", "Sandstone"},
{"default:clay","default_clay", "Clay"},
{"default:coalblock","default_coal_block", "Coal Block"},
{"default:stone","default_stone", "Stone"},
{"default:desert_stone","default_desert_stone", "Desert Stone"},
{"default:wood","default_wood", "Wood"},
{"default:acacia_wood","default_acacia_wood", "Acacia Wood"},
{"default:aspen_wood","default_aspen_wood", "Aspen Wood"},
{"default:pine_wood","default_pine_wood", "Pine Wood"},
{"default:desert_cobble","default_desert_cobble", "Desert Cobble"},
{"default:junglewood","default_junglewood", "Jungle Wood"},
{"default:sandstonebrick","default_sandstone_brick", "Sandstone Brick"},
{"default:stonebrick","default_stone_brick", "Stone Brick"},
{"default:desert_stonebrick","default_desert_stone_brick", "Desert Stone Brick"},
{"default:steelblock", "default_steel_block", "Steel Block"},
{"default:copperblock", "default_copper_block", "Copper Block"},
{"default:bronzeblock", "default_bronze_block", "Bronze Block"},
{"default:goldblock", "default_gold_block", "Gold Block"},
{"default:tinblock", "default_tin_block", "Tin Block"},
{"moreblocks:copperpatina", "moreblocks_copperpatina", "Copperpatina"},
{"default:desert_sandstone","default_desert_sandstone", "Desert Sandstone"},
{"default:desert_sandstone_brick","default_desert_sandstone_brick", "Desert Sandstonebrick"},
{"default:silver_sandstone","default_silver_sandstone", "Silver Sandstone"},
{"default:silver_sandstone_brick","default_silver_sandstone_brick", "Silver Sandstonebrick"},
}
-- Chatcommand to show loaded mods with names and number of styles and supported materials
if minetest.get_modpath( "bakedclay") then
local clay = {
{"white", "White"},
{"grey", "Grey"},
{"black", "Black"},
{"red", "Red"},
{"yellow", "Yellow"},
{"green", "Green"},
{"cyan", "Cyan"},
{"blue", "Blue"},
{"magenta", "Magenta"},
{"orange", "Orange"},
{"violet", "Violet"},
{"brown", "Brown"},
{"pink", "Pink"},
{"dark_grey", "Dark Grey"},
{"dark_green", "Dark Green"},
{"natural", "Natural"}
}
for _, clay in pairs(clay) do
table.insert(default_material,{"bakedclay:"..clay[1] , "baked_clay_" .. clay[1], clay[2] .. " Baked Clay"})
end
end
-- Chatcommand to show loaded mods with names and number of styles and supported materials
minetest.register_chatcommand("chisel", {
params = "",
description = "Shows supported mods and materials in mychisel",
privs = {interact = true},
func = function(name, poi_name)
for i in ipairs (chisel.mods) do
local counter = 1
local rawname = ""
minetest.chat_send_player(name,core.colorize(color,i..") modname: "..chisel.mods[i][1].." styles: "..chisel.mods[i][2]))
if chisel.mods[i][1] == "default" then
for j in ipairs (default_material) do
minetest.chat_send_player(name, " "..j..": "..default_material[j][1])
end
else
for j in ipairs (chisel.materials) do
if chisel.materials[j][3] ~= rawname then
minetest.chat_send_player(name, " "..counter..": "..chisel.materials[j][3])
rawname = chisel.materials[j][3]
counter = counter +1
for i in ipairs (chisel.mods) do
local counter = 1
local rawname = ""
minetest.chat_send_player(name,core.colorize(color,i..") modname: "..chisel.mods[i][1].." styles: "..chisel.mods[i][2]))
if chisel.mods[i][1] == "default" then
for j in ipairs (default_material) do
minetest.chat_send_player(name, " "..j..": "..default_material[j][1])
end
end
end
else
for j in ipairs (chisel.materials) do
if chisel.materials[j][3] ~= rawname then
minetest.chat_send_player(name, " "..counter..": "..chisel.materials[j][3])
rawname = chisel.materials[j][3]
counter = counter +1
end
end
end
end
end,
@ -82,38 +98,38 @@ minetest.register_chatcommand("chisel", {
-- global API
function chisel.register_node(modname, prefix, raw, design) -- global function to register new stuff
local counter = chisel.count_stuff() +1
chisel.materials [counter] = {}
chisel.materials [counter][1] = modname
chisel.materials [counter][2] = prefix
chisel.materials [counter][3] = raw
chisel.materials [counter][4] = design
local counter = chisel.count_stuff() +1
chisel.materials [counter] = {}
chisel.materials [counter][1] = modname
chisel.materials [counter][2] = prefix
chisel.materials [counter][3] = raw
chisel.materials [counter][4] = design
end
function chisel.add_mod(modname,number) -- global function to init a new mod for the chisel.
local counter = chisel.count_mods() +1
chisel.mods [counter] = {}
chisel.mods [counter][1] = modname
chisel.mods [counter][2] = number
minetest.log("action","[CHISEL] Added mod "..modname .. " with " .. number.." styles to mychisel") -- log loaded mods to debug.txt
local counter = chisel.count_mods() +1
chisel.mods [counter] = {}
chisel.mods [counter][1] = modname
chisel.mods [counter][2] = number
minetest.log("action","[CHISEL] Added mod "..modname .. " with " .. number.." styles to mychisel") -- log loaded mods to debug.txt
end
function chisel.count_stuff() -- how many materials have been registered already ?
local counter = 0
for i in ipairs (chisel.materials) do counter = counter +1 end
return counter
local counter = 0
for i in ipairs (chisel.materials) do counter = counter +1 end
return counter
end
function chisel.count_mods() -- how many different mods are registered ?
local counter = 0
for i in ipairs (chisel.mods) do counter = counter +1 end
return counter
function chisel.count_mods() -- how many different mods are registered ?
local counter = 0
for i in ipairs (chisel.mods) do counter = counter +1 end
return counter
end
@ -134,433 +150,252 @@ end)
-- end init
local function parti(pos)
minetest.add_particlespawner(25, 0.3,
pos, pos,
{x=2, y=0.2, z=2}, {x=-2, y=2, z=-2},
{x=0, y=-6, z=0}, {x=0, y=-10, z=0},
0.2, 1,
0.2, 2,
true, "mychisel_parti.png")
minetest.add_particlespawner({
amount = 25,
time = 0.3,
minpos = pos,
maxpos = pos,
minvel = {x=2, y=0.2, z=2},
maxvel = {x=-2, y=2, z=-2},
minacc = {x=0, y=-6, z=0},
maxacc = {x=0, y=-10, z=0},
minexptime = 0.2,
maxexptime = 1,
minsize = 0.2,
maxsize = 2,
collisiondetection = true,
texture = "mychisel_parti.png"
})
end
local function chiselcut(pos,user,node)
local name = user:get_player_name()
for i in ipairs (chisel.materials) do
if chisel.materials[i][1] == chisel.active[name] then
if node.name == chisel.materials[i][3] and chisel.materials[i][4] == chisel.materials[chisel.program[name]][4] then
minetest.set_node(pos, {name=chisel.materials[i][1]..":"..chisel.materials[i][2].."_"..chisel.materials[i][4], param2=minetest.dir_to_facedir(user:get_look_dir())})
end
end
end
local name = user:get_player_name()
for i in ipairs (chisel.materials) do
local material = chisel.materials[i]
if material[1] == chisel.active[name] then
if node.name == material[3] and material[4] == chisel.materials[chisel.program[name]][4] then
local stack = ItemStack(material[1]..":"..material[2].."_"..material[4])
if not stack:is_known() then
return false
end
minetest.set_node(pos, {
name = stack:get_name(),
param2 = minetest.dir_to_facedir(user:get_look_dir())
})
return true
end
end
end
end
local chisel_modes = {
["1"] = {desc = "Chisel 4 Edges", cut = "mychisel:chiseled_%s"},
["2"] = {desc = "Horizontal Groove", cut = "mychisel:horizontal_%s"},
["3"] = {desc = "Vertical Groove", cut = "mychisel:vertical_%s"},
["4"] = {desc = "Cross Grooves", cut = "mychisel:cross_%s"},
["5"] = {desc = "Square", cut = "mychisel:square_%s"}
}
local function change_mode(user, choice)
local name = user:get_player_name()
-- choice = true: choose next program
-- choice = false: choose next mode
local name = user:get_player_name()
if choice then
if chisel.mode[name] == "1" then
chisel.mode[name] = "2"
minetest.chat_send_player(name,core.colorize(color, "Horizontal Groove"))
elseif chisel.mode[name] == "2" then
chisel.mode[name] = "3"
minetest.chat_send_player(name,core.colorize(color, "Vertical Groove"))
elseif chisel.mode[name] == "3" then
chisel.mode[name] = "4"
minetest.chat_send_player(name, core.colorize(color, "Cross Grooves"))
elseif chisel.mode[name] == "4" then
chisel.mode[name] = "5"
minetest.chat_send_player(name, core.colorize(color, "Square"))
elseif chisel.mode[name] == "5" then
chisel.mode[name] = "1"
minetest.chat_send_player(name, core.colorize(color, "Chisel 4 Edges"))
end
else
chisel.program[name] = chisel.program[name] +1
if chisel.program[name] > chisel.mods [chisel.selected[name]][2] then chisel.program[name] = 1 end
minetest.chat_send_player(name, core.colorize(color, chisel.materials [chisel.program[name]][4]))
if not choice then
local player_program = chisel.program[name]
player_program = player_program + 1
if player_program > chisel.mods[chisel.selected[name]][2] then
player_program = 1
end
chisel.program[name] = player_program
minetest.chat_send_player(name, core.colorize(color, chisel.materials[player_program][4]))
return
end
local player_mode = tostring((tonumber(chisel.mode[name]) or 0) + 1)
if not chisel_modes[player_mode] then
player_mode = "1"
end
chisel.mode[name] = player_mode
minetest.chat_send_player(name, core.colorize(color, chisel_modes[player_mode].desc))
end
local function chiselme(pos, user, node)
local name = user:get_player_name()
for i in ipairs (default_material) do
local item = default_material [i][1]
local mat = default_material [i][2]
local desc = default_material [i][3]
local name = user:get_player_name()
if chisel.mode[name] == "1" then
for i in ipairs (default_material) do
local item = default_material[i][1]
local mat = default_material[i][2]
--local desc = default_material[i][3]
local cmode = chisel_modes[chisel.mode[name]]
local newnode
if cmode then
if node.name == item then
minetest.set_node(pos,{name = "mychisel:chiseled_"..mat.."1", param2=minetest.dir_to_facedir(user:get_look_dir())})
parti(pos)
newnode = cmode.cut:format(mat .. "1")
elseif node.name == cmode.cut:format(mat .. "1") then
newnode = cmode.cut:format(mat .. "2")
elseif node.name == cmode.cut:format(mat .. "2") then
newnode = cmode.cut:format(mat .. "3")
elseif node.name == cmode.cut:format(mat .. "3") then
newnode = cmode.cut:format(mat .. "4")
end
if node.name == "mychisel:chiseled_"..mat.."1" then
minetest.set_node(pos,{name = "mychisel:chiseled_"..mat.."2", param2=minetest.dir_to_facedir(user:get_look_dir())})
parti(pos)
end
if node.name == "mychisel:chiseled_"..mat.."2" then
minetest.set_node(pos,{name = "mychisel:chiseled_"..mat.."3", param2=minetest.dir_to_facedir(user:get_look_dir())})
parti(pos)
end
if node.name == "mychisel:chiseled_"..mat.."3" then
minetest.set_node(pos,{name = "mychisel:chiseled_"..mat.."4", param2=minetest.dir_to_facedir(user:get_look_dir())})
parti(pos)
end
end
if chisel.mode[name] == "2" then
if node.name == item then
minetest.set_node(pos,{name = "mychisel:horizontal_"..mat.."1", param2=minetest.dir_to_facedir(user:get_look_dir())})
parti(pos)
end
if node.name == "mychisel:horizontal_"..mat.."1" then
minetest.set_node(pos,{name = "mychisel:horizontal_"..mat.."2", param2=minetest.dir_to_facedir(user:get_look_dir())})
parti(pos)
end
if node.name == "mychisel:horizontal_"..mat.."2" then
minetest.set_node(pos,{name = "mychisel:horizontal_"..mat.."3", param2=minetest.dir_to_facedir(user:get_look_dir())})
parti(pos)
end
if node.name == "mychisel:horizontal_"..mat.."3" then
minetest.set_node(pos,{name = "mychisel:horizontal_"..mat.."4", param2=minetest.dir_to_facedir(user:get_look_dir())})
parti(pos)
end
if newnode then
minetest.swap_node(pos, {
name = newnode,
param2 = minetest.dir_to_facedir(user:get_look_dir())
})
parti(pos)
end
if chisel.mode[name] == "3" then
if node.name == item then
minetest.set_node(pos,{name = "mychisel:vertical_"..mat.."1", param2=minetest.dir_to_facedir(user:get_look_dir())})
parti(pos)
end
if node.name == "mychisel:vertical_"..mat.."1" then
minetest.set_node(pos,{name = "mychisel:vertical_"..mat.."2", param2=minetest.dir_to_facedir(user:get_look_dir())})
parti(pos)
end
if node.name == "mychisel:vertical_"..mat.."2" then
minetest.set_node(pos,{name = "mychisel:vertical_"..mat.."3", param2=minetest.dir_to_facedir(user:get_look_dir())})
parti(pos)
end
if node.name == "mychisel:vertical_"..mat.."3" then
minetest.set_node(pos,{name = "mychisel:vertical_"..mat.."4", param2=minetest.dir_to_facedir(user:get_look_dir())})
parti(pos)
end
end
if chisel.mode[name] == "4" then
if node.name == item then
minetest.set_node(pos,{name = "mychisel:cross_"..mat.."1", param2=minetest.dir_to_facedir(user:get_look_dir())})
parti(pos)
end
if node.name == "mychisel:cross_"..mat.."1" then
minetest.set_node(pos,{name = "mychisel:cross_"..mat.."2", param2=minetest.dir_to_facedir(user:get_look_dir())})
parti(pos)
end
if node.name == "mychisel:cross_"..mat.."2" then
minetest.set_node(pos,{name = "mychisel:cross_"..mat.."3", param2=minetest.dir_to_facedir(user:get_look_dir())})
parti(pos)
end
if node.name == "mychisel:cross_"..mat.."3" then
minetest.set_node(pos,{name = "mychisel:cross_"..mat.."4", param2=minetest.dir_to_facedir(user:get_look_dir())})
parti(pos)
end
end
if chisel.mode[name] == "5" then
if node.name == item then
minetest.set_node(pos,{name = "mychisel:square_"..mat.."1", param2=minetest.dir_to_facedir(user:get_look_dir())})
parti(pos)
end
if node.name == "mychisel:square_"..mat.."1" then
minetest.set_node(pos,{name = "mychisel:square_"..mat.."2", param2=minetest.dir_to_facedir(user:get_look_dir())})
parti(pos)
end
if node.name == "mychisel:square_"..mat.."2" then
minetest.set_node(pos,{name = "mychisel:square_"..mat.."3", param2=minetest.dir_to_facedir(user:get_look_dir())})
parti(pos)
end
if node.name == "mychisel:square_"..mat.."3" then
minetest.set_node(pos,{name = "mychisel:square_"..mat.."4", param2=minetest.dir_to_facedir(user:get_look_dir())})
parti(pos)
end
end
end
end
if not wehavetechnic then
minetest.register_tool( "mychisel:chisel",{
description = "Chisel",
inventory_image = "mychisel_chisel.png",
wield_image = "mychisel_chisel.png",
local chisel_def = {
description = "Chisel",
inventory_image = "mychisel_chisel.png",
wield_image = "mychisel_chisel.png",
-- on_use is specific
on_use = function(itemstack, user, pointed_thing)
on_place = function(itemstack, user, pointed_thing)
local number = chisel.count_mods()
local keys = user:get_player_control()
local name = user:get_player_name()
local node = minetest.get_node(pointed_thing.under)
if pointed_thing.type ~= "node" then
return
end
local pos = pointed_thing.under
local node = minetest.get_node(pos)
local feedback = false
local name = user:get_player_name()
if minetest.is_protected(pos, user:get_player_name()) then
minetest.record_protection_violation(pos, user:get_player_name())
return
end
if chisel.active[name] == "default" then
chiselme(pos,user,node)
else
chiselcut(pos,user,node)
end
if not minetest.setting_getbool("creative_mode") then
itemstack:add_wear(65535 / (USES - 1))
end
return itemstack
end,
on_place = function(itemstack, user, pointed_thing)
local number = chisel.count_mods()
local keys = user:get_player_control()
local name = user:get_player_name()
local node = minetest.get_node(pointed_thing.under)
-- chisel can be repaired with an anvil
if node.name == "anvil:anvil" then
-- chisel can be repaired with an anvil
if node.name == "anvil:anvil" then
minetest.item_place(itemstack, user, pointed_thing)
return itemstack
end
-- change design mode of chisel by pressing sneak while right-clicking
if( not( keys["sneak"] )) then
if chisel.active[name] == "default" then
end
-- change design mode of chisel by pressing sneak while right-clicking
if not keys.sneak then
if chisel.active[name] == "default" then
change_mode(user,true)
else
else
change_mode(user,false)
end
else
chisel.selected[name] = chisel.selected[name] +1
if chisel.selected[name] > chisel.count_mods() then chisel.selected[name] = 1 end
chisel.active[name] = chisel.mods[chisel.selected[name]][1]
minetest.chat_send_player(user:get_player_name(), core.colorize(color, " ***>>> switched to mod: "..chisel.active[name]))
end
end
else
chisel.selected[name] = chisel.selected[name] + 1
if chisel.selected[name] > chisel.count_mods() then
chisel.selected[name] = 1
end
return itemstack
chisel.active[name] = chisel.mods[chisel.selected[name]][1]
minetest.chat_send_player(
user:get_player_name(),
core.colorize(color, " ***>>> switched to mod: "..chisel.active[name])
)
end
return itemstack
end
}
end
if not minetest.get_modpath("technic") then
chisel_def.on_use = function(itemstack, user, pointed_thing)
if pointed_thing.type ~= "node" then
return
end
})
local pos = pointed_thing.under
local node = minetest.get_node(pos)
local name = user:get_player_name()
local cut = false
minetest.register_craft({
output = "mychisel:chisel",
recipe = {
{"default:steel_ingot"},
{"wool:brown"},
},
})
if minetest.is_protected(pos, user:get_player_name()) then
minetest.record_protection_violation(pos, user:get_player_name())
return
end
else
if chisel.active[name] == "default" then
chiselme(pos,user,node)
else
cut = chiselcut(pos,user,node)
end
if not minetest.settings:get_bool("creative_mode") and cut then
itemstack:add_wear(65535 / (USES - 1))
end
return itemstack
end
minetest.register_tool("mychisel:chisel", chisel_def)
minetest.register_craft({
output = "mychisel:chisel",
recipe = {
{"default:steel_ingot"},
{"wool:brown"},
},
})
local S = technic.getter
else -- technic is installed
technic.register_power_tool("mychisel:chisel",TechnicMaxCharge)
local chisel_charge_per_node =math.floor( TechnicMaxCharge / USES )
local S = technic.getter
technic.register_power_tool("mychisel:chisel",TechnicMaxCharge)
local chisel_charge_per_node = math.floor(TechnicMaxCharge / USES)
minetest.register_tool("mychisel:chisel", {
description = S("Chisel"),
inventory_image = "mychisel_chisel.png",
stack_max = 1,
wear_represents = "technic_RE_charge",
on_refill = technic.refill_RE_charge,
on_use = function(itemstack, user, pointed_thing)
if pointed_thing.type ~= "node" then
return
end
local pos = pointed_thing.under
local node = minetest.get_node(pos)
local name = user:get_player_name()
if minetest.is_protected(pos, user:get_player_name()) then
minetest.record_protection_violation(pos, user:get_player_name())
return
end
chisel_def.description = S("Chisel")
chisel_def.wear_represents = "technic_RE_charge"
chisel_def.on_refill = technic.refill_RE_charge
chisel_def.on_use = function(itemstack, user, pointed_thing)
if pointed_thing.type ~= "node" then
return
end
--
local meta = minetest.deserialize(itemstack:get_metadata())
if not meta or not meta.charge or
meta.charge < chisel_charge_per_node then
return
end
if chisel.active[name] == "default" then
chiselme(pos,user,node)
meta.charge = meta.charge - chisel_charge_per_node
else
chiselcut(pos,user,node)
meta.charge = meta.charge - chisel_charge_per_node
end
local pos = pointed_thing.under
local node = minetest.get_node(pos)
local name = user:get_player_name()
if minetest.is_protected(pos, user:get_player_name()) then
minetest.record_protection_violation(pos, user:get_player_name())
return
end
if not technic.creative_mode then
technic.set_RE_wear(itemstack, meta.charge, TechnicMaxCharge)
itemstack:set_metadata(minetest.serialize(meta))
end
return itemstack
end,
on_place = function(itemstack, user, pointed_thing)
local meta = minetest.deserialize(itemstack:get_metadata())
if not meta or not meta.charge or
meta.charge < chisel_charge_per_node then
return
end
local number = chisel.count_mods()
local keys = user:get_player_control()
local name = user:get_player_name()
-- change design mode of chisel by pressing sneak while right-clicking
if( not( keys["sneak"] )) then
if chisel.active[name] == "default" then
change_mode(user,true)
else
change_mode(user,false)
end
else
chisel.selected[name] = chisel.selected[name] +1
if chisel.selected[name] > chisel.count_mods() then chisel.selected[name] = 1 end
chisel.active[name] = chisel.mods[chisel.selected[name]][1]
minetest.chat_send_player(user:get_player_name(),core.colorize(color, " ***>>> switched to mod: "..chisel.active[name]))
end
if chisel.active[name] == "default" then
chiselme(pos,user,node)
else
chiselcut(pos,user,node)
end
meta.charge = meta.charge - chisel_charge_per_node
return itemstack
if not technic.creative_mode then
technic.set_RE_wear(itemstack, meta.charge, TechnicMaxCharge)
itemstack:set_metadata(minetest.serialize(meta))
end
end
})
return itemstack
end,
minetest.register_tool("mychisel:chisel", chisel_def)
minetest.register_craft({
output = "mychisel:chisel",
recipe = {
{"default:diamond", "default:diamond" , "default:diamond" },
{"", "technic:stainless_steel_ingot", ""},
{"", "technic:battery", ""},
}
})
minetest.register_craft({
output = "mychisel:chisel",
recipe = {
{"default:diamond", "default:diamond" , "default:diamond"},
{"", "technic:stainless_steel_ingot", ""},
{"", "technic:battery", ""},
}
})
end
chisel.add_mod("default",5)

View File

@ -1,2 +1,3 @@
default
technic?
bakedclay?

View File

@ -2,7 +2,6 @@ chisel = {}
dofile(minetest.get_modpath("mychisel").."/chisel.lua")
dofile(minetest.get_modpath("mychisel").."/nodes.lua")

View File

@ -1,2 +1,4 @@
name = mychisel
tags = tool, chisel, carve, groove
depends = default
optional_depends = technic, bakedclay

788
nodes.lua
View File

@ -1,616 +1,236 @@
local vert1 = {
type = "fixed",
fixed = {
{-0.5, -0.5, -0.4375, 0.5, 0.5, 0.5},
{0.1875, -0.5, -0.5, 0.5, 0.5, 0.5},
{-0.5, -0.5, -0.5, -0.1875, 0.5, 0.5},
}
}
local vert2 = {
type = "fixed",
fixed = {
{-0.5, -0.5, -0.375, 0.5, 0.5, 0.5},
{0.1875, -0.5, -0.5, 0.5, 0.5, 0.5},
{-0.5, -0.5, -0.5, -0.1875, 0.5, 0.5},
}
}
local vert3 = {
type = "fixed",
fixed = {
{-0.5, -0.5, -0.3125, 0.5, 0.5, 0.5},
{0.1875, -0.5, -0.5, 0.5, 0.5, 0.5},
{-0.5, -0.5, -0.5, -0.1875, 0.5, 0.5},
}
}
local vert4 = {
type = "fixed",
fixed = {
{-0.5, -0.5, -0.25, 0.5, 0.5, 0.5},
{0.1875, -0.5, -0.5, 0.5, 0.5, 0.5},
{-0.5, -0.5, -0.5, -0.1875, 0.5, 0.5},
}
}
local hori1 = {
type = "fixed",
fixed = {
{-0.5, -0.5, -0.4375, 0.5, 0.5, 0.5},
{-0.5, 0.1875, -0.5, 0.5, 0.5, 0.5},
{-0.5, -0.5, -0.5, 0.5, -0.1875, 0.5},
}
}
local hori2 = {
type = "fixed",
fixed = {
{-0.5, -0.5, -0.375, 0.5, 0.5, 0.5},
{-0.5, 0.1875, -0.5, 0.5, 0.5, 0.5},
{-0.5, -0.5, -0.5, 0.5, -0.1875, 0.5},
}
}
local hori3 = {
type = "fixed",
fixed = {
{-0.5, -0.5, -0.3125, 0.5, 0.5, 0.5},
{-0.5, 0.1875, -0.5, 0.5, 0.5, 0.5},
{-0.5, -0.5, -0.5, 0.5, -0.1875, 0.5},
}
}
local hori4 = {
type = "fixed",
fixed = {
{-0.5, -0.5, -0.25, 0.5, 0.5, 0.5},
{-0.5, 0.1875, -0.5, 0.5, 0.5, 0.5},
{-0.5, -0.5, -0.5, 0.5, -0.1875, 0.5},
}
}
local cross1 = {
type = "fixed",
fixed = {
{-0.5, -0.5, -0.4375, 0.5, 0.5, 0.5},
{0.1875, -0.5, -0.5, 0.5, -0.1875, 0.5},
{-0.5, -0.5, -0.5, -0.1875, -0.1875, 0.5},
{-0.5, 0.1875, -0.5, -0.1875, 0.5, 0.5},
{0.1875, 0.1875, -0.5, 0.5, 0.5, 0.5},
}
}
local cross2 = {
type = "fixed",
fixed = {
{-0.5, -0.5, -0.375, 0.5, 0.5, 0.5},
{0.1875, -0.5, -0.5, 0.5, -0.1875, 0.5},
{-0.5, -0.5, -0.5, -0.1875, -0.1875, 0.5},
{-0.5, 0.1875, -0.5, -0.1875, 0.5, 0.5},
{0.1875, 0.1875, -0.5, 0.5, 0.5, 0.5},
}
}
local cross3 = {
type = "fixed",
fixed = {
{-0.5, -0.5, -0.3125, 0.5, 0.5, 0.5},
{0.1875, -0.5, -0.5, 0.5, -0.1875, 0.5},
{-0.5, -0.5, -0.5, -0.1875, -0.1875, 0.5},
{-0.5, 0.1875, -0.5, -0.1875, 0.5, 0.5},
{0.1875, 0.1875, -0.5, 0.5, 0.5, 0.5},
}
}
local cross4 = {
type = "fixed",
fixed = {
{-0.5, -0.5, -0.25, 0.5, 0.5, 0.5},
{0.1875, -0.5, -0.5, 0.5, -0.1875, 0.5},
{-0.5, -0.5, -0.5, -0.1875, -0.1875, 0.5},
{-0.5, 0.1875, -0.5, -0.1875, 0.5, 0.5},
{0.1875, 0.1875, -0.5, 0.5, 0.5, 0.5},
}
}
local chis1 = {
type = "fixed",
fixed = {
-- TODO: Combine with the table in chisel.lua
local chisel_node_defs = {
["mychisel:chiseled_%s"] = {
desc = "Chiseled",
{ -- 1
{-0.5, -0.5, -0.4375, 0.5, 0.5, 0.5},
{-0.4375, -0.4375, -0.5, 0.4375, 0.4375, 0.5},
}
}
local chis2 = {
type = "fixed",
fixed = {
{-0.5, -0.5, -0.375, 0.5, 0.5, 0.5},
{-0.375, -0.375, -0.5, 0.375, 0.375, 0.5},
},
{ -- 2
{-0.5, -0.5, -0.375, 0.5, 0.5, 0.5},
{-0.375, -0.375, -0.5, 0.375, 0.375, 0.5},
{-0.4375, -0.4375, -0.4375, 0.4375, 0.4375, 0.5},
}
}
local chis3 = {
type = "fixed",
fixed = {
{-0.5, -0.5, -0.3125, 0.5, 0.5, 0.5},
},
{ -- 3
{-0.5, -0.5, -0.3125, 0.5, 0.5, 0.5},
{-0.375, -0.375, -0.4375, 0.375, 0.375, 0.5},
{-0.4375, -0.4375, -0.375, 0.4375, 0.4375, 0.5},
{-0.3125, -0.3125, -0.5, 0.3125, 0.3125, 0.5},
}
}
local chis4 = {
type = "fixed",
fixed = {
{-0.5, -0.5, -0.25, 0.5, 0.5, 0.5},
},
{ -- 4
{-0.5, -0.5, -0.25, 0.5, 0.5, 0.5},
{-0.375, -0.375, -0.375, 0.375, 0.375, 0.5},
{-0.4375, -0.4375, -0.3125, 0.4375, 0.4375, 0.5},
{-0.3125, -0.3125, -0.4375, 0.3125, 0.3125, 0.5},
{-0.4375, -0.4375, -0.3125, 0.4375, 0.4375, 0.5},
{-0.3125, -0.3125, -0.4375, 0.3125, 0.3125, 0.5},
{-0.25, -0.25, -0.5, 0.25, 0.25, 0.5},
}
}
local squar1 = {
type = "fixed",
fixed = {
},
},
["mychisel:horizontal_%s"] = {
desc = "Horizontal",
{ -- 1
{-0.5, -0.5, -0.4375, 0.5, 0.5, 0.5},
{-0.5, 0.1875, -0.5, 0.5, 0.5, 0.5},
{-0.5, -0.5, -0.5, 0.5, -0.1875, 0.5},
},
{ -- 2
{-0.5, -0.5, -0.375, 0.5, 0.5, 0.5},
{-0.5, 0.1875, -0.5, 0.5, 0.5, 0.5},
{-0.5, -0.5, -0.5, 0.5, -0.1875, 0.5},
},
{ -- 3
{-0.5, -0.5, -0.3125, 0.5, 0.5, 0.5},
{-0.5, 0.1875, -0.5, 0.5, 0.5, 0.5},
{-0.5, -0.5, -0.5, 0.5, -0.1875, 0.5},
},
{ -- 4
{-0.5, -0.5, -0.25, 0.5, 0.5, 0.5},
{-0.5, 0.1875, -0.5, 0.5, 0.5, 0.5},
{-0.5, -0.5, -0.5, 0.5, -0.1875, 0.5},
},
},
["mychisel:vertical_%s"] = {
desc = "Vertical",
{ -- 1
{-0.5, -0.5, -0.4375, 0.5, 0.5, 0.5},
{0.1875, -0.5, -0.5, 0.5, 0.5, 0.5},
{-0.5, -0.5, -0.5, -0.1875, 0.5, 0.5},
},
{ -- 2
{-0.5, -0.5, -0.375, 0.5, 0.5, 0.5},
{0.1875, -0.5, -0.5, 0.5, 0.5, 0.5},
{-0.5, -0.5, -0.5, -0.1875, 0.5, 0.5},
},
{ -- 3
{-0.5, -0.5, -0.3125, 0.5, 0.5, 0.5},
{0.1875, -0.5, -0.5, 0.5, 0.5, 0.5},
{-0.5, -0.5, -0.5, -0.1875, 0.5, 0.5},
},
{ -- 4
{-0.5, -0.5, -0.25, 0.5, 0.5, 0.5},
{0.1875, -0.5, -0.5, 0.5, 0.5, 0.5},
{-0.5, -0.5, -0.5, -0.1875, 0.5, 0.5},
},
},
["mychisel:cross_%s"] = {
desc = "Cross",
{ -- 1
{-0.5, -0.5, -0.4375, 0.5, 0.5, 0.5},
{0.1875, -0.5, -0.5, 0.5, -0.1875, 0.5},
{-0.5, -0.5, -0.5, -0.1875, -0.1875, 0.5},
{-0.5, 0.1875, -0.5, -0.1875, 0.5, 0.5},
{0.1875, 0.1875, -0.5, 0.5, 0.5, 0.5},
},
{ -- 2
{-0.5, -0.5, -0.375, 0.5, 0.5, 0.5},
{0.1875, -0.5, -0.5, 0.5, -0.1875, 0.5},
{-0.5, -0.5, -0.5, -0.1875, -0.1875, 0.5},
{-0.5, 0.1875, -0.5, -0.1875, 0.5, 0.5},
{0.1875, 0.1875, -0.5, 0.5, 0.5, 0.5},
},
{ -- 3
{-0.5, -0.5, -0.3125, 0.5, 0.5, 0.5},
{0.1875, -0.5, -0.5, 0.5, -0.1875, 0.5},
{-0.5, -0.5, -0.5, -0.1875, -0.1875, 0.5},
{-0.5, 0.1875, -0.5, -0.1875, 0.5, 0.5},
{0.1875, 0.1875, -0.5, 0.5, 0.5, 0.5},
},
{ -- 4
{-0.5, -0.5, -0.25, 0.5, 0.5, 0.5},
{0.1875, -0.5, -0.5, 0.5, -0.1875, 0.5},
{-0.5, -0.5, -0.5, -0.1875, -0.1875, 0.5},
{-0.5, 0.1875, -0.5, -0.1875, 0.5, 0.5},
{0.1875, 0.1875, -0.5, 0.5, 0.5, 0.5},
},
},
["mychisel:square_%s"] = {
desc = "Square",
{ -- 1
{-0.5, -0.5, -0.4375, 0.5, 0.5, 0.5},
{-0.5, -0.5, -0.5, -0.3125, 0.5, -0.4375},
{0.3125, -0.5, -0.5, 0.5, 0.5, -0.4375},
{-0.5, -0.5, -0.5, 0.5, -0.3125, -0.4375},
{-0.5, 0.3125, -0.5, 0.5, 0.5, -0.4375},
}
}
local squar2 = {
type = "fixed",
fixed = {
{-0.5, -0.5, -0.375, 0.5, 0.5, 0.5},
{-0.5, 0.3125, -0.5, 0.5, 0.5, -0.4375},
},
{ -- 2
{-0.5, -0.5, -0.375, 0.5, 0.5, 0.5},
{-0.5, -0.5, -0.5, -0.3125, 0.5, -0.375},
{0.3125, -0.5, -0.5, 0.5, 0.5, -0.375},
{-0.5, -0.5, -0.5, 0.5, -0.3125, -0.375},
{-0.5, 0.3125, -0.5, 0.5, 0.5, -0.375},
}
}
local squar3 = {
type = "fixed",
fixed = {
},
{ -- 3
{-0.5, -0.5, -0.3125, 0.5, 0.5, 0.5},
{-0.5, -0.5, -0.5, -0.3125, 0.5, -0.3125},
{0.3125, -0.5, -0.5, 0.5, 0.5, -0.3125},
{-0.5, -0.5, -0.5, 0.5, -0.3125, -0.3125},
{-0.5, 0.3125, -0.5, 0.5, 0.5, -0.3125},
}
}
local squar4 = {
type = "fixed",
fixed = {
},
{ -- 4
{-0.5, -0.5, -0.25, 0.5, 0.5, 0.5},
{-0.5, -0.5, -0.5, -0.3125, 0.5, -0.25},
{0.3125, -0.5, -0.5, 0.5, 0.5, -0.25},
{-0.5, -0.5, -0.5, 0.5, -0.3125, -0.25},
{-0.5, 0.3125, -0.5, 0.5, 0.5, -0.25},
}
}
},
},
}
local default_material = {
{"default:cobble", "default_cobble", "Cobble", {cracky = 3, not_in_creative_inventory=1}},
{"default:sandstone","default_sandstone", "Sandstone", {crumbly=2, not_in_creative_inventory=1}},
{"default:clay","default_clay", "Clay", {crumbly=3, not_in_creative_inventory=1}},
{"default:coalblock","default_coal_block", "Coal Block", {cracky = 3, not_in_creative_inventory=1}},
{"default:stone","default_stone", "Stone", {cracky = 3, not_in_creative_inventory=1}},
{"default:desert_stone","default_desert_stone", "Desert Stone", {cracky = 3, not_in_creative_inventory=1}},
{"default:wood","default_wood", "Wood", {choppy=2, not_in_creative_inventory=1}},
{"default:acacia_wood","default_acacia_wood", "Acacia Wood", {choppy=2, not_in_creative_inventory=1}},
{"default:aspen_wood","default_aspen_wood", "Aspen Wood", {choppy=2, not_in_creative_inventory=1}},
{"default:pine_wood","default_pine_wood", "Pine Wood", {choppy=2, not_in_creative_inventory=1}},
{"default:desert_cobble","default_desert_cobble", "Desert Cobble", {cracky = 3, not_in_creative_inventory=1}},
{"default:junglewood","default_junglewood", "Jungle Wood", {choppy=2, not_in_creative_inventory=1}},
{"default:sandstonebrick","default_sandstone_brick", "Sandstone Brick", {cracky = 2, not_in_creative_inventory=1}},
{"default:stonebrick","default_stone_brick", "Stone Brick", {cracky = 2, not_in_creative_inventory=1}},
{"default:desert_stonebrick","default_desert_stone_brick", "Desert Stone Brick", {cracky = 2, not_in_creative_inventory=1}},
{"default:steelblock", "default_steel_block", "Steel Block", {cracky = 2, not_in_creative_inventory=1}},
{"default:copperblock", "default_copper_block", "Copper Block", {cracky = 2, not_in_creative_inventory=1}},
{"default:bronzeblock", "default_bronze_block", "Bronze Block", {cracky = 2, not_in_creative_inventory=1}},
{"default:goldblock", "default_gold_block", "Gold Block", {cracky = 2, not_in_creative_inventory=1}},
{"default:tinblock", "default_tin_block", "Tin Block", {cracky = 2, not_in_creative_inventory=1}},
{"moreblocks:copperpatina", "moreblocks_copperpatina", "Copperpatina", {cracky = 2, not_in_creative_inventory=1}},
{"default:desert_sandstone","default_desert_sandstone", "Desert Sandstone", {cracky = 2, not_in_creative_inventory=1}},
{"default:desert_sandstone_brick","default_desert_sandstone_brick", "Desert Sandstonebrick", {cracky = 2, not_in_creative_inventory=1}},
{"default:silver_sandstone","default_silver_sandstone", "Silver Sandstone", {cracky = 2, not_in_creative_inventory=1}},
{"default:silver_sandstone_brick","default_silver_sandstone_brick", "Silver Sandstonebrick", {cracky = 2, not_in_creative_inventory=1}},
}
{"default:cobble", "default_cobble", "Cobble", {cracky = 3}},
{"default:sandstone","default_sandstone", "Sandstone", {crumbly=2}},
{"default:clay","default_clay", "Clay", {crumbly=3}},
{"default:coalblock","default_coal_block", "Coal Block", {cracky = 3}},
{"default:stone","default_stone", "Stone", {cracky = 3}},
{"default:desert_stone","default_desert_stone", "Desert Stone", {cracky = 3}},
{"default:wood","default_wood", "Wood", {choppy=2}},
{"default:acacia_wood","default_acacia_wood", "Acacia Wood", {choppy=2}},
{"default:aspen_wood","default_aspen_wood", "Aspen Wood", {choppy=2}},
{"default:pine_wood","default_pine_wood", "Pine Wood", {choppy=2}},
{"default:desert_cobble","default_desert_cobble", "Desert Cobble", {cracky = 3}},
{"default:junglewood","default_junglewood", "Jungle Wood", {choppy=2}},
{"default:sandstonebrick","default_sandstone_brick", "Sandstone Brick", {cracky = 2}},
{"default:stonebrick","default_stone_brick", "Stone Brick", {cracky = 2}},
{"default:desert_stonebrick","default_desert_stone_brick", "Desert Stone Brick", {cracky = 2}},
{"default:steelblock", "default_steel_block", "Steel Block", {cracky = 2}},
{"default:copperblock", "default_copper_block", "Copper Block", {cracky = 2}},
{"default:bronzeblock", "default_bronze_block", "Bronze Block", {cracky = 2}},
{"default:goldblock", "default_gold_block", "Gold Block", {cracky = 2}},
{"default:tinblock", "default_tin_block", "Tin Block", {cracky = 2}},
{"moreblocks:copperpatina", "moreblocks_copperpatina", "Copperpatina", {cracky = 2}},
{"default:desert_sandstone","default_desert_sandstone", "Desert Sandstone", {cracky = 2}},
{"default:desert_sandstone_brick","default_desert_sandstone_brick", "Desert Sandstonebrick", {cracky = 2}},
{"default:silver_sandstone","default_silver_sandstone", "Silver Sandstone", {cracky = 2}},
{"default:silver_sandstone_brick","default_silver_sandstone_brick", "Silver Sandstonebrick", {cracky = 2}},
}
for i in ipairs (default_material) do
local item = default_material [i][1]
local mat = default_material [i][2]
local desc = default_material [i][3]
local gro = default_material [i][4]
minetest.register_node("mychisel:vertical_"..mat.."1", {
description = "Vertical "..desc.."1",
drawtype = "nodebox",
tiles = {
mat..".png",
mat..".png",
mat..".png",
mat..".png",
mat..".png",
mat..".png^mychisel_vtint.png",
},
paramtype = "light",
paramtype2 = "facedir",
drop = item,
groups = gro,
node_box = vert1,
selection_box = vert1,
on_place = minetest.rotate_node,
})
minetest.register_node("mychisel:vertical_"..mat.."2", {
description = "Vertical "..desc.."2",
drawtype = "nodebox",
tiles = {
mat..".png",
mat..".png",
mat..".png",
mat..".png",
mat..".png",
mat..".png^mychisel_vtint.png",
},
paramtype = "light",
paramtype2 = "facedir",
drop = item,
groups = gro,
node_box = vert2,
selection_box = vert2
})
minetest.register_node("mychisel:vertical_"..mat.."3", {
description = "Vertical "..desc.."3",
drawtype = "nodebox",
tiles = {
mat..".png",
mat..".png",
mat..".png",
mat..".png",
mat..".png",
mat..".png^mychisel_vtint.png",
},
paramtype = "light",
paramtype2 = "facedir",
drop = item,
groups = gro,
node_box = vert3,
selection_box = vert3
})
minetest.register_node("mychisel:vertical_"..mat.."4", {
description = "Vertical "..desc.."4",
drawtype = "nodebox",
tiles = {
mat..".png",
mat..".png",
mat..".png",
mat..".png",
mat..".png",
mat..".png^mychisel_vtint.png",
},
paramtype = "light",
paramtype2 = "facedir",
drop = item,
groups = gro,
node_box = vert4,
selection_box = vert4
})
minetest.register_node("mychisel:chiseled_"..mat.."1", {
description = "Chiseled"..desc.."1",
drawtype = "nodebox",
tiles = {
mat..".png",
mat..".png",
mat..".png",
mat..".png",
mat..".png",
mat..".png^mychisel_ctint1.png",
},
paramtype = "light",
paramtype2 = "facedir",
drop = item,
groups = gro,
node_box = chis1,
selection_box = chis1,
})
minetest.register_node("mychisel:chiseled_"..mat.."2", {
description = "Chiseled"..desc.."2",
drawtype = "nodebox",
tiles = {
mat..".png",
mat..".png",
mat..".png",
mat..".png",
mat..".png",
mat..".png^mychisel_ctint2.png",
},
paramtype = "light",
paramtype2 = "facedir",
drop = item,
groups = gro,
node_box = chis2,
selection_box = chis2
})
minetest.register_node("mychisel:chiseled_"..mat.."3", {
description = "Chiseled"..desc.."3",
drawtype = "nodebox",
tiles = {
mat..".png",
mat..".png",
mat..".png",
mat..".png",
mat..".png",
mat..".png^mychisel_ctint3.png",
},
paramtype = "light",
paramtype2 = "facedir",
drop = item,
groups = gro,
node_box = chis3,
selection_box = chis3
})
minetest.register_node("mychisel:chiseled_"..mat.."4", {
description = "Chiseled"..desc.."4",
drawtype = "nodebox",
tiles = {
mat..".png",
mat..".png",
mat..".png",
mat..".png",
mat..".png",
mat..".png^mychisel_ctint4.png",
},
paramtype = "light",
paramtype2 = "facedir",
drop = item,
groups = gro,
node_box = chis4,
selection_box = chis4
})
minetest.register_node("mychisel:horizontal_"..mat.."1", {
description = "Horizontal "..desc.."1",
drawtype = "nodebox",
tiles = {
mat..".png",
mat..".png",
mat..".png",
mat..".png",
mat..".png",
mat..".png^mychisel_htint.png",
},
paramtype = "light",
paramtype2 = "facedir",
drop = item,
groups = gro,
node_box = hori1,
selection_box = hori1
})
minetest.register_node("mychisel:horizontal_"..mat.."2", {
description = "Horizontal"..desc.."2",
drawtype = "nodebox",
tiles = {
mat..".png",
mat..".png",
mat..".png",
mat..".png",
mat..".png",
mat..".png^mychisel_htint.png",
},
paramtype = "light",
paramtype2 = "facedir",
drop = item,
groups = gro,
node_box = hori2,
selection_box = hori2
})
minetest.register_node("mychisel:horizontal_"..mat.."3", {
description = "Horizontal"..desc.."3",
drawtype = "nodebox",
tiles = {
mat..".png",
mat..".png",
mat..".png",
mat..".png",
mat..".png",
mat..".png^mychisel_htint.png",
},
paramtype = "light",
paramtype2 = "facedir",
drop = item,
groups = gro,
node_box = hori3,
selection_box = hori3
})
minetest.register_node("mychisel:horizontal_"..mat.."4", {
description = "Horizontal"..desc.."4",
drawtype = "nodebox",
tiles = {
mat..".png",
mat..".png",
mat..".png",
mat..".png",
mat..".png",
mat..".png^mychisel_htint.png",
},
paramtype = "light",
paramtype2 = "facedir",
drop = item,
groups = gro,
node_box = hori4,
selection_box = hori4
})
minetest.register_node("mychisel:cross_"..mat.."1", {
description = "cross "..desc.."1",
drawtype = "nodebox",
tiles = {
mat..".png",
mat..".png",
mat..".png",
mat..".png",
mat..".png",
mat..".png^mychisel_ctint.png",
},
paramtype = "light",
paramtype2 = "facedir",
drop = item,
groups = gro,
node_box = cross1,
selection_box = cross1
})
minetest.register_node("mychisel:cross_"..mat.."2", {
description = "cross"..desc.."2",
drawtype = "nodebox",
tiles = {
mat..".png",
mat..".png",
mat..".png",
mat..".png",
mat..".png",
mat..".png^mychisel_ctint.png",
},
paramtype = "light",
paramtype2 = "facedir",
drop = item,
groups = gro,
node_box = cross2,
selection_box = cross2
})
minetest.register_node("mychisel:cross_"..mat.."3", {
description = "cross"..desc.."3",
drawtype = "nodebox",
tiles = {
mat..".png",
mat..".png",
mat..".png",
mat..".png",
mat..".png",
mat..".png^mychisel_ctint.png",
},
paramtype = "light",
paramtype2 = "facedir",
drop = item,
groups = gro,
node_box = cross3,
selection_box = cross3
})
minetest.register_node("mychisel:cross_"..mat.."4", {
description = "cross"..desc.."4",
drawtype = "nodebox",
tiles = {
mat..".png",
mat..".png",
mat..".png",
mat..".png",
mat..".png",
mat..".png^mychisel_ctint.png",
},
paramtype = "light",
paramtype2 = "facedir",
drop = item,
groups = gro,
node_box = cross4,
selection_box = cross4
})
minetest.register_node("mychisel:square_"..mat.."1", {
description = "cross "..desc.."1",
drawtype = "nodebox",
tiles = {
mat..".png",
mat..".png",
mat..".png",
mat..".png",
mat..".png",
mat..".png^mychisel_stint.png",
},
paramtype = "light",
paramtype2 = "facedir",
drop = item,
groups = gro,
node_box = squar1,
selection_box = squar1
})
minetest.register_node("mychisel:square_"..mat.."2", {
description = "cross"..desc.."2",
drawtype = "nodebox",
tiles = {
mat..".png",
mat..".png",
mat..".png",
mat..".png",
mat..".png",
mat..".png^mychisel_stint.png",
},
paramtype = "light",
paramtype2 = "facedir",
drop = item,
groups = gro,
node_box = squar2,
selection_box = squar2
})
minetest.register_node("mychisel:square_"..mat.."3", {
description = "cross"..desc.."3",
drawtype = "nodebox",
tiles = {
mat..".png",
mat..".png",
mat..".png",
mat..".png",
mat..".png",
mat..".png^mychisel_stint.png",
},
paramtype = "light",
paramtype2 = "facedir",
drop = item,
groups = gro,
node_box = squar3,
selection_box = squar3
})
minetest.register_node("mychisel:square_"..mat.."4", {
description = "cross"..desc.."4",
drawtype = "nodebox",
tiles = {
mat..".png",
mat..".png",
mat..".png",
mat..".png",
mat..".png",
mat..".png^mychisel_stint.png",
},
paramtype = "light",
paramtype2 = "facedir",
drop = item,
groups = gro,
node_box = squar4,
selection_box = squar4
})
if minetest.get_modpath( "bakedclay") then
local clay = {
{"white", "White"},
{"grey", "Grey"},
{"black", "Black"},
{"red", "Red"},
{"yellow", "Yellow"},
{"green", "Green"},
{"cyan", "Cyan"},
{"blue", "Blue"},
{"magenta", "Magenta"},
{"orange", "Orange"},
{"violet", "Violet"},
{"brown", "Brown"},
{"pink", "Pink"},
{"dark_grey", "Dark Grey"},
{"dark_green", "Dark Green"},
{"natural", "Natural"}
}
for _, clay in pairs(clay) do
table.insert(default_material,{"bakedclay:"..clay[1] , "baked_clay_" .. clay[1], clay[2] .. " Baked Clay",{cracky = 2}})
end
end
for _, material in ipairs(default_material) do
local item = material[1]
local mat = material[2]
local desc = material[3]
local groups = material[4]
groups.not_in_creative_inventory = 1
for name, def in pairs(chisel_node_defs) do
if not minetest.registered_nodes[item] then
minetest.log("warning", "[mychisel] Tried to register node '" .. item ..
"' but it does not exist.")
break
end
local n = 1
while def[n] do
local box = {
type = "fixed",
fixed = def[n]
}
minetest.register_node(name:format(mat .. n), {
description = def.desc .. " " .. desc .. n,
drawtype = "nodebox",
tiles = {
mat..".png",
mat..".png",
mat..".png",
mat..".png",
mat..".png",
mat..".png^mychisel_vtint.png",
},
paramtype = "light",
paramtype2 = "facedir",
drop = item,
groups = groups,
node_box = box,
selection_box = box,
on_place = minetest.rotate_node,
})
n = n + 1
end
end
end