Revert "Add sound to doors, add glass door and trapdoor"

This reverts commit 59123e589b.
This commit is contained in:
BlockMen 2013-05-21 00:04:04 +02:00
parent 6e1f2d3552
commit c19ddc6be5
6 changed files with 3 additions and 159 deletions

View file

@ -1,11 +1,9 @@
Minetest 0.4 mod: doors Minetest 0.4 mod: doors
======================= =======================
version: 1.2.2
License of source code: License of source code:
----------------------- -----------------------
Copyright (C) 2012 PilzAdam Copyright (C) 2012 PilzAdam
modified by BlockMen (added sounds, glassdoor, trapdoor)
This program is free software. It comes without any warranty, to This program is free software. It comes without any warranty, to
the extent permitted by applicable law. You can redistribute it the extent permitted by applicable law. You can redistribute it
@ -13,25 +11,13 @@ and/or modify it under the terms of the Do What The Fuck You Want
To Public License, Version 2, as published by Sam Hocevar. See To Public License, Version 2, as published by Sam Hocevar. See
http://sam.zoy.org/wtfpl/COPYING for more details. http://sam.zoy.org/wtfpl/COPYING for more details.
License of textures License of media (textures and sounds)
-------------------------------------- --------------------------------------
following Textures created by Fernando Zapata (CC BY-SA 3.0): Textures created by Fernando Zapata (CC BY-SA 3.0):
door_wood.png door_wood.png
door_wood_a.png door_wood_a.png
door_wood_a_r.png door_wood_a_r.png
door_wood_b.png door_wood_b.png
door_wood_b_r.png door_wood_b_r.png
following Textures created by BlockMen (WTFPL): All other textures (created by PilzAdam): WTFPL
door_glass.png
door_trapdoor.png
All other textures created by PilzAdam (WTFPL)
License of sounds
--------------------------------------
Opening-Sound created by CGEffex (CC BY 3.0), modified by BlockMen
door_open.ogg
Closing-Sound created by bennstir (CC BY 3.0)
door_close.ogg

View file

