Localize some global variables
This commit is contained in:
parent
e51a683fe3
commit
8c0b41efcf
@ -2,6 +2,8 @@ local enchanting = {}
|
|||||||
|
|
||||||
function enchanting.construct(pos)
|
function enchanting.construct(pos)
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
|
local xbg = default.gui_bg..default.gui_bg_img..default.gui_slots
|
||||||
|
|
||||||
meta:set_string("formspec", "size[8,7;]"..xbg..
|
meta:set_string("formspec", "size[8,7;]"..xbg..
|
||||||
"label[0.85,-0.15;Enchant]".."image[0.6,0.2;2,2;xdecor_enchbook.png]"..
|
"label[0.85,-0.15;Enchant]".."image[0.6,0.2;2,2;xdecor_enchbook.png]"..
|
||||||
"list[current_name;tool;0.5,2;1,1;]"..
|
"list[current_name;tool;0.5,2;1,1;]"..
|
||||||
@ -78,7 +80,7 @@ xdecor.register("enchantment_table", {
|
|||||||
"xdecor_enchantment_side.png", "xdecor_enchantment_side.png"
|
"xdecor_enchantment_side.png", "xdecor_enchantment_side.png"
|
||||||
},
|
},
|
||||||
groups = {cracky=1},
|
groups = {cracky=1},
|
||||||
sounds = sound.stone,
|
sounds = default.node_sound_stone_defaults(),
|
||||||
can_dig = enchanting.dig,
|
can_dig = enchanting.dig,
|
||||||
on_construct = enchanting.construct,
|
on_construct = enchanting.construct,
|
||||||
on_receive_fields = enchanting.fields,
|
on_receive_fields = enchanting.fields,
|
||||||
|
@ -5,13 +5,7 @@ local default_can_dig = function(pos, _)
|
|||||||
return inv:is_empty("main")
|
return inv:is_empty("main")
|
||||||
end
|
end
|
||||||
|
|
||||||
sound = {}
|
local xbg = default.gui_bg..default.gui_bg_img..default.gui_slots
|
||||||
sound.wood = default.node_sound_wood_defaults()
|
|
||||||
sound.glass = default.node_sound_glass_defaults()
|
|
||||||
sound.leaves = default.node_sound_leaves_defaults()
|
|
||||||
sound.stone = default.node_sound_stone_defaults()
|
|
||||||
|
|
||||||
xbg = default.gui_bg..default.gui_bg_img..default.gui_slots
|
|
||||||
|
|
||||||
local default_inventory_size = 32
|
local default_inventory_size = 32
|
||||||
local default_inventory_formspecs = {
|
local default_inventory_formspecs = {
|
||||||
@ -66,7 +60,8 @@ function xdecor.register(name, def)
|
|||||||
meta:set_string("infotext", infotext)
|
meta:set_string("infotext", infotext)
|
||||||
end
|
end
|
||||||
local size = inventory.size or default_inventory_size
|
local size = inventory.size or default_inventory_size
|
||||||
meta:get_inventory():set_size("main", size)
|
local inv = meta:get_inventory()
|
||||||
|
inv:set_size("main", size)
|
||||||
meta:set_string("formspec", inventory.formspec or get_formspec_by_size(size))
|
meta:set_string("formspec", inventory.formspec or get_formspec_by_size(size))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
2
hive.lua
2
hive.lua
@ -2,6 +2,8 @@ local hive = {}
|
|||||||
|
|
||||||
function hive.construct(pos)
|
function hive.construct(pos)
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
|
local xbg = default.gui_bg..default.gui_bg_img..default.gui_slots
|
||||||
|
|
||||||
meta:set_string("formspec", "size[8,5;]"..xbg..
|
meta:set_string("formspec", "size[8,5;]"..xbg..
|
||||||
"label[1.35,0;Bees are making honey\nwith pollen around...]"..
|
"label[1.35,0;Bees are making honey\nwith pollen around...]"..
|
||||||
"image[0.2,-0.1;1,1;flowers_dandelion_white.png]"..
|
"image[0.2,-0.1;1,1;flowers_dandelion_white.png]"..
|
||||||
|
@ -82,7 +82,7 @@ end
|
|||||||
xdecor.register("frame", {
|
xdecor.register("frame", {
|
||||||
description = "Item frame",
|
description = "Item frame",
|
||||||
groups = {choppy=3, snappy=2},
|
groups = {choppy=3, snappy=2},
|
||||||
sounds = sound.wood,
|
sounds = default.node_sound_wood_defaults(),
|
||||||
on_rotate = screwdriver.disallow,
|
on_rotate = screwdriver.disallow,
|
||||||
node_box = {
|
node_box = {
|
||||||
type = "fixed",
|
type = "fixed",
|
||||||
|
@ -59,6 +59,8 @@ xdecor.register("mailbox", {
|
|||||||
end
|
end
|
||||||
})
|
})
|
||||||
|
|
||||||
|
local xbg = default.gui_bg..default.gui_bg_img..default.gui_slots
|
||||||
|
|
||||||
function mailbox.get_formspec(pos)
|
function mailbox.get_formspec(pos)
|
||||||
local spos = pos.x..","..pos.y..","..pos.z
|
local spos = pos.x..","..pos.y..","..pos.z
|
||||||
local formspec =
|
local formspec =
|
||||||
|
@ -1,3 +1,9 @@
|
|||||||
|
local sound = {}
|
||||||
|
sound.wood = default.node_sound_wood_defaults()
|
||||||
|
sound.glass = default.node_sound_glass_defaults()
|
||||||
|
sound.leaves = default.node_sound_leaves_defaults()
|
||||||
|
sound.stone = default.node_sound_stone_defaults()
|
||||||
|
|
||||||
xpanes.register_pane("bamboo_frame", {
|
xpanes.register_pane("bamboo_frame", {
|
||||||
description = "Bamboo Frame",
|
description = "Bamboo Frame",
|
||||||
tiles = {"xdecor_bamboo_frame.png"},
|
tiles = {"xdecor_bamboo_frame.png"},
|
||||||
|
@ -34,6 +34,7 @@ function worktable.construct(pos)
|
|||||||
end
|
end
|
||||||
nodebtn = table.concat(nodebtn)
|
nodebtn = table.concat(nodebtn)
|
||||||
|
|
||||||
|
local xbg = default.gui_bg..default.gui_bg_img..default.gui_slots
|
||||||
meta:set_string("formspec", "size[8,7;]"..xbg..
|
meta:set_string("formspec", "size[8,7;]"..xbg..
|
||||||
"label[0,0;Cut your material into...]"..nodebtn..
|
"label[0,0;Cut your material into...]"..nodebtn..
|
||||||
"label[0,1.5;Input]".."list[current_name;input;0,2;1,1;]"..
|
"label[0,1.5;Input]".."list[current_name;input;0,2;1,1;]"..
|
||||||
@ -118,7 +119,7 @@ end
|
|||||||
xdecor.register("worktable", {
|
xdecor.register("worktable", {
|
||||||
description = "Work Table",
|
description = "Work Table",
|
||||||
groups = {cracky=2, choppy=2},
|
groups = {cracky=2, choppy=2},
|
||||||
sounds = sound.wood,
|
sounds = default.node_sound_wood_defaults(),
|
||||||
tiles = {
|
tiles = {
|
||||||
"xdecor_worktable_top.png", "xdecor_worktable_top.png",
|
"xdecor_worktable_top.png", "xdecor_worktable_top.png",
|
||||||
"xdecor_worktable_sides.png", "xdecor_worktable_sides.png",
|
"xdecor_worktable_sides.png", "xdecor_worktable_sides.png",
|
||||||
|
@ -184,7 +184,7 @@ function xwall.register_wall(name, tiles, def)
|
|||||||
def = {
|
def = {
|
||||||
description = string.sub(name:gsub("%l", string.upper, 7), 8, -6).." Wall",
|
description = string.sub(name:gsub("%l", string.upper, 7), 8, -6).." Wall",
|
||||||
textures = {tiles, tiles, tiles, tiles},
|
textures = {tiles, tiles, tiles, tiles},
|
||||||
sounds = sound.stone,
|
sounds = default.node_sound_stone_defaults(),
|
||||||
groups = {cracky=3, stone=1, pane=1},
|
groups = {cracky=3, stone=1, pane=1},
|
||||||
sunlight_propagates = true,
|
sunlight_propagates = true,
|
||||||
collision_box = {
|
collision_box = {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user