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",
|
||||
walkable = false,
|
||||
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",
|
||||
drawtype = "signlike",
|
||||
paramtype2 = "wallmounted",
|
||||
groups = {dig_immediate=3, flammable=3},
|
||||
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})
|
||||
return itemstack
|
||||
end
|
||||
})
|
||||
|
||||
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",
|
||||
paramtype2 = "wallmounted",
|
||||
walkable = false,
|
||||
groups = {dig_immediate=3, flammable=3, not_in_creative_inventory=1},
|
||||
selection_box = {type="wallmounted"},
|
||||
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})
|
||||
return itemstack
|
||||
end
|
||||
@ -225,7 +227,10 @@ xdecor.register("cushion_block", {
|
||||
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 = {
|
||||
japanese = {
|
||||
{"group:wood", "default:paper"},
|
||||
@ -342,8 +347,8 @@ for _, f in pairs({"dandelion_white", "dandelion_yellow", "geranium",
|
||||
|
||||
minetest.register_craft({
|
||||
output = "xdecor:potted_"..f,
|
||||
recipe = { {"default:clay_brick", "flowers:"..f, "default:clay_brick"},
|
||||
{"", "default:clay_brick", ""} }
|
||||
recipe = {{"default:clay_brick", "flowers:"..f,
|
||||
"default:clay_brick"}, {"", "default:clay_brick", ""}}
|
||||
})
|
||||
end
|
||||
|
||||
@ -367,8 +372,10 @@ xdecor.register("painting_1", {
|
||||
node_placement_prediction = "",
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
local num = math.random(4)
|
||||
local leftover = minetest.item_place_node(ItemStack("xdecor:painting_"..num), placer, pointed_thing)
|
||||
if leftover:get_count() == 0 and not minetest.setting_getbool("creative_mode") then
|
||||
local leftover = minetest.item_place_node(
|
||||
ItemStack("xdecor:painting_"..num), placer, pointed_thing)
|
||||
if leftover:get_count() == 0 and
|
||||
not minetest.setting_getbool("creative_mode") then
|
||||
itemstack:take_item()
|
||||
end
|
||||
return itemstack
|
||||
@ -381,7 +388,8 @@ for i = 2, 4 do
|
||||
paramtype2 = "wallmounted",
|
||||
drop = "xdecor:painting_1",
|
||||
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(),
|
||||
node_box = painting_box
|
||||
})
|
||||
@ -402,6 +410,7 @@ xdecor.register("stonepath", {
|
||||
})
|
||||
|
||||
local function register_hard_node(name, desc, def)
|
||||
def = def or {}
|
||||
xdecor.register(name, {
|
||||
description = desc,
|
||||
tiles = {"xdecor_"..name..".png"},
|
||||
@ -410,13 +419,13 @@ local function register_hard_node(name, desc, def)
|
||||
})
|
||||
end
|
||||
|
||||
register_hard_node("cactusbrick", "Cactus Brick", {})
|
||||
register_hard_node("coalstone_tile", "Coal Stone Tile", {})
|
||||
register_hard_node("desertstone_tile", "Desert Stone Tile", {})
|
||||
register_hard_node("hard_clay", "Hardened Clay", {})
|
||||
register_hard_node("moonbrick", "Moon Brick", {})
|
||||
register_hard_node("stone_tile", "Stone Tile", {})
|
||||
register_hard_node("stone_rune", "Runestone", {})
|
||||
register_hard_node("cactusbrick", "Cactus Brick")
|
||||
register_hard_node("coalstone_tile", "Coal Stone Tile")
|
||||
register_hard_node("desertstone_tile", "Desert Stone Tile")
|
||||
register_hard_node("hard_clay", "Hardened Clay")
|
||||
register_hard_node("moonbrick", "Moon Brick")
|
||||
register_hard_node("stone_tile", "Stone Tile")
|
||||
register_hard_node("stone_rune", "Runestone")
|
||||
register_hard_node("packed_ice", "Packed Ice", {
|
||||
groups = {cracky=1, puts_out_fire=1},
|
||||
sounds = default.node_sound_glass_defaults()
|
||||
@ -474,4 +483,3 @@ xdecor.register("woodframed_glass", {
|
||||
groups = {cracky=2, oddly_breakable_by_hand=1},
|
||||
sounds = default.node_sound_glass_defaults()
|
||||
})
|
||||
|
||||
|
@ -2,11 +2,12 @@ local workbench = {}
|
||||
WB = {}
|
||||
screwdriver = screwdriver or {}
|
||||
local min, ceil = math.min, math.ceil
|
||||
local registered_nodes = minetest.registered_nodes
|
||||
|
||||
-- Nodes allowed to be cut
|
||||
-- Only the regular, solid blocks without metas or explosivity can be cut
|
||||
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
|
||||
(def.groups.cracky or def.groups.choppy) and
|
||||
not def.on_construct and
|
||||
@ -77,10 +78,11 @@ end
|
||||
|
||||
function workbench:get_output(inv, input, name)
|
||||
local output = {}
|
||||
for _, n in pairs(self.defs) do
|
||||
local count = min(n[2] * input:get_count(), input:get_stack_max())
|
||||
local item = name.."_"..n[1]
|
||||
if not n[3] then item = "stairs:"..n[1].."_"..name:match(":(.*)") end
|
||||
for i=1, #self.defs do
|
||||
local nbox = self.defs[i]
|
||||
local count = min(nbox[2] * input:get_count(), input:get_stack_max())
|
||||
local item = name.."_"..nbox[1]
|
||||
item = nbox[3] and item or "stairs:"..nbox[1].."_"..name:match(":(.*)")
|
||||
output[#output+1] = item.." "..count
|
||||
end
|
||||
inv:set_list("forms", output)
|
||||
@ -117,7 +119,8 @@ local formspecs = {
|
||||
}
|
||||
|
||||
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))
|
||||
end
|
||||
|
||||
@ -136,10 +139,11 @@ function workbench.construct(pos)
|
||||
end
|
||||
|
||||
function workbench.fields(pos, _, fields)
|
||||
if fields.quit then return end
|
||||
local meta = minetest.get_meta(pos)
|
||||
if fields.back then workbench:set_formspec(meta, 1)
|
||||
elseif fields.craft then workbench:set_formspec(meta, 2)
|
||||
elseif fields.storage then workbench:set_formspec(meta, 3) end
|
||||
workbench:set_formspec(meta, fields.back and 1 or
|
||||
fields.craft and 2 or
|
||||
fields.storage and 3)
|
||||
end
|
||||
|
||||
function workbench.dig(pos)
|
||||
@ -172,7 +176,7 @@ function workbench.put(_, listname, _, stack)
|
||||
local stackname = stack:get_name()
|
||||
if (listname == "tool" and stack:get_wear() > 0 and
|
||||
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 == "storage" then
|
||||
return stack:get_count()
|
||||
@ -243,7 +247,7 @@ xdecor.register("workbench", {
|
||||
for _, d in pairs(workbench.defs) do
|
||||
for i=1, #nodes do
|
||||
local node = nodes[i]
|
||||
local def = minetest.registered_nodes[node]
|
||||
local def = registered_nodes[node]
|
||||
|
||||
if d[3] then
|
||||
local groups = {}
|
||||
@ -257,7 +261,7 @@ for i=1, #nodes do
|
||||
end
|
||||
|
||||
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
|
||||
else
|
||||
tiles = {def.tiles[1]}
|
||||
@ -266,7 +270,7 @@ for i=1, #nodes do
|
||||
tiles = {def.tile_images[1]}
|
||||
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,
|
||||
groups, tiles, def.description.." Stair",
|
||||
def.description.." Slab", def.sounds)
|
||||
@ -288,4 +292,3 @@ for i=1, #nodes do
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user