Added wood nodes and crafts

This commit is contained in:
DonBatman 2014-12-03 07:01:07 -08:00
parent ce0b20471c
commit 7a198e0ad9
10 changed files with 305 additions and 145 deletions

149
init.lua

@ -1,147 +1,6 @@
local door_list = { --Number , Description , Inven Image , Image , Is Locked
{ "1" , "Locked Circle" , "door1", "door1" , "true"},
{ "2" , "Wood Circle" , "door2" , "door2" , "false"},
{ "3" , "Wood Glass" , "door3" , "door3" , "false"},
{ "4" , "Wood" , "door4" , "door4" , "false"},
{ "5", "White" , "door5" , "door5" , "false"},
{ "6", "Medevil 1" , "door6" , "door6" , "true"},
{ "7", "Medevil 2" , "door7" , "door7" , "true"},
{ "8", "Medevil 3" , "door8" , "door8" , "true"},
}
dofile(minetest.get_modpath("mydoors").."/wood.lua")
dofile(minetest.get_modpath("mydoors").."/locked.lua")
dofile(minetest.get_modpath("mydoors").."/unlocked.lua")
for i in ipairs(door_list) do
local num = door_list[i][1]
local desc = door_list[i][2]
local inv = door_list[i][3]
local img = door_list[i][4]
local lock = door_list[i][5]
doors.register_door("mydoors:door"..num.."_locked", {
description = desc.." Door",
inventory_image = inv.."_inv.png",
groups = {choppy=2,cracky=2,door=1},
tiles_bottom = {img.."_bottom.png", img.."_edge.png"},
tiles_top = {img.."_top.png", img.."_edge.png"},
only_placer_can_open = lock,
})
--[[
--Unlocked Door
doors.register_door("mydoors:door"..num.."_unlocked", {
description = desc.." Door Unlocked",
inventory_image = inv.."_inv.png",
groups = {choppy=2,cracky=2,door=1},
tiles_bottom = {img.."_bottom.png", img.."_edge.png"},
tiles_top = {img.."_top.png", img.."_edge.png"},
only_placer_can_open = false,
})
--Crafts
--Locked
minetest.register_craft({
output = "bat_blocks:bat_door",
recipe = {
{"bat_blocks:bat_color_black", "default:tree"},
{"default:tree", "bat_blocks:bat_rod_black"},
{"bat_blocks:bat_color_black", "default:tree"}
}
})
--Unlocked
minetest.register_craft({
output = "bat_blocks:bat_door_unlocked",
recipe = {
{"bat_blocks:bat_color_black", "default:tree"},
{"default:tree", "bat_blocks:bat_color_black"},
{"bat_blocks:bat_color_black", "default:tree"}
}
})
----trapdoor----
local function update_node(pos, node)
minetest.set_node(pos, node)
end
local function punch(pos)
local meta = minetest.get_meta(pos)
local state = meta:get_int("state")
local me = minetest.get_node(pos)
local tmp_node
local tmp_node2
oben = {x=pos.x, y=pos.y, z=pos.z}
if state == 1 then
state = 0
tmp_node = {name="bat_blocks:bat_trapdoor", param1=me.param1, param2=me.param2}
else
state = 1
tmp_node = {name="bat_blocks:bat_trapdoor_open", param1=me.param1, param2=me.param2}
end
update_node(pos, tmp_node)
meta:set_int("state", state)
end
minetest.register_node("bat_blocks:bat_trapdoor", {
description = "Trapdoor",
inventory_image = "bat_trapdoor.png",
drawtype = "nodebox",
tiles = {"bat_trapdoor.png", "bat_trapdoor.png", "bat_trap_side.png", "bat_trap_side.png", "bat_trap_side.png", "bat_trap_side.png"},
paramtype = "light",
paramtype2 = "facedir",
groups = {snappy=1,choppy=2,oddly_breakable_by_hand=2,flammable=2,door=1},
sounds = default.node_sound_wood_defaults(),
drop = "bat_blocks:bat_trapdoor",
node_box = {
type = "fixed",
fixed = {-0.5, -0.5, -0.5, 0.5, -0.4, 0.5}
},
selection_box = {
type = "fixed",
fixed = {-0.5, -0.5, -0.5, 0.5, -0.4, 0.5}
},
on_punch = function(pos, node, clicker)
punch(pos)
end,
})
minetest.register_node("bat_blocks:bat_trapdoor_open", {
drawtype = "nodebox",
tiles = {"bat_trap_side.png", "bat_trap_side.png", "bat_trap_side.png", "bat_trap_side.png", "bat_trapdoor.png", "bat_trapdoor.png"},
paramtype = "light",
paramtype2 = "facedir",
pointable = true,
stack_max = 0,
groups = {snappy=1,choppy=2,oddly_breakable_by_hand=2,flammable=2,door=1},
climbable = true,
sounds = default.node_sound_wood_defaults(),
drop = "bat_blocks:bat_trapdoor",
node_box = {
type = "fixed",
fixed = {-0.5, -0.5, 0.4, 0.5, 0.5, 0.5}
},
selection_box = {
type = "fixed",
fixed = {-0.5, -0.5, 0.4, 0.5, 0.5, 0.5}
},
on_punch = function(pos, node, clicker)
punch(pos)
end,
})
minetest.register_craft({
output = 'bat_blocks:bat_trapdoor 2',
recipe = {
{'bat_blocks:bat_color_black', 'bat_blocks:bat_rod_black', ''},
{'bat_blocks:bat_color_black', 'bat_blocks:bat_rod_black', ''},
{'', '', ''},
}
})
--]]
end

