Formatting clean-up

This commit is contained in:
random-geek 2020-09-18 15:48:22 -07:00
parent d9a155d71a
commit 8e75f3e927
5 changed files with 191 additions and 79 deletions

@ -5,7 +5,7 @@ function morelights.register_variants(variants, fixedDef)
local name = variant.name
local def = table.copy(fixedDef)
for k,v in pairs(variant) do
for k, v in pairs(variant) do
if k ~= "name" then
def[k] = v
end
@ -15,7 +15,8 @@ function morelights.register_variants(variants, fixedDef)
end
end
function morelights.on_place_hanging(itemstack, placer, pointed_thing, replaceName)
function morelights.on_place_hanging(itemstack, placer, pointed_thing,
replaceName)
local ceiling = minetest.get_node(vector.add(pointed_thing.above,
{x=0, y=1, z=0}))
@ -24,10 +25,10 @@ function morelights.on_place_hanging(itemstack, placer, pointed_thing, replaceNa
and not (placer and placer:get_player_control().sneak) then
local name = itemstack:get_name()
local fakestack = itemstack
fakestack:set_name(replaceName)
local fakeStack = itemstack
fakeStack:set_name(replaceName)
minetest.item_place(fakestack, placer, pointed_thing, 0)
minetest.item_place(fakeStack, placer, pointed_thing, 0)
itemstack:set_name(name)
return itemstack
@ -38,7 +39,8 @@ function morelights.on_place_hanging(itemstack, placer, pointed_thing, replaceNa
end
function morelights.rotate_and_place(itemstack, placer, pointed_thing, lookup)
local dir = minetest.dir_to_wallmounted(vector.subtract(pointed_thing.under, pointed_thing.above))
local dir = minetest.dir_to_wallmounted(
vector.subtract(pointed_thing.under, pointed_thing.above))
local fDirs = lookup or {[0] = 20, 0, 16, 12, 8, 4}
minetest.item_place(itemstack, placer, pointed_thing, fDirs[dir] or 0)
return itemstack

@ -4,22 +4,30 @@ minetest.register_craftitem("morelights:bulb", {
})
morelights.register_variants({
{name = "morelights:pole_d", description = "Metal Pole (dark)",
{
name = "morelights:pole_d",
description = "Metal Pole (dark)",
tiles = {"morelights_metal_dark_32.png"},
inventory_image = "morelights_pole_d_inv.png",
wield_image = "morelights_pole_d_inv.png",
on_place = function(itemstack, placer, pointed_thing)
return morelights.on_place_hanging(itemstack, placer, pointed_thing,
"morelights:pole_ceiling_d")
end},
{name = "morelights:pole_l", description = "Metal Pole (light)",
return morelights.on_place_hanging(itemstack, placer,
pointed_thing, "morelights:pole_ceiling_d")
end
},
{
name = "morelights:pole_l",
description = "Metal Pole (light)",
tiles = {"morelights_metal_light_32.png"},
inventory_image = "morelights_pole_l_inv.png",
wield_image = "morelights_pole_l_inv.png",
on_place = function(itemstack, placer, pointed_thing)
return morelights.on_place_hanging(itemstack, placer, pointed_thing,
"morelights:pole_ceiling_l")
end}
return morelights.on_place_hanging(itemstack, placer,
pointed_thing, "morelights:pole_ceiling_l")
end
}
},
{
drawtype = "nodebox",
@ -41,10 +49,16 @@ morelights.register_variants({
})
morelights.register_variants({
{name = "morelights:pole_ceiling_d",
tiles = {"morelights_metal_dark_32.png"}, drop = "morelights:pole_d"},
{name = "morelights:pole_ceiling_l",
tiles = {"morelights_metal_light_32.png"}, drop = "morelights:pole_l"}
{
name = "morelights:pole_ceiling_d",
tiles = {"morelights_metal_dark_32.png"},
drop = "morelights:pole_d"
},
{
name = "morelights:pole_ceiling_l",
tiles = {"morelights_metal_light_32.png"},
drop = "morelights:pole_l"
}
},
{
drawtype = "nodebox",
@ -68,22 +82,29 @@ morelights.register_variants({
})
morelights.register_variants({
{name = "morelights:chain_d", description = "Metal Chain (dark)",
{
name = "morelights:chain_d",
description = "Metal Chain (dark)",
tiles = {"morelights_metal_dark_32.png"},
inventory_image = "morelights_chain_d_inv.png",
wield_image = "morelights_chain_d_inv.png",
on_place = function(itemstack, placer, pointed_thing)
return morelights.on_place_hanging(itemstack, placer, pointed_thing,
"morelights:chain_ceiling_d")
end},
{name = "morelights:chain_l", description = "Metal Chain (light)",
{
name = "morelights:chain_l",
description = "Metal Chain (light)",
tiles = {"morelights_metal_light_32.png"},
inventory_image = "morelights_chain_l_inv.png",
wield_image = "morelights_chain_l_inv.png",
on_place = function(itemstack, placer, pointed_thing)
return morelights.on_place_hanging(itemstack, placer, pointed_thing,
"morelights:chain_ceiling_l")
end}
end
}
},
{
drawtype = "mesh",
@ -103,10 +124,16 @@ morelights.register_variants({
})
morelights.register_variants({
{name = "morelights:chain_ceiling_d",
tiles = {"morelights_metal_dark_32.png"}, drop = "morelights:chain_d"},
{name = "morelights:chain_ceiling_l",
tiles = {"morelights_metal_light_32.png"}, drop = "morelights:chain_l"}
{
name = "morelights:chain_ceiling_d",
tiles = {"morelights_metal_dark_32.png"},
drop = "morelights:chain_d"
},
{
name = "morelights:chain_ceiling_l",
tiles = {"morelights_metal_light_32.png"},
drop = "morelights:chain_l"
}
},
{
drawtype = "mesh",

@ -9,8 +9,10 @@ minetest.register_node("morelights_extras:f_block", {
minetest.register_node("morelights_extras:dirt_with_grass", {
description = "Grass Light",
tiles = {"default_grass.png^morelights_extras_blocklight.png",
"default_dirt.png", "default_dirt.png^default_grass_side.png"},
tiles = {
"default_grass.png^morelights_extras_blocklight.png",
"default_dirt.png", "default_dirt.png^default_grass_side.png"
},
paramtype = "light",
light_source = 12,
groups = {cracky = 2, oddly_breakable_by_hand = 3},
@ -49,7 +51,7 @@ minetest.register_node("morelights_extras:stairlight", {
walkable = false,
tiles = {"morelights_metal_dark.png"},
overlay_tiles = {"", "morelights_extras_stairlight.png",
"", "", "morelights_extras_stairlight.png"},
"", "", "morelights_extras_stairlight.png"},
inventory_image = "morelights_extras_stairlight_inv.png",
wield_image = "morelights_extras_stairlight_inv.png",
paramtype = "light",

@ -14,9 +14,12 @@ minetest.register_node("morelights_modern:smallblock", {
type = "fixed",
fixed = {-1/4, -1/2, -1/4, 1/4, 0, 1/4}
},
tiles = {"morelights_metal_dark.png^morelights_modern_smallblock.png",
tiles = {
"morelights_metal_dark.png^morelights_modern_smallblock.png",
"[combine:16x16:0,0=morelights_metal_dark.png:0,4=morelights_modern_smallblock.png"},
"morelights_metal_dark.png^morelights_modern_smallblock.png",
"[combine:16x16:0,0=morelights_metal_dark.png" ..
":0,4=morelights_modern_smallblock.png"
},
paramtype = "light",
paramtype2 = "facedir",
light_source = 12,
@ -29,12 +32,24 @@ minetest.register_node("morelights_modern:smallblock", {
})
morelights.register_variants({
{name = "morelights_modern:post_d", description = "Modern Post Light (dark)",
tiles = {"morelights_metal_dark.png", "morelights_metal_dark.png",
"morelights_metal_dark.png^morelights_modern_post.png"}},
{name = "morelights_modern:post_l", description = "Modern Post Light (light)",
tiles = {"morelights_metal_light.png", "morelights_metal_light.png",
"morelights_metal_light.png^morelights_modern_post.png"}}
{
name = "morelights_modern:post_d",
description = "Modern Post Light (dark)",
tiles = {
"morelights_metal_dark.png",
"morelights_metal_dark.png",
"morelights_metal_dark.png^morelights_modern_post.png"
}
},
{
name = "morelights_modern:post_l",
description = "Modern Post Light (light)",
tiles = {
"morelights_metal_light.png",
"morelights_metal_light.png",
"morelights_metal_light.png^morelights_modern_post.png"
}
}
},
{
drawtype = "nodebox",
@ -49,12 +64,16 @@ morelights.register_variants({
})
morelights.register_variants({
{name = "morelights_modern:streetpost_d",
{
name = "morelights_modern:streetpost_d",
description = "Street Lamp Post (dark)--connects to bar lights",
tiles = {"morelights_metal_dark.png"}},
{name = "morelights_modern:streetpost_l",
tiles = {"morelights_metal_dark.png"}
},
{
name = "morelights_modern:streetpost_l",
description = "Street Lamp Post (light)--connects to bar lights",
tiles = {"morelights_metal_light.png"}}
tiles = {"morelights_metal_light.png"}
}
},
{
drawtype = "nodebox",
@ -66,7 +85,10 @@ morelights.register_variants({
connect_back = {-1/16, 3/8, 1/16, 1/16, 7/16, 1/2},
connect_right = {1/16, 3/8, -1/16, 1/2, 7/16, 1/16},
},
connects_to = {"morelights_modern:barlight_c", "morelights_modern:barlight_s"},
connects_to = {
"morelights_modern:barlight_c",
"morelights_modern:barlight_s"
},
paramtype = "light",
groups = {cracky = 2, oddly_breakable_by_hand = 3},
sounds = default.node_sound_metal_defaults(),
@ -83,10 +105,17 @@ minetest.register_node("morelights_modern:barlight_c", {
connect_back = {-1/8, 3/8, 1/8, 1/8, 1/2, 1/2},
connect_right = {1/8, 3/8, -1/8, 1/2, 1/2, 1/8},
},
connects_to = {"morelights_modern:barlight_c", "morelights_modern:barlight_s",
"morelights_modern:streetpost_d", "morelights_modern:streetpost_l"},
tiles = {"morelights_metal_dark.png", "morelights_modern_barlight.png",
"morelights_metal_dark.png"},
connects_to = {
"morelights_modern:barlight_c",
"morelights_modern:barlight_s",
"morelights_modern:streetpost_d",
"morelights_modern:streetpost_l"
},
tiles = {
"morelights_metal_dark.png",
"morelights_modern_barlight.png",
"morelights_metal_dark.png"
},
paramtype = "light",
light_source = LIGHT_MAX,
groups = {cracky = 2, oddly_breakable_by_hand = 3},
@ -100,8 +129,11 @@ minetest.register_node("morelights_modern:barlight_s", {
type = "fixed",
fixed = {-1/2, 3/8, -1/8, 1/2, 1/2, 1/8},
},
tiles = {"morelights_metal_dark.png", "morelights_modern_barlight.png",
"morelights_metal_dark.png"},
tiles = {
"morelights_metal_dark.png",
"morelights_modern_barlight.png",
"morelights_metal_dark.png"
},
paramtype = "light",
paramtype2 = "facedir",
light_source = LIGHT_MAX,
@ -116,8 +148,10 @@ minetest.register_node("morelights_modern:ceilinglight", {
type = "fixed",
fixed = {-1/4, 3/8, -1/4, 1/4, 1/2, 1/4}
},
tiles = {"morelights_metal_dark.png",
"morelights_metal_dark.png^morelights_modern_block.png"},
tiles = {
"morelights_metal_dark.png",
"morelights_metal_dark.png^morelights_modern_block.png"
},
paramtype = "light",
paramtype2 = "facedir",
light_source = LIGHT_MAX,
@ -131,12 +165,16 @@ minetest.register_node("morelights_modern:ceilinglight", {
})
morelights.register_variants({
{name = "morelights_modern:canlight_d",
{
name = "morelights_modern:canlight_d",
description = "Modern Can Light (dark)",
tiles = {"morelights_metal_dark.png^morelights_modern_canlight.png"}},
{name = "morelights_modern:canlight_l",
tiles = {"morelights_metal_dark.png^morelights_modern_canlight.png"}
},
{
name = "morelights_modern:canlight_l",
description = "Modern Can Light (light)",
tiles = {"morelights_metal_light.png^morelights_modern_canlight.png"}},
tiles = {"morelights_metal_light.png^morelights_modern_canlight.png"}
},
},
{
drawtype = "mesh",
@ -181,14 +219,21 @@ minetest.register_node("morelights_modern:walllamp", {
})
morelights.register_variants({
{name = "morelights_modern:tablelamp_d",
{
name = "morelights_modern:tablelamp_d",
description = "Modern Table Lamp (dark)",
tiles = {"morelights_metal_light_32.png^morelights_modern_tablelamp_o.png",
"morelights_modern_tablelamp_d.png"}},
{name = "morelights_modern:tablelamp_l",
tiles = {
"morelights_metal_light_32.png^morelights_modern_tablelamp_o.png",
"morelights_modern_tablelamp_d.png"}
},
{
name = "morelights_modern:tablelamp_l",
description = "Modern Table Lamp (light)",
tiles = {"morelights_metal_dark_32.png^morelights_modern_tablelamp_o.png",
"morelights_modern_tablelamp_l.png"}},
tiles = {
"morelights_metal_dark_32.png^morelights_modern_tablelamp_o.png",
"morelights_modern_tablelamp_l.png"
}
},
},
{
drawtype = "mesh",
@ -208,12 +253,20 @@ morelights.register_variants({
})
morelights.register_variants({
{name = "morelights_modern:pathlight_d",
{
name = "morelights_modern:pathlight_d",
description = "Modern Path Light (dark)",
tiles = {"morelights_metal_dark_32.png^morelights_modern_pathlight.png"}},
{name = "morelights_modern:pathlight_l",
tiles = {
"morelights_metal_dark_32.png^morelights_modern_pathlight.png"
}
},
{
name = "morelights_modern:pathlight_l",
description = "Modern Path Light (light)",
tiles = {"morelights_metal_light_32.png^morelights_modern_pathlight.png"}}
tiles = {
"morelights_metal_light_32.png^morelights_modern_pathlight.png"
}
}
},
{
drawtype = "nodebox",

@ -46,19 +46,23 @@ minetest.register_node("morelights_vintage:chain_ceiling_b", {
mesh = "morelights_chain_ceiling.obj",
collision_box = {
type = "fixed",
fixed = {{-3/16, 7/16, -3/16, 3/16, 8/16, 3/16},
{-1/16, -8/16, -1/16, 1/16, 7/16, 1/16}}
fixed = {
{-3/16, 7/16, -3/16, 3/16, 8/16, 3/16},
{-1/16, -8/16, -1/16, 1/16, 7/16, 1/16}
}
},
selection_box = {
type = "fixed",
fixed = {{-3/16, 7/16, -3/16, 3/16, 8/16, 3/16},
{-1/16, -8/16, -1/16, 1/16, 7/16, 1/16}}
fixed = {
{-3/16, 7/16, -3/16, 3/16, 8/16, 3/16},
{-1/16, -8/16, -1/16, 1/16, 7/16, 1/16}
}
},
tiles = {"morelights_vintage_brass_32.png"},
drop = "morelights_vintage:chain_b",
paramtype = "light",
groups = {cracky = 3, oddly_breakable_by_hand = 3,
not_in_creative_inventory = 1, mounted_ceiling = 1},
not_in_creative_inventory = 1, mounted_ceiling = 1},
sounds = default.node_sound_metal_defaults(),
})
@ -78,13 +82,17 @@ minetest.register_node("morelights_vintage:smallblock", {
type = "fixed",
fixed = {-1/4, -1/2, -1/4, 1/4, 0, 1/4}
},
tiles = {"morelights_vintage_block.png", "morelights_vintage_block.png",
"[combine:16x16:0,4=morelights_vintage_block.png"},
tiles = {
"morelights_vintage_block.png",
"morelights_vintage_block.png",
"[combine:16x16:0,4=morelights_vintage_block.png"
},
paramtype = "light",
paramtype2 = "facedir",
light_source = 12,
groups = {cracky = 2, oddly_breakable_by_hand = 3},
sounds = default.node_sound_glass_defaults(),
on_place = function(itemstack, placer, pointed_thing)
return morelights.rotate_and_place(itemstack, placer, pointed_thing)
end,
@ -94,7 +102,10 @@ minetest.register_node("morelights_vintage:lantern_f", {
description = "Vintage Lantern (floor, wall, or ceiling)",
drawtype = "mesh",
mesh = "morelights_vintage_lantern_f.obj",
tiles = {"morelights_vintage_lantern.png", "morelights_metal_dark_32.png"},
tiles = {
"morelights_vintage_lantern.png",
"morelights_metal_dark_32.png"
},
collision_box = {
type = "fixed",
fixed = {-3/16, -1/2, -3/16, 3/16, 1/16, 3/16}
@ -110,7 +121,7 @@ minetest.register_node("morelights_vintage:lantern_f", {
on_place = function(itemstack, placer, pointed_thing)
local wdir = minetest.dir_to_wallmounted(
vector.subtract(pointed_thing.under, pointed_thing.above))
vector.subtract(pointed_thing.under, pointed_thing.above))
local fakestack = itemstack
if wdir == 0 then
@ -151,7 +162,10 @@ minetest.register_node("morelights_vintage:lantern_c", {
minetest.register_node("morelights_vintage:lantern_w", {
drawtype = "mesh",
mesh = "morelights_vintage_lantern_w.obj",
tiles = {"morelights_vintage_lantern.png", "morelights_metal_dark_32.png"},
tiles = {
"morelights_vintage_lantern.png",
"morelights_metal_dark_32.png"
},
collision_box = {
type = "fixed",
fixed = {-3/16, -1/4, -5/16, 3/16, 1/8, 3/16}
@ -175,7 +189,10 @@ minetest.register_node("morelights_vintage:hangingbulb", {
description = "Vintage Hanging Light Bulb",
drawtype = "mesh",
mesh = "morelights_vintage_hangingbulb.obj",
tiles = {"morelights_vintage_hangingbulb.png^[lowpart:50:morelights_metal_dark_32.png"},
tiles = {
"morelights_vintage_hangingbulb.png" ..
"^[lowpart:50:morelights_metal_dark_32.png"
},
inventory_image = "morelights_vintage_hangingbulb_inv.png",
wield_image = "morelights_vintage_hangingbulb_inv.png",
use_texture_alpha = true,
@ -197,10 +214,19 @@ minetest.register_node("morelights_vintage:oillamp", {
description = "Vintage Oil Lamp",
drawtype = "mesh",
mesh = "morelights_vintage_oillamp.obj",
tiles = {{name = "morelights_vintage_oil_flame.png",
animation = {type = "sheet_2d", frames_w = 16, frames_h = 1, frame_length = 0.3}},
tiles = {
{
name = "morelights_vintage_oil_flame.png",
animation = {
type = "sheet_2d",
frames_w = 16,
frames_h = 1,
frame_length = 0.3
}
},
"morelights_vintage_oillamp.png",
"morelights_vintage_brass_32.png"},
"morelights_vintage_brass_32.png"
},
collision_box = {
type = "fixed",
fixed = {-1/8, -1/2, -1/8, 1/8, 1/4, 1/8}
@ -219,8 +245,10 @@ minetest.register_node("morelights_vintage:chandelier", {
description = "Vintage Chandelier",
drawtype = "mesh",
mesh = "morelights_vintage_chandelier.obj",
tiles = {"morelights_vintage_chandelier.png",
"morelights_vintage_brass_32.png^[multiply:#DFDFDF"},
tiles = {
"morelights_vintage_chandelier.png",
"morelights_vintage_brass_32.png^[multiply:#DFDFDF"
},
collision_box = {
type = "fixed",
fixed = {-3/8, -1/2, -3/8, 3/8, 1/2, 3/8}