changed all "homedecor_" variable and function names to "homedecor."

(underscore -> period).  Similarly for intllib calls and the DEBUG variable.
This commit is contained in:
Vanessa Ezekowitz 2013-10-09 12:47:22 -04:00
parent 2550672352
commit e04a0e5e4f
18 changed files with 161 additions and 158 deletions

View File

@ -8,8 +8,8 @@
-- Boilerplate to support localized strings if intllib mod is installed. -- Boilerplate to support localized strings if intllib mod is installed.
local S local S
if intllib_modpath then if homedecor.intllib_modpath then
dofile(intllib_modpath.."/intllib.lua") dofile(homedecor.intllib_modpath.."/intllib.lua")
S = intllib.Getter(minetest.get_current_modname()) S = intllib.Getter(minetest.get_current_modname())
else else
S = function ( s ) return s end S = function ( s ) return s end

View File

@ -1,14 +1,14 @@
-- Boilerplate to support localized strings if intllib mod is installed. -- Boilerplate to support localized strings if intllib mod is installed.
local S local S
if intllib_modpath then if homedecor.intllib_modpath then
dofile(intllib_modpath.."/intllib.lua") dofile(homedecor.intllib_modpath.."/intllib.lua")
S = intllib.Getter(minetest.get_current_modname()) S = intllib.Getter(minetest.get_current_modname())
else else
S = function ( s ) return s end S = function ( s ) return s end
end end
homedecor_door_models = { homedecor.door_models = {
{ {
"closet_mahogany", "closet_mahogany",
S("Mahogany Closet Door"), S("Mahogany Closet Door"),

View File

@ -2,8 +2,8 @@
-- Boilerplate to support localized strings if intllib mod is installed. -- Boilerplate to support localized strings if intllib mod is installed.
local S local S
if intllib_modpath then if homedecor.intllib_modpath then
dofile(intllib_modpath.."/intllib.lua") dofile(homedecor.intllib_modpath.."/intllib.lua")
S = intllib.Getter(minetest.get_current_modname()) S = intllib.Getter(minetest.get_current_modname())
else else
S = function ( s ) return s end S = function ( s ) return s end
@ -18,9 +18,9 @@ for i in ipairs(sides) do
local side = sides[i] local side = sides[i]
local rside = rsides[i] local rside = rsides[i]
for j in ipairs(homedecor_door_models) do for j in ipairs(homedecor.door_models) do
local doorname = homedecor_door_models[j][1] local doorname = homedecor.door_models[j][1]
local doordesc = homedecor_door_models[j][2] local doordesc = homedecor.door_models[j][2]
local nodeboxes_top = nil local nodeboxes_top = nil
local nodeboxes_bottom = nil local nodeboxes_bottom = nil
local texalpha = false local texalpha = false
@ -29,11 +29,11 @@ for i in ipairs(sides) do
end end
if side == "left" then if side == "left" then
nodeboxes_top = homedecor_door_models[j][3] nodeboxes_top = homedecor.door_models[j][3]
nodeboxes_bottomtom = homedecor_door_models[j][4] nodeboxes_bottomtom = homedecor.door_models[j][4]
else else
nodeboxes_top = homedecor_door_models[j][5] nodeboxes_top = homedecor.door_models[j][5]
nodeboxes_bottomtom = homedecor_door_models[j][6] nodeboxes_bottomtom = homedecor.door_models[j][6]
end end
local lower_top_side = "homedecor_door_"..doorname.."_tb.png" local lower_top_side = "homedecor_door_"..doorname.."_tb.png"
@ -94,7 +94,7 @@ for i in ipairs(sides) do
end end
end, end,
on_rightclick = function(pos, node, clicker) on_rightclick = function(pos, node, clicker)
homedecor_flip_door({x=pos.x, y=pos.y-1, z=pos.z}, node, clicker, doorname, side) homedecor.flip_door({x=pos.x, y=pos.y-1, z=pos.z}, node, clicker, doorname, side)
end end
}) })
@ -120,11 +120,11 @@ for i in ipairs(sides) do
end end
end, end,
on_place = function(itemstack, placer, pointed_thing) on_place = function(itemstack, placer, pointed_thing)
homedecor_place_door(itemstack, placer, pointed_thing, doorname, side) homedecor.place_door(itemstack, placer, pointed_thing, doorname, side)
return itemstack return itemstack
end, end,
on_rightclick = function(pos, node, clicker) on_rightclick = function(pos, node, clicker)
homedecor_flip_door(pos, node, clicker, doorname, side) homedecor.flip_door(pos, node, clicker, doorname, side)
end end
}) })
end end
@ -203,7 +203,7 @@ for i in ipairs(gates_list) do
fixed = gate_models_closed[i] fixed = gate_models_closed[i]
}, },
on_rightclick = function(pos, node, clicker) on_rightclick = function(pos, node, clicker)
homedecor_flip_gate(pos, node, clicker, gate, "closed") homedecor.flip_gate(pos, node, clicker, gate, "closed")
end end
}) })
@ -234,7 +234,7 @@ for i in ipairs(gates_list) do
}, },
drop = "homedecor:gate_"..gate.."_closed", drop = "homedecor:gate_"..gate.."_closed",
on_rightclick = function(pos, node, clicker) on_rightclick = function(pos, node, clicker)
homedecor_flip_gate(pos, node, clicker, gate, "open") homedecor.flip_gate(pos, node, clicker, gate, "open")
end end
}) })
@ -258,7 +258,7 @@ local function get_nodedef_field(nodename, fieldname)
return minetest.registered_nodes[nodename][fieldname] return minetest.registered_nodes[nodename][fieldname]
end end
function homedecor_place_door(itemstack, placer, pointed_thing, name, side) function homedecor.place_door(itemstack, placer, pointed_thing, name, side)
local pointed = pointed_thing.under local pointed = pointed_thing.under
local pnode = minetest.get_node(pointed) local pnode = minetest.get_node(pointed)
@ -281,8 +281,8 @@ function homedecor_place_door(itemstack, placer, pointed_thing, name, side)
local node_bottom = minetest.get_node(pos1) local node_bottom = minetest.get_node(pos1)
local node_top = minetest.get_node(pos2) local node_top = minetest.get_node(pos2)
if not homedecor_node_is_owned(pos1, placer) if not homedecor.node_is_owned(pos1, placer)
and not homedecor_node_is_owned(pos2, placer) then and not homedecor.node_is_owned(pos2, placer) then
if not get_nodedef_field(node_bottom.name, "buildable_to") if not get_nodedef_field(node_bottom.name, "buildable_to")
or not get_nodedef_field(node_top.name, "buildable_to") then or not get_nodedef_field(node_top.name, "buildable_to") then
@ -291,7 +291,7 @@ function homedecor_place_door(itemstack, placer, pointed_thing, name, side)
local fdir = minetest.dir_to_facedir(placer:get_look_dir()) local fdir = minetest.dir_to_facedir(placer:get_look_dir())
minetest.add_node(pos1, { name = "homedecor:door_"..name.."_bottom_"..side, param2=fdir}) minetest.add_node(pos1, { name = "homedecor:door_"..name.."_bottom_"..side, param2=fdir})
minetest.add_node(pos2, { name = "homedecor:door_"..name.."_top_"..side, param2=fdir}) minetest.add_node(pos2, { name = "homedecor:door_"..name.."_top_"..side, param2=fdir})
if not homedecor_expect_infinite_stacks then if not homedecor.expect_infinite_stacks then
itemstack:take_item() itemstack:take_item()
return itemstack return itemstack
end end
@ -302,7 +302,7 @@ function homedecor_place_door(itemstack, placer, pointed_thing, name, side)
end end
end end
function homedecor_flip_door(pos, node, player, name, side) function homedecor.flip_door(pos, node, player, name, side)
local rside = nil local rside = nil
local nfdir = nil local nfdir = nil
if side == "left" then if side == "left" then
@ -328,7 +328,7 @@ function homedecor_flip_door(pos, node, player, name, side)
minetest.add_node(pos, { name = "homedecor:door_"..name.."_bottom_"..rside, param2=nfdir}) minetest.add_node(pos, { name = "homedecor:door_"..name.."_bottom_"..rside, param2=nfdir})
end end
function homedecor_flip_gate(pos, node, player, gate, oc) function homedecor.flip_gate(pos, node, player, gate, oc)
minetest.sound_play("homedecor_gate_open_close", { minetest.sound_play("homedecor_gate_open_close", {
pos=pos, pos=pos,
max_hear_distance = 5, max_hear_distance = 5,

View File

@ -2,8 +2,8 @@
-- Boilerplate to support localized strings if intllib mod is installed. -- Boilerplate to support localized strings if intllib mod is installed.
local S local S
if intllib_modpath then if homedecor.intllib_modpath then
dofile(intllib_modpath.."/intllib.lua") dofile(homedecor.intllib_modpath.."/intllib.lua")
S = intllib.Getter(minetest.get_current_modname()) S = intllib.Getter(minetest.get_current_modname())
else else
S = function ( s ) return s end S = function ( s ) return s end

View File

@ -2,8 +2,8 @@
-- Boilerplate to support localized strings if intllib mod is installed. -- Boilerplate to support localized strings if intllib mod is installed.
local S local S
if intllib_modpath then if homedecor.intllib_modpath then
dofile(intllib_modpath.."/intllib.lua") dofile(homedecor.intllib_modpath.."/intllib.lua")
S = intllib.Getter(minetest.get_current_modname()) S = intllib.Getter(minetest.get_current_modname())
else else
S = function ( s ) return s end S = function ( s ) return s end
@ -448,6 +448,6 @@ minetest.register_node("homedecor:fence_chainlink_corner", {
minetest.register_alias("homedecor:fence_wood_with_sign", "signs:sign_post") minetest.register_alias("homedecor:fence_wood_with_sign", "signs:sign_post")
homedecor_register_fence_with_sign("default:fence_wood", "signs:sign_post") homedecor.register_fence_with_sign("default:fence_wood", "signs:sign_post")
homedecor_register_fence_with_sign("homedecor:fence_brass", "homedecor:fence_brass_with_sign") homedecor.register_fence_with_sign("homedecor:fence_brass", "homedecor:fence_brass_with_sign")
homedecor_register_fence_with_sign("homedecor:fence_wrought_iron", "homedecor:fence_wrought_iron_with_sign") homedecor.register_fence_with_sign("homedecor:fence_wrought_iron", "homedecor:fence_wrought_iron_with_sign")

View File

@ -2,8 +2,8 @@
-- Boilerplate to support localized strings if intllib mod is installed. -- Boilerplate to support localized strings if intllib mod is installed.
local S local S
if intllib_modpath then if homedecor.intllib_modpath then
dofile(intllib_modpath.."/intllib.lua") dofile(homedecor.intllib_modpath.."/intllib.lua")
S = intllib.Getter(minetest.get_current_modname()) S = intllib.Getter(minetest.get_current_modname())
else else
S = function ( s ) return s end S = function ( s ) return s end
@ -82,7 +82,7 @@ local function make_tiles(tiles, fmt, active)
return tiles return tiles
end end
function homedecor_register_furnace(name, furnacedef) function homedecor.register_furnace(name, furnacedef)
local furnacedef = furnacedef local furnacedef = furnacedef
@ -351,7 +351,7 @@ function homedecor_register_furnace(name, furnacedef)
end end
homedecor_register_furnace("homedecor:oven", { homedecor.register_furnace("homedecor:oven", {
description = "Oven", description = "Oven",
tile_format = "homedecor_oven_%s%s.png", tile_format = "homedecor_oven_%s%s.png",
output_slots = 4, output_slots = 4,
@ -359,7 +359,7 @@ homedecor_register_furnace("homedecor:oven", {
cook_speed = 1.25, cook_speed = 1.25,
}) })
homedecor_register_furnace("homedecor:microwave_oven", { homedecor.register_furnace("homedecor:microwave_oven", {
description = "Microwave Oven", description = "Microwave Oven",
tiles = { tiles = {
"homedecor_microwave_top.png", "homedecor_microwave_bottom.png", "homedecor_microwave_top.png", "homedecor_microwave_bottom.png",

View File

@ -11,14 +11,17 @@
-- License: LGPL 2.0 or higher -- License: LGPL 2.0 or higher
-- --
local DEBUG = 0 homedecor = {}
homedecor_modpath = minetest.get_modpath("homedecor")
intllib_modpath = minetest.get_modpath("intllib") local homedecor.debug = 0
homedecor.modpath = minetest.get_modpath("homedecor")
homedecor.intllib_modpath = minetest.get_modpath("intllib")
-- Boilerplate to support localized strings if intllib mod is installed. -- Boilerplate to support localized strings if intllib mod is installed.
local S local S
if intllib_modpath then if homedecor.intllib_modpath then
dofile(intllib_modpath.."/intllib.lua") dofile(homedecor.intllib_modpath.."/intllib.lua")
S = intllib.Getter(minetest.get_current_modname()) S = intllib.Getter(minetest.get_current_modname())
else else
S = function ( s ) return s end S = function ( s ) return s end
@ -26,17 +29,17 @@ end
-- Global stuff -- Global stuff
homedecor_disable_signs = minetest.setting_getbool("homedecor.disable_signs") homedecor.disable_signs = minetest.setting_getbool("homedecor.disable_signs")
-- Various Functions -- Various Functions
local dbg = function(s) local dbg = function(s)
if DEBUG == 1 then if homedecor.debug == 1 then
print('[HomeDecor] ' .. s) print('[HomeDecor] ' .. s)
end end
end end
function homedecor_node_is_owned(pos, placer) function homedecor.node_is_owned(pos, placer)
local ownername = false local ownername = false
if type(IsPlayerNodeOwner) == "function" then -- node_ownership mod if type(IsPlayerNodeOwner) == "function" then -- node_ownership mod
if HasOwner(pos, placer) then -- returns true if the node is owned if HasOwner(pos, placer) then -- returns true if the node is owned
@ -70,38 +73,38 @@ function homedecor_node_is_owned(pos, placer)
end end
if minetest.get_modpath("unified_inventory") or not minetest.setting_getbool("creative_mode") then if minetest.get_modpath("unified_inventory") or not minetest.setting_getbool("creative_mode") then
homedecor_expect_infinite_stacks = false homedecor.expect_infinite_stacks = false
else else
homedecor_expect_infinite_stacks = true homedecor.expect_infinite_stacks = true
end end
dofile(homedecor_modpath.."/misc_nodes.lua") -- the catch-all for all misc nodes dofile(homedecor.modpath.."/misc_nodes.lua") -- the catch-all for all misc nodes
dofile(homedecor_modpath.."/tables.lua") dofile(homedecor.modpath.."/tables.lua")
dofile(homedecor_modpath.."/electronics.lua") dofile(homedecor.modpath.."/electronics.lua")
dofile(homedecor_modpath.."/shutters.lua") dofile(homedecor.modpath.."/shutters.lua")
dofile(homedecor_modpath.."/shingles.lua") dofile(homedecor.modpath.."/shingles.lua")
dofile(homedecor_modpath.."/slopes.lua") dofile(homedecor.modpath.."/slopes.lua")
dofile(homedecor_modpath.."/door_models.lua") dofile(homedecor.modpath.."/door_models.lua")
dofile(homedecor_modpath.."/doors_and_gates.lua") dofile(homedecor.modpath.."/doors_and_gates.lua")
dofile(homedecor_modpath.."/signs_lib.lua") dofile(homedecor.modpath.."/signs_lib.lua")
dofile(homedecor_modpath.."/fences.lua") dofile(homedecor.modpath.."/fences.lua")
dofile(homedecor_modpath.."/lighting.lua") dofile(homedecor.modpath.."/lighting.lua")
dofile(homedecor_modpath.."/kitchen_cabinet.lua") dofile(homedecor.modpath.."/kitchen_cabinet.lua")
dofile(homedecor_modpath.."/refrigerator.lua") dofile(homedecor.modpath.."/refrigerator.lua")
dofile(homedecor_modpath.."/furnaces.lua") dofile(homedecor.modpath.."/furnaces.lua")
dofile(homedecor_modpath.."/nightstands.lua") dofile(homedecor.modpath.."/nightstands.lua")
dofile(homedecor_modpath.."/crafts.lua") dofile(homedecor.modpath.."/crafts.lua")
dofile(homedecor_modpath.."/furniture.lua") dofile(homedecor.modpath.."/furniture.lua")
dofile(homedecor_modpath.."/furniture_medieval.lua") dofile(homedecor.modpath.."/furniture_medieval.lua")
dofile(homedecor_modpath.."/furniture_bathroom.lua") dofile(homedecor.modpath.."/furniture_bathroom.lua")
dofile(homedecor_modpath.."/furniture_recipes.lua") dofile(homedecor.modpath.."/furniture_recipes.lua")
dofile(homedecor_modpath.."/locked.lua") dofile(homedecor.modpath.."/locked.lua")
print("[HomeDecor] "..S("Loaded!")) print("[HomeDecor] "..S("Loaded!"))

View File

@ -2,8 +2,8 @@
-- Boilerplate to support localized strings if intllib mod is installed. -- Boilerplate to support localized strings if intllib mod is installed.
local S local S
if intllib_modpath then if homedecor.intllib_modpath then
dofile(intllib_modpath.."/intllib.lua") dofile(homedecor.intllib_modpath.."/intllib.lua")
S = intllib.Getter(minetest.get_current_modname()) S = intllib.Getter(minetest.get_current_modname())
else else
S = function ( s ) return s end S = function ( s ) return s end

View File

@ -3,8 +3,8 @@
-- Boilerplate to support localized strings if intllib mod is installed. -- Boilerplate to support localized strings if intllib mod is installed.
local S local S
if intllib_modpath then if homedecor.intllib_modpath then
dofile(intllib_modpath.."/intllib.lua") dofile(homedecor.intllib_modpath.."/intllib.lua")
S = intllib.Getter(minetest.get_current_modname()) S = intllib.Getter(minetest.get_current_modname())
else else
S = function ( s ) return s end S = function ( s ) return s end
@ -13,9 +13,9 @@ end
local dirs1 = { 20, 23, 22, 21 } local dirs1 = { 20, 23, 22, 21 }
local dirs2 = { 9, 18, 7, 12 } local dirs2 = { 9, 18, 7, 12 }
function homedecor_rotate_and_place(itemstack, placer, pointed_thing) function homedecor.rotate_and_place(itemstack, placer, pointed_thing)
if not homedecor_node_is_owned(pointed_thing.under, placer) if not homedecor.node_is_owned(pointed_thing.under, placer)
and not homedecor_node_is_owned(pointed_thing.above, placer) then and not homedecor.node_is_owned(pointed_thing.above, placer) then
local node = minetest.get_node(pointed_thing.under) local node = minetest.get_node(pointed_thing.under)
if not minetest.registered_nodes[node.name] or not minetest.registered_nodes[node.name].on_rightclick then if not minetest.registered_nodes[node.name] or not minetest.registered_nodes[node.name].on_rightclick then
@ -49,7 +49,7 @@ function homedecor_rotate_and_place(itemstack, placer, pointed_thing)
minetest.add_node(pos1, {name = wield_name, param2 = 0 }) -- place right side up minetest.add_node(pos1, {name = wield_name, param2 = 0 }) -- place right side up
end end
if not homedecor_expect_infinite_stacks then if not homedecor.expect_infinite_stacks then
itemstack:take_item() itemstack:take_item()
return itemstack return itemstack
end end
@ -146,7 +146,7 @@ minetest.register_node('homedecor:glowlight_half_yellow', {
sounds = default.node_sound_wood_defaults(), sounds = default.node_sound_wood_defaults(),
on_place = function(itemstack, placer, pointed_thing) on_place = function(itemstack, placer, pointed_thing)
homedecor_rotate_and_place(itemstack, placer, pointed_thing) homedecor.rotate_and_place(itemstack, placer, pointed_thing)
return itemstack return itemstack
end end
}) })
@ -179,7 +179,7 @@ minetest.register_node('homedecor:glowlight_quarter_yellow', {
light_source = LIGHT_MAX-1, light_source = LIGHT_MAX-1,
sounds = default.node_sound_wood_defaults(), sounds = default.node_sound_wood_defaults(),
on_place = function(itemstack, placer, pointed_thing) on_place = function(itemstack, placer, pointed_thing)
homedecor_rotate_and_place(itemstack, placer, pointed_thing) homedecor.rotate_and_place(itemstack, placer, pointed_thing)
return itemstack return itemstack
end end
}) })
@ -216,7 +216,7 @@ minetest.register_node('homedecor:glowlight_half_white', {
light_source = LIGHT_MAX, light_source = LIGHT_MAX,
sounds = default.node_sound_wood_defaults(), sounds = default.node_sound_wood_defaults(),
on_place = function(itemstack, placer, pointed_thing) on_place = function(itemstack, placer, pointed_thing)
homedecor_rotate_and_place(itemstack, placer, pointed_thing) homedecor.rotate_and_place(itemstack, placer, pointed_thing)
return itemstack return itemstack
end end
}) })
@ -249,7 +249,7 @@ minetest.register_node('homedecor:glowlight_quarter_white', {
light_source = LIGHT_MAX-1, light_source = LIGHT_MAX-1,
sounds = default.node_sound_wood_defaults(), sounds = default.node_sound_wood_defaults(),
on_place = function(itemstack, placer, pointed_thing) on_place = function(itemstack, placer, pointed_thing)
homedecor_rotate_and_place(itemstack, placer, pointed_thing) homedecor.rotate_and_place(itemstack, placer, pointed_thing)
return itemstack return itemstack
end end
}) })
@ -285,7 +285,7 @@ minetest.register_node('homedecor:glowlight_small_cube_yellow', {
sounds = default.node_sound_wood_defaults(), sounds = default.node_sound_wood_defaults(),
on_place = function(itemstack, placer, pointed_thing) on_place = function(itemstack, placer, pointed_thing)
homedecor_rotate_and_place(itemstack, placer, pointed_thing) homedecor.rotate_and_place(itemstack, placer, pointed_thing)
return itemstack return itemstack
end end
}) })
@ -318,7 +318,7 @@ minetest.register_node('homedecor:glowlight_small_cube_white', {
light_source = LIGHT_MAX-1, light_source = LIGHT_MAX-1,
sounds = default.node_sound_wood_defaults(), sounds = default.node_sound_wood_defaults(),
on_place = function(itemstack, placer, pointed_thing) on_place = function(itemstack, placer, pointed_thing)
homedecor_rotate_and_place(itemstack, placer, pointed_thing) homedecor.rotate_and_place(itemstack, placer, pointed_thing)
return itemstack return itemstack
end end
}) })

View File

@ -9,8 +9,8 @@
-- Boilerplate to support localized strings if intllib mod is installed. -- Boilerplate to support localized strings if intllib mod is installed.
local S local S
if intllib_modpath then if homedecor.intllib_modpath then
dofile(intllib_modpath.."/intllib.lua") dofile(homedecor.intllib_modpath.."/intllib.lua")
S = intllib.Getter(minetest.get_current_modname()) S = intllib.Getter(minetest.get_current_modname())
else else
S = function ( s ) return s end S = function ( s ) return s end

View File

@ -2,8 +2,8 @@
-- Boilerplate to support localized strings if intllib mod is installed. -- Boilerplate to support localized strings if intllib mod is installed.
local S local S
if intllib_modpath then if homedecor.intllib_modpath then
dofile(intllib_modpath.."/intllib.lua") dofile(homedecor.intllib_modpath.."/intllib.lua")
S = intllib.Getter(minetest.get_current_modname()) S = intllib.Getter(minetest.get_current_modname())
else else
S = function ( s ) return s end S = function ( s ) return s end

View File

@ -2,8 +2,8 @@
-- Boilerplate to support localized strings if intllib mod is installed. -- Boilerplate to support localized strings if intllib mod is installed.
local S local S
if intllib_modpath then if homedecor.intllib_modpath then
dofile(intllib_modpath.."/intllib.lua") dofile(homedecor.intllib_modpath.."/intllib.lua")
S = intllib.Getter(minetest.get_current_modname()) S = intllib.Getter(minetest.get_current_modname())
else else
S = function ( s ) return s end S = function ( s ) return s end

View File

@ -2,8 +2,8 @@
-- Boilerplate to support localized strings if intllib mod is installed. -- Boilerplate to support localized strings if intllib mod is installed.
local S local S
if intllib_modpath then if homedecor.intllib_modpath then
dofile(intllib_modpath.."/intllib.lua") dofile(homedecor.intllib_modpath.."/intllib.lua")
S = intllib.Getter(minetest.get_current_modname()) S = intllib.Getter(minetest.get_current_modname())
else else
S = function ( s ) return s end S = function ( s ) return s end

View File

@ -2,8 +2,8 @@
-- Boilerplate to support localized strings if intllib mod is installed. -- Boilerplate to support localized strings if intllib mod is installed.
local S local S
if intllib_modpath then if homedecor.intllib_modpath then
dofile(intllib_modpath.."/intllib.lua") dofile(homedecor.intllib_modpath.."/intllib.lua")
S = intllib.Getter(minetest.get_current_modname()) S = intllib.Getter(minetest.get_current_modname())
else else
S = function ( s ) return s end S = function ( s ) return s end

View File

@ -2,8 +2,8 @@
-- Boilerplate to support localized strings if intllib mod is installed. -- Boilerplate to support localized strings if intllib mod is installed.
local S local S
if intllib_modpath then if homedecor.intllib_modpath then
dofile(intllib_modpath.."/intllib.lua") dofile(homedecor.intllib_modpath.."/intllib.lua")
S = intllib.Getter(minetest.get_current_modname()) S = intllib.Getter(minetest.get_current_modname())
else else
S = function ( s ) return s end S = function ( s ) return s end

View File

@ -2,8 +2,8 @@
-- Boilerplate to support localized strings if intllib mod is installed. -- Boilerplate to support localized strings if intllib mod is installed.
local S local S
if intllib_modpath then if homedecor.intllib_modpath then
dofile(intllib_modpath.."/intllib.lua") dofile(homedecor.intllib_modpath.."/intllib.lua")
S = intllib.Getter(minetest.get_current_modname()) S = intllib.Getter(minetest.get_current_modname())
else else
S = function ( s ) return s end S = function ( s ) return s end
@ -52,13 +52,13 @@ local sign_groups = {choppy=2, dig_immediate=2}
local fences_with_sign = { } local fences_with_sign = { }
homedecor_construct_sign = function(pos) homedecor.construct_sign = function(pos)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
meta:set_string("formspec", "field[text;;${text}]") meta:set_string("formspec", "field[text;;${text}]")
meta:set_string("infotext", "") meta:set_string("infotext", "")
end end
homedecor_destruct_sign = function(pos) homedecor.destruct_sign = function(pos)
local objects = minetest.get_objects_inside_radius(pos, 0.5) local objects = minetest.get_objects_inside_radius(pos, 0.5)
for _, v in ipairs(objects) do for _, v in ipairs(objects) do
if v:get_entity_name() == "signs:text" then if v:get_entity_name() == "signs:text" then
@ -67,17 +67,17 @@ homedecor_destruct_sign = function(pos)
end end
end end
homedecor_update_sign = function(pos, fields) homedecor.update_sign = function(pos, fields)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
if fields then if fields then
meta:set_string("infotext", table.concat(homedecor_create_lines(fields.text), "\n")) meta:set_string("infotext", table.concat(homedecor.create_lines(fields.text), "\n"))
meta:set_string("text", fields.text) meta:set_string("text", fields.text)
end end
local text = meta:get_string("text") local text = meta:get_string("text")
local objects = minetest.get_objects_inside_radius(pos, 0.5) local objects = minetest.get_objects_inside_radius(pos, 0.5)
for _, v in ipairs(objects) do for _, v in ipairs(objects) do
if v:get_entity_name() == "signs:text" then if v:get_entity_name() == "signs:text" then
v:set_properties({textures={homedecor_generate_texture(homedecor_create_lines(text))}}) v:set_properties({textures={homedecor.generate_texture(homedecor.create_lines(text))}})
return return
end end
end end
@ -100,7 +100,7 @@ homedecor_update_sign = function(pos, fields)
text:setyaw(sign_info.yaw) text:setyaw(sign_info.yaw)
end end
if not homedecor_disable_signs then if not homedecor.disable_signs then
minetest.register_node(":default:sign_wall", { minetest.register_node(":default:sign_wall", {
description = "Sign", description = "Sign",
inventory_image = "default_sign_wall.png", inventory_image = "default_sign_wall.png",
@ -119,13 +119,13 @@ if not homedecor_disable_signs then
local name local name
name = minetest.get_node(pointed_thing.under).name name = minetest.get_node(pointed_thing.under).name
if fences_with_sign[name] then if fences_with_sign[name] then
if homedecor_node_is_owned(pointed_thing.under, placer) then if homedecor.node_is_owned(pointed_thing.under, placer) then
return itemstack return itemstack
end end
else else
name = minetest.get_node(pointed_thing.above).name name = minetest.get_node(pointed_thing.above).name
local def = minetest.registered_nodes[name] local def = minetest.registered_nodes[name]
if homedecor_node_is_owned(pointed_thing.above, placer) if homedecor.node_is_owned(pointed_thing.above, placer)
or (not def.buildable_to) then or (not def.buildable_to) then
return itemstack return itemstack
end end
@ -182,17 +182,17 @@ if not homedecor_disable_signs then
text:setyaw(sign_info.yaw) text:setyaw(sign_info.yaw)
if not homedecor_expect_infinite_stacks then if not homedecor.expect_infinite_stacks then
itemstack:take_item() itemstack:take_item()
end end
return itemstack return itemstack
end end
end, end,
on_construct = function(pos) on_construct = function(pos)
homedecor_construct_sign(pos) homedecor.construct_sign(pos)
end, end,
on_destruct = function(pos) on_destruct = function(pos)
homedecor_destruct_sign(pos) homedecor.destruct_sign(pos)
end, end,
on_receive_fields = function(pos, formname, fields, sender) on_receive_fields = function(pos, formname, fields, sender)
if fields then if fields then
@ -202,11 +202,11 @@ if not homedecor_disable_signs then
minetest.pos_to_string(pos) minetest.pos_to_string(pos)
)) ))
end end
if homedecor_node_is_owned(pos, sender) then return end if homedecor.node_is_owned(pos, sender) then return end
homedecor_update_sign(pos, fields) homedecor.update_sign(pos, fields)
end, end,
on_punch = function(pos, node, puncher) on_punch = function(pos, node, puncher)
homedecor_update_sign(pos) homedecor.update_sign(pos)
end, end,
}) })
end end
@ -226,10 +226,10 @@ minetest.register_node(":signs:sign_yard", {
drop = "default:sign_wall", drop = "default:sign_wall",
on_construct = function(pos) on_construct = function(pos)
homedecor_construct_sign(pos) homedecor.construct_sign(pos)
end, end,
on_destruct = function(pos) on_destruct = function(pos)
homedecor_destruct_sign(pos) homedecor.destruct_sign(pos)
end, end,
on_receive_fields = function(pos, formname, fields, sender) on_receive_fields = function(pos, formname, fields, sender)
if fields then if fields then
@ -239,11 +239,11 @@ minetest.register_node(":signs:sign_yard", {
minetest.pos_to_string(pos) minetest.pos_to_string(pos)
)) ))
end end
if homedecor_node_is_owned(pos, sender) then return end if homedecor.node_is_owned(pos, sender) then return end
homedecor_update_sign(pos, fields) homedecor.update_sign(pos, fields)
end, end,
on_punch = function(pos, node, puncher) on_punch = function(pos, node, puncher)
homedecor_update_sign(pos) homedecor.update_sign(pos)
end, end,
}) })
@ -286,11 +286,11 @@ minetest.register_node(":signs:sign_post", {
local signs_text_on_activate local signs_text_on_activate
if not homedecor_disable_signs then if not homedecor.disable_signs then
signs_text_on_activate = function(self) signs_text_on_activate = function(self)
local meta = minetest.get_meta(self.object:getpos()) local meta = minetest.get_meta(self.object:getpos())
local text = meta:get_string("text") local text = meta:get_string("text")
self.object:set_properties({textures={homedecor_generate_texture(homedecor_create_lines(text))}}) self.object:set_properties({textures={homedecor.generate_texture(homedecor.create_lines(text))}})
end end
else else
signs_text_on_activate = function(self) signs_text_on_activate = function(self)
@ -318,7 +318,7 @@ local NUMBER_OF_LINES = 4
local LINE_HEIGHT = 14 local LINE_HEIGHT = 14
local CHAR_WIDTH = 5 local CHAR_WIDTH = 5
homedecor_string_to_array = function(str) homedecor.string_to_array = function(str)
local tab = {} local tab = {}
for i=1,string.len(str) do for i=1,string.len(str) do
table.insert(tab, string.sub(str, i,i)) table.insert(tab, string.sub(str, i,i))
@ -326,11 +326,11 @@ homedecor_string_to_array = function(str)
return tab return tab
end end
homedecor_string_to_word_array = function(str) homedecor.string_to_word_array = function(str)
local tab = {} local tab = {}
local current = 1 local current = 1
tab[1] = "" tab[1] = ""
for _,char in ipairs(homedecor_string_to_array(str)) do for _,char in ipairs(homedecor.string_to_array(str)) do
if char ~= " " then if char ~= " " then
tab[current] = tab[current]..char tab[current] = tab[current]..char
else else
@ -341,11 +341,11 @@ homedecor_string_to_word_array = function(str)
return tab return tab
end end
homedecor_create_lines = function(text) homedecor.create_lines = function(text)
local line = "" local line = ""
local line_num = 1 local line_num = 1
local tab = {} local tab = {}
for _,word in ipairs(homedecor_string_to_word_array(text)) do for _,word in ipairs(homedecor.string_to_word_array(text)) do
if string.len(line)+string.len(word) < LINE_LENGTH and word ~= "|" then if string.len(line)+string.len(word) < LINE_LENGTH and word ~= "|" then
if line ~= "" then if line ~= "" then
line = line.." "..word line = line.." "..word
@ -369,17 +369,17 @@ homedecor_create_lines = function(text)
return tab return tab
end end
homedecor_generate_texture = function(lines) homedecor.generate_texture = function(lines)
local texture = "[combine:"..SIGN_WITH.."x"..SIGN_WITH local texture = "[combine:"..SIGN_WITH.."x"..SIGN_WITH
local ypos = 12 local ypos = 12
for i = 1, #lines do for i = 1, #lines do
texture = texture..homedecor_generate_line(lines[i], ypos) texture = texture..homedecor.generate_line(lines[i], ypos)
ypos = ypos + LINE_HEIGHT ypos = ypos + LINE_HEIGHT
end end
return texture return texture
end end
homedecor_generate_line = function(s, ypos) homedecor.generate_line = function(s, ypos)
local i = 1 local i = 1
local parsed = {} local parsed = {}
local width = 0 local width = 0
@ -425,7 +425,7 @@ local function copy ( t )
return nt return nt
end end
function homedecor_register_fence_with_sign(fencename, fencewithsignname) function homedecor.register_fence_with_sign(fencename, fencewithsignname)
local def = minetest.registered_nodes[fencename] local def = minetest.registered_nodes[fencename]
local def_sign = minetest.registered_nodes[fencewithsignname] local def_sign = minetest.registered_nodes[fencewithsignname]
if not (def and def_sign) then if not (def and def_sign) then
@ -443,18 +443,18 @@ function homedecor_register_fence_with_sign(fencename, fencewithsignname)
local fdir = minetest.dir_to_facedir(placer:get_look_dir()) local fdir = minetest.dir_to_facedir(placer:get_look_dir())
if def_under and def_under.on_rightclick then if def_under and def_under.on_rightclick then
return def_under.on_rightclick(pointed_thing.under, node_under, placer, itemstack) or itemstack return def_under.on_rightclick(pointed_thing.under, node_under, placer, itemstack) or itemstack
elseif (not homedecor_node_is_owned(pointed_thing.under, placer)) elseif (not homedecor.node_is_owned(pointed_thing.under, placer))
and def_under.buildable_to then and def_under.buildable_to then
minetest.add_node(pointed_thing.under, {name = fencename, param2 = fdir}) minetest.add_node(pointed_thing.under, {name = fencename, param2 = fdir})
if not homedecor_expect_infinite_stacks then if not homedecor.expect_infinite_stacks then
itemstack:take_item() itemstack:take_item()
end end
placer:set_wielded_item(itemstack) placer:set_wielded_item(itemstack)
return itemstack return itemstack
elseif (not homedecor_node_is_owned(pointed_thing.above, placer)) elseif (not homedecor.node_is_owned(pointed_thing.above, placer))
and def_above.buildable_to then and def_above.buildable_to then
minetest.add_node(pointed_thing.above, {name = fencename, param2 = fdir}) minetest.add_node(pointed_thing.above, {name = fencename, param2 = fdir})
if not homedecor_expect_infinite_stacks then if not homedecor.expect_infinite_stacks then
itemstack:take_item() itemstack:take_item()
end end
placer:set_wielded_item(itemstack) placer:set_wielded_item(itemstack)
@ -462,10 +462,10 @@ function homedecor_register_fence_with_sign(fencename, fencewithsignname)
end end
end end
def_sign.on_construct = function(pos, ...) def_sign.on_construct = function(pos, ...)
homedecor_construct_sign(pos) homedecor.construct_sign(pos)
end end
def_sign.on_destruct = function(pos, ...) def_sign.on_destruct = function(pos, ...)
homedecor_destruct_sign(pos) homedecor.destruct_sign(pos)
end end
def_sign.on_receive_fields = function(pos, formname, fields, sender, ...) def_sign.on_receive_fields = function(pos, formname, fields, sender, ...)
if fields then if fields then
@ -475,11 +475,11 @@ function homedecor_register_fence_with_sign(fencename, fencewithsignname)
minetest.pos_to_string(pos) minetest.pos_to_string(pos)
)) ))
end end
if homedecor_node_is_owned(pos, sender) then return end if homedecor.node_is_owned(pos, sender) then return end
homedecor_update_sign(pos, fields) homedecor.update_sign(pos, fields)
end end
def_sign.on_punch = function(pos, node, puncher, ...) def_sign.on_punch = function(pos, node, puncher, ...)
homedecor_update_sign(pos) homedecor.update_sign(pos)
end end
local fencename = fencename local fencename = fencename
def_sign.after_dig_node = function(pos, node, ...) def_sign.after_dig_node = function(pos, node, ...)

