]> git.lizzy.rs Git - Crafter.git/commitdiff
Add in doors
authoroilboi <47129783+oilboi@users.noreply.github.com>
Sat, 21 Mar 2020 20:13:57 +0000 (16:13 -0400)
committeroilboi <47129783+oilboi@users.noreply.github.com>
Sat, 21 Mar 2020 20:13:57 +0000 (16:13 -0400)
Notch's Sounds/1.png [new file with mode: 0644]
Notch's Sounds/2.png [new file with mode: 0644]
Notch's Sounds/3.png [new file with mode: 0644]
Notch's Sounds/4.png [new file with mode: 0644]
Notch's Sounds/what is this.txt [new file with mode: 0644]
mods/door/init.lua [new file with mode: 0644]
mods/door/sounds/credit.txt [new file with mode: 0644]
mods/door/sounds/door.1.ogg [new file with mode: 0644]
mods/door/sounds/door.2.ogg [new file with mode: 0644]
mods/door/textures/door_top.png [new file with mode: 0644]

diff --git a/Notch's Sounds/1.png b/Notch's Sounds/1.png
new file mode 100644 (file)
index 0000000..35d041b
Binary files /dev/null and b/Notch's Sounds/1.png differ
diff --git a/Notch's Sounds/2.png b/Notch's Sounds/2.png
new file mode 100644 (file)
index 0000000..8663c69
Binary files /dev/null and b/Notch's Sounds/2.png differ
diff --git a/Notch's Sounds/3.png b/Notch's Sounds/3.png
new file mode 100644 (file)
index 0000000..02bcb2a
Binary files /dev/null and b/Notch's Sounds/3.png differ
diff --git a/Notch's Sounds/4.png b/Notch's Sounds/4.png
new file mode 100644 (file)
index 0000000..d4c2a59
Binary files /dev/null and b/Notch's Sounds/4.png differ
diff --git a/Notch's Sounds/what is this.txt b/Notch's Sounds/what is this.txt
new file mode 100644 (file)
index 0000000..a2d5d3b
--- /dev/null
@@ -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
\ No newline at end of file
diff --git a/mods/door/init.lua b/mods/door/init.lua
new file mode 100644 (file)
index 0000000..6828034
--- /dev/null
@@ -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
diff --git a/mods/door/sounds/credit.txt b/mods/door/sounds/credit.txt
new file mode 100644 (file)
index 0000000..c56eec7
--- /dev/null
@@ -0,0 +1 @@
+door = https://freesound.org/people/SoundsForHim/sounds/395650/
\ No newline at end of file
diff --git a/mods/door/sounds/door.1.ogg b/mods/door/sounds/door.1.ogg
new file mode 100644 (file)
index 0000000..c235360
Binary files /dev/null and b/mods/door/sounds/door.1.ogg differ
diff --git a/mods/door/sounds/door.2.ogg b/mods/door/sounds/door.2.ogg
new file mode 100644 (file)
index 0000000..367256b
Binary files /dev/null and b/mods/door/sounds/door.2.ogg differ
diff --git a/mods/door/textures/door_top.png b/mods/door/textures/door_top.png
new file mode 100644 (file)
index 0000000..f2a1e89
Binary files /dev/null and b/mods/door/textures/door_top.png differ