Skip to content

Commit

Permalink
Formatting clean-up
Browse files Browse the repository at this point in the history
  • Loading branch information
random-geek committed Sep 18, 2020
1 parent d9a155d commit 8e75f3e
Show file tree
Hide file tree
Showing 5 changed files with 191 additions and 79 deletions.
14 changes: 8 additions & 6 deletions morelights/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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}))

Expand All @@ -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
Expand All @@ -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
Expand Down
65 changes: 46 additions & 19 deletions morelights/nodes.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
Expand All @@ -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",
Expand All @@ -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",
Expand Down
8 changes: 5 additions & 3 deletions morelights_extras/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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},
Expand Down Expand Up @@ -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",
Expand Down
123 changes: 88 additions & 35 deletions morelights_modern/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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",
Expand All @@ -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",
Expand All @@ -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(),
Expand All @@ -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},
Expand All @@ -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,
Expand All @@ -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,
Expand All @@ -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",
Expand Down Expand Up @@ -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",
Expand All @@ -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",
Expand Down
Loading

0 comments on commit 8e75f3e

Please sign in to comment.