99
locked.lua Normal file

@ -0,0 +1,99 @@
local door_list = { --Number , Description , Inven Image , Image , Is Locked
{ "1" , "Circle" , "door1", "door1" , "true"},
{ "2" , "Wood Circle" , "door2" , "door2" , "false"},
{ "3" , "Wood Glass" , "door3" , "door3" , "false"},
-- { "4" , "Wood Glass 2" , "door4" , "door4" , "false"},
-- { "5", "White" , "door5" , "door5" , "false"},
{ "6", "Medevil 1" , "door6" , "door6" , "true"},
{ "7", "Medevil 2" , "door7" , "door7" , "true"},
{ "8", "Medevil 3" , "door8" , "door8" , "true"},
}
for i in ipairs(door_list) do
local num = door_list[i][1]
local desc = door_list[i][2]
local inv = door_list[i][3]
local img = door_list[i][4]
local lock = door_list[i][5]
doors.register_door("mydoors:door"..num.."_locked", {
description = desc.." Door Locked",
inventory_image = inv.."_inv.png",
groups = {choppy=2,cracky=2,door=1},
tiles_bottom = {img.."_bottom.png", img.."_edge.png"},
tiles_top = {img.."_top.png", img.."_edge.png"},
only_placer_can_open = true,
})
end
-- Crafts
minetest.register_craft({
output = "mydoors:door1_locked 1",
recipe = {
{"default:steel_ingot", "default:glass", ""},
{"mydoors:wood_dark_grey", "mydoors:wood_dark_grey", "default:steel_ingot"},
{"mydoors:wood_dark_grey", "default:steel_ingot", ""}
}
})
minetest.register_craft({
output = "mydoors:door2_locked 1",
recipe = {
{"default:steel_ingot", "default:glass", ""},
{"mydoors:wood_red", "mydoors:wood_red", "default:steel_ingot"},
{"mydoors:wood_red", "default:steel_ingot", ""}
}
})
minetest.register_craft({
output = "mydoors:door3_locked 1",
recipe = {
{"mydoors:wood_clear", "default:glass", ""},
{"mydoors:wood_clear", "mydoors:wood_clear", "default:steel_ingot"},
{"mydoors:wood_clear", "default:glass", ""}
}
})
minetest.register_craft({
output = "mydoors:door4_locked 1",
recipe = {
{"default:glass", "mydoors:wood_clear", ""},
{"mydoors:wood_clear", "mydoors:wood_clear", "default:steel_ingot"},
{"default:glass", "mydoors:wood_clear", ""}
}
})
minetest.register_craft({
output = "mydoors:door5_locked 1",
recipe = {
{"mydoors:wood_white", "default:glass", ""},
{"mydoors:wood_white", "mydoors:wood_white", "default:steel_ingot"},
{"mydoors:wood_white", "default:glass", ""}
}
})
minetest.register_craft({
output = "mydoors:door6_locked 1",
recipe = {
{"mydoors:wood_grey", "mydoors:wood_grey", ""},
{"mydoors:wood_grey", "default:steel_ingot", "default:steel_ingot"},
{"mydoors:wood_grey", "mydoors:wood_grey", ""}
}
})
minetest.register_craft({
output = "mydoors:door7_locked 1",
recipe = {
{"mydoors:wood_red", "mydoors:wood_red", ""},
{"mydoors:wood_red", "default:steel_ingot", "default:steel_ingot"},
{"mydoors:wood_red", "mydoors:wood_red", ""}
}
})
minetest.register_craft({
output = "mydoors:door8_locked 1",
recipe = {
{"default:steel_ingot", "default:steel_ingot", ""},
{"mydoors:wood_dark_grey", "mydoors:wood_dark_grey", "default:steel_ingot"},
{"default:steel_ingot", "default:steel_ingot", ""}
}
})

