Skip to content

Commit

Permalink
Add rock bricks+blocks; move chamotte and mordor bricks+blocks into s…
Browse files Browse the repository at this point in the history
…eparate files; save untranslated definition for rocks to use it in other blocks registration. Closes #1304
  • Loading branch information
Doloment authored and alek13 committed Oct 2, 2024
1 parent 9a37c93 commit e976c81
Show file tree
Hide file tree
Showing 7 changed files with 165 additions and 103 deletions.
94 changes: 94 additions & 0 deletions mods/lord/Blocks/lord_bricks/chamotte_bricks.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
local S = minetest.get_translator(minetest.get_current_modname())

-- Items

minetest.register_craftitem("lord_bricks:chamotte_brick_raw", {
description = S("Raw Chamotte Brick"),
inventory_image = "lord_bricks_chamotte_brick_raw.png"
})

minetest.register_craftitem("lord_bricks:chamotte_brick_dried", {
description = S("Chamotte Brick"),
inventory_image = "lord_bricks_chamotte_brick_dried.png"
})


-- Nodes

minetest.register_node("lord_bricks:chamotte_masonry", {
description = S("Chamotte Masonry"),
tiles = {"lord_bricks_chamotte_masonry.png"},
is_ground_content = false,
groups = {cracky = 2, brick = 1},
sounds = default.node_sound_stone_defaults(),
})

minetest.register_node("lord_bricks:chamotte_masonry_large", {
description = S("Large Chamotte Masonry"),
tiles = {"lord_bricks_chamotte_masonry_large.png"},
is_ground_content = false,
groups = {cracky = 2, brick = 1},
sounds = default.node_sound_stone_defaults(),
})

minetest.register_node("lord_bricks:chamotte_brick", {
description = S("Chamotte Brick"),
tiles = {"lord_bricks_chamotte_brick.png"},
is_ground_content = false,
groups = {cracky = 2, brick = 1},
sounds = default.node_sound_stone_defaults(),
})

minetest.register_node("lord_bricks:chamotte_block", {
description = S("Chamotte Block"),
tiles = {"lord_bricks_chamotte_block.png"},
is_ground_content = false,
groups = {cracky = 2},
sounds = default.node_sound_stone_defaults(),
})


stairs.register_stair_and_slab("chamotte_masonry", "lord_bricks:chamotte_masonry",
{cracky=2},
{"lord_bricks_chamotte_masonry.png"},
S("Chamotte Masonry Stair"),
S("Chamotte Masonry Slab"),
default.node_sound_stone_defaults(),
false,
S("Inner Chamotte Masonry Stair"),
S("Outer Chamotte Masonry Stair")
)

stairs.register_stair_and_slab("chamotte_masonry_large", "lord_bricks:chamotte_masonry_large",
{cracky=2},
{"lord_bricks_chamotte_masonry_large.png"},
S("Large Chamotte Masonry Stair"),
S("Large Chamotte Masonry Slab"),
default.node_sound_stone_defaults(),
false,
S("Inner Large Chamotte Masonry Stair"),
S("Outer Large Chamotte Masonry Stair")
)

stairs.register_stair_and_slab("chamotte_brick", "lord_bricks:chamotte_brick",
{cracky=2},
{"lord_bricks_chamotte_brick.png"},
S("Chamotte Brick Stair"),
S("Chamotte Brick Slab"),
default.node_sound_stone_defaults(),
false,
S("Inner Chamotte Brick Stair"),
S("Outer Chamotte Brick Stair")
)

stairs.register_stair_and_slab("chamotte_block", "lord_bricks:chamotte_block",
{cracky=2},
{"lord_bricks_chamotte_block.png"},
S("Chamotte Block Stair"),
S("Chamotte Block Slab"),
default.node_sound_stone_defaults(),
false,
S("Inner Chamotte Block Stair"),
S("Outer Chamotte Block Stair")
)

26 changes: 4 additions & 22 deletions mods/lord/Blocks/lord_bricks/init.lua
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
local S = minetest.get_translator(minetest.get_current_modname())

