diff options
author | cheapie <no-email-for-you@example.com> | 2017-02-07 20:58:25 -0600 |
---|---|---|
committer | cheapie <no-email-for-you@example.com> | 2017-02-07 20:58:25 -0600 |
commit | 7a1f0ce12303a384c2e95cc14a85ec6cd7160c02 (patch) | |
tree | 5f36d393e421279ee007fabfa50de7b6ee67e0a2 | |
download | handdryer-7a1f0ce12303a384c2e95cc14a85ec6cd7160c02.tar handdryer-7a1f0ce12303a384c2e95cc14a85ec6cd7160c02.tar.gz handdryer-7a1f0ce12303a384c2e95cc14a85ec6cd7160c02.tar.bz2 handdryer-7a1f0ce12303a384c2e95cc14a85ec6cd7160c02.tar.xz handdryer-7a1f0ce12303a384c2e95cc14a85ec6cd7160c02.zip |
Add content
-rw-r--r-- | LICENSE | 24 | ||||
-rw-r--r-- | depends.txt | 0 | ||||
-rw-r--r-- | init.lua | 112 | ||||
-rw-r--r-- | sounds/handdryer_a_ra_run.ogg | bin | 0 -> 73501 bytes | |||
-rw-r--r-- | sounds/handdryer_xa5_run.ogg | bin | 0 -> 17052 bytes | |||
-rw-r--r-- | sounds/handdryer_xa5_start.ogg | bin | 0 -> 22403 bytes | |||
-rw-r--r-- | sounds/handdryer_xa5_stop.ogg | bin | 0 -> 40644 bytes | |||
-rw-r--r-- | textures/handdryer_a_front.png | bin | 0 -> 5485 bytes | |||
-rw-r--r-- | textures/handdryer_a_xa5_bottom.png | bin | 0 -> 5062 bytes | |||
-rw-r--r-- | textures/handdryer_a_xa5_sides.png | bin | 0 -> 5278 bytes | |||
-rw-r--r-- | textures/handdryer_metal.png | bin | 0 -> 4689 bytes | |||
-rw-r--r-- | textures/handdryer_plain.png | bin | 0 -> 5310 bytes | |||
-rw-r--r-- | textures/handdryer_xa5_front.png | bin | 0 -> 5386 bytes |
13 files changed, 136 insertions, 0 deletions
@@ -0,0 +1,24 @@ +This is free and unencumbered software released into the public domain. + +Anyone is free to copy, modify, publish, use, compile, sell, or +distribute this software, either in source code form or as a compiled +binary, for any purpose, commercial or non-commercial, and by any +means. + +In jurisdictions that recognize copyright laws, the author or authors +of this software dedicate any and all copyright interest in the +software to the public domain. We make this dedication for the benefit +of the public at large and to the detriment of our heirs and +successors. We intend this dedication to be an overt act of +relinquishment in perpetuity of all present and future rights to this +software under copyright law. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR +OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. + +For more information, please refer to <http://unlicense.org/> diff --git a/depends.txt b/depends.txt new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/depends.txt diff --git a/init.lua b/init.lua new file mode 100644 index 0000000..0add0dc --- /dev/null +++ b/init.lua @@ -0,0 +1,112 @@ +local sounds = {} + +minetest.register_node("handdryer:a",{ + description = "Hand Dryer", + groups = {cracky=3}, + drawtype = "nodebox", + paramtype = "light", + paramtype2 = "facedir", + is_ground_content = false, + node_box = { + type = "fixed", + fixed = { + {-0.3, -0.25, 0.204, 0.3, 0.25, 0.5}, --Body + {-0.202, -0.094, 0.1, -0.077, 0.1085, 0.204}, --Outlet + {0.125, -0.045, 0.15, 0.22, 0.045, 0.204}, --Button + }, + }, + tiles = { + "handdryer_a_xa5_sides.png", + "handdryer_a_xa5_bottom.png^[transformFY", + "handdryer_a_xa5_sides.png^[transformR270", + "handdryer_a_xa5_sides.png^[transformR90", + "handdryer_metal.png", + "handdryer_a_front.png", + }, + on_punch = function(pos) + local hash = minetest.hash_node_position(pos) + local handle = sounds[hash] + if handle then + minetest.sound_stop(handle) + end + sounds[hash] = minetest.sound_play("handdryer_a_ra_run",{pos=pos,gain=0.75,max_hear_distance=20}) + end, +}) + +minetest.register_node("handdryer:xa5",{ + description = "Automatic Hand Dryer", + groups = {cracky=3}, + drawtype = "nodebox", + paramtype = "light", + paramtype2 = "facedir", + is_ground_content = false, + node_box = { + type = "fixed", + fixed = { + {-0.3, -0.25, 0.204, 0.3, 0.25, 0.5}, --Body + {-0.202, -0.094, 0.1, -0.077, 0.1085, 0.204}, --Outlet + }, + }, + tiles = { + "handdryer_a_xa5_sides.png", + "handdryer_a_xa5_bottom.png^[transformFY", + "handdryer_a_xa5_sides.png^[transformR270", + "handdryer_a_xa5_sides.png^[transformR90", + "handdryer_metal.png", + "handdryer_xa5_front.png", + }, +}) + +minetest.register_abm({ + label = "Automatic hand dryers", + interval = 1, + chance = 1, + nodenames = {"handdryer:xa5"}, + action = function(pos) + local posbelow = vector.add(pos,vector.new(0,-1,0)) + local objects = minetest.get_objects_inside_radius(posbelow,1) + local player = false + for _,obj in pairs(objects) do + if obj:is_player() then player = true end + end + local hash = minetest.hash_node_position(pos) + local handle = sounds[hash] + local meta = minetest.get_meta(pos) + if player then + if meta:get_int("running") == 0 then + if handle then minetest.sound_stop(handle) end + meta:set_int("running",1) + minetest.sound_play("handdryer_xa5_start",{pos=pos,gain=0.75,max_hear_distance=20}) + minetest.after(2,function(pos,hash) + local meta = minetest.get_meta(pos) + if not meta:get_int("running") == 1 then return end + sounds[hash] = minetest.sound_play("handdryer_xa5_run",{pos=pos,gain=0.75,max_hear_distance=20,loop=true}) + end,pos,hash) + end + else + if handle then minetest.sound_stop(handle) end + if meta:get_int("running") == 1 then + meta:set_int("running",0) + minetest.sound_play("handdryer_xa5_stop",{pos=pos,gain=0.75,max_hear_distance=20}) + end + end + end, +}) + +minetest.register_craft({ + output = "handdryer:a", + recipe = { + {"default:steel_ingot","default:steel_ingot","mesecons_button:button_off"}, + {"default:steel_ingot","homedecor:fan_blades","homedecor:motor"}, + {"default:steel_ingot","homedecor:heating_element","default:steel_ingot"}, + }, +}) + +minetest.register_craft({ + output = "handdryer:xa5", + recipe = { + {"default:steel_ingot","default:steel_ingot","homedecor:ic"}, + {"default:steel_ingot","homedecor:fan_blades","homedecor:motor"}, + {"default:steel_ingot","homedecor:heating_element","mesecons_solarpanel:solar_panel_off"}, + }, +}) diff --git a/sounds/handdryer_a_ra_run.ogg b/sounds/handdryer_a_ra_run.ogg Binary files differnew file mode 100644 index 0000000..9adf33e --- /dev/null +++ b/sounds/handdryer_a_ra_run.ogg diff --git a/sounds/handdryer_xa5_run.ogg b/sounds/handdryer_xa5_run.ogg Binary files differnew file mode 100644 index 0000000..0d13023 --- /dev/null +++ b/sounds/handdryer_xa5_run.ogg diff --git a/sounds/handdryer_xa5_start.ogg b/sounds/handdryer_xa5_start.ogg Binary files differnew file mode 100644 index 0000000..9a25bd0 --- /dev/null +++ b/sounds/handdryer_xa5_start.ogg diff --git a/sounds/handdryer_xa5_stop.ogg b/sounds/handdryer_xa5_stop.ogg Binary files differnew file mode 100644 index 0000000..293e2a8 --- /dev/null +++ b/sounds/handdryer_xa5_stop.ogg diff --git a/textures/handdryer_a_front.png b/textures/handdryer_a_front.png Binary files differnew file mode 100644 index 0000000..ae7fb3e --- /dev/null +++ b/textures/handdryer_a_front.png diff --git a/textures/handdryer_a_xa5_bottom.png b/textures/handdryer_a_xa5_bottom.png Binary files differnew file mode 100644 index 0000000..4ba0714 --- /dev/null +++ b/textures/handdryer_a_xa5_bottom.png diff --git a/textures/handdryer_a_xa5_sides.png b/textures/handdryer_a_xa5_sides.png Binary files differnew file mode 100644 index 0000000..13153ab --- /dev/null +++ b/textures/handdryer_a_xa5_sides.png diff --git a/textures/handdryer_metal.png b/textures/handdryer_metal.png Binary files differnew file mode 100644 index 0000000..eabe2eb --- /dev/null +++ b/textures/handdryer_metal.png diff --git a/textures/handdryer_plain.png b/textures/handdryer_plain.png Binary files differnew file mode 100644 index 0000000..bbcbea8 --- /dev/null +++ b/textures/handdryer_plain.png diff --git a/textures/handdryer_xa5_front.png b/textures/handdryer_xa5_front.png Binary files differnew file mode 100644 index 0000000..e8dd0f0 --- /dev/null +++ b/textures/handdryer_xa5_front.png |