Binary file not shown.

After

(image error) Size: 243 B

Binary file not shown.

After

(image error) Size: 286 B

Binary file not shown.

After

(image error) Size: 230 B

Binary file not shown.

After

(image error) Size: 257 B

Binary file not shown.

After

(image error) Size: 263 B

Binary file not shown.

After

(image error) Size: 222 B

97
unlocked.lua Normal file

@ -0,0 +1,97 @@
local door_list = { --Number , Description , Inven Image , Image , Is Locked
{ "1" , "Locked Circle" , "door1", "door1" , "true"},
-- { "2" , "Wood Circle" , "door2" , "door2" , "false"},
-- { "3" , "Wood Glass" , "door3" , "door3" , "false"},
{ "4" , "Wood Glass 2" , "door4" , "door4" , "false"},
{ "5", "White" , "door5" , "door5" , "false"},
-- { "6", "Medevil 1" , "door6" , "door6" , "true"},
-- { "7", "Medevil 2" , "door7" , "door7" , "true"},
-- { "8", "Medevil 3" , "door8" , "door8" , "true"},
}
for i in ipairs(door_list) do
local num = door_list[i][1]
local desc = door_list[i][2]
local inv = door_list[i][3]
local img = door_list[i][4]
local lock = door_list[i][5]
doors.register_door("mydoors:door"..num.."_unlocked", {
description = desc.." Door Unlocked",
inventory_image = inv.."_inv.png",
groups = {choppy=2,cracky=2,door=1},
tiles_bottom = {img.."_bottom.png", img.."_edge.png"},
tiles_top = {img.."_top.png", img.."_edge.png"},
only_placer_can_open = false,
})
end
-- Crafts
minetest.register_craft({
output = "mydoors:door1_unlocked 1",
recipe = {
{"default:steel_ingot", "default:glass", ""},
{"mydoors:wood_dark_grey", "mydoors:wood_dark_grey", ""},
{"mydoors:wood_dark_grey", "default:steel_ingot", ""}
}
})
minetest.register_craft({
output = "mydoors:door2_unlocked 1",
recipe = {
{"default:steel_ingot", "default:glass", ""},
{"mydoors:wood_red", "mydoors:wood_red", ""},
{"mydoors:wood_red", "default:steel_ingot", ""}
}
})
minetest.register_craft({
output = "mydoors:door3_unlocked 1",
recipe = {
{"mydoors:wood_clear", "default:glass", ""},
{"mydoors:wood_clear", "mydoors:wood_clear", ""},
{"mydoors:wood_clear", "default:glass", ""}
}
})
minetest.register_craft({
output = "mydoors:door4_unlocked 1",
recipe = {
{"default:glass", "mydoors:wood_clear", ""},
{"mydoors:wood_clear", "mydoors:wood_clear", ""},
{"default:glass", "mydoors:wood_clear", ""}
}
})
minetest.register_craft({
output = "mydoors:door5_unlocked 1",
recipe = {
{"mydoors:wood_white", "default:glass", ""},
{"mydoors:wood_white", "mydoors:wood_white", ""},
{"mydoors:wood_white", "default:glass", ""}
}
})
minetest.register_craft({
output = "mydoors:door6_unlocked 1",
recipe = {
{"mydoors:wood_grey", "mydoors:wood_grey", ""},
{"mydoors:wood_grey", "default:steel_ingot", ""},
{"mydoors:wood_grey", "mydoors:wood_grey", ""}
}
})
minetest.register_craft({
output = "mydoors:door7_unlocked 1",
recipe = {
{"mydoors:wood_red", "mydoors:wood_red", ""},
{"mydoors:wood_red", "default:steel_ingot", ""},
{"mydoors:wood_red", "mydoors:wood_red", ""}
}
})
minetest.register_craft({
output = "mydoors:door8_unlocked 1",
recipe = {
{"default:steel_ingot", "default:steel_ingot", ""},
{"mydoors:wood_dark_grey", "mydoors:wood_dark_grey", ""},
{"default:steel_ingot", "default:steel_ingot", ""}
}
})

