diff --git a/mods/jukebox/README.txt b/mods/jukebox/README.txt new file mode 100644 index 00000000..4857cc79 --- /dev/null +++ b/mods/jukebox/README.txt @@ -0,0 +1,47 @@ +Minetest mod "Jukebox" +======================= +version: 1.0 + +License of source code and textures: WTFPL +----------------------------------------- +(c) Copyright BlockMen (2013) + + +License of music: CC0 +--------------------- +The authors are : (freesound.org) +-cheesepuff (song1) +-geerterig (song2) +-rap2h (song3) +-keffstay (song4) +-usedtobe (song5) +-zagi2 (song6) + +This program is free software. It comes without any warranty, to +the extent permitted by applicable law. You can redistribute it +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 +http://sam.zoy.org/wtfpl/COPYING for more details. + + +Using the mod: +-------------- + +To use the jukebox, you have to craft one. You need 8 wood and 1 diamond to craft it following way: + +wood wood wood +wood diamond wood +wood wood wood + + +Furthermore you need Music Discs, that you can craft following way: + + + - coal - +coal gold coal + - coal - + + +Just click with a music disc in your hand on the jukebox and it will play a random song. To stop the music +rightclick the box again and it will drop the music disc. + diff --git a/mods/jukebox/depends.txt b/mods/jukebox/depends.txt new file mode 100644 index 00000000..331d858c --- /dev/null +++ b/mods/jukebox/depends.txt @@ -0,0 +1 @@ +default \ No newline at end of file diff --git a/mods/jukebox/init.lua b/mods/jukebox/init.lua new file mode 100644 index 00000000..31a5cc56 --- /dev/null +++ b/mods/jukebox/init.lua @@ -0,0 +1,81 @@ +local discs = { + [1] = "track_1", +} + +minetest.register_node("jukebox:box", { + description = "Jukebox", + drawtype = "nodebox", + tiles = {"jukebox_top.png", "default_wood.png", "jukebox_side.png", + "jukebox_side.png", "jukebox_front.png", "jukebox_front.png"}, + paramtype = "light", + paramtype2 = "facedir", + stack_max = 1, + groups = {choppy=2,oddly_breakable_by_hand=2,flammable=2}, + sounds = default.node_sound_wood_defaults(), + node_box = { + type = "fixed", + fixed = {-0.5, -0.5, -0.5, 0.5, 0.5, 0.5}, + }, + selection_box = { + type = "fixed", + fixed = {-0.5, -0.5, -0.5, 0.5, 0.5, 0.5}, + + }, + on_rightclick = function(pos, node, clicker, itemstack) + local meta = minetest.get_meta(pos) + local inv = meta:get_inventory() + if not clicker then return end + if minetest.get_item_group(clicker:get_wielded_item():get_name(), "disc") == 1 then + -- Rewrite this + else + if not inv:is_empty("main") then + local drop_pos = minetest.find_node_near(pos, 1, "air") + if drop_pos == nil then drop_pos = {x=pos.x, y=pos.y+1,z=pos.z} end + minetest.add_item(drop_pos, inv:get_stack("main",1)) + if meta:get_string("now_playing") then minetest.sound_stop(meta:get_string("now_playing")) end + end + end + end, + on_construct = function(pos) + local meta = minetest.get_meta(pos) + local inv = meta:get_inventory() + inv:set_size("main", 1) + end, + on_destruct = function(pos) + local meta = minetest.env:get_meta(pos) + local inv = meta:get_inventory() + if not inv:is_empty("main") then + local drop_pos = minetest.find_node_near(pos, 1, "air") + if drop_pos == nil then drop_pos = {x=pos.x, y=pos.y+1,z=pos.z} end + minetest.add_item(drop_pos, inv:get_stack("main",1)) + if meta:get_string("now_playing") then minetest.sound_stop(meta:get_string("now_playing")) end + end + end, +}) + + +minetest.register_craftitem("jukebox:disc", { + description = "Music Disc", + inventory_image = "jukebox_disc.png", + liquids_pointable = false, + stack_max = 1 + +}) + +minetest.register_craft({ + output = "jukebox:box", + recipe = { + {"group:wood", "group:wood", "group:wood", }, + {"group:wood", "default:diamond", "group:wood", }, + {"group:wood", "group:wood", "group:wood", } + } +}) + +minetest.register_craft({ + output = "jukebox:disc", + recipe = { + {"", "default:coal_lump", "", }, + {"default:coal_lump", "default:gold_lump", "default:coal_lump", }, + {"", "default:coal_lump", "", } + } +}) diff --git a/mods/jukebox/sounds/jukebox_song.1.ogg b/mods/jukebox/sounds/jukebox_song.1.ogg new file mode 100644 index 00000000..a9f1f057 Binary files /dev/null and b/mods/jukebox/sounds/jukebox_song.1.ogg differ diff --git a/mods/jukebox/sounds/jukebox_song.2.ogg b/mods/jukebox/sounds/jukebox_song.2.ogg new file mode 100644 index 00000000..6420e3b7 Binary files /dev/null and b/mods/jukebox/sounds/jukebox_song.2.ogg differ diff --git a/mods/jukebox/sounds/jukebox_song.3.ogg b/mods/jukebox/sounds/jukebox_song.3.ogg new file mode 100644 index 00000000..9b970139 Binary files /dev/null and b/mods/jukebox/sounds/jukebox_song.3.ogg differ diff --git a/mods/jukebox/sounds/jukebox_song.4.ogg b/mods/jukebox/sounds/jukebox_song.4.ogg new file mode 100644 index 00000000..dcfee497 Binary files /dev/null and b/mods/jukebox/sounds/jukebox_song.4.ogg differ diff --git a/mods/jukebox/sounds/jukebox_song.5.ogg b/mods/jukebox/sounds/jukebox_song.5.ogg new file mode 100644 index 00000000..cbc43e74 Binary files /dev/null and b/mods/jukebox/sounds/jukebox_song.5.ogg differ diff --git a/mods/jukebox/sounds/jukebox_song.6.ogg b/mods/jukebox/sounds/jukebox_song.6.ogg new file mode 100644 index 00000000..e2bd75ec Binary files /dev/null and b/mods/jukebox/sounds/jukebox_song.6.ogg differ diff --git a/mods/jukebox/textures/jukebox_disc.png b/mods/jukebox/textures/jukebox_disc.png new file mode 100644 index 00000000..f63ae250 Binary files /dev/null and b/mods/jukebox/textures/jukebox_disc.png differ diff --git a/mods/jukebox/textures/jukebox_front.png b/mods/jukebox/textures/jukebox_front.png new file mode 100644 index 00000000..4eca5aa3 Binary files /dev/null and b/mods/jukebox/textures/jukebox_front.png differ diff --git a/mods/jukebox/textures/jukebox_side.png b/mods/jukebox/textures/jukebox_side.png new file mode 100644 index 00000000..ff61c6db Binary files /dev/null and b/mods/jukebox/textures/jukebox_side.png differ diff --git a/mods/jukebox/textures/jukebox_top.png b/mods/jukebox/textures/jukebox_top.png new file mode 100644 index 00000000..82ee05d1 Binary files /dev/null and b/mods/jukebox/textures/jukebox_top.png differ