View File

@ -2,8 +2,8 @@
-- Boilerplate to support localized strings if intllib mod is installed. -- Boilerplate to support localized strings if intllib mod is installed.
local S local S
if intllib_modpath then if homedecor.intllib_modpath then
dofile(intllib_modpath.."/intllib.lua") dofile(homedecor.intllib_modpath.."/intllib.lua")
S = intllib.Getter(minetest.get_current_modname()) S = intllib.Getter(minetest.get_current_modname())
else else
S = function ( s ) return s end S = function ( s ) return s end
@ -11,11 +11,11 @@ end
-- Corner shingle nodes, courtesy Bas080 -- Corner shingle nodes, courtesy Bas080
homedecor_detail_level = 16 homedecor.detail_level = 16
homedecor_register_outer_corner = function(modname, subname, groups, images, description) homedecor.register_outer_corner = function(modname, subname, groups, images, description)
local slopeboxedge = {} local slopeboxedge = {}
local detail = homedecor_detail_level local detail = homedecor.detail_level
for i = 0, detail-1 do for i = 0, detail-1 do
slopeboxedge[i+1]={-0.5, -0.5, (i/detail)-0.5, 0.5-(i/detail), (i/detail)-0.5+(1.25/detail), 0.5} slopeboxedge[i+1]={-0.5, -0.5, (i/detail)-0.5, 0.5-(i/detail), (i/detail)-0.5+(1.25/detail), 0.5}
end end
@ -43,9 +43,9 @@ homedecor_register_outer_corner = function(modname, subname, groups, images, des
}) })
end end
homedecor_register_inner_corner = function(modname, subname, groups, images, description) homedecor.register_inner_corner = function(modname, subname, groups, images, description)
local slopeboxedge = {} local slopeboxedge = {}
local detail = homedecor_detail_level local detail = homedecor.detail_level
for i = 0, detail-1 do for i = 0, detail-1 do
slopeboxedge[i+1]={-0.5, -0.5, -0.5, 0.5-(i/detail), (i/detail)-0.5+(1.25/detail), 0.5} slopeboxedge[i+1]={-0.5, -0.5, -0.5, 0.5-(i/detail), (i/detail)-0.5+(1.25/detail), 0.5}
slopeboxedge[i+detail+1]={-0.5, -0.5, (i/detail)-0.5, 0.5, (i/detail)-0.5+(1.25/detail), 0.5} slopeboxedge[i+detail+1]={-0.5, -0.5, (i/detail)-0.5, 0.5, (i/detail)-0.5+(1.25/detail), 0.5}
@ -69,9 +69,9 @@ homedecor_register_inner_corner = function(modname, subname, groups, images, des
}) })
end end
homedecor_register_slope = function(modname, subname, recipeitem, groups, images, description) homedecor.register_slope = function(modname, subname, recipeitem, groups, images, description)
local slopeboxedge = {} local slopeboxedge = {}
local detail = homedecor_detail_level local detail = homedecor.detail_level
for i = 0, detail-1 do for i = 0, detail-1 do
slopeboxedge[i+1]={-0.5, -0.5, (i/detail)-0.5, 0.5, (i/detail)-0.5+(1.25/detail), 0.5} slopeboxedge[i+1]={-0.5, -0.5, (i/detail)-0.5, 0.5, (i/detail)-0.5+(1.25/detail), 0.5}
end end
@ -203,14 +203,14 @@ minetest.register_craft({
burntime = 30, burntime = 30,
}) })
homedecor_register_roof = function(modname, subname, groups, images , description) homedecor.register_roof = function(modname, subname, groups, images , description)
homedecor_register_outer_corner(modname, subname, groups, images, description) homedecor.register_outer_corner(modname, subname, groups, images, description)
homedecor_register_inner_corner(modname, subname, groups, images, description) homedecor.register_inner_corner(modname, subname, groups, images, description)
end end
-- corners -- corners
homedecor_register_roof("homedecor", "wood", homedecor.register_roof("homedecor", "wood",
{ snappy = 3 }, { snappy = 3 },
{ {
"homedecor_shingles_wood_c_t.png", "homedecor_shingles_wood_c_t.png",
@ -223,7 +223,7 @@ homedecor_register_roof("homedecor", "wood",
"Wood Shingles" "Wood Shingles"
) )
homedecor_register_roof("homedecor", "asphalt", homedecor.register_roof("homedecor", "asphalt",
{ snappy = 3 }, { snappy = 3 },
{ {
"homedecor_shingles_asphalt_c_t.png", "homedecor_shingles_asphalt_c_t.png",
@ -236,7 +236,7 @@ homedecor_register_roof("homedecor", "asphalt",
"Asphalt Shingles" "Asphalt Shingles"
) )
homedecor_register_roof("homedecor", "terracotta", homedecor.register_roof("homedecor", "terracotta",
{ snappy = 3 }, { snappy = 3 },
{ {
"homedecor_shingles_terracotta_c_t.png", "homedecor_shingles_terracotta_c_t.png",
@ -251,7 +251,7 @@ homedecor_register_roof("homedecor", "terracotta",
-- register just the slopes -- register just the slopes
homedecor_register_slope("homedecor", "wood", homedecor.register_slope("homedecor", "wood",
"homedecor:shingles_wood", "homedecor:shingles_wood",
{ snappy = 3 }, { snappy = 3 },
{ {
@ -265,7 +265,7 @@ homedecor_register_slope("homedecor", "wood",
"Wood Shingles" "Wood Shingles"
) )
homedecor_register_slope("homedecor", "asphalt", homedecor.register_slope("homedecor", "asphalt",
"homedecor:shingles_asphalt", "homedecor:shingles_asphalt",
{ snappy = 3 }, { snappy = 3 },
{ {
@ -279,7 +279,7 @@ homedecor_register_slope("homedecor", "asphalt",
"Asphalt Shingles" "Asphalt Shingles"
) )
homedecor_register_slope("homedecor", "terracotta", homedecor.register_slope("homedecor", "terracotta",
"homedecor:shingles_terracotta", "homedecor:shingles_terracotta",
{ snappy = 3 }, { snappy = 3 },
{ {

View File

@ -2,8 +2,8 @@
-- Boilerplate to support localized strings if intllib mod is installed. -- Boilerplate to support localized strings if intllib mod is installed.
local S local S
if intllib_modpath then if homedecor.intllib_modpath then
dofile(intllib_modpath.."/intllib.lua") dofile(homedecor.intllib_modpath.."/intllib.lua")
S = intllib.Getter(minetest.get_current_modname()) S = intllib.Getter(minetest.get_current_modname())
else else
S = function ( s ) return s end S = function ( s ) return s end
@ -79,7 +79,7 @@ for i in ipairs(materials) do
else else
minetest.add_node(above, {name = 'homedecor:'..m..'_table_small_square_b'}) minetest.add_node(above, {name = 'homedecor:'..m..'_table_small_square_b'})
end end
if not homedecor_expect_infinite_stacks then if not homedecor.expect_infinite_stacks then
itemstack:take_item() itemstack:take_item()
return itemstack return itemstack
end end
@ -207,7 +207,7 @@ for i in ipairs(materials) do
else else
minetest.add_node(above, {name = 'homedecor:'..m..'_table_small_round_b'}) minetest.add_node(above, {name = 'homedecor:'..m..'_table_small_round_b'})
end end
if not homedecor_expect_infinite_stacks then if not homedecor.expect_infinite_stacks then
itemstack:take_item() itemstack:take_item()
return itemstack return itemstack
end end
@ -334,7 +334,7 @@ for i in ipairs(materials) do
else else
minetest.add_node(above, {name = 'homedecor:'..m..'_table_large_b'}) minetest.add_node(above, {name = 'homedecor:'..m..'_table_large_b'})
end end
if not homedecor_expect_infinite_stacks then if not homedecor.expect_infinite_stacks then
itemstack:take_item() itemstack:take_item()
return itemstack return itemstack
end end