2017-07-07 17:52:28 +03:00
|
|
|
-- Glass nodes
|
2019-03-08 00:40:43 +02:00
|
|
|
local S = minetest.get_translator("mcl_core")
|
2019-03-24 11:31:58 +02:00
|
|
|
local mod_doc = minetest.get_modpath("doc")
|
2017-07-07 17:52:28 +03:00
|
|
|
|
2017-07-07 17:37:05 +03:00
|
|
|
minetest.register_node("mcl_core:glass", {
|
2019-03-08 00:40:43 +02:00
|
|
|
description = S("Glass"),
|
2019-03-09 18:01:36 +02:00
|
|
|
_doc_items_longdesc = S("A decorative and mostly transparent block."),
|
2017-07-07 17:37:05 +03:00
|
|
|
drawtype = "glasslike",
|
|
|
|
is_ground_content = false,
|
|
|
|
tiles = {"default_glass.png"},
|
|
|
|
paramtype = "light",
|
|
|
|
sunlight_propagates = true,
|
|
|
|
stack_max = 64,
|
|
|
|
groups = {handy=1, glass=1, building_block=1, material_glass=1},
|
|
|
|
sounds = mcl_sounds.node_sound_glass_defaults(),
|
|
|
|
drop = "",
|
2020-04-15 14:27:29 +03:00
|
|
|
_mcl_blast_resistance = 0.3,
|
2017-07-07 17:37:05 +03:00
|
|
|
_mcl_hardness = 0.3,
|
2020-11-02 20:09:23 +02:00
|
|
|
_mcl_silk_touch_drop = true,
|
2017-07-07 17:37:05 +03:00
|
|
|
})
|
|
|
|
|
|
|
|
------------------------
|
2021-05-23 01:09:07 +03:00
|
|
|
-- Create Color Glass --
|
2017-07-07 17:37:05 +03:00
|
|
|
------------------------
|
2019-03-24 11:51:45 +02:00
|
|
|
local canonical_color = "yellow"
|
2019-03-24 11:31:58 +02:00
|
|
|
function mcl_core.add_stained_glass(desc, recipeitem, colorgroup, color)
|
2017-07-07 17:37:05 +03:00
|
|
|
|
2019-03-24 11:31:58 +02:00
|
|
|
local longdesc, create_entry, entry_name
|
|
|
|
if mod_doc then
|
|
|
|
if color == canonical_color then
|
|
|
|
longdesc = S("Stained glass is a decorative and mostly transparent block which comes in various different colors.")
|
|
|
|
entry_name = S("Stained Glass")
|
|
|
|
else
|
|
|
|
create_entry = false
|
|
|
|
end
|
|
|
|
end
|
2017-07-07 17:37:05 +03:00
|
|
|
minetest.register_node("mcl_core:glass_"..color, {
|
|
|
|
description = desc,
|
2019-03-24 11:31:58 +02:00
|
|
|
_doc_items_create_entry = create_entry,
|
|
|
|
_doc_items_entry_name = entry_name,
|
|
|
|
_doc_items_longdesc = longdesc,
|
2017-07-07 17:37:05 +03:00
|
|
|
drawtype = "glasslike",
|
|
|
|
is_ground_content = false,
|
2017-07-17 19:14:11 +03:00
|
|
|
tiles = {"mcl_core_glass_"..color..".png"},
|
2017-07-07 17:37:05 +03:00
|
|
|
paramtype = "light",
|
2019-01-30 05:54:30 +02:00
|
|
|
sunlight_propagates = true,
|
2021-02-18 11:39:19 +02:00
|
|
|
use_texture_alpha = minetest.features.use_texture_alpha_string_modes and "blend" or true,
|
2017-07-07 17:37:05 +03:00
|
|
|
stack_max = 64,
|
|
|
|
-- TODO: Add color to groups
|
|
|
|
groups = {handy=1, glass=1, building_block=1, material_glass=1},
|
|
|
|
sounds = mcl_sounds.node_sound_glass_defaults(),
|
|
|
|
drop = "",
|
2020-04-15 14:27:29 +03:00
|
|
|
_mcl_blast_resistance = 0.3,
|
2017-07-07 17:37:05 +03:00
|
|
|
_mcl_hardness = 0.3,
|
2020-11-02 20:09:23 +02:00
|
|
|
_mcl_silk_touch_drop = true,
|
2017-07-07 17:37:05 +03:00
|
|
|
})
|
2021-05-23 01:09:07 +03:00
|
|
|
|
2017-07-07 17:37:05 +03:00
|
|
|
minetest.register_craft({
|
|
|
|
output = 'mcl_core:glass_'..color..' 8',
|
|
|
|
recipe = {
|
|
|
|
{'mcl_core:glass','mcl_core:glass','mcl_core:glass'},
|
|
|
|
{'mcl_core:glass',recipeitem,'mcl_core:glass'},
|
|
|
|
{'mcl_core:glass','mcl_core:glass','mcl_core:glass'},
|
|
|
|
}
|
|
|
|
})
|
2019-03-24 11:31:58 +02:00
|
|
|
|
|
|
|
if mod_doc and color ~= canonical_color then
|
|
|
|
doc.add_entry_alias("nodes", "mcl_core:glass_"..canonical_color, "nodes", "mcl_core:glass_"..color)
|
|
|
|
end
|
|
|
|
|
2017-07-07 17:37:05 +03:00
|
|
|
end
|
|
|
|
|
|
|
|
---- colored glass
|
2019-03-24 11:31:58 +02:00
|
|
|
mcl_core.add_stained_glass( S("Red Stained Glass"), "mcl_dye:red", "basecolor_red", "red")
|
|
|
|
mcl_core.add_stained_glass( S("Green Stained Glass"), "mcl_dye:dark_green", "unicolor_dark_green", "green")
|
|
|
|
mcl_core.add_stained_glass( S("Blue Stained Glass"), "mcl_dye:blue", "basecolor_blue", "blue")
|
|
|
|
mcl_core.add_stained_glass( S("Light Blue Stained Glass"), "mcl_dye:lightblue", "unicolor_light_blue", "light_blue")
|
|
|
|
mcl_core.add_stained_glass( S("Black Stained Glass"), "mcl_dye:black", "basecolor_black", "black")
|
|
|
|
mcl_core.add_stained_glass( S("White Stained Glass"), "mcl_dye:white", "basecolor_white", "white")
|
|
|
|
mcl_core.add_stained_glass( S("Yellow Stained Glass"), "mcl_dye:yellow", "basecolor_yellow", "yellow")
|
|
|
|
mcl_core.add_stained_glass( S("Brown Stained Glass"), "mcl_dye:brown", "unicolor_dark_orange", "brown")
|
|
|
|
mcl_core.add_stained_glass( S("Orange Stained Glass"), "mcl_dye:orange", "excolor_orange", "orange")
|
|
|
|
mcl_core.add_stained_glass( S("Pink Stained Glass"), "mcl_dye:pink", "unicolor_light_red", "pink")
|
|
|
|
mcl_core.add_stained_glass( S("Grey Stained Glass"), "mcl_dye:dark_grey", "unicolor_darkgrey", "gray")
|
|
|
|
mcl_core.add_stained_glass( S("Lime Stained Glass"), "mcl_dye:green", "basecolor_green", "lime")
|
|
|
|
mcl_core.add_stained_glass( S("Light Grey Stained Glass"), "mcl_dye:grey", "basecolor_grey", "silver")
|
|
|
|
mcl_core.add_stained_glass( S("Magenta Stained Glass"), "mcl_dye:magenta", "basecolor_magenta", "magenta")
|
|
|
|
mcl_core.add_stained_glass( S("Purple Stained Glass"), "mcl_dye:violet", "excolor_violet", "purple")
|
|
|
|
mcl_core.add_stained_glass( S("Cyan Stained Glass"), "mcl_dye:cyan", "basecolor_cyan", "cyan")
|