This commit is contained in:
WilLiam12 2021-03-28 14:02:15 -03:00
parent 4f685d9d83
commit 53805dfdd4
8 changed files with 245 additions and 0 deletions

15
cblocks/README.md Normal file
View File

@ -0,0 +1,15 @@
CBlocks (Coloured Blocks) mod for Minetest
This mod adds coloured wood and stonebrick blocks to the game without the need for any additional textures. To craft place 2 wood or stonebrick blocks and then 1 coloured dye.
https://forum.minetest.net/viewtopic.php?f=9&t=13303
Change log:
- 0.1 - Initial release
- 0.2 - Added coloured glass and fixed violet
- 0.3 - Added stairsplus and stairs mod support
- 0.4 - Glass stairs created with transparency if stairs redo active
Lucky Blocks: 4

4
cblocks/depends.txt Normal file
View File

@ -0,0 +1,4 @@
default
lucky_block?
stairs?
moreblocks?

1
cblocks/description.txt Normal file
View File

@ -0,0 +1 @@
Adds coloured wood, glass and stone blocks.

197
cblocks/init.lua Normal file
View File

@ -0,0 +1,197 @@
local stairs_mod = minetest.get_modpath("stairs")
local stairsplus_mod = minetest.global_exists("stairsplus")
local ethereal_mod = minetest.get_modpath("ethereal")
local colours = {
{"black", "Black", "#000000b0"},
{"blue", "Blue", "#015dbb70"},
{"brown", "Brown", "#a78c4570"},
{"cyan", "Cyan", "#01ffd870"},
{"dark_green", "Dark Green", "#005b0770"},
{"dark_grey", "Dark Grey", "#303030b0"},
{"green", "Green", "#61ff0170"},
{"grey", "Grey", "#5b5b5bb0"},
{"magenta", "Magenta", "#ff05bb70"},
{"orange", "Orange", "#ff840170"},
{"pink", "Pink", "#ff65b570"},
{"red", "Red", "#ff000070"},
{"violet", "Violet", "#2000c970"},
{"white", "White", "#abababc0"},
{"yellow", "Yellow", "#e3ff0070"},
}
local function cblocks_stairs(nodename, def)
minetest.register_node(nodename, def)
if stairs_mod or stairsplus_mod then
local mod, name = nodename:match("(.*):(.*)")
for groupname, value in pairs(def.groups) do
if groupname ~= "cracky"
and groupname ~= "choppy"
and groupname ~="flammable"
and groupname ~="crumbly"
and groupname ~="snappy" then
def.groups.groupname = nil
end
end
if stairsplus_mod then
stairsplus:register_all(mod, name, nodename, {
description = def.description,
tiles = def.tiles,
groups = def.groups,
sounds = def.sounds,
})
elseif stairs_mod and stairs
and stairs.mod and stairs.mod == "redo" then
stairs.register_all(name, nodename,
def.groups,
def.tiles,
def.description,
def.sounds
)
elseif stairs_mod and not stairs.mod then
stairs.register_stair_and_slab(name, nodename,
def.groups,
def.tiles,
("%s Stair"):format(def.description),
("%s Slab"):format(def.description),
def.sounds
)
end
end
end
local function set_alias(col, name)
minetest.register_alias("stairs:stair_" .. col .. "_" .. name,
"stairs:stair_" .. name .. "_" .. col)
minetest.register_alias("stairs:slab_" .. col .. "_" .. name,
"stairs:slab_" .. name .. "_" .. col)
minetest.register_alias("stairs:stair_inner_" .. col .. "_" .. name,
"stairs:stair_inner_" .. name .. "_" .. col)
minetest.register_alias("stairs:stair_outer_" .. col .. "_" .. name,
"stairs:stair_outer_" .. name .. "_" .. col)
minetest.register_alias("stairs:slope_" .. col .. "_" .. name,
"stairs:slope_" .. name .. "_" .. col)
end
for i = 1, #colours, 1 do
-- stone brick
cblocks_stairs("cblocks:stonebrick_" .. colours[i][1], {
description = colours[i][2] .. " Stone Brick",
tiles = {"default_stone_brick.png^[colorize:" .. colours[i][3]},
paramtype = "light",
is_ground_content = false,
groups = {cracky = 2, stone = 1},
sounds = default.node_sound_stone_defaults(),
})
minetest.register_craft({
output = "cblocks:stonebrick_".. colours[i][1] .. " 2",
recipe = {
{"default:stonebrick","default:stonebrick", "dye:" .. colours[i][1]},
}
})
-- glass (no stairs unless stairs redo active because default stairs mod
-- does not support transparent stairs)
if stairs_mod and stairs and stairs.mod and stairs.mod == "redo" then
cblocks_stairs("cblocks:glass_" .. colours[i][1], {
description = colours[i][2] .. " Glass",
tiles = {"cblocks.png^[colorize:" .. colours[i][3]},
drawtype = "glasslike",
paramtype = "light",
sunlight_propagates = true,
use_texture_alpha = true,
is_ground_content = false,
groups = {cracky = 3, oddly_breakable_by_hand = 3},
sounds = default.node_sound_glass_defaults(),
})
set_alias(colours[i][1], "glass")
else
minetest.register_node("cblocks:glass_" .. colours[i][1], {
description = colours[i][2] .. " Glass",
tiles = {"cblocks.png^[colorize:" .. colours[i][3]},
drawtype = "glasslike",
paramtype = "light",
sunlight_propagates = true,
use_texture_alpha = true,
is_ground_content = false,
groups = {cracky = 3, oddly_breakable_by_hand = 3},
sounds = default.node_sound_glass_defaults(),
})
end
minetest.register_craft({
output = "cblocks:glass_".. colours[i][1] .. " 2",
recipe = {
{"default:glass","default:glass", "dye:" .. colours[i][1]},
}
})
-- wood
local col = colours[i][1]
-- ethereal already has yellow wood so rename to yellow2
if ethereal_mod and col == "yellow" then
col = "yellow2"
end
cblocks_stairs("cblocks:wood_" .. col, {
description = colours[i][2] .. " Wooden Planks",
tiles = {"default_wood.png^[colorize:" .. colours[i][3]},
paramtype = "light",
is_ground_content = false,
groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 3, wood = 1},
sounds = default.node_sound_wood_defaults(),
})
set_alias(colours[i][1], "wood")
minetest.register_craft({
output = "cblocks:wood_".. col .. " 2",
recipe = {
{"group:wood","group:wood", "dye:" .. colours[i][1]},
}
})
end
-- add lucky blocks
if minetest.get_modpath("lucky_block") then
lucky_block:add_blocks({
{"dro", {"cblocks:wood_"}, 10, true},
{"dro", {"cblocks:stonebrick_"}, 10, true},
{"dro", {"cblocks:glass_"}, 10, true},
{"exp"},
})
end
print ("[MOD] Cblocks loaded")

21
cblocks/license.txt Normal file
View File

@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) 2016 TenPlus1
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

7
cblocks/mod.conf Normal file
View File

@ -0,0 +1,7 @@
name = cblocks
depends = default
optional_depends = lucky_block, stairs, moreblocks
description = Adds coloured wood, glass and stone blocks.
release = 6342
author = TenPlus1
title = Cblocks

BIN
cblocks/screenshot.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 84 B