properly name each lamp by color

This commit is contained in:
Vanessa Ezekowitz 2014-09-30 10:53:10 -04:00
parent 86b6326dcf
commit 4021edd243

View File

@ -390,11 +390,15 @@ minetest.register_node('homedecor:lattice_lantern_small', {
local repl = { off="low", low="med", med="hi", hi="max", max="off", }
local lamp_colors = { "", "blue", "green", "pink", "red", "violet" }
local function reg_lamp(suffix, nxt, desc, tilesuffix, light, color)
local function reg_lamp(suffix, nxt, tilesuffix, light, color)
local lampcolor = "_"..color
if color == "" then lampcolor = "" end
local colordesc = " ("..color..")"
if color == "" then
lampcolor = ""
colordesc = " (white)"
end
minetest.register_node("homedecor:table_lamp"..lampcolor.."_"..suffix, {
description = S(desc),
description = S("Table Lamp "..colordesc),
drawtype = "nodebox",
tiles = {
"forniture_table_lamp_s"..tilesuffix..".png",
@ -423,7 +427,7 @@ local function reg_lamp(suffix, nxt, desc, tilesuffix, light, color)
fixed = { -0.2, -0.5, -0.2, 0.2, 0.30, 0.2 },
},
groups = {cracky=2,oddly_breakable_by_hand=1,
not_in_creative_inventory=((desc == nil) and 1) or nil,
not_in_creative_inventory=((light ~= nil) and 1) or nil,
},
drop = "homedecor:table_lamp"..lampcolor.."_off",
on_punch = function(pos, node, puncher)
@ -436,8 +440,10 @@ local function reg_lamp(suffix, nxt, desc, tilesuffix, light, color)
minetest.register_alias("3dforniture:table_lamp_"..suffix, "homedecor:table_lamp_"..suffix)
end
-- standing lamps
minetest.register_node("homedecor:standing_lamp_bottom"..lampcolor.."_"..suffix, {
description = S(desc),
description = S("Standing Lamp"..colordesc),
drawtype = "nodebox",
tiles = {
"forniture_table_lamp_s"..tilesuffix..".png",
@ -458,7 +464,9 @@ local function reg_lamp(suffix, nxt, desc, tilesuffix, light, color)
type = "fixed",
fixed = { 0, 0, 0, 0, 0, 0}
},
groups = {snappy=3},
groups = {cracky=2,oddly_breakable_by_hand=1,
not_in_creative_inventory=((light ~= nil) and 1) or nil,
},
on_place = function(itemstack, placer, pointed_thing)
return homedecor.stack_vertically(itemstack, placer, pointed_thing,
"homedecor:standing_lamp_bottom"..lampcolor.."_"..suffix, "homedecor:standing_lamp_top"..lampcolor.."_"..suffix)
@ -507,9 +515,9 @@ local function reg_lamp(suffix, nxt, desc, tilesuffix, light, color)
end
for _, color in ipairs(lamp_colors) do
reg_lamp("off", "low", "Table Lamp", "", nil, color )
reg_lamp("low", "med", nil, "l", 3, color )
reg_lamp("med", "hi" , nil, "m", 7, color )
reg_lamp("hi" , "max", nil, "h", 11, color )
reg_lamp("max", "off", nil, "x", 14, color )
reg_lamp("off", "low", "", nil, color )
reg_lamp("low", "med", "l", 3, color )
reg_lamp("med", "hi", "m", 7, color )
reg_lamp("hi", "max", "h", 11, color )
reg_lamp("max", "off", "x", 14, color )
end