dofile(minetest.get_modpath(minetest.get_current_modname()).."/crafts.lua")
dofile(minetest.get_modpath(minetest.get_current_modname()).."/nodes.lua")
dofile(minetest.get_modpath(minetest.get_current_modname()).."/chamotte_bricks.lua")
dofile(minetest.get_modpath(minetest.get_current_modname()).."/mordor_bricks.lua")
dofile(minetest.get_modpath(minetest.get_current_modname()).."/rock_bricks.lua")


-- Raw Brick for default clay

Expand All @@ -10,24 +13,3 @@ minetest.register_craftitem("lord_bricks:clay_brick_raw", {
inventory_image = "lord_bricks_clay_brick_raw.png"
})

-- Chamotte Brick
minetest.register_craftitem("lord_bricks:chamotte_brick_raw", {
description = S("Raw Chamotte Brick"),
inventory_image = "lord_bricks_chamotte_brick_raw.png"
})

minetest.register_craftitem("lord_bricks:chamotte_brick_dried", {
description = S("Chamotte Brick"),
inventory_image = "lord_bricks_chamotte_brick_dried.png"
})

-- Mordor Clay Brick
minetest.register_craftitem("lord_bricks:mordor_clay_brick_raw", {
description = S("Raw Mordor Clay Brick"),
inventory_image = "lord_bricks_mordor_clay_brick_raw.png"
})

minetest.register_craftitem("lord_bricks:mordor_clay_brick_dried", {
description = S("Mordor Clay Brick"),
inventory_image = "lord_bricks_mordor_clay_brick_dried.png"
})
2 changes: 1 addition & 1 deletion mods/lord/Blocks/lord_bricks/mod.conf
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
name = lord_bricks
depends = lord_overwrites_mtg_default, stairs
depends = lord_overwrites_mtg_default, stairs, lord_rocks
Original file line number Diff line number Diff line change
@@ -1,86 +1,19 @@
local S = minetest.get_translator(minetest.get_current_modname())

-- Chamotte Bricks
-- Items

minetest.register_node("lord_bricks:chamotte_masonry", {
description = S("Chamotte Masonry"),
tiles = {"lord_bricks_chamotte_masonry.png"},
is_ground_content = false,
groups = {cracky = 2, brick = 1},
sounds = default.node_sound_stone_defaults(),
})

