minetest-mm/mods/castle/arrowslit.lua
2020-10-26 17:38:53 +01:00

79 lines
2 KiB
Lua

local slit = {
{"stone", "Stone", "default_stone", "default:stone"},
{"sandstone", "Sandstone", "default_sandstone", "default:sandstone"},
{"desertstone", "Desert Stone", "default_desert_stone", "default:desert_stone"},
{"dungeonstone", "Dungeon Stone", "castle_dungeon_stone", "castle:dungeon_stone"},
}
local grp = {cracky = 3}
for n = 1, #slit do
-- arrow slits
minetest.register_node("castle:arrowslit_"..slit[n][1], {
drawtype = "nodebox",
description = slit[n][2].." Arrowslit",
tiles = {slit[n][3]..".png"},
groups = grp,
sounds = default.node_sound_defaults(),
paramtype = "light",
paramtype2 = "facedir",
node_box = {
type = "fixed",
fixed = {
{-0.500000,-0.375000,-0.500000,-0.062500,0.375000,-0.312500},
{0.062500,-0.375000,-0.500000,0.500000,0.375000,-0.312500},
{-0.500000,0.375000,-0.500000,0.500000,0.500000,-0.312500},
{-0.500000,-0.500000,-0.500000,0.500000,-0.375000,-0.312500},
},
},
selection_box = {
type = "fixed",
fixed = {
{-0.500000,-0.500000,-0.500000,0.500000,0.500000,-0.312500},
},
},
})
minetest.register_craft({
output = "castle:arrowslit_"..slit[n][1].." 6",
recipe = {
{slit[n][4],"", slit[n][4]},
{slit[n][4],"", slit[n][4]},
{slit[n][4],"", slit[n][4]} },
})
-- murder holes
minetest.register_node("castle:hole_"..slit[n][1], {
drawtype = "nodebox",
description = slit[n][2].." Murder Hole",
tiles = {slit[n][3]..".png"},
groups = grp,
sounds = default.node_sound_defaults(),
paramtype = "light",
paramtype2 = "facedir",
node_box = {
type = "fixed",
fixed = {
{-8/16,-8/16,-8/16,-4/16,8/16,8/16},
{4/16,-8/16,-8/16,8/16,8/16,8/16},
{-4/16,-8/16,-8/16,4/16,8/16,-4/16},
{-4/16,-8/16,8/16,4/16,8/16,4/16},
},
},
})
minetest.register_craft({
output = "castle:hole_"..slit[n][1].." 4",
recipe = {
{"",slit[n][4], "" },
{slit[n][4],"", slit[n][4]},
{"",slit[n][4], ""} },
})
grp = {cracky = 3, not_in_craft_guide = 1}
end