forked from MineClone5/MineClone5
Remove some annoying whitespace
This commit is contained in:
parent
1aa3b19099
commit
7f6cc1b95e
|
@ -28,9 +28,9 @@ function mcl_doors:register_door(name, def)
|
||||||
if not def.sound_close then
|
if not def.sound_close then
|
||||||
def.sound_close = "doors_door_close"
|
def.sound_close = "doors_door_close"
|
||||||
end
|
end
|
||||||
|
|
||||||
local box = {{-8/16, -8/16, -8/16, 8/16, 8/16, -5/16}}
|
local box = {{-8/16, -8/16, -8/16, 8/16, 8/16, -5/16}}
|
||||||
|
|
||||||
if not def.node_box_bottom then
|
if not def.node_box_bottom then
|
||||||
def.node_box_bottom = box
|
def.node_box_bottom = box
|
||||||
end
|
end
|
||||||
|
@ -43,7 +43,7 @@ function mcl_doors:register_door(name, def)
|
||||||
if not def.selection_box_top then
|
if not def.selection_box_top then
|
||||||
def.selection_box_top = box
|
def.selection_box_top = box
|
||||||
end
|
end
|
||||||
|
|
||||||
minetest.register_craftitem(name, {
|
minetest.register_craftitem(name, {
|
||||||
description = def.description,
|
description = def.description,
|
||||||
inventory_image = def.inventory_image,
|
inventory_image = def.inventory_image,
|
||||||
|
@ -62,7 +62,7 @@ function mcl_doors:register_door(name, def)
|
||||||
if minetest.registered_nodes[nu.name].on_rightclick then
|
if minetest.registered_nodes[nu.name].on_rightclick then
|
||||||
return minetest.registered_nodes[nu.name].on_rightclick(ptu, nu, placer, itemstack)
|
return minetest.registered_nodes[nu.name].on_rightclick(ptu, nu, placer, itemstack)
|
||||||
end
|
end
|
||||||
|
|
||||||
local pt = pointed_thing.above
|
local pt = pointed_thing.above
|
||||||
local pt2 = {x=pt.x, y=pt.y, z=pt.z}
|
local pt2 = {x=pt.x, y=pt.y, z=pt.z}
|
||||||
pt2.y = pt2.y+1
|
pt2.y = pt2.y+1
|
||||||
|
@ -74,7 +74,7 @@ function mcl_doors:register_door(name, def)
|
||||||
then
|
then
|
||||||
return itemstack
|
return itemstack
|
||||||
end
|
end
|
||||||
|
|
||||||
local p2 = minetest.dir_to_facedir(placer:get_look_dir())
|
local p2 = minetest.dir_to_facedir(placer:get_look_dir())
|
||||||
local pt3 = {x=pt.x, y=pt.y, z=pt.z}
|
local pt3 = {x=pt.x, y=pt.y, z=pt.z}
|
||||||
if p2 == 0 then
|
if p2 == 0 then
|
||||||
|
@ -96,7 +96,7 @@ function mcl_doors:register_door(name, def)
|
||||||
if def.sounds and def.sounds.place then
|
if def.sounds and def.sounds.place then
|
||||||
minetest.sound_play(def.sounds.place, {pos=pt})
|
minetest.sound_play(def.sounds.place, {pos=pt})
|
||||||
end
|
end
|
||||||
|
|
||||||
if def.only_placer_can_open then
|
if def.only_placer_can_open then
|
||||||
local meta = minetest.get_meta(pt)
|
local meta = minetest.get_meta(pt)
|
||||||
meta:set_string("doors_owner", "")
|
meta:set_string("doors_owner", "")
|
||||||
|
@ -109,24 +109,24 @@ function mcl_doors:register_door(name, def)
|
||||||
meta:set_int("is_open", 0)
|
meta:set_int("is_open", 0)
|
||||||
meta = minetest.get_meta(pt2)
|
meta = minetest.get_meta(pt2)
|
||||||
meta:set_int("is_open", 0)
|
meta:set_int("is_open", 0)
|
||||||
|
|
||||||
if not minetest.setting_getbool("creative_mode") then
|
if not minetest.setting_getbool("creative_mode") then
|
||||||
itemstack:take_item()
|
itemstack:take_item()
|
||||||
end
|
end
|
||||||
return itemstack
|
return itemstack
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
local tt = def.tiles_top
|
local tt = def.tiles_top
|
||||||
local tb = def.tiles_bottom
|
local tb = def.tiles_bottom
|
||||||
|
|
||||||
local function after_dig_node(pos, name, digger)
|
local function after_dig_node(pos, name, digger)
|
||||||
local node = minetest.get_node(pos)
|
local node = minetest.get_node(pos)
|
||||||
if node.name == name then
|
if node.name == name then
|
||||||
minetest.node_dig(pos, node, digger)
|
minetest.node_dig(pos, node, digger)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local function on_open_close(pos, dir, check_name, replace, replace_dir, params)
|
local function on_open_close(pos, dir, check_name, replace, replace_dir, params)
|
||||||
pos.y = pos.y+dir
|
pos.y = pos.y+dir
|
||||||
if not minetest.get_node(pos).name == check_name then
|
if not minetest.get_node(pos).name == check_name then
|
||||||
|
@ -134,11 +134,11 @@ function mcl_doors:register_door(name, def)
|
||||||
end
|
end
|
||||||
local p2 = minetest.get_node(pos).param2
|
local p2 = minetest.get_node(pos).param2
|
||||||
local np2 = params[p2+1]
|
local np2 = params[p2+1]
|
||||||
|
|
||||||
local meta = minetest.get_meta(pos):to_table()
|
local meta = minetest.get_meta(pos):to_table()
|
||||||
minetest.set_node(pos, {name=replace_dir, param2=np2})
|
minetest.set_node(pos, {name=replace_dir, param2=np2})
|
||||||
minetest.get_meta(pos):from_table(meta)
|
minetest.get_meta(pos):from_table(meta)
|
||||||
|
|
||||||
pos.y = pos.y-dir
|
pos.y = pos.y-dir
|
||||||
meta = minetest.get_meta(pos):to_table()
|
meta = minetest.get_meta(pos):to_table()
|
||||||
minetest.set_node(pos, {name=replace, param2=np2})
|
minetest.set_node(pos, {name=replace, param2=np2})
|
||||||
|
@ -163,7 +163,7 @@ function mcl_doors:register_door(name, def)
|
||||||
local function on_mesecons_signal_close (pos, node)
|
local function on_mesecons_signal_close (pos, node)
|
||||||
on_open_close(pos, 1, name.."_t_2", name.."_b_1", name.."_t_1", {3,0,1,2})
|
on_open_close(pos, 1, name.."_t_2", name.."_b_1", name.."_t_1", {3,0,1,2})
|
||||||
end
|
end
|
||||||
|
|
||||||
local function check_player_priv(pos, player)
|
local function check_player_priv(pos, player)
|
||||||
if not def.only_placer_can_open then
|
if not def.only_placer_can_open then
|
||||||
return true
|
return true
|
||||||
|
@ -182,7 +182,7 @@ function mcl_doors:register_door(name, def)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
minetest.register_node(name.."_b_1", {
|
minetest.register_node(name.."_b_1", {
|
||||||
tiles = {tt[2].."^[transformFY", tt[2], tb[2].."^[transformFX", tb[2], tb[1], tb[1].."^[transformFX"},
|
tiles = {tt[2].."^[transformFY", tt[2], tb[2].."^[transformFX", tb[2], tb[1], tb[1].."^[transformFX"},
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
|
@ -202,21 +202,21 @@ function mcl_doors:register_door(name, def)
|
||||||
groups = def.groups,
|
groups = def.groups,
|
||||||
_mcl_hardness = def._mcl_hardness,
|
_mcl_hardness = def._mcl_hardness,
|
||||||
sounds = def.sounds,
|
sounds = def.sounds,
|
||||||
|
|
||||||
after_dig_node = function(pos, oldnode, oldmetadata, digger)
|
after_dig_node = function(pos, oldnode, oldmetadata, digger)
|
||||||
pos.y = pos.y+1
|
pos.y = pos.y+1
|
||||||
after_dig_node(pos, name.."_t_1", digger)
|
after_dig_node(pos, name.."_t_1", digger)
|
||||||
end,
|
end,
|
||||||
|
|
||||||
on_rightclick = on_rightclick,
|
on_rightclick = on_rightclick,
|
||||||
|
|
||||||
mesecons = { effector = {
|
mesecons = { effector = {
|
||||||
action_on = on_mesecons_signal_open
|
action_on = on_mesecons_signal_open
|
||||||
}},
|
}},
|
||||||
|
|
||||||
can_dig = check_player_priv,
|
can_dig = check_player_priv,
|
||||||
})
|
})
|
||||||
|
|
||||||
if def.only_redstone_can_open then
|
if def.only_redstone_can_open then
|
||||||
on_rightclick = nil
|
on_rightclick = nil
|
||||||
else
|
else
|
||||||
|
@ -226,7 +226,7 @@ function mcl_doors:register_door(name, def)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
minetest.register_node(name.."_t_1", {
|
minetest.register_node(name.."_t_1", {
|
||||||
tiles = {tt[2].."^[transformFY", tt[2], tt[2].."^[transformFX", tt[2], tt[1], tt[1].."^[transformFX"},
|
tiles = {tt[2].."^[transformFY", tt[2], tt[2].."^[transformFX", tt[2], tt[1], tt[1].."^[transformFX"},
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
|
@ -246,12 +246,12 @@ function mcl_doors:register_door(name, def)
|
||||||
groups = def.groups,
|
groups = def.groups,
|
||||||
_mcl_hardness = def._mcl_hardness,
|
_mcl_hardness = def._mcl_hardness,
|
||||||
sounds = def.sounds,
|
sounds = def.sounds,
|
||||||
|
|
||||||
after_dig_node = function(pos, oldnode, oldmetadata, digger)
|
after_dig_node = function(pos, oldnode, oldmetadata, digger)
|
||||||
pos.y = pos.y-1
|
pos.y = pos.y-1
|
||||||
after_dig_node(pos, name.."_b_1", digger)
|
after_dig_node(pos, name.."_b_1", digger)
|
||||||
end,
|
end,
|
||||||
|
|
||||||
on_rightclick = on_rightclick,
|
on_rightclick = on_rightclick,
|
||||||
|
|
||||||
can_dig = check_player_priv,
|
can_dig = check_player_priv,
|
||||||
|
@ -266,7 +266,7 @@ function mcl_doors:register_door(name, def)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
minetest.register_node(name.."_b_2", {
|
minetest.register_node(name.."_b_2", {
|
||||||
tiles = {tt[2].."^[transformFY", tt[2], tb[2].."^[transformFX", tb[2], tb[1].."^[transformFX", tb[1]},
|
tiles = {tt[2].."^[transformFY", tt[2], tb[2].."^[transformFX", tb[2], tb[1].."^[transformFX", tb[1]},
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
|
@ -286,18 +286,18 @@ function mcl_doors:register_door(name, def)
|
||||||
groups = def.groups,
|
groups = def.groups,
|
||||||
_mcl_hardness = def._mcl_hardness,
|
_mcl_hardness = def._mcl_hardness,
|
||||||
sounds = def.sounds,
|
sounds = def.sounds,
|
||||||
|
|
||||||
after_dig_node = function(pos, oldnode, oldmetadata, digger)
|
after_dig_node = function(pos, oldnode, oldmetadata, digger)
|
||||||
pos.y = pos.y+1
|
pos.y = pos.y+1
|
||||||
after_dig_node(pos, name.."_t_2", digger)
|
after_dig_node(pos, name.."_t_2", digger)
|
||||||
end,
|
end,
|
||||||
|
|
||||||
on_rightclick = on_rightclick,
|
on_rightclick = on_rightclick,
|
||||||
|
|
||||||
mesecons = { effector = {
|
mesecons = { effector = {
|
||||||
action_on = on_mesecons_signal_close
|
action_on = on_mesecons_signal_close
|
||||||
}},
|
}},
|
||||||
|
|
||||||
can_dig = check_player_priv,
|
can_dig = check_player_priv,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -340,7 +340,7 @@ function mcl_doors:register_door(name, def)
|
||||||
|
|
||||||
can_dig = check_player_priv,
|
can_dig = check_player_priv,
|
||||||
})
|
})
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Normal Door ---
|
--- Normal Door ---
|
||||||
|
|
Loading…
Reference in New Issue