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.
local S
if intllib_modpath then
dofile(intllib_modpath.."/intllib.lua")
if homedecor.intllib_modpath then
dofile(homedecor.intllib_modpath.."/intllib.lua")
S = intllib.Getter(minetest.get_current_modname())
else
S = function ( s ) return s end

View File

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

View File

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

View File

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

View File

@ -2,8 +2,8 @@
-- Boilerplate to support localized strings if intllib mod is installed.
local S
if intllib_modpath then
dofile(intllib_modpath.."/intllib.lua")
if homedecor.intllib_modpath then
dofile(homedecor.intllib_modpath.."/intllib.lua")
S = intllib.Getter(minetest.get_current_modname())
else
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")
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_wrought_iron", "homedecor:fence_wrought_iron_with_sign")
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_wrought_iron", "homedecor:fence_wrought_iron_with_sign")

View File

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

View File

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

View File

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

View File

@ -3,8 +3,8 @@
-- Boilerplate to support localized strings if intllib mod is installed.
local S
if intllib_modpath then
dofile(intllib_modpath.."/intllib.lua")
if homedecor.intllib_modpath then
dofile(homedecor.intllib_modpath.."/intllib.lua")
S = intllib.Getter(minetest.get_current_modname())
else
S = function ( s ) return s end
@ -13,9 +13,9 @@ end
local dirs1 = { 20, 23, 22, 21 }
local dirs2 = { 9, 18, 7, 12 }
function homedecor_rotate_and_place(itemstack, placer, pointed_thing)
if not homedecor_node_is_owned(pointed_thing.under, placer)
and not homedecor_node_is_owned(pointed_thing.above, placer) then
function homedecor.rotate_and_place(itemstack, placer, pointed_thing)
if not homedecor.node_is_owned(pointed_thing.under, placer)
and not homedecor.node_is_owned(pointed_thing.above, placer) then
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
@ -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
end
if not homedecor_expect_infinite_stacks then
if not homedecor.expect_infinite_stacks then
itemstack:take_item()
return itemstack
end
@ -146,7 +146,7 @@ minetest.register_node('homedecor:glowlight_half_yellow', {
sounds = default.node_sound_wood_defaults(),
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
end
})
@ -179,7 +179,7 @@ minetest.register_node('homedecor:glowlight_quarter_yellow', {
light_source = LIGHT_MAX-1,
sounds = default.node_sound_wood_defaults(),
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
end
})
@ -216,7 +216,7 @@ minetest.register_node('homedecor:glowlight_half_white', {
light_source = LIGHT_MAX,
sounds = default.node_sound_wood_defaults(),
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
end
})
@ -249,7 +249,7 @@ minetest.register_node('homedecor:glowlight_quarter_white', {
light_source = LIGHT_MAX-1,
sounds = default.node_sound_wood_defaults(),
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
end
})
@ -285,7 +285,7 @@ minetest.register_node('homedecor:glowlight_small_cube_yellow', {
sounds = default.node_sound_wood_defaults(),
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
end
})
@ -318,7 +318,7 @@ minetest.register_node('homedecor:glowlight_small_cube_white', {
light_source = LIGHT_MAX-1,
sounds = default.node_sound_wood_defaults(),
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
end
})

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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