@ -15,17 +15,6 @@ doors = {}
-- selection_box_top -- selection_box_top
-- only_placer_can_open: if true only the player who placed the door can -- only_placer_can_open: if true only the player who placed the door can
-- open it -- open it
local function is_right(pos, clicker)
local r1 = minetest.env:get_node({x=pos.x+1, y=pos.y, z=pos.z})
local r2 = minetest.env:get_node({x=pos.x, y=pos.y, z=pos.z+1})
if string.find(r1.name, "door_") or string.find(r2.name, "door_") then
return false
else
return true
end
end
function doors:register_door(name, def) function doors:register_door(name, def)
def.groups.not_in_creative_inventory = 1 def.groups.not_in_creative_inventory = 1
@ -167,11 +156,6 @@ function doors:register_door(name, def)
on_rightclick = function(pos, node, clicker) on_rightclick = function(pos, node, clicker)
if check_player_priv(pos, clicker) then if check_player_priv(pos, clicker) then
on_rightclick(pos, 1, name.."_t_1", name.."_b_2", name.."_t_2", {1,2,3,0}) on_rightclick(pos, 1, name.."_t_1", name.."_b_2", name.."_t_2", {1,2,3,0})
if is_right(pos, clicker) then
minetest.sound_play("door_close", {gain = 0.3, max_hear_distance = 10})
else
minetest.sound_play("door_open", {gain = 0.3, max_hear_distance = 10})
end
end end
end, end,
@ -202,11 +186,6 @@ function doors:register_door(name, def)
on_rightclick = function(pos, node, clicker) on_rightclick = function(pos, node, clicker)
if check_player_priv(pos, clicker) then if check_player_priv(pos, clicker) then
on_rightclick(pos, -1, name.."_b_1", name.."_t_2", name.."_b_2", {1,2,3,0}) on_rightclick(pos, -1, name.."_b_1", name.."_t_2", name.."_b_2", {1,2,3,0})
if is_right(pos, clicker) then
minetest.sound_play("door_close", {gain = 0.3, max_hear_distance = 10})
else
minetest.sound_play("door_open", {gain = 0.3, max_hear_distance = 10})
end
end end
end, end,
@ -237,11 +216,6 @@ function doors:register_door(name, def)
on_rightclick = function(pos, node, clicker) on_rightclick = function(pos, node, clicker)
if check_player_priv(pos, clicker) then if check_player_priv(pos, clicker) then
on_rightclick(pos, 1, name.."_t_2", name.."_b_1", name.."_t_1", {3,0,1,2}) on_rightclick(pos, 1, name.."_t_2", name.."_b_1", name.."_t_1", {3,0,1,2})
if is_right(pos, clicker) then
minetest.sound_play("door_open", {gain = 0.3, max_hear_distance = 10})
else
minetest.sound_play("door_close", {gain = 0.3, max_hear_distance = 10})
end
end end
end, end,
@ -272,11 +246,6 @@ function doors:register_door(name, def)
on_rightclick = function(pos, node, clicker) on_rightclick = function(pos, node, clicker)
if check_player_priv(pos, clicker) then if check_player_priv(pos, clicker) then
on_rightclick(pos, -1, name.."_b_2", name.."_t_1", name.."_b_1", {3,0,1,2}) on_rightclick(pos, -1, name.."_b_2", name.."_t_1", name.."_b_1", {3,0,1,2})
if is_right(pos, clicker) then
minetest.sound_play("door_open", {gain = 0.3, max_hear_distance = 10})
else
minetest.sound_play("door_close", {gain = 0.3, max_hear_distance = 10})
end
end end
end, end,
@ -320,118 +289,7 @@ minetest.register_craft({
} }
}) })
doors:register_door("doors:door_glass", {
description = "Glass Door",
inventory_image = "door_glass.png",
groups = {snappy=1,cracky=1,oddly_breakable_by_hand=2,door=1},
tiles_bottom = {"default_glass.png", "door_grey.png"},
tiles_top = {"default_glass.png", "door_grey.png"},
})
minetest.register_craft({
output = "doors:door_glass",
recipe = {
{"default:glass", "default:glass"},
{"default:glass", "default:glass"},
{"default:glass", "default:glass"}
}
})
minetest.register_alias("doors:door_wood_a_c", "doors:door_wood_t_1") minetest.register_alias("doors:door_wood_a_c", "doors:door_wood_t_1")
minetest.register_alias("doors:door_wood_a_o", "doors:door_wood_t_1") minetest.register_alias("doors:door_wood_a_o", "doors:door_wood_t_1")
minetest.register_alias("doors:door_wood_b_c", "doors:door_wood_b_1") minetest.register_alias("doors:door_wood_b_c", "doors:door_wood_b_1")
minetest.register_alias("doors:door_wood_b_o", "doors:door_wood_b_1") minetest.register_alias("doors:door_wood_b_o", "doors:door_wood_b_1")
----trapdoor----
local me
local meta
local state = 0
local function update_door(pos, node)
minetest.env:set_node(pos, node)
end
local function punch(pos)
meta = minetest.env:get_meta(pos)
state = meta:get_int("state")
me = minetest.env:get_node(pos)
local tmp_node
local tmp_node2
oben = {x=pos.x, y=pos.y+1, z=pos.z}
if state == 1 then
state = 0
minetest.sound_play("door_close", {to_player = puncher, gain = 0.3, max_hear_distance = 10})
tmp_node = {name="doors:trapdoor", param1=me.param1, param2=me.param2}
else
state = 1
minetest.sound_play("door_open", {to_player = puncher, gain = 0.3, max_hear_distance = 10})
tmp_node = {name="doors:trapdoor_open", param1=me.param1, param2=me.param2}
end
update_door(pos, tmp_node)
meta:set_int("state", state)
end
minetest.register_node("doors:trapdoor", {
description = "Trapdoor",
inventory_image = "door_trapdoor.png",
drawtype = "nodebox",
tiles = {"door_trapdoor.png", "door_trapdoor.png", "default_wood.png", "default_wood.png", "default_wood.png", "default_wood.png"},
paramtype = "light",
paramtype2 = "facedir",
groups = {snappy=1,choppy=2,oddly_breakable_by_hand=2,flammable=2,door=1},
sounds = default.node_sound_wood_defaults(),
drop = "doors:trapdoor",
node_box = {
type = "fixed",
fixed = {-0.5, -0.5, -0.5, 0.5, -0.4, 0.5}
},
selection_box = {
type = "fixed",
fixed = {-0.5, -0.5, -0.5, 0.5, -0.4, 0.5}
},
on_creation = function(pos)
state = 0
end,
on_rightclick = function(pos, node, clicker)
punch(pos)
end,
})
minetest.register_node("doors:trapdoor_open", {
drawtype = "nodebox",
tiles = {"default_wood.png", "default_wood.png", "default_wood.png", "default_wood.png", "door_trapdoor.png", "door_trapdoor.png"},
paramtype = "light",
paramtype2 = "facedir",
pointable = true,
stack_max = 0,
groups = {snappy=1,choppy=2,oddly_breakable_by_hand=2,flammable=2,door=1},
sounds = default.node_sound_wood_defaults(),
drop = "doors:trapdoor",
node_box = {
type = "fixed",
fixed = {-0.5, -0.5, 0.4, 0.5, 0.5, 0.5}
},
selection_box = {
type = "fixed",
fixed = {-0.5, -0.5, 0.4, 0.5, 0.5, 0.5}
},
on_rightclick = function(pos, node, clicker)
punch(pos)
end,
})
minetest.register_craft({
output = 'doors:trapdoor 2',
recipe = {
{'group:wood', 'group:wood', 'group:wood'},
{'group:wood', 'group:wood', 'group:wood'},
{'', '', ''},
}
})

Binary file not shown.

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 589 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 390 B