minetest.register_node("lord_bricks:chamotte_masonry_large", {
description = S("Large Chamotte Masonry"),
tiles = {"lord_bricks_chamotte_masonry_large.png"},
is_ground_content = false,
groups = {cracky = 2, brick = 1},
sounds = default.node_sound_stone_defaults(),
minetest.register_craftitem("lord_bricks:mordor_clay_brick_raw", {
description = S("Raw Mordor Clay Brick"),
inventory_image = "lord_bricks_mordor_clay_brick_raw.png"
})

minetest.register_node("lord_bricks:chamotte_brick", {
description = S("Chamotte Brick"),
tiles = {"lord_bricks_chamotte_brick.png"},
is_ground_content = false,
groups = {cracky = 2, brick = 1},
sounds = default.node_sound_stone_defaults(),
})

minetest.register_node("lord_bricks:chamotte_block", {
description = S("Chamotte Block"),
tiles = {"lord_bricks_chamotte_block.png"},
is_ground_content = false,
groups = {cracky = 2},
sounds = default.node_sound_stone_defaults(),
minetest.register_craftitem("lord_bricks:mordor_clay_brick_dried", {
description = S("Mordor Clay Brick"),
inventory_image = "lord_bricks_mordor_clay_brick_dried.png"
})


stairs.register_stair_and_slab("chamotte_masonry", "lord_bricks:chamotte_masonry",
{cracky=2},
{"lord_bricks_chamotte_masonry.png"},
S("Chamotte Masonry Stair"),
S("Chamotte Masonry Slab"),
default.node_sound_stone_defaults(),
false,
S("Inner Chamotte Masonry Stair"),
S("Outer Chamotte Masonry Stair")
)

stairs.register_stair_and_slab("chamotte_masonry_large", "lord_bricks:chamotte_masonry_large",
{cracky=2},
{"lord_bricks_chamotte_masonry_large.png"},
S("Large Chamotte Masonry Stair"),
S("Large Chamotte Masonry Slab"),
default.node_sound_stone_defaults(),
false,
S("Inner Large Chamotte Masonry Stair"),
S("Outer Large Chamotte Masonry Stair")
)

stairs.register_stair_and_slab("chamotte_brick", "lord_bricks:chamotte_brick",
{cracky=2},
{"lord_bricks_chamotte_brick.png"},
S("Chamotte Brick Stair"),
S("Chamotte Brick Slab"),
default.node_sound_stone_defaults(),
false,
S("Inner Chamotte Brick Stair"),
S("Outer Chamotte Brick Stair")
)

stairs.register_stair_and_slab("chamotte_block", "lord_bricks:chamotte_block",
{cracky=2},
{"lord_bricks_chamotte_block.png"},
S("Chamotte Block Stair"),
S("Chamotte Block Slab"),
default.node_sound_stone_defaults(),
false,
S("Inner Chamotte Block Stair"),
S("Outer Chamotte Block Stair")
)


-- Mordor Clay Bricks
-- Nodes

minetest.register_node("lord_bricks:mordor_clay_masonry", {
description = S("Mordor Clay Masonry"),
Expand Down
51 changes: 51 additions & 0 deletions mods/lord/Blocks/lord_bricks/rock_bricks.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
local S = minetest.get_translator(minetest.get_current_modname())

for node_name, registration in pairs(rocks.get_lord_nodes()) do
local name = node_name:split(":")[2]
local base_description = registration.original_description

local def_brick = table.copy(minetest.registered_nodes[node_name])
local brick_name = string.format("lord_bricks:%s_brick", name)
def_brick.description = S(string.format("%s Brick", base_description))
def_brick.tiles = { string.format("lord_bricks_$s_brick.png", name) }
def_brick.groups.stone = nil
def_brick.groups.rock = nil
def_brick.groups.brick = 1

local def_block = table.copy(minetest.registered_nodes[node_name])
local block_name = string.format("lord_bricks:%s_block", name)
def_block.description = S(string.format("%s Block", base_description))
def_brick.tiles = { string.format("lord_bricks_$s_block.png", name) }
def_block.groups.stone = nil
def_block.groups.rock = nil

for _, texture in ipairs(def_brick.tiles) do
minetest.log("info", "use texture: " .. texture .. " at " .. __FILE_LINE__())
end

for _, texture in ipairs(def_block.tiles) do
minetest.log("info", "use texture: " .. texture .. " at " .. __FILE_LINE__())
end

minetest.register_node(brick_name, def_brick)
minetest.register_node(block_name, def_block)

minetest.register_craft({
type = "shaped",
output = brick_name .. " 4",
recipe = {
{ node_name, node_name, },
{ node_name, node_name, },
},
})

minetest.register_craft({
type = "shaped",
output = block_name .. " 9",
recipe = {
{ node_name, node_name, node_name, },
{ node_name, node_name, node_name, },
{ node_name, node_name, node_name, },
},
})
end
10 changes: 6 additions & 4 deletions mods/lord/Blocks/lord_rocks/src/rocks/api.lua
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,15 @@ local function register_rock(node_name, softness, definition, register_stairs)
end

rocks.nodes[node_name] = {
softness = softness,
definition = definition,
softness = softness,
definition = definition,
original_description = description
}

rocks.lord_nodes[node_name] = {
softness = softness,
definition = definition,
softness = softness,
definition = definition,
original_description = description
}


Expand Down
2 changes: 1 addition & 1 deletion mods/lord/Blocks/lord_walls/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ for node_name, registration in pairs(rocks.get_lord_nodes()) do
local sub_name = node_name:split(":")[2]

local walls_node = ":walls:" .. sub_name
local description = sub_name:remove_underscores():to_headline()
local description = registration.original_description
local texture = registration.definition.tiles
walls.register(walls_node, S(description), texture, node_name, default.node_sound_stone_defaults())

Expand Down

0 comments on commit e976c81

Please sign in to comment.