Add in doors
This commit is contained in:
parent
9f828d20fe
commit
969fc40ef3
BIN
Notch's Sounds/1.png
Normal file
BIN
Notch's Sounds/1.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 166 KiB |
BIN
Notch's Sounds/2.png
Normal file
BIN
Notch's Sounds/2.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 152 KiB |
BIN
Notch's Sounds/3.png
Normal file
BIN
Notch's Sounds/3.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 143 KiB |
BIN
Notch's Sounds/4.png
Normal file
BIN
Notch's Sounds/4.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 96 KiB |
2
Notch's Sounds/what is this.txt
Normal file
2
Notch's Sounds/what is this.txt
Normal file
@ -0,0 +1,2 @@
|
||||
This is Notch's (The creator of minecraft) free sound download log, almost every one of these sounds are in minecraft
|
||||
keeping this here if I need to use one of the sounds
|
74
mods/door/init.lua
Normal file
74
mods/door/init.lua
Normal file
@ -0,0 +1,74 @@
|
||||
--this is a really lazy way to make a door and I'll improve it in the future
|
||||
local door_move = function(pos)
|
||||
local node = minetest.get_node(pos)
|
||||
local param2 = node.param2
|
||||
local name = string.gsub(node.name, "door:", "")
|
||||
local dir = minetest.facedir_to_dir(param2)
|
||||
local x = dir.z
|
||||
local z = dir.x
|
||||
local dir = minetest.dir_to_facedir(vector.new(x,0,z))
|
||||
minetest.set_node(pos,{name = "door:"..name,param2=dir})
|
||||
if string.match(node.name, ":bottom") then
|
||||
pos.y = pos.y + 1
|
||||
minetest.set_node(pos,{name = "door:top",param2=dir})
|
||||
else
|
||||
pos.y = pos.y - 1
|
||||
minetest.set_node(pos,{name = "door:bottom",param2=dir})
|
||||
end
|
||||
minetest.sound_play("door", {pos=pos})--,pitch=math.random(80,100)/100})
|
||||
end
|
||||
for _,door in pairs({"top","bottom"}) do
|
||||
local tiles
|
||||
local groups
|
||||
--make it so only the bottom activates
|
||||
if door == "bottom" then
|
||||
tiles = {"wood.png"}
|
||||
groups = {wood = 2, tree = 1, hard = 1, axe = 1, hand = 3, redstone_activation = 1}
|
||||
else
|
||||
tiles = {"wood.png","wood.png","wood.png","wood.png","door_top.png","door_top.png"}
|
||||
groups = {wood = 2, tree = 1, hard = 1, axe = 1, hand = 3}
|
||||
end
|
||||
minetest.register_node("door:"..door, {
|
||||
description = "Door",
|
||||
tiles = tiles,
|
||||
drawtype = "nodebox",
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
groups = groups,
|
||||
sounds = main.woodSound(),
|
||||
drop = "door:bottom",
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
--left front bottom right back top
|
||||
{-0.5, -0.5, -0.5, 0.5, 0.5, -0.3},
|
||||
},
|
||||
},
|
||||
redstone_activation = function(pos)
|
||||
door_move(pos)
|
||||
end,
|
||||
redstone_deactivation = function(pos)
|
||||
door_move(pos)
|
||||
end,
|
||||
on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
|
||||
door_move(pos)
|
||||
end,
|
||||
after_place_node = function(pos, placer, itemstack, pointed_thing)
|
||||
local node = minetest.get_node(pos)
|
||||
local param2 = node.param2
|
||||
pos.y = pos.y + 1
|
||||
if minetest.get_node(pos).name == "air" then
|
||||
minetest.set_node(pos,{name="door:top",param2=param2})
|
||||
end
|
||||
end,
|
||||
after_dig_node = function(pos, oldnode, oldmetadata, digger)
|
||||
if string.match(oldnode.name, ":bottom") then
|
||||
pos.y = pos.y + 1
|
||||
minetest.remove_node(pos)
|
||||
else
|
||||
pos.y = pos.y - 1
|
||||
minetest.remove_node(pos)
|
||||
end
|
||||
end,
|
||||
})
|
||||
end
|
1
mods/door/sounds/credit.txt
Normal file
1
mods/door/sounds/credit.txt
Normal file
@ -0,0 +1 @@
|
||||
door = https://freesound.org/people/SoundsForHim/sounds/395650/
|
BIN
mods/door/sounds/door.1.ogg
Normal file
BIN
mods/door/sounds/door.1.ogg
Normal file
Binary file not shown.
BIN
mods/door/sounds/door.2.ogg
Normal file
BIN
mods/door/sounds/door.2.ogg
Normal file
Binary file not shown.
BIN
mods/door/textures/door_top.png
Normal file
BIN
mods/door/textures/door_top.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 886 B |
Loading…
x
Reference in New Issue
Block a user