105
wood.lua Normal file

@ -0,0 +1,105 @@
minetest.register_node("mydoors:wood_red", {
description = "Red Stained Wood",
drawtype = "normal",
paramtype = "light",
tiles = {"mydoors_red_wood.png"},
paramtype = "light",
groups = {cracky = 2, choppy = 2},
})
minetest.register_node("mydoors:wood_grey", {
description = "Grey Stained Wood",
drawtype = "normal",
paramtype = "light",
tiles = {"mydoors_grey_wood.png"},
paramtype = "light",
groups = {cracky = 2, choppy = 2},
})
minetest.register_node("mydoors:wood_dark_grey", {
description = "Dark Grey Stained Wood",
drawtype = "normal",
paramtype = "light",
tiles = {"mydoors_dark_grey_wood.png"},
paramtype = "light",
groups = {cracky = 2, choppy = 2},
})
minetest.register_node("mydoors:wood_brown", {
description = "Brown Stained Wood",
drawtype = "normal",
paramtype = "light",
tiles = {"mydoors_brown_wood.png"},
paramtype = "light",
groups = {cracky = 2, choppy = 2},
})
minetest.register_node("mydoors:wood_white", {
description = "White Stained Wood",
drawtype = "normal",
paramtype = "light",
tiles = {"mydoors_white_wood.png"},
paramtype = "light",
groups = {cracky = 2, choppy = 2},
})
minetest.register_node("mydoors:wood_clear", {
description = "Clear Stained Wood",
drawtype = "normal",
paramtype = "light",
tiles = {"mydoors_clear_wood.png"},
paramtype = "light",
groups = {cracky = 2, choppy = 2},
})
-- Crafts
minetest.register_craft({
output = "mydoors:wood_red 1",
recipe = {
{"default:wood", "", ""},
{"dye:red", "", ""},
{"", "", ""}
}
})
minetest.register_craft({
output = "mydoors:wood_grey 1",
recipe = {
{"default:wood", "", ""},
{"dye:grey", "", ""},
{"", "", ""}
}
})
minetest.register_craft({
output = "mydoors:wood_dark_grey 1",
recipe = {
{"default:wood", "", ""},
{"dye:dark_grey", "", ""},
{"", "", ""}
}
})
minetest.register_craft({
output = "mydoors:wood_brown 1",
recipe = {
{"default:wood", "", ""},
{"dye:brown", "", ""},
{"", "", ""}
}
})
minetest.register_craft({
output = "mydoors:wood_white 1",
recipe = {
{"default:wood", "", ""},
{"dye:white", "", ""},
{"", "", ""}
}
})
minetest.register_craft({
output = "mydoors:wood_clear 1",
recipe = {
{"default:wood", "", ""},
{"default:glass", "", ""},
{"", "", ""}
}
})