style
This commit is contained in:
parent
fe471a0a73
commit
7a3b338ff9
@ -22,7 +22,8 @@ local function xconstruct(pos)
|
|||||||
local nodebtn = {}
|
local nodebtn = {}
|
||||||
|
|
||||||
for i=1, #def do
|
for i=1, #def do
|
||||||
nodebtn[#nodebtn+1] = "item_image_button["..(i-1)..",0.5;1,1;xdecor:"..def[i][1].."_cloud;"..def[i][1]..";]"
|
nodebtn[#nodebtn+1] = "item_image_button["..(i-1)..
|
||||||
|
",0.5;1,1;xdecor:"..def[i][1].."_cloud;"..def[i][1]..";]"
|
||||||
end
|
end
|
||||||
nodebtn = table.concat(nodebtn)
|
nodebtn = table.concat(nodebtn)
|
||||||
|
|
||||||
@ -53,16 +54,15 @@ local function xfields(pos, formname, fields, sender)
|
|||||||
local inv = meta:get_inventory()
|
local inv = meta:get_inventory()
|
||||||
local inputstack = inv:get_stack("input", 1)
|
local inputstack = inv:get_stack("input", 1)
|
||||||
local outputstack = inv:get_stack("output", 1)
|
local outputstack = inv:get_stack("output", 1)
|
||||||
local shape = {}
|
local shape, get = {}, {}
|
||||||
local get = {}
|
|
||||||
local anz = 0
|
local anz = 0
|
||||||
|
|
||||||
for m=1, #material do
|
for m=1, #material do
|
||||||
for n=1, #def do
|
for n=1, #def do
|
||||||
local v = material[m]
|
local v = material[m]
|
||||||
local w = def[n]
|
local w = def[n]
|
||||||
if (inputstack:get_name() == "default:"..v) and (outputstack:get_count() < 99)
|
if (inputstack:get_name() == "default:"..v)
|
||||||
and fields[w[1]] then
|
and (outputstack:get_count() < 99) and fields[w[1]] then
|
||||||
shape = "xdecor:"..w[1].."_"..v
|
shape = "xdecor:"..w[1].."_"..v
|
||||||
anz = w[2]
|
anz = w[2]
|
||||||
get = shape.." "..anz
|
get = shape.." "..anz
|
||||||
@ -79,8 +79,8 @@ local function xdig(pos, player)
|
|||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
local inv = meta:get_inventory()
|
local inv = meta:get_inventory()
|
||||||
if not inv:is_empty("input") or not inv:is_empty("output")
|
if not inv:is_empty("input") or not inv:is_empty("output")
|
||||||
or not inv:is_empty("fuel") or not inv:is_empty("src") then
|
or not inv:is_empty("fuel") or not inv:is_empty("src") then
|
||||||
return false end
|
return false end
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -90,32 +90,30 @@ xdecor.register("worktable", {
|
|||||||
tiles = {"xdecor_worktable_top.png", "xdecor_worktable_top.png",
|
tiles = {"xdecor_worktable_top.png", "xdecor_worktable_top.png",
|
||||||
"xdecor_worktable_sides.png", "xdecor_worktable_sides.png",
|
"xdecor_worktable_sides.png", "xdecor_worktable_sides.png",
|
||||||
"xdecor_worktable_front.png", "xdecor_worktable_front.png"},
|
"xdecor_worktable_front.png", "xdecor_worktable_front.png"},
|
||||||
on_construct = xconstruct,
|
on_construct = xconstruct, on_receive_fields = xfields, can_dig = xdig })
|
||||||
on_receive_fields = xfields,
|
|
||||||
can_dig = xdig })
|
|
||||||
|
|
||||||
local function lightlvl(material)
|
local function lightlvl(mat)
|
||||||
if (material == "meselamp") then return 12 else return 0 end
|
if (mat == "meselamp") then return 12 else return 0 end
|
||||||
end
|
end
|
||||||
|
|
||||||
local function stype(material)
|
local function stype(mat)
|
||||||
if string.find(material, "glass") or string.find(material, "lamp") then
|
if string.find(mat, "glass") or string.find(mat, "lamp") then
|
||||||
return default.node_sound_glass_defaults()
|
return default.node_sound_glass_defaults()
|
||||||
elseif string.find(material, "wood") or string.find(material, "tree") then
|
elseif string.find(mat, "wood") or string.find(mat, "tree") then
|
||||||
return default.node_sound_wood_defaults()
|
return default.node_sound_wood_defaults()
|
||||||
else
|
else
|
||||||
return default.node_sound_stone_defaults()
|
return default.node_sound_stone_defaults()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local function tnaming(material)
|
local function tnaming(mat)
|
||||||
if string.find(material, "block") then
|
if string.find(mat, "block") then
|
||||||
local newname = string.gsub(material, "(block)", "_%1")
|
local newname = string.gsub(mat, "(block)", "_%1")
|
||||||
return "default_"..newname..".png"
|
return "default_"..newname..".png"
|
||||||
elseif string.find(material, "brick") then
|
elseif string.find(mat, "brick") then
|
||||||
local newname = string.gsub(material, "(brick)", "_%1")
|
local newname = string.gsub(mat, "(brick)", "_%1")
|
||||||
return "default_"..newname..".png"
|
return "default_"..newname..".png"
|
||||||
else return "default_"..material..".png" end
|
else return "default_"..mat..".png" end
|
||||||
end
|
end
|
||||||
|
|
||||||
for m=1, #material do
|
for m=1, #material do
|
||||||
@ -130,7 +128,8 @@ for m=1, #material do
|
|||||||
description = string.sub(string.upper(w[1]), 0, 1)..string.sub(w[1], 2),
|
description = string.sub(string.upper(w[1]), 0, 1)..string.sub(w[1], 2),
|
||||||
light_source = light, sounds = sound, tiles = {tile},
|
light_source = light, sounds = sound, tiles = {tile},
|
||||||
groups = {snappy=3, not_in_creative_inventory=1},
|
groups = {snappy=3, not_in_creative_inventory=1},
|
||||||
on_place = minetest.rotate_node, node_box = {type = "fixed", fixed = w[3]} })
|
node_box = {type = "fixed", fixed = w[3]},
|
||||||
|
on_place = minetest.rotate_node })
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -149,7 +148,6 @@ minetest.register_abm({
|
|||||||
if (src:is_empty() or wear == 0 or wear == 65535) then return end
|
if (src:is_empty() or wear == 0 or wear == 65535) then return end
|
||||||
local fuel = inv:get_stack("fuel", 1)
|
local fuel = inv:get_stack("fuel", 1)
|
||||||
if (fuel:is_empty() or fuel:get_name() ~= "xdecor:hammer") then return end
|
if (fuel:is_empty() or fuel:get_name() ~= "xdecor:hammer") then return end
|
||||||
|
|
||||||
if (wear + repair < 0) then src:add_wear(repair + wear)
|
if (wear + repair < 0) then src:add_wear(repair + wear)
|
||||||
else src:add_wear(repair) end
|
else src:add_wear(repair) end
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user