More doors

This commit is contained in:
JoseDouglas26 2024-06-13 17:24:00 -03:00
parent 792c40d7ec
commit 95dc308827
2 changed files with 41 additions and 5 deletions

View File

@ -26,7 +26,7 @@ local items = {
["honeycomb"] = {
groups = {ingredients = 1},
on_place = function(itemstack, placer, pointed_thing)
if not placer or pointed_thing.type ~= "node" then
if not placer then
return
end

View File

@ -1,7 +1,7 @@
local common_defs = {
doors = {
collision_box = {
fixed = {-0.5, -0.5, 0.3125, 0.5, 0.5, 0.5},
fixed = {-0.5, -0.5, 0.3125, 0.5, 1.5, 0.5},
type = "fixed"
},
drawtype = "mesh",
@ -10,7 +10,7 @@ local common_defs = {
paramtype = "light",
paramtype2 = "4dir",
selection_box = {
fixed = {-0.5, -0.5, 0.3125, 0.5, 0.5, 0.5},
fixed = {-0.5, -0.5, 0.3125, 0.5, 1.5, 0.5},
type = "fixed"
},
sunlight_propagates = true,
@ -37,6 +37,19 @@ local function set_door_tiles(identifier, side_tiles, alternative_tiles)
}
end
local function set_images(identifier, definitions)
local image_name = ""
if not identifier:find("waxed") then
image_name = "utility_"..identifier.."_door.png"
else
image_name = ("utility_"..identifier.."_door.png"):gsub("waxed_", "")
end
definitions.inventory_image = image_name
definitions.wield_image = image_name
end
local doors = {
["acacia"] = {
tiles = set_door_tiles("acacia", false, "building_acacia_planks.png"),
@ -50,12 +63,18 @@ local doors = {
["cherry"] = {
tiles = set_door_tiles("cherry", false, "building_cherry_planks.png"),
},
["copper"] = {
tiles = set_door_tiles("copper", false, "building_cut_copper.png")
},
["crimson"] = {
tiles = set_door_tiles("crimson", false, "building_crimson_planks.png")
},
["dark_oak"] = {
tiles = set_door_tiles("dark_oak", false, "building_dark_oak_planks.png")
},
["exposed_copper"] = {
tiles = set_door_tiles("exposed_copper", false, "building_exposed_cut_copper.png")
},
["jungle"] = {
tiles = set_door_tiles("jungle", true, nil)
},
@ -65,17 +84,34 @@ local doors = {
["oak"] = {
tiles = set_door_tiles("oak", false, "building_oak_planks.png")
},
["oxidized_copper"] = {
tiles = set_door_tiles("oxidized_copper", false, "building_oxidized_cut_copper.png")
},
["spruce"] = {
tiles = set_door_tiles("spruce", false, "building_spruce_planks.png")
},
["warped"] = {
tiles = set_door_tiles("warped", false, "building_warped_planks.png")
},
["waxed_copper"] = {
tiles = set_door_tiles("copper", false, "building_cut_copper.png")
},
["waxed_exposed_copper"] = {
tiles = set_door_tiles("exposed_copper", false, "building_exposed_cut_copper.png")
},
["waxed_oxidized_copper"] = {
tiles = set_door_tiles("oxidized_copper", false, "building_oxidized_cut_copper.png")
},
["waxed_weathered_copper"] = {
tiles = set_door_tiles("weathered_copper", false, "building_weathered_cut_copper.png")
},
["weathered_copper"] = {
tiles = set_door_tiles("weathered_copper", false, "building_weathered_cut_copper.png")
}
}
for identifier, definitions in pairs(doors) do
definitions.inventory_image = "utility_"..identifier.."_door.png"
definitions.wield_image = "utility_"..identifier.."_door.png"
set_images(identifier, definitions)
voxelibre.register_block(identifier.."_door", table.merge(common_defs.doors, definitions))
end