Compare commits
	
		
			13 Commits
		
	
	
		
			4ef1892dbe
			...
			master
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 552767bd6e | |||
|  | 4d20404380 | ||
| 919c6861e6 | |||
| df984afcde | |||
| 05e03901ca | |||
|  | 1011023d6c | ||
| a083365df9 | |||
|  | f341d63b01 | ||
| 9d1ad53d75 | |||
| 4e596096fa | |||
| f116c1d6cf | |||
| 304579a8ca | |||
|  | ef92eceeb6 | 
							
								
								
									
										10
									
								
								.github/workflows/luacheck.yml
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						| @@ -0,0 +1,10 @@ | ||||
| name: luacheck | ||||
| on: [push, pull_request] | ||||
| jobs: | ||||
|   luacheck: | ||||
|     runs-on: ubuntu-latest | ||||
|     steps: | ||||
|       - name: Checkout | ||||
|         uses: actions/checkout@master | ||||
|       - name: Luacheck | ||||
|         uses: lunarmodules/luacheck@master | ||||
							
								
								
									
										9
									
								
								.luacheckrc
									
									
									
									
									
										Normal file
									
								
							
							
						
						| @@ -0,0 +1,9 @@ | ||||
| read_globals = { | ||||
| 	"minetest", | ||||
| 	"unifieddyes", | ||||
| 	"default" | ||||
| } | ||||
|  | ||||
| globals = { | ||||
| 	"unifiedbricks" | ||||
| } | ||||
| @@ -1,4 +0,0 @@ | ||||
| default | ||||
| bucket | ||||
| unifieddyes | ||||
| vessels | ||||
| @@ -1 +0,0 @@ | ||||
| This mod allows the user to re-color default bricks using Unified Dyes, and provides some pattern variations as well. | ||||
							
								
								
									
										476
									
								
								init.lua
									
									
									
									
									
								
							
							
						
						| @@ -1,5 +1,5 @@ | ||||
