Style cleaning
This commit is contained in:
parent
4e9af95454
commit
16ea4a7385
@ -172,27 +172,29 @@ for _, c in pairs({"red"}) do -- Add more curtains colors simply here
|
|||||||
description = c:gsub("^%l", string.upper).." Curtain",
|
description = c:gsub("^%l", string.upper).." Curtain",
|
||||||
walkable = false,
|
walkable = false,
|
||||||
tiles = {"wool_white.png^[colorize:"..c..":170"},
|
tiles = {"wool_white.png^[colorize:"..c..":170"},
|
||||||
inventory_image = "wool_white.png^[colorize:"..c..":170^xdecor_curtain_open_overlay.png^[makealpha:255,126,126",
|
inventory_image = "wool_white.png^[colorize:"..c..
|
||||||
|
":170^xdecor_curtain_open_overlay.png^[makealpha:255,126,126",
|
||||||
wield_image = "wool_white.png^[colorize:"..c..":170",
|
wield_image = "wool_white.png^[colorize:"..c..":170",
|
||||||
drawtype = "signlike",
|
drawtype = "signlike",
|
||||||
paramtype2 = "wallmounted",
|
paramtype2 = "wallmounted",
|
||||||
groups = {dig_immediate=3, flammable=3},
|
groups = {dig_immediate=3, flammable=3},
|
||||||
selection_box = {type="wallmounted"},
|
selection_box = {type="wallmounted"},
|
||||||
on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
|
on_rightclick = function(pos, node, _, itemstack)
|
||||||
minetest.set_node(pos, {name="xdecor:curtain_open_"..c, param2=node.param2})
|
minetest.set_node(pos, {name="xdecor:curtain_open_"..c, param2=node.param2})
|
||||||
return itemstack
|
return itemstack
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
|
|
||||||
xdecor.register("curtain_open_"..c, {
|
xdecor.register("curtain_open_"..c, {
|
||||||
tiles = {"wool_white.png^[colorize:"..c..":170^xdecor_curtain_open_overlay.png^[makealpha:255,126,126"},
|
tiles = {"wool_white.png^[colorize:"..c..
|
||||||
|
":170^xdecor_curtain_open_overlay.png^[makealpha:255,126,126"},
|
||||||
drawtype = "signlike",
|
drawtype = "signlike",
|
||||||
paramtype2 = "wallmounted",
|
paramtype2 = "wallmounted",
|
||||||
walkable = false,
|
walkable = false,
|
||||||
groups = {dig_immediate=3, flammable=3, not_in_creative_inventory=1},
|
groups = {dig_immediate=3, flammable=3, not_in_creative_inventory=1},
|
||||||
selection_box = {type="wallmounted"},
|
selection_box = {type="wallmounted"},
|
||||||
drop = "xdecor:curtain_"..c,
|
drop = "xdecor:curtain_"..c,
|
||||||
on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
|
on_rightclick = function(pos, node, _, itemstack)
|
||||||
minetest.set_node(pos, {name="xdecor:curtain_"..c, param2=node.param2})
|
minetest.set_node(pos, {name="xdecor:curtain_"..c, param2=node.param2})
|
||||||
return itemstack
|
return itemstack
|
||||||
end
|
end
|
||||||
@ -200,8 +202,8 @@ for _, c in pairs({"red"}) do -- Add more curtains colors simply here
|
|||||||
|
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
output = "xdecor:curtain_"..c.." 4",
|
output = "xdecor:curtain_"..c.." 4",
|
||||||
recipe = { {"", "wool:"..c, ""},
|
recipe = {{"", "wool:"..c, ""},
|
||||||
{"", "wool:"..c, ""} }
|
{"", "wool:"..c, ""}}
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -225,7 +227,10 @@ xdecor.register("cushion_block", {
|
|||||||
groups = {snappy=3, flammable=3, fall_damage_add_percent=-75, not_in_creative_inventory=1}
|
groups = {snappy=3, flammable=3, fall_damage_add_percent=-75, not_in_creative_inventory=1}
|
||||||
})
|
})
|
||||||
|
|
||||||
local function door_access(name) return name:find("prison") end
|
local function door_access(name)
|
||||||
|
return name:find("prison")
|
||||||
|
end
|
||||||
|
|
||||||
local xdecor_doors = {
|
local xdecor_doors = {
|
||||||
japanese = {
|
japanese = {
|
||||||
{"group:wood", "default:paper"},
|
{"group:wood", "default:paper"},
|
||||||
@ -313,7 +318,7 @@ xdecor.register("lantern", {
|
|||||||
paramtype2 = "wallmounted",
|
paramtype2 = "wallmounted",
|
||||||
walkable = false,
|
walkable = false,
|
||||||
groups = {snappy=3, attached_node=1},
|
groups = {snappy=3, attached_node=1},
|
||||||
tiles = {{name = "xdecor_lantern.png", animation = {type="vertical_frames", length=1.5}}},
|
tiles = {{name="xdecor_lantern.png", animation={type="vertical_frames", length=1.5}}},
|
||||||
selection_box = xdecor.pixelbox(16, {{4, 0, 4, 8, 16, 8}})
|
selection_box = xdecor.pixelbox(16, {{4, 0, 4, 8, 16, 8}})
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -342,8 +347,8 @@ for _, f in pairs({"dandelion_white", "dandelion_yellow", "geranium",
|
|||||||
|
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
output = "xdecor:potted_"..f,
|
output = "xdecor:potted_"..f,
|
||||||
recipe = { {"default:clay_brick", "flowers:"..f, "default:clay_brick"},
|
recipe = {{"default:clay_brick", "flowers:"..f,
|
||||||
{"", "default:clay_brick", ""} }
|
"default:clay_brick"}, {"", "default:clay_brick", ""}}
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -367,8 +372,10 @@ xdecor.register("painting_1", {
|
|||||||
node_placement_prediction = "",
|
node_placement_prediction = "",
|
||||||
on_place = function(itemstack, placer, pointed_thing)
|
on_place = function(itemstack, placer, pointed_thing)
|
||||||
local num = math.random(4)
|
local num = math.random(4)
|
||||||
local leftover = minetest.item_place_node(ItemStack("xdecor:painting_"..num), placer, pointed_thing)
|
local leftover = minetest.item_place_node(
|
||||||
if leftover:get_count() == 0 and not minetest.setting_getbool("creative_mode") then
|
ItemStack("xdecor:painting_"..num), placer, pointed_thing)
|
||||||
|
if leftover:get_count() == 0 and
|
||||||
|
not minetest.setting_getbool("creative_mode") then
|
||||||
itemstack:take_item()
|
itemstack:take_item()
|
||||||
end
|
end
|
||||||
return itemstack
|
return itemstack
|
||||||
@ -381,7 +388,8 @@ for i = 2, 4 do
|
|||||||
paramtype2 = "wallmounted",
|
paramtype2 = "wallmounted",
|
||||||
drop = "xdecor:painting_1",
|
drop = "xdecor:painting_1",
|
||||||
sunlight_propagates = true,
|
sunlight_propagates = true,
|
||||||
groups = {choppy=3, oddly_breakable_by_hand=2, flammable=2, attached_node=1, not_in_creative_inventory=1},
|
groups = {choppy=3, oddly_breakable_by_hand=2, flammable=2,
|
||||||
|
attached_node=1, not_in_creative_inventory=1},
|
||||||
sounds = default.node_sound_wood_defaults(),
|
sounds = default.node_sound_wood_defaults(),
|
||||||
node_box = painting_box
|
node_box = painting_box
|
||||||
})
|
})
|
||||||
@ -402,6 +410,7 @@ xdecor.register("stonepath", {
|
|||||||
})
|
})
|
||||||
|
|
||||||
local function register_hard_node(name, desc, def)
|
local function register_hard_node(name, desc, def)
|
||||||
|
def = def or {}
|
||||||
xdecor.register(name, {
|
xdecor.register(name, {
|
||||||
description = desc,
|
description = desc,
|
||||||
tiles = {"xdecor_"..name..".png"},
|
tiles = {"xdecor_"..name..".png"},
|
||||||
@ -410,13 +419,13 @@ local function register_hard_node(name, desc, def)
|
|||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
register_hard_node("cactusbrick", "Cactus Brick", {})
|
register_hard_node("cactusbrick", "Cactus Brick")
|
||||||
register_hard_node("coalstone_tile", "Coal Stone Tile", {})
|
register_hard_node("coalstone_tile", "Coal Stone Tile")
|
||||||
register_hard_node("desertstone_tile", "Desert Stone Tile", {})
|
register_hard_node("desertstone_tile", "Desert Stone Tile")
|
||||||
register_hard_node("hard_clay", "Hardened Clay", {})
|
register_hard_node("hard_clay", "Hardened Clay")
|
||||||
register_hard_node("moonbrick", "Moon Brick", {})
|
register_hard_node("moonbrick", "Moon Brick")
|
||||||
register_hard_node("stone_tile", "Stone Tile", {})
|
register_hard_node("stone_tile", "Stone Tile")
|
||||||
register_hard_node("stone_rune", "Runestone", {})
|
register_hard_node("stone_rune", "Runestone")
|
||||||
register_hard_node("packed_ice", "Packed Ice", {
|
register_hard_node("packed_ice", "Packed Ice", {
|
||||||
groups = {cracky=1, puts_out_fire=1},
|
groups = {cracky=1, puts_out_fire=1},
|
||||||
sounds = default.node_sound_glass_defaults()
|
sounds = default.node_sound_glass_defaults()
|
||||||
@ -474,4 +483,3 @@ xdecor.register("woodframed_glass", {
|
|||||||
groups = {cracky=2, oddly_breakable_by_hand=1},
|
groups = {cracky=2, oddly_breakable_by_hand=1},
|
||||||
sounds = default.node_sound_glass_defaults()
|
sounds = default.node_sound_glass_defaults()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -2,11 +2,12 @@ local workbench = {}
|
|||||||
WB = {}
|
WB = {}
|
||||||
screwdriver = screwdriver or {}
|
screwdriver = screwdriver or {}
|
||||||
local min, ceil = math.min, math.ceil
|
local min, ceil = math.min, math.ceil
|
||||||
|
local registered_nodes = minetest.registered_nodes
|
||||||
|
|
||||||
-- Nodes allowed to be cut
|
-- Nodes allowed to be cut
|
||||||
-- Only the regular, solid blocks without metas or explosivity can be cut
|
-- Only the regular, solid blocks without metas or explosivity can be cut
|
||||||
local nodes = {}
|
local nodes = {}
|
||||||
for node, def in pairs(minetest.registered_nodes) do
|
for node, def in pairs(registered_nodes) do
|
||||||
if (def.drawtype == "normal" or def.drawtype:sub(1,5) == "glass") and
|
if (def.drawtype == "normal" or def.drawtype:sub(1,5) == "glass") and
|
||||||
(def.groups.cracky or def.groups.choppy) and
|
(def.groups.cracky or def.groups.choppy) and
|
||||||
not def.on_construct and
|
not def.on_construct and
|
||||||
@ -77,10 +78,11 @@ end
|
|||||||
|
|
||||||
function workbench:get_output(inv, input, name)
|
function workbench:get_output(inv, input, name)
|
||||||
local output = {}
|
local output = {}
|
||||||
for _, n in pairs(self.defs) do
|
for i=1, #self.defs do
|
||||||
local count = min(n[2] * input:get_count(), input:get_stack_max())
|
local nbox = self.defs[i]
|
||||||
local item = name.."_"..n[1]
|
local count = min(nbox[2] * input:get_count(), input:get_stack_max())
|
||||||
if not n[3] then item = "stairs:"..n[1].."_"..name:match(":(.*)") end
|
local item = name.."_"..nbox[1]
|
||||||
|
item = nbox[3] and item or "stairs:"..nbox[1].."_"..name:match(":(.*)")
|
||||||
output[#output+1] = item.." "..count
|
output[#output+1] = item.." "..count
|
||||||
end
|
end
|
||||||
inv:set_list("forms", output)
|
inv:set_list("forms", output)
|
||||||
@ -117,7 +119,8 @@ local formspecs = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function workbench:set_formspec(meta, id)
|
function workbench:set_formspec(meta, id)
|
||||||
meta:set_string("formspec", "size[8,7;]list[current_player;main;0,3.25;8,4;]"..
|
meta:set_string("formspec",
|
||||||
|
"size[8,7;]list[current_player;main;0,3.25;8,4;]"..
|
||||||
formspecs[id]..xbg..default.get_hotbar_bg(0,3.25))
|
formspecs[id]..xbg..default.get_hotbar_bg(0,3.25))
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -136,10 +139,11 @@ function workbench.construct(pos)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function workbench.fields(pos, _, fields)
|
function workbench.fields(pos, _, fields)
|
||||||
|
if fields.quit then return end
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
if fields.back then workbench:set_formspec(meta, 1)
|
workbench:set_formspec(meta, fields.back and 1 or
|
||||||
elseif fields.craft then workbench:set_formspec(meta, 2)
|
fields.craft and 2 or
|
||||||
elseif fields.storage then workbench:set_formspec(meta, 3) end
|
fields.storage and 3)
|
||||||
end
|
end
|
||||||
|
|
||||||
function workbench.dig(pos)
|
function workbench.dig(pos)
|
||||||
@ -172,7 +176,7 @@ function workbench.put(_, listname, _, stack)
|
|||||||
local stackname = stack:get_name()
|
local stackname = stack:get_name()
|
||||||
if (listname == "tool" and stack:get_wear() > 0 and
|
if (listname == "tool" and stack:get_wear() > 0 and
|
||||||
workbench:repairable(stackname)) or
|
workbench:repairable(stackname)) or
|
||||||
(listname == "input" and minetest.registered_nodes[stackname.."_cube"]) or
|
(listname == "input" and registered_nodes[stackname.."_cube"]) or
|
||||||
(listname == "hammer" and stackname == "xdecor:hammer") or
|
(listname == "hammer" and stackname == "xdecor:hammer") or
|
||||||
listname == "storage" then
|
listname == "storage" then
|
||||||
return stack:get_count()
|
return stack:get_count()
|
||||||
@ -243,7 +247,7 @@ xdecor.register("workbench", {
|
|||||||
for _, d in pairs(workbench.defs) do
|
for _, d in pairs(workbench.defs) do
|
||||||
for i=1, #nodes do
|
for i=1, #nodes do
|
||||||
local node = nodes[i]
|
local node = nodes[i]
|
||||||
local def = minetest.registered_nodes[node]
|
local def = registered_nodes[node]
|
||||||
|
|
||||||
if d[3] then
|
if d[3] then
|
||||||
local groups = {}
|
local groups = {}
|
||||||
@ -257,7 +261,7 @@ for i=1, #nodes do
|
|||||||
end
|
end
|
||||||
|
|
||||||
if def.tiles then
|
if def.tiles then
|
||||||
if #def.tiles > 1 and not (def.drawtype:sub(1,5) == "glass") then
|
if #def.tiles > 1 and (def.drawtype:sub(1,5) ~= "glass") then
|
||||||
tiles = def.tiles
|
tiles = def.tiles
|
||||||
else
|
else
|
||||||
tiles = {def.tiles[1]}
|
tiles = {def.tiles[1]}
|
||||||
@ -266,7 +270,7 @@ for i=1, #nodes do
|
|||||||
tiles = {def.tile_images[1]}
|
tiles = {def.tile_images[1]}
|
||||||
end
|
end
|
||||||
|
|
||||||
if not minetest.registered_nodes["stairs:slab_"..node:match(":(.*)")] then
|
if not registered_nodes["stairs:slab_"..node:match(":(.*)")] then
|
||||||
stairs.register_stair_and_slab(node:match(":(.*)"), node,
|
stairs.register_stair_and_slab(node:match(":(.*)"), node,
|
||||||
groups, tiles, def.description.." Stair",
|
groups, tiles, def.description.." Stair",
|
||||||
def.description.." Slab", def.sounds)
|
def.description.." Slab", def.sounds)
|
||||||
@ -288,4 +292,3 @@ for i=1, #nodes do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user