From dd23d518cb1c57d7b297db88a6f217df2fbb7b85 Mon Sep 17 00:00:00 2001 From: unknown <24964441+wsor4035@users.noreply.github.com> Date: Mon, 25 Apr 2022 21:50:59 -0400 Subject: [PATCH] add hd lighting, as well as fix warnings --- homedecor_common/materials.lua | 2 +- homedecor_lighting/.luacheckrc | 23 ----- homedecor_lighting/init.lua | 157 +++++++++++++++++---------------- homedecor_lighting/mod.conf | 4 +- 4 files changed, 84 insertions(+), 102 deletions(-) delete mode 100644 homedecor_lighting/.luacheckrc diff --git a/homedecor_common/materials.lua b/homedecor_common/materials.lua index f8bbc35e..937f19df 100644 --- a/homedecor_common/materials.lua +++ b/homedecor_common/materials.lua @@ -132,7 +132,7 @@ elseif minetest.get_modpath("hades_core") then diamond = "hades_core:diamond", clay_lump = "hades_core:clay_lump", clay_brick = "hades_core:clay_brick", - + --[[ Since hades doesnt have buckets or water for the user, using dirt from near water to pull the water out diff --git a/homedecor_lighting/.luacheckrc b/homedecor_lighting/.luacheckrc deleted file mode 100644 index 383f28f4..00000000 --- a/homedecor_lighting/.luacheckrc +++ /dev/null @@ -1,23 +0,0 @@ -unused_args = false -allow_defined_top = true -max_comment_line_length = 999 - -read_globals = { - "DIR_DELIM", - "minetest", "core", - "unpack", - "dump", - table = { fields = { "copy", "getn" } }, - "vector", "nodeupdate", - "VoxelManip", "VoxelArea", - "PseudoRandom", "ItemStack", - "default", - "homedecor", - "mesecon", - "unifieddyes", - "screwdriver", -} - -globals = { -} - diff --git a/homedecor_lighting/init.lua b/homedecor_lighting/init.lua index bb548522..20f5f7f6 100644 --- a/homedecor_lighting/init.lua +++ b/homedecor_lighting/init.lua @@ -275,9 +275,11 @@ for brightness_level = 0, 14 do wall_side = { -0.5, -0.5, -0.5, 0, 0.5, 0.5 } }, node_box = glowlight_nodebox.half, - groups = { snappy = 3, ud_param2_colorable = 1, not_in_creative_inventory = nici }, + groups = { snappy = 3, ud_param2_colorable = 1, not_in_creative_inventory = nici, dig_glass=1 }, light_source = brightness_level, - sounds = default.node_sound_glass_defaults(), + _sound_def = { + key = "node_sound_glass_defaults", + }, after_place_node = function(pos, placer, itemstack, pointed_thing) unifieddyes.fix_rotation(pos, placer, itemstack, pointed_thing) end, @@ -341,9 +343,11 @@ for brightness_level = 0, 14 do wall_side = { -0.5, -0.5, -0.5, -0.25, 0.5, 0.5 } }, node_box = glowlight_nodebox.quarter, - groups = { snappy = 3, ud_param2_colorable = 1, not_in_creative_inventory = nici }, + groups = { snappy = 3, ud_param2_colorable = 1, not_in_creative_inventory = nici, dig_glass=1 }, light_source = brightness_level, - sounds = default.node_sound_glass_defaults(), + _sound_def = { + key = "node_sound_glass_defaults", + }, after_place_node = function(pos, placer, itemstack, pointed_thing) unifieddyes.fix_rotation(pos, placer, itemstack, pointed_thing) end, @@ -408,9 +412,11 @@ for brightness_level = 0, 14 do wall_side = { -0.5, -0.25, -0.25, 0, 0.25, 0.25 } }, node_box = glowlight_nodebox.small_cube, - groups = { snappy = 3, ud_param2_colorable = 1, not_in_creative_inventory = nici }, + groups = { snappy = 3, ud_param2_colorable = 1, not_in_creative_inventory = nici, dig_glass=1 }, light_source = brightness_level, - sounds = default.node_sound_glass_defaults(), + _sound_def = { + key = "node_sound_glass_defaults", + }, after_place_node = function(pos, placer, itemstack, pointed_thing) unifieddyes.fix_rotation(pos, placer, itemstack, pointed_thing) end, @@ -440,19 +446,22 @@ for brightness_level = 0, 14 do lighttex = "homedecor_plasma_lamp_off.png" end + local gtex=minetest.get_modpath("default") and "default_gold_block.png" or "[combine:16x16^[noalpha^[colorize:#FFD700" homedecor.register("plasma_lamp_"..brightness_level, { description = S("Plasma Lamp/Light"), drawtype = "mesh", mesh = "plasma_lamp.obj", tiles = { - "default_gold_block.png", + gtex, lighttex }, use_texture_alpha = "blend", light_source = brightness_level, sunlight_propagates = true, groups = {cracky=3, oddly_breakable_by_hand=3, not_in_creative_inventory = nici}, - sounds = default.node_sound_glass_defaults(), + _sound_def = { + key = "node_sound_glass_defaults", + }, on_rightclick = homedecor_lighting.toggle_light, drop = { items = { @@ -476,7 +485,7 @@ for brightness_level = 0, 14 do use_texture_alpha = "blend", inventory_image = "homedecor_ground_lantern_inv.png", wield_image = "homedecor_ground_lantern_inv.png", - groups = {snappy=3, not_in_creative_inventory = nici}, + groups = {snappy=3, not_in_creative_inventory = nici, dig_glass=1}, light_source = brightness_level, selection_box = gl_cbox, walkable = false, @@ -503,7 +512,7 @@ for brightness_level = 0, 14 do use_texture_alpha = "blend", inventory_image = "homedecor_hanging_lantern_inv.png", wield_image = "homedecor_hanging_lantern_inv.png", - groups = {snappy=3, not_in_creative_inventory = nici}, + groups = {snappy=3, not_in_creative_inventory = nici, dig_glass=1}, light_source = brightness_level, selection_box = hl_cbox, walkable = false, @@ -530,7 +539,7 @@ for brightness_level = 0, 14 do use_texture_alpha = "blend", inventory_image = "homedecor_ceiling_lantern_inv.png", description = S("Ceiling Lantern/Light"), - groups = {snappy=3, not_in_creative_inventory = nici}, + groups = {snappy=3, not_in_creative_inventory = nici, dig_glass=1}, light_source = brightness_level, selection_box = cl_cbox, walkable = false, @@ -550,9 +559,11 @@ for brightness_level = 0, 14 do description = S("Lattice lantern/Light (large)"), tiles = { gen_ls_tex_yellow.."^homedecor_lattice_lantern_large_overlay.png" }, use_texture_alpha = "clip", - groups = { snappy = 3, not_in_creative_inventory = nici }, + groups = { snappy = 3, not_in_creative_inventory = nici, dig_glass=1 }, light_source = brightness_level, - sounds = default.node_sound_glass_defaults(), + _sound_def = { + key = "node_sound_glass_defaults", + }, on_rightclick = homedecor_lighting.toggle_light, drop = { items = { @@ -592,9 +603,11 @@ for brightness_level = 0, 14 do fixed = { -0.25, -0.5, -0.25, 0.25, 0, 0.25 } }, use_texture_alpha = "clip", - groups = { snappy = 3, not_in_creative_inventory = nici }, + groups = { snappy = 3, not_in_creative_inventory = nici, dig_glass=1 }, light_source = brightness_level, - sounds = default.node_sound_glass_defaults(), + _sound_def = { + key = "node_sound_glass_defaults", + }, on_place = minetest.rotate_node, on_rightclick = homedecor_lighting.toggle_light, drop = { @@ -630,7 +643,7 @@ for brightness_level = 0, 14 do selection_box = dlamp_cbox, node_box = dlamp_cbox, walkable = false, - groups = {snappy=3, ud_param2_colorable = 1, not_in_creative_inventory = nici}, + groups = {snappy=3, ud_param2_colorable = 1, not_in_creative_inventory = nici, dig_glass=1}, after_place_node = function(pos, placer, itemstack, pointed_thing) unifieddyes.fix_rotation_nsew(pos, placer, itemstack, pointed_thing) end, @@ -661,7 +674,7 @@ for brightness_level = 0, 14 do }, inventory_image = "homedecor_ceiling_lamp_inv.png", light_source = brightness_level, - groups = {snappy=3, not_in_creative_inventory = nici}, + groups = {snappy=3, not_in_creative_inventory = nici, dig_glass=1}, walkable = false, on_rightclick = homedecor_lighting.toggle_light, drop = { @@ -684,7 +697,8 @@ for brightness_level = 0, 14 do fixed = { -0.25, -0.5, -0.25, 0.25, 1.5, 0.25 } } - local wool_brightened = "wool_grey.png^[colorize:#ffffff:"..(brightness_level * 15) + local wool_brightened=(minetest.get_modpath("wool") and "wool_grey.png" or "[combine:16x16^[noalpha6[colorize:#A9A9A9") + .. "^[colorize:#ffffff:"..(brightness_level * 15) homedecor.register("table_lamp_"..brightness_level, { description = S("Table Lamp/Light"), @@ -702,7 +716,9 @@ for brightness_level = 0, 14 do walkable = false, light_source = brightness_level, selection_box = tlamp_cbox, - sounds = default.node_sound_wood_defaults(), + _sound_def = { + key = "node_sound_wood_defaults", + }, groups = {cracky=2,oddly_breakable_by_hand=1, ud_param2_colorable = 1, not_in_creative_inventory=nici }, drop = { items = { @@ -733,7 +749,9 @@ for brightness_level = 0, 14 do light_source = brightness_level, groups = {cracky=2,oddly_breakable_by_hand=1, ud_param2_colorable = 1, not_in_creative_inventory=nici }, selection_box = slamp_cbox, - sounds = default.node_sound_wood_defaults(), + _sound_def = { + key = "node_sound_wood_defaults", + }, on_rotate = minetest.get_modpath("screwdriver") and screwdriver.rotate_simple or nil, --expand = { top="air" }, drop = { @@ -795,10 +813,12 @@ for _, light_brightn_name in ipairs({"off", "on"}) do }, walkable = false, use_texture_alpha = "blend", - light_source = onflag and (default.LIGHT_MAX - 5) or nil, + light_source = onflag and (minetest.LIGHT_MAX - 5) or nil, sunlight_propagates = true, groups = {cracky=3, oddly_breakable_by_hand=3, not_in_creative_inventory = nici}, - sounds = default.node_sound_glass_defaults(), + _sound_def = { + key = "node_sound_glass_defaults", + }, on_rightclick = homedecor_lighting.toggle_light, drop = { items = { @@ -846,7 +866,9 @@ for _, light_brightn_name in ipairs({"off", "on"}) do "group:mesecon_conductor_craftable" }, groups = {cracky=3, oddly_breakable_by_hand=3, not_in_creative_inventory = nici_m}, - sounds = default.node_sound_stone_defaults(), + _sound_def = { + key = "node_sound_stone_defaults", + }, drop = { items = { {items = {"homedecor:rope_light_on_floor_"..di} }, @@ -892,7 +914,9 @@ for _, light_brightn_name in ipairs({"off", "on"}) do "group:mesecon_conductor_craftable" }, groups = {cracky=3, oddly_breakable_by_hand=3, not_in_creative_inventory = nici_m}, - sounds = default.node_sound_stone_defaults(), + _sound_def = { + key = "node_sound_stone_defaults", + }, drop = { items = { {items = {"homedecor:rope_light_on_ceiling_"..di}}, @@ -920,8 +944,8 @@ for _, light_brightn_name in ipairs({"off", "on"}) do }, use_texture_alpha = "blend", inventory_image = "homedecor_wall_lamp_inv.png", - groups = {snappy=3, not_in_creative_inventory = nici}, - light_source = onflag and (default.LIGHT_MAX - 3) or nil, + groups = {snappy=3, not_in_creative_inventory = nici, dig_glass=1}, + light_source = onflag and (minetest.LIGHT_MAX - 3) or nil, selection_box = wl_cbox, walkable = false, drop = { @@ -957,8 +981,8 @@ homedecor.register("candle", { selection_box = tc_cbox, walkable = false, use_texture_alpha = "clip", - groups = { snappy = 3 }, - light_source = default.LIGHT_MAX-4, + groups = { snappy = 3, dig_glass=1 }, + light_source = minetest.LIGHT_MAX-4, }) local c_cbox = { @@ -979,8 +1003,8 @@ homedecor.register("candle_thin", { selection_box = c_cbox, walkable = false, use_texture_alpha = "clip", - groups = { snappy = 3 }, - light_source = default.LIGHT_MAX-4, + groups = { snappy = 3, dig_glass=1 }, + light_source = minetest.LIGHT_MAX-4, }) local cs_cbox = { @@ -1002,8 +1026,8 @@ homedecor.register("candlestick_wrought_iron", { selection_box = cs_cbox, walkable = false, use_texture_alpha = "clip", - groups = { snappy = 3 }, - light_source = default.LIGHT_MAX-4, + groups = { snappy = 3, dig_glass=1 }, + light_source = minetest.LIGHT_MAX-4, }) homedecor.register("candlestick_brass", { @@ -1018,8 +1042,8 @@ homedecor.register("candlestick_brass", { selection_box = cs_cbox, walkable = false, use_texture_alpha = "clip", - groups = { snappy = 3 }, - light_source = default.LIGHT_MAX-4, + groups = { snappy = 3, dig_glass=1 }, + light_source = minetest.LIGHT_MAX-4, }) homedecor.register("wall_sconce", { @@ -1038,8 +1062,8 @@ homedecor.register("wall_sconce", { }, walkable = false, use_texture_alpha = "clip", - groups = { snappy = 3 }, - light_source = default.LIGHT_MAX-4, + groups = { snappy = 3, dig_glass=1 }, + light_source = minetest.LIGHT_MAX-4, }) local ol_cbox = { @@ -1064,9 +1088,11 @@ homedecor.register("oil_lamp", { inventory_image = "homedecor_oil_lamp_inv.png", selection_box = ol_cbox, walkable = false, - groups = { snappy = 3 }, - light_source = default.LIGHT_MAX-3, - sounds = default.node_sound_glass_defaults(), + groups = { snappy = 3, dig_glass=1 }, + light_source = minetest.LIGHT_MAX-3, + _sound_def = { + key = "node_sound_glass_defaults", + }, }) homedecor.register("oil_lamp_tabletop", { @@ -1076,9 +1102,11 @@ homedecor.register("oil_lamp_tabletop", { inventory_image = "homedecor_oil_lamp_tabletop_inv.png", selection_box = ol_cbox, collision_box = ol_cbox, - groups = { snappy = 3 }, - light_source = default.LIGHT_MAX-3, - sounds = default.node_sound_glass_defaults(), + groups = { snappy = 3, dig_glass=1 }, + light_source = minetest.LIGHT_MAX-3, + _sound_def = { + key = "node_sound_glass_defaults", + }, }) local topchains_sbox = { @@ -1099,7 +1127,7 @@ minetest.register_node(":homedecor:chain_steel_top", { sunlight_propagates = true, paramtype = "light", inventory_image = "basic_materials_chain_steel_inv.png", - groups = {cracky=3}, + groups = {cracky=3, dig_glass=1}, selection_box = topchains_sbox, }) @@ -1113,7 +1141,7 @@ minetest.register_node(":homedecor:chain_brass_top", { sunlight_propagates = true, paramtype = "light", inventory_image = "basic_materials_chain_brass_inv.png", - groups = {cracky=3}, + groups = {cracky=3, dig_glass=1}, selection_box = topchains_sbox, }) @@ -1140,8 +1168,10 @@ minetest.register_node(":homedecor:chandelier_steel", { drawtype = "mesh", mesh = "homedecor_chandelier.obj", use_texture_alpha = "clip", - groups = {cracky=3}, - sounds = default.node_sound_stone_defaults(), + groups = {cracky=3, dig_glass=1}, + _sound_def = { + key = "node_sound_stone_defaults", + }, }) minetest.register_node(":homedecor:chandelier_brass", { @@ -1167,8 +1197,10 @@ minetest.register_node(":homedecor:chandelier_brass", { drawtype = "mesh", mesh = "homedecor_chandelier.obj", use_texture_alpha = "clip", - groups = {cracky=3}, - sounds = default.node_sound_stone_defaults(), + groups = {cracky=3, dig_glass=1}, + _sound_def = { + key = "node_sound_stone_defaults", + }, }) homedecor.register("torch_wall", { @@ -1196,7 +1228,7 @@ homedecor.register("torch_wall", { fixed = { -0.15, -0.45, 0.15, 0.15,0.35, 0.5 }, }, use_texture_alpha = "clip", - groups = {cracky=3}, + groups = {cracky=3, dig_glass=1}, }) -- table lamps and standing lamps @@ -1817,46 +1849,19 @@ minetest.register_alias("chains:chandelier_steel", "homedecor:chande minetest.register_alias("chains:chandelier_brass", "homedecor:chandelier_brass") minetest.register_alias("homedecor:glowlight_half", "homedecor:glowlight_half_14") -minetest.register_alias("homedecor:glowlight_half_max", "homedecor:glowlight_half_14") - minetest.register_alias("homedecor:glowlight_quarter", "homedecor:glowlight_quarter_14") -minetest.register_alias("homedecor:glowlight_quarter_max", "homedecor:glowlight_quarter_14") - minetest.register_alias("homedecor:glowlight_small_cube", "homedecor:glowlight_small_cube_14") -minetest.register_alias("homedecor:glowlight_small_cube_max", "homedecor:glowlight_small_cube_14") - minetest.register_alias("homedecor:plasma_lamp", "homedecor:plasma_lamp_14") -minetest.register_alias("homedecor:plasma_lamp_max", "homedecor:plasma_lamp_14") - minetest.register_alias("homedecor:ground_lantern", "homedecor:ground_lantern_14") -minetest.register_alias("homedecor:ground_lantern_max", "homedecor:ground_lantern_14") - minetest.register_alias("homedecor:hanging_lantern", "homedecor:hanging_lantern_14") -minetest.register_alias("homedecor:hanging_lantern_max", "homedecor:hanging_lantern_14") - minetest.register_alias("homedecor:ceiling_lantern", "homedecor:ceiling_lantern_14") -minetest.register_alias("homedecor:ceiling_lantern_max", "homedecor:ceiling_lantern_14") - minetest.register_alias("homedecor:lattice_lantern_large", "homedecor:lattice_lantern_large_14") -minetest.register_alias("homedecor:lattice_lantern_large_max", "homedecor:lattice_lantern_large_14") - minetest.register_alias("homedecor:lattice_lantern_small", "homedecor:lattice_lantern_small_14") -minetest.register_alias("homedecor:lattice_lantern_small_max", "homedecor:lattice_lantern_small_14") - minetest.register_alias("homedecor:desk_lamp", "homedecor:desk_lamp_14") -minetest.register_alias("homedecor:desk_lamp_max", "homedecor:desk_lamp_14") - minetest.register_alias("homedecor:ceiling_lamp", "homedecor:ceiling_lamp_14") -minetest.register_alias("homedecor:ceiling_lamp_max", "homedecor:ceiling_lamp_14") - minetest.register_alias("homedecor:table_lamp", "homedecor:table_lamp_14") -minetest.register_alias("homedecor:table_lamp_max", "homedecor:table_lamp_14") - minetest.register_alias("homedecor:standing_lamp", "homedecor:standing_lamp_14") -minetest.register_alias("homedecor:standing_lamp_max", "homedecor:standing_lamp_14") - minetest.register_alias("3dforniture:table_lamp", "homedecor:table_lamp_14") -minetest.register_alias("3dforniture:table_lamp_max", "homedecor:table_lamp_14") minetest.register_alias("3dforniture:torch_wall", "homedecor:torch_wall") minetest.register_alias("torch_wall", "homedecor:torch_wall") diff --git a/homedecor_lighting/mod.conf b/homedecor_lighting/mod.conf index 1e69e386..ce69f665 100644 --- a/homedecor_lighting/mod.conf +++ b/homedecor_lighting/mod.conf @@ -1,4 +1,4 @@ name = homedecor_lighting description = Homedecor mod: lighting -depends = homedecor_common, default, basic_materials, unifieddyes, creative -optional_depends = moreblocks, building_blocks, darkage, mesecons, digilines, screwdriver +depends = homedecor_common +optional_depends = moreblocks, building_blocks, darkage, mesecons, digilines, screwdriver, default, basic_materials, unifieddyes, creative