| --Unified Bricks by Vsevolod Borislav (wowiamdiamonds) | ||||
| -- | ||||
| --Modified by sys4 for NALC server | ||||
| --License: WTFPL | ||||
| -- | ||||
| --Depends: default, bucket, unifieddyes, vessels | ||||
| @@ -10,13 +10,14 @@ | ||||
| unifiedbricks = {} | ||||
| unifiedbricks.old_static_list = {} | ||||
| unifiedbricks.old_static_list_formals = {} | ||||
| unifiedbricks.old_colouredstonebrick_list = {} | ||||
|  | ||||
| minetest.register_alias("unifieddyes:white","unifieddyes:white_paint") | ||||
| minetest.register_alias("unifieddyes:lightgrey","unifieddyes:lightgrey_paint") | ||||
| minetest.register_alias("unifieddyes:grey","unifieddyes:grey_paint") | ||||
| minetest.register_alias("unifieddyes:darkgrey","unifieddyes:darkgrey_paint") | ||||
|  | ||||
| HUES = { | ||||
| local HUES = { | ||||
| 	"red", | ||||
| 	"orange", | ||||
| 	"yellow", | ||||
| @@ -35,25 +36,18 @@ HUES = { | ||||
| 	"lightgrey", | ||||
| 	"white" | ||||
| } | ||||
| TYPES = { | ||||
| 	"clayblock_", | ||||
| 	"clay_", | ||||
| 	"brick_", | ||||
| 	"brickblock_", | ||||
| 	"multicolor_" | ||||
| } | ||||
| SATURATION = { | ||||
| local SATURATION = { | ||||
| 	"_s50", | ||||
| 	"" | ||||
| } | ||||
| DARKNESS = { | ||||
| local DARKNESS = { | ||||
| 	"dark_", | ||||
| 	"medium_", | ||||
| 	"", | ||||
| 	"light_" | ||||
| } | ||||
| --formal versions | ||||
| FORMALHUES = { | ||||
| local FORMALHUES = { | ||||
| 	"Red", | ||||
| 	"Orange", | ||||
| 	"Yellow", | ||||
| @@ -72,26 +66,69 @@ FORMALHUES = { | ||||
| 	"Light grey", | ||||
| 	"White" | ||||
| } | ||||
| FORMALTYPES = { | ||||
| 	" clay", | ||||
| 	" clay lump", | ||||
| 	" brick", | ||||
| 	" bricks", | ||||
| 	" multicolor bricks" | ||||
| } | ||||
| FORMALSATURATION = { | ||||
| local FORMALSATURATION = { | ||||
| 	" (low saturation)", | ||||
| 	"" | ||||
| } | ||||
| FORMALDARKNESS = { | ||||
| local FORMALDARKNESS = { | ||||
| 	"Dark ", | ||||
| 	"Medium ", | ||||
| 	"Bright ", | ||||
| 	"Light " | ||||
| } | ||||
|  | ||||
| -- colouredstonebricks mod colors | ||||
| local old_colors = {"black", "cyan", "brown", "dark_blue", "dark_green", | ||||
| 						  "dark_grey", "dark_pink", "green", "grey", "orange", | ||||
| 						  "pink", "purple", "red", "white", "yellow" | ||||
| } | ||||
|  | ||||
| local function get_class_shape(brick_type, name) | ||||
|  | ||||
| 	local a = string.find(name, ":") | ||||
| 	local b = string.find(name, "_") | ||||
| 	local c = 0 | ||||
| 	if brick_type == "stonebrick" then | ||||
| 		c = 11 | ||||
| 	elseif brick_type == "brick" then | ||||
| 		c = 6 | ||||
| 	elseif brick_type == "brick_multicolor_dark" then | ||||
| 		c = 22 | ||||
| 	elseif brick_type == "brick_multicolor_medium" then | ||||
| 		c = 24 | ||||
| 	elseif brick_type == "brick_multicolor_light" then | ||||
| 		c = 23 | ||||
| 	end | ||||
| 	local class = string.sub(name, a+1, b-1) | ||||
| 	local shape = "" | ||||
|  | ||||
| 	if class == "stair" or class == "slab" or class == "panel" or | ||||
| 	class == "micro" or class == "slope" then | ||||
| 		shape = string.sub(name, b+c) | ||||
| 	end | ||||
| 	return class, shape | ||||
| end | ||||
|  | ||||
| -- param2-coloring-enabled nodes | ||||
|  | ||||
| minetest.register_node("unifiedbricks:stonebrick", { | ||||
| 	description = "Stone Brick", | ||||
| 	tiles = {"colouredstonebricks_white.png"}, | ||||
| 	paramtype2 = "color", | ||||
| 	palette = "unifieddyes_palette_extended.png", | ||||
| 	is_ground_content = false, | ||||
| 	groups = {cracky=3, not_in_creative_inventory=1, ud_param2_colorable = 1}, | ||||
| 	sounds = default.node_sound_stone_defaults(), | ||||
| 	on_construct = unifieddyes.on_construct, | ||||
| 	on_dig = unifieddyes.on_dig, | ||||
| }) | ||||
|  | ||||
| minetest.override_item("default:stonebrick", { | ||||
| 	palette = "unifieddyes_palette_extended.png", | ||||
| 	airbrush_replacement_node = "unifiedbricks:stonebrick", | ||||
| 	groups = {cracky = 3, ud_param2_colorable = 1}, | ||||
| }) | ||||
|  | ||||
| minetest.register_node("unifiedbricks:brickblock", { | ||||
| 	description = "Brick Block", | ||||
| 	tiles = { | ||||
| @@ -103,10 +140,11 @@ minetest.register_node("unifiedbricks:brickblock", { | ||||
| 	paramtype = "light", | ||||
| 	paramtype2 = "color", | ||||
| 	palette = "unifieddyes_palette_extended.png", | ||||
| 	is_ground_content = true, | ||||
| 	is_ground_content = false, | ||||
| 	groups = {cracky=3, not_in_creative_inventory=1, ud_param2_colorable = 1}, | ||||
| 	sounds = default.node_sound_stone_defaults(), | ||||
| 	on_construct = unifieddyes.on_construct, | ||||
| 	on_dig = unifieddyes.on_dig, | ||||
| }) | ||||
|  | ||||
| minetest.override_item("default:brick", { | ||||
| @@ -122,12 +160,13 @@ minetest.register_node("unifiedbricks:clayblock", { | ||||
| 	}, | ||||
| 	paramtype2 = "color", | ||||
| 	palette = "unifieddyes_palette_extended.png", | ||||
| 	is_ground_content = true, | ||||
| 	is_ground_content = false, | ||||
| 	groups = {crumbly=3, not_in_creative_inventory=1, ud_param2_colorable = 1}, | ||||
| 		sounds = default.node_sound_dirt_defaults({ | ||||
| 			footstep = "", | ||||
| 		}), | ||||
| 	on_construct = unifieddyes.on_construct, | ||||
| 	on_dig = unifieddyes.on_dig, | ||||
| }) | ||||
|  | ||||
| minetest.override_item("default:clay", { | ||||
| @@ -137,6 +176,24 @@ minetest.override_item("default:clay", { | ||||
| }) | ||||
|  | ||||
| minetest.register_node("unifiedbricks:brickblock_multicolor_dark", { | ||||
| 	description = "Brick block (dark multicolor)", | ||||
| 	tiles = { | ||||
| 		"unifiedbricks_brickblock_multicolor_dark.png" | ||||
| 	}, | ||||
| 	overlay_tiles = { | ||||
| 		{ name = "unifiedbricks_mortar.png", color = "white" } | ||||
| 	}, | ||||
| 	paramtype = "light", | ||||
| 	paramtype2 = "color", | ||||
| 	palette = "unifieddyes_palette_extended.png", | ||||
| 	is_ground_content = false, | ||||
| 	groups = {cracky=3, ud_param2_colorable = 1, not_in_creative_inventory=1}, | ||||
| 	sounds = default.node_sound_stone_defaults(), | ||||
| 	on_construct = unifieddyes.on_construct, | ||||
| 	on_dig = unifieddyes.on_dig, | ||||
| }) | ||||
|  | ||||
| minetest.register_node("unifiedbricks:brick_multicolor_dark", { | ||||
| 	description = "Brick block (dark multicolor)", | ||||
| 	tiles = { | ||||
| 		"unifiedbricks_brickblock_multicolor_dark.png", | ||||
| @@ -144,13 +201,13 @@ minetest.register_node("unifiedbricks:brickblock_multicolor_dark", { | ||||
| 	overlay_tiles = { | ||||
| 		{ name = "unifiedbricks_mortar2.png", color = "white" } | ||||
| 	}, | ||||
| 	paramtype = "light", | ||||
| 	paramtype2 = "color", | ||||
| 	palette = "unifieddyes_palette_extended.png", | ||||
| 	is_ground_content = true, | ||||
| 	airbrush_replacement_node = "unifiedbricks:brickblock_multicolor_dark", | ||||
| 	paramtype2 = "facedir", | ||||
| 	place_param2 = 0, | ||||
| 	is_ground_content = false, | ||||
| 	groups = {cracky = 3, ud_param2_colorable = 1}, | ||||
| 	sounds = default.node_sound_stone_defaults(), | ||||
| 	on_construct = unifieddyes.on_construct, | ||||
| }) | ||||
|  | ||||
| minetest.register_node("unifiedbricks:brickblock_multicolor_medium", { | ||||
| @@ -159,15 +216,33 @@ minetest.register_node("unifiedbricks:brickblock_multicolor_medium", { | ||||
| 		"unifiedbricks_brickblock_multicolor_medium.png" | ||||
| 	}, | ||||
| 	overlay_tiles = { | ||||
| 		{ name = "unifiedbricks_mortar3.png", color = "white" } | ||||
| 		{ name = "unifiedbricks_mortar.png", color = "white" } | ||||
| 	}, | ||||
| 	paramtype = "light", | ||||
| 	paramtype2 = "color", | ||||
| 	palette = "unifieddyes_palette_extended.png", | ||||
| 	is_ground_content = true, | ||||
| 	groups = {cracky=3, ud_param2_colorable = 1}, | ||||
| 	is_ground_content = false, | ||||
| 	groups = {cracky=3, ud_param2_colorable = 1, not_in_creative_inventory=1}, | ||||
| 	sounds = default.node_sound_stone_defaults(), | ||||
| 	on_construct = unifieddyes.on_construct, | ||||
| 	on_dig = unifieddyes.on_dig, | ||||
| }) | ||||
|  | ||||
| minetest.register_node("unifiedbricks:brick_multicolor_medium", { | ||||
| 	description = "Brick block (medium multicolor)", | ||||
| 	tiles = { | ||||
| 		"unifiedbricks_brickblock_multicolor_medium.png", | ||||
| 	}, | ||||
| 	overlay_tiles = { | ||||
| 		{ name = "unifiedbricks_mortar3.png", color = "white" } | ||||
| 	}, | ||||
| 	palette = "unifieddyes_palette_extended.png", | ||||
| 	airbrush_replacement_node = "unifiedbricks:brickblock_multicolor_medium", | ||||
| 	paramtype2 = "facedir", | ||||
| 	place_param2 = 0, | ||||
| 	is_ground_content = false, | ||||
| 	groups = {cracky = 3, ud_param2_colorable = 1}, | ||||
| 	sounds = default.node_sound_stone_defaults(), | ||||
| }) | ||||
|  | ||||
| minetest.register_node("unifiedbricks:brickblock_multicolor_light", { | ||||
| @@ -176,20 +251,49 @@ minetest.register_node("unifiedbricks:brickblock_multicolor_light", { | ||||
| 		"unifiedbricks_brickblock_multicolor_light.png" | ||||
| 	}, | ||||
| 	overlay_tiles = { | ||||
| 		{ name = "unifiedbricks_mortar4.png", color = "white" } | ||||
| 		{ name = "unifiedbricks_mortar.png", color = "white" } | ||||
| 	}, | ||||
| 	paramtype = "light", | ||||
| 	paramtype2 = "color", | ||||
| 	palette = "unifieddyes_palette_extended.png", | ||||
| 	is_ground_content = true, | ||||
| 	groups = {cracky=3, ud_param2_colorable = 1}, | ||||
| 	is_ground_content = false, | ||||
| 	groups = {cracky=3, ud_param2_colorable = 1, not_in_creative_inventory=1}, | ||||
| 	sounds = default.node_sound_stone_defaults(), | ||||
| 	on_construct = unifieddyes.on_construct, | ||||
| 	on_dig = unifieddyes.on_dig, | ||||
| }) | ||||
|  | ||||
| minetest.register_node("unifiedbricks:brick_multicolor_light", { | ||||
| 	description = "Brick block (light multicolor)", | ||||
| 	tiles = { | ||||
| 		"unifiedbricks_brickblock_multicolor_light.png", | ||||
| 	}, | ||||
| 	overlay_tiles = { | ||||
| 		{ name = "unifiedbricks_mortar4.png", color = "white" } | ||||
| 	}, | ||||
| 	palette = "unifieddyes_palette_extended.png", | ||||
| 	airbrush_replacement_node = "unifiedbricks:brickblock_multicolor_light", | ||||
| 	paramtype2 = "facedir", | ||||
| 	place_param2 = 0, | ||||
| 	is_ground_content = false, | ||||
| 	groups = {cracky = 3, ud_param2_colorable = 1}, | ||||
| 	sounds = default.node_sound_stone_defaults(), | ||||
| }) | ||||
|  | ||||
| unifieddyes.register_color_craft({ | ||||
| 	output = "unifiedbricks:stonebrick", | ||||
| 	palette = "extended", | ||||
| 	neutral_node = "default:stonebrick", | ||||
| 	type = "shapeless", | ||||
| 	recipe = { | ||||
| 		"NEUTRAL_NODE", | ||||
| 		"MAIN_DYE" | ||||
| 	} | ||||
| }) | ||||
|  | ||||
| minetest.register_craft( { | ||||
|    type = "shapeless", | ||||
|    output = "unifiedbricks:brickblock_multicolor_dark", | ||||
|    output = "unifiedbricks:brick_multicolor_dark", | ||||
|    recipe = { | ||||
| 		"default:brick", | ||||
| 		"unifieddyes:grey", | ||||
| @@ -200,7 +304,7 @@ minetest.register_craft( { | ||||
|  | ||||
| minetest.register_craft( { | ||||
|    type = "shapeless", | ||||
|    output = "unifiedbricks:brickblock_multicolor_medium", | ||||
|    output = "unifiedbricks:brick_multicolor_medium", | ||||
|    recipe = { | ||||
| 		"default:brick", | ||||
| 		"unifieddyes:white", | ||||
| @@ -211,7 +315,7 @@ minetest.register_craft( { | ||||
|  | ||||
| minetest.register_craft( { | ||||
|    type = "shapeless", | ||||
|    output = "unifiedbricks:brickblock_multicolor_light", | ||||
|    output = "unifiedbricks:brick_multicolor_light", | ||||
|    recipe = { | ||||
| 		"default:brick", | ||||
| 		"unifieddyes:white", | ||||
| @@ -245,7 +349,7 @@ unifieddyes.register_color_craft({ | ||||
| unifieddyes.register_color_craft({ | ||||
| 	output = "unifiedbricks:brickblock_multicolor_dark", | ||||
| 	palette = "extended", | ||||
| 	neutral_node = "unifiedbricks:brickblock_multicolor_dark", | ||||
| 	neutral_node = "unifiedbricks:brick_multicolor_dark", | ||||
| 	type = "shapeless", | ||||
| 	recipe = { | ||||
| 		"NEUTRAL_NODE", | ||||
| @@ -256,7 +360,7 @@ unifieddyes.register_color_craft({ | ||||
| unifieddyes.register_color_craft({ | ||||
| 	output = "unifiedbricks:brickblock_multicolor_medium", | ||||
| 	palette = "extended", | ||||
| 	neutral_node = "unifiedbricks:brickblock_multicolor_medium", | ||||
| 	neutral_node = "unifiedbricks:brick_multicolor_medium", | ||||
| 	type = "shapeless", | ||||
| 	recipe = { | ||||
| 		"NEUTRAL_NODE", | ||||
| @@ -267,7 +371,7 @@ unifieddyes.register_color_craft({ | ||||
| unifieddyes.register_color_craft({ | ||||
| 	output = "unifiedbricks:brickblock_multicolor_light", | ||||
| 	palette = "extended", | ||||
| 	neutral_node = "unifiedbricks:brickblock_multicolor_light", | ||||
| 	neutral_node = "unifiedbricks:brick_multicolor_light", | ||||
| 	type = "shapeless", | ||||
| 	recipe = { | ||||
| 		"NEUTRAL_NODE", | ||||
| @@ -275,6 +379,160 @@ unifieddyes.register_color_craft({ | ||||
| 	} | ||||
| }) | ||||
|  | ||||
| -- stairsplus | ||||
| if minetest.get_modpath("moreblocks") then | ||||
| 	local brick_types = { | ||||
| 		stonebrick = { | ||||
| 			name = "stonebrick", | ||||
| 			base_node = "default:stonebrick", | ||||
| 			description = " Stone Brick", | ||||
| 			tiles = {"colouredstonebricks_white.png"}, | ||||
| 			overlay_tiles = nil, | ||||
| 			substring_count = 26, | ||||
| 			substring_short = "stonebric", | ||||
| 			substring_long = "stonebrick", | ||||
| 			 | ||||
| 		}, | ||||
| 		brick = { | ||||
| 			name = "brickblock", | ||||
| 			base_node = "default:brick", | ||||
| 			description = " Brick Block", | ||||
| 			tiles = {"unifiedbricks_brickblock.png"}, | ||||
| 			overlay_tiles = {{ name = "unifiedbricks_mortar.png", color = "white" }}, | ||||
| 			substring_count = 21, | ||||
| 			substring_short = "bric", | ||||
| 			substring_long = "brick", | ||||
| 		}, | ||||
| 		brick_multicolor_dark = { | ||||
| 			name = "brickblock_multicolor_dark", | ||||
| 			base_node = "unifiedbricks:brick_multicolor_dark", | ||||
| 			base_name = "brick_multicolor_dark", | ||||
| 			description = " Brick Block (dark multicolor)", | ||||
| 			tiles = {"unifiedbricks_brickblock_multicolor_dark.png"}, | ||||
| 			overlay_tiles = {{ name = "unifiedbricks_mortar2.png", color = "white" }}, | ||||
| 			substring_count = 39, | ||||
| 			substring_short = "brick_multicolor_da", | ||||
| 			substring_long = "brick_multicolor_dar", | ||||
| 		}, | ||||
| 		brick_multicolor_medium = { | ||||
| 			name = "brickblock_multicolor_medium", | ||||
| 			base_node = "unifiedbricks:brick_multicolor_medium", | ||||
| 			base_name = "brick_multicolor_medium", | ||||
| 			description = " Brick Block (medium multicolor)", | ||||
| 			tiles = {"unifiedbricks_brickblock_multicolor_medium.png"}, | ||||
| 			overlay_tiles = {{ name = "unifiedbricks_mortar3.png", color = "white" }}, | ||||
| 			substring_count = 39, | ||||
| 			substring_short = "brick_multicolor_me", | ||||
| 			substring_long = "brick_multicolor_med", | ||||
| 		}, | ||||
| 		brick_multicolor_light = { | ||||
| 			name = "brickblock_multicolor_light", | ||||
| 			base_node = "unifiedbricks:brick_multicolor_light", | ||||
| 			base_name = "brick_multicolor_light", | ||||
| 			description = " Brick Block (light multicolor)", | ||||
| 			tiles = {"unifiedbricks_brickblock_multicolor_light.png"}, | ||||
| 			overlay_tiles = {{ name = "unifiedbricks_mortar4.png", color = "white" }}, | ||||
| 			substring_count = 39, | ||||
| 			substring_short = "brick_multicolor_li", | ||||
| 			substring_long = "brick_multicolor_lig", | ||||
| 		}, | ||||
| 	} | ||||
|  | ||||
| 	for brick_type, def in pairs(brick_types) do | ||||
| 		local groups2 = table.copy(minetest.registered_items[def.base_node].groups) | ||||
| 		groups2.ud_param2_colorable = 1 | ||||
| 		groups2.not_in_creative_inventory=1 | ||||
|  | ||||
| 		if brick_type == "brick_multicolor_dark" or brick_type == "brick_multicolor_medium" or | ||||
| 		brick_type == "brick_multicolor_light" then | ||||
|  | ||||
| 			stairsplus:register_all( | ||||
| 				"unifiedbricks", | ||||
| 				def.base_name, | ||||
| 				def.base_node, { | ||||
| 					description = def.description, | ||||
| 					tiles = def.tiles, | ||||
| 					overlay_tiles = def.overlay_tiles, | ||||
| 					paramtype = "light", | ||||
| 					groups = groups2, | ||||
| 					sounds = default.node_sound_stone_defaults(), | ||||
| 					sunlight_propagates = true, | ||||
| 			}) | ||||
| 		end | ||||
|  | ||||
| 		for _, color in ipairs(unifieddyes.HUES_WITH_GREY) do | ||||
|  | ||||
| 			stairsplus:register_all( | ||||
| 				"unifiedbricks", | ||||
| 				def.name.."_"..color, | ||||
| 				"unifiedbricks:"..def.name.."_"..color, { | ||||
| 					description = color..def.description, | ||||
| 					tiles = def.tiles, | ||||
| 					overlay_tiles = def.overlay_tiles, | ||||
| 					paramtype = "light", | ||||
| 					paramtype2 = "colorfacedir", | ||||
| 					palette = "unifieddyes_palette_"..color.."s.png", | ||||
| 					on_dig = unifieddyes.on_dig, | ||||
| 					groups = groups2, | ||||
| 					sounds = default.node_sound_stone_defaults(), | ||||
| 					sunlight_propagates = true, | ||||
| 			}) | ||||
| 		end | ||||
| 	end | ||||
|  | ||||
| 	for _, i in pairs(minetest.registered_nodes) do | ||||
| 		for brick_type, def in pairs(brick_types) do | ||||
|  | ||||
| 			local chk = string.sub(i.name, 1, def.substring_count) | ||||
| 			local sub_type = "unifiedbricks:" | ||||
| 			if brick_type == "stonebrick" or brick_type == "brick" then | ||||
| 				sub_type = "moreblocks:" | ||||
| 			end | ||||
|  | ||||
| 			if chk == sub_type.."stair_"..def.substring_short | ||||
| 				or chk == sub_type.."slab_"..def.substring_long | ||||
| 				or chk == sub_type.."panel_"..def.substring_short | ||||
| 				or chk == sub_type.."micro_"..def.substring_short | ||||
| 			or chk == sub_type.."slope_"..def.substring_short then | ||||
|  | ||||
| 				local groups2 = table.copy(minetest.registered_items[i.name].groups) | ||||
| 				groups2.ud_param2_colorable = 1 | ||||
| 				groups2.not_in_creative_inventory=1 | ||||
| 			 | ||||
| 				local class, shape = get_class_shape(brick_type, i.name) | ||||
|  | ||||
| 				minetest.override_item(i.name, { | ||||
| 					groups = groups2, | ||||
| 					paramtype2 = "colorfacedir", | ||||
| 					palette = "unifieddyes_palette_greys.png", | ||||
| 					airbrush_replacement_node = "unifiedbricks:"..class.."_"..def.name.."_grey"..shape, | ||||
| 					drop = sub_type..class.."_"..brick_type..shape, -- Fix drop | ||||
| 				}) | ||||
|  | ||||
| 				unifieddyes.register_color_craft({ | ||||
| 					output_prefix = "unifiedbricks:"..class.."_"..def.name.."_", | ||||
| 					output_suffix = shape, | ||||
| 					palette = "split", | ||||
| 					type = "shapeless", | ||||
| 					neutral_node = i.name, | ||||
| 					recipe = { | ||||
| 						"NEUTRAL_NODE", | ||||
| 						"MAIN_DYE", | ||||
| 					} | ||||
| 				}) | ||||
|  | ||||
| 				-- Old colouredstonebricks stairsplus nodes list | ||||
| 				if brick_type == "stonebrick" then | ||||
| 					for _, color in ipairs(old_colors) do | ||||
| 						table.insert(unifiedbricks.old_colouredstonebrick_list, | ||||
| 										 "colouredstonebricks:"..class.."_"..color..shape) | ||||
| 					end | ||||
| 				end | ||||
| 			end | ||||
| 		end | ||||
| 	end | ||||
| end | ||||
|  | ||||
| -- static nodes | ||||
|  | ||||
| unifiedbricks.register_old_static_block = function(name, formalname, blocktype) | ||||
| @@ -292,12 +550,16 @@ table.insert(unifiedbricks.old_static_list, "unifiedbricks:multicolor_darkgrey") | ||||
| table.insert(unifiedbricks.old_static_list, "unifiedbricks:multicolor_grey") | ||||
| table.insert(unifiedbricks.old_static_list, "unifiedbricks:multicolor_lightgrey") | ||||
|  | ||||
| for _, color in ipairs(old_colors) do | ||||
| 	table.insert(unifiedbricks.old_colouredstonebrick_list, "colouredstonebricks:"..color) | ||||
| end | ||||
|  | ||||
| --REGISTERS ALL STATIC NODES EXCEPT MULTICOLOR BRICK BLOCKS | ||||
| for i = 1,17 do | ||||
| 	for j = 1,4 do | ||||
| 		if i > 12 then | ||||
| 			formalname = FORMALHUES[i] | ||||
| 			name = HUES[i] | ||||
| 			local formalname = FORMALHUES[i] | ||||
| 			local name = HUES[i] | ||||
| 			if j == 1 then | ||||
| 				unifiedbricks.register_old_static_block(name, formalname, "clayblock") | ||||
| 			elseif j == 4 then | ||||
| @@ -305,6 +567,7 @@ for i = 1,17 do | ||||
| 			end | ||||
| 		else | ||||
| 			for k = 1,4 do | ||||
| 				local formalname, name | ||||
| 				if k == 4 then | ||||
| 					formalname = FORMALDARKNESS[k] .. FORMALHUES[i] | ||||
| 					name = DARKNESS[k] .. HUES[i] | ||||
| @@ -332,51 +595,118 @@ end | ||||
| -- convert in-map static nodes to use param2 coloring | ||||
|  | ||||
| minetest.register_lbm({ | ||||
| 	name = "unifiedbricks:convert_brickblocks", | ||||
| 	label = "Convert clay blocks and single-color brick blocks to use param2 color", | ||||
| 	name = "unifiedbricks:convert_colouredstonebrick", | ||||
| 	label = "Convert coloured stone bricks to use param2 color", | ||||
| 	run_at_every_load = false, | ||||
| 	nodenames = unifiedbricks.old_static_list, | ||||
| 	nodenames = unifiedbricks.old_colouredstonebrick_list, | ||||
| 	action = function(pos, node) | ||||
|  | ||||
| 		local name = node.name | ||||
| 		local t = string.find(name, "_") | ||||
| 		local type = string.sub(name, 1, t - 1) | ||||
| 		local color1 = string.sub(name, t + 1) | ||||
|  | ||||
| 		local color2 = string.gsub(color1, "grey", "_grey") | ||||
| 		if color2 == "_grey" then color2 = "grey" end | ||||
| 		local a = string.find(name, ":") | ||||
| 		local b = string.find(name, "_") or 0 | ||||
|  | ||||
| 		local paletteidx, hue = unifieddyes.getpaletteidx("unifieddyes:"..color2, "extended") | ||||
| 		local colorclass = string.sub(name, a+1) | ||||
| 		if b > 0 then | ||||
| 			colorclass = string.sub(name, a+1, b-1) | ||||
| 		end | ||||
| 		local class = "" | ||||
| 		local color = "" | ||||
| 		local shape = "" | ||||
|  | ||||
| 		if colorclass == "stair" or colorclass == "slab" or class == "panel" or | ||||
| 		colorclass == "micro" or colorclass == "slope" then | ||||
| 			class = colorclass | ||||
| 			local colorshape = string.sub(name, b+1) | ||||
| 			local c,d = string.find(colorshape, "dark_") | ||||
| 			if not c then c = 0 end | ||||
| 			if not d then d = 0 end | ||||
| 			local colshapetemp = string.sub(colorshape, d+1) | ||||
| 			c = string.find(colshapetemp, "_") or 0 | ||||
| 			shape = string.sub(colshapetemp, c) | ||||
| 			if colshapetemp == shape then | ||||
| 				shape = "" | ||||
| 				color = colorshape | ||||
| 			else | ||||
| 				c,d = string.find(colorshape, shape) | ||||
| 				color = string.sub(colorshape, 1, c-1) | ||||
| 			end | ||||
| 		else | ||||
| 			color = string.sub(name, a+1) | ||||
| 		end | ||||
|  | ||||
| 		local old_param2 = minetest.get_node(pos).param2 | ||||
| 		local palette = "extended" | ||||
| 		if class ~= "" then | ||||
| 			palette = "split" | ||||
| 			class = class.."_" | ||||
| 		end | ||||
| 		if color == "dark_pink" then color = "magenta" end | ||||
| 		if color == "purple" then color = "violet" end | ||||
| 		 | ||||
| 		local paletteidx, hue = unifieddyes.getpaletteidx("unifieddyes:"..color, palette) | ||||
| 		if not paletteidx or not hue then return end | ||||
|  | ||||
| 		if string.find(type, "multicolor") then | ||||
|  | ||||
| 			local newpalette = (hue*8)+1 | ||||
| 			local shade | ||||
|  | ||||
| 			if string.find(name, "dark") then | ||||
| 				shade = "dark" | ||||
| 			elseif string.find(name, "medium") | ||||
| 					or name == "unifiedbricks:multicolor_grey" then | ||||
| 				shade = "medium" | ||||
| 		if palette ~= "extended" and color ~= "" then | ||||
| 			color = "_"..color | ||||
| 		else | ||||
| 				shade = "light" | ||||
| 			end | ||||
| 			if string.find(name, "grey") then | ||||
| 				newpalette = 2 | ||||
| 			color = "" | ||||
| 		end | ||||
|  | ||||
| 			minetest.set_node(pos, { name = "unifiedbricks:brickblock_multicolor_"..shade, param2 = newpalette }) | ||||
|  | ||||
| 		elseif string.find(type, "brickblock") then | ||||
| 			minetest.set_node(pos, { name = "unifiedbricks:brickblock", param2 = paletteidx }) | ||||
| 		elseif string.find(type, "clayblock") then | ||||
| 			minetest.set_node(pos, { name = "unifiedbricks:clayblock", param2 = paletteidx }) | ||||
| 		if color == "_black" or color == "_white" or color == "_dark_grey" then | ||||
| 			color = "_grey" | ||||
| 		end | ||||
| 		local meta = minetest.get_meta(pos) | ||||
| 		meta:set_string("dye", "unifieddyes:"..color1) | ||||
| 		meta:set_string("palette", "ext") | ||||
|  | ||||
| 		minetest.set_node(pos, { name = "unifiedbricks:"..class.."stonebrick"..color..shape, param2 = paletteidx+old_param2 }) | ||||
| 	end | ||||
| }) | ||||
| 	 | ||||
| --minetest.register_lbm({ | ||||
| --	name = "unifiedbricks:convert_brickblocks", | ||||
| --	label = "Convert clay blocks and single-color brick blocks to use param2 color", | ||||
| --	run_at_every_load = false, | ||||
| --	nodenames = unifiedbricks.old_static_list, | ||||
| --	action = function(pos, node) | ||||
| -- | ||||
| --		local name = node.name | ||||
| --		local t = string.find(name, "_") | ||||
| --		local type = string.sub(name, 1, t - 1) | ||||
| --		local color1 = string.sub(name, t + 1) | ||||
| -- | ||||
| --		local color2 = string.gsub(color1, "grey", "_grey") | ||||
| --		if color2 == "_grey" then color2 = "grey" end | ||||
| -- | ||||
| --		local paletteidx, hue = unifieddyes.getpaletteidx("unifieddyes:"..color2, "extended") | ||||
| --		if not paletteidx or not hue then return end | ||||
| -- | ||||
| --		if string.find(type, "multicolor") then | ||||
| -- | ||||
| --			local newpalette = (hue*8)+1 | ||||
| --			local shade | ||||
| -- | ||||
| --			if string.find(name, "dark") then | ||||
| --				shade = "dark" | ||||
| --			elseif string.find(name, "medium") | ||||
| --					or name == "unifiedbricks:multicolor_grey" then | ||||
| --				shade = "medium" | ||||
| --			else | ||||
| --				shade = "light" | ||||
| --			end | ||||
| --			if string.find(name, "grey") then | ||||
| --				newpalette = 2 | ||||
| --			end | ||||
| -- | ||||
| --			minetest.set_node(pos, { name = "unifiedbricks:brickblock_multicolor_"..shade, param2 = newpalette }) | ||||
| -- | ||||
| --		elseif string.find(type, "brickblock") then | ||||
| --			minetest.set_node(pos, { name = "unifiedbricks:brickblock", param2 = paletteidx }) | ||||
| --		elseif string.find(type, "clayblock") then | ||||
| --			minetest.set_node(pos, { name = "unifiedbricks:clayblock", param2 = paletteidx }) | ||||
| --		end | ||||
| --		local meta = minetest.get_meta(pos) | ||||
| --		meta:set_string("dye", "unifieddyes:"..color1) | ||||
| --		meta:set_string("palette", "ext") | ||||
| --	end | ||||
| --}) | ||||
|  | ||||
| print("[UnifiedBricks] Loaded!") | ||||
|   | ||||
							
								
								
									
										3
									
								
								mod.conf
									
									
									
									
									
								
							
							
						
						| @@ -1 +1,4 @@ | ||||
| name = unifiedbricks | ||||
| description = This mod allows the user to re-color default bricks using Unified Dyes, and provides some pattern variations as well. | ||||
| depends = default, bucket, unifieddyes, vessels | ||||
| optional_depends = moreblocks | ||||
|   | ||||
							
								
								
									
										
											BIN
										
									
								
								textures/colouredstonebricks_white.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| After Width: | Height: | Size: 238 B | 
| Before Width: | Height: | Size: 118 B After Width: | Height: | Size: 234 B | 
| Before Width: | Height: | Size: 389 B After Width: | Height: | Size: 264 B | 
| Before Width: | Height: | Size: 247 B After Width: | Height: | Size: 170 B | 
| Before Width: | Height: | Size: 247 B After Width: | Height: | Size: 170 B | 
| Before Width: | Height: | Size: 247 B After Width: | Height: | Size: 170 B | 
| Before Width: | Height: | Size: 247 B After Width: | Height: | Size: 170 B |