diff --git a/mods/mcl_jukebox/README.md b/mods/mcl_jukebox/README.md new file mode 100644 index 0000000000..b8da9bfb82 --- /dev/null +++ b/mods/mcl_jukebox/README.md @@ -0,0 +1,9 @@ +Jukebox mod for MineClone. +Licenced as GPLv3. + +Based on the jdukebox mod by Jordach. +Music by Jordach and HeroOfTheWinds (see in-game item tooltip). +Textures from Faithful texture pack. + +8 tracks are included. +4 music disc textures are currently unused. diff --git a/mods/mcl_jukebox/depends.txt b/mods/mcl_jukebox/depends.txt new file mode 100644 index 0000000000..331d858ce9 --- /dev/null +++ b/mods/mcl_jukebox/depends.txt @@ -0,0 +1 @@ +default \ No newline at end of file diff --git a/mods/mcl_jukebox/init.lua b/mods/mcl_jukebox/init.lua new file mode 100644 index 0000000000..63bd41d953 --- /dev/null +++ b/mods/mcl_jukebox/init.lua @@ -0,0 +1,99 @@ +local active_tracks = {} + +local recorddata = { + { "The Evil Sister (Jordach's Mix)", "SoundHelix", "13" } , + { "The Energetic Rat (Jordach's Mix)", "SoundHelix", "wait" }, + { "Eastern Feeling", "Jordach", "blocks"}, + { "Minetest", "Jordach", "far" }, + { "Credit Roll (Jordach's HD Mix)", "Junichi Masuda", "chirp" }, + { "Moonsong (Jordach's Mix)", "HeroOfTheWinds", "strad" }, + { "Synthgroove (Jordach's Mix)", "HeroOfTheWinds", "mellohi" }, + { "The Clueless Frog (Jordach's Mix)", "SoundHelix", "mall" }, +} +local records = #recorddata + +for r=1, records do + minetest.register_craftitem("mcl_jukebox:record_"..r, { + description = + "Music Disc" .. "\n" .. + recorddata[r][1] .. "\n" .. + recorddata[r][2], + inventory_image = "mcl_jukebox_record_"..recorddata[r][3]..".png", + stack_max = 1, + groups = { music_record = r }, + }) +end + + +-- Jukebox crafting +minetest.register_craft({ + output = 'mcl_jukebox:jukebox', + recipe = { + {'group:wood', 'group:wood', 'group:wood'}, + {'group:wood', 'default:diamond', 'group:wood'}, + {'group:wood', 'group:wood', 'group:wood'}, + } +}) + +-- Jukebox +minetest.register_node("mcl_jukebox:jukebox", { + description = "Jukebox", + tiles = {"mcl_jukebox_top.png", "mcl_jukebox_side.png", "mcl_jukebox_side.png"}, + sounds = default.node_sound_wood_defaults(), + groups = {oddly_breakable_by_hand=1, flammable=1, choppy=3}, + on_construct = function(pos) + local meta = minetest.get_meta(pos) + local inv = meta:get_inventory() + inv:set_size("main", 1) + end, + on_punch = function(pos, node, puncher, pointed_thing) + if not puncher then return end + + local meta = minetest.get_meta(pos) + local inv = meta:get_inventory() + if not inv:is_empty("main") then + -- Jukebox contains a disc: Stop music and remove disc + if active_tracks[puncher:get_player_name()] ~= nil then + minetest.sound_stop(active_tracks[puncher:get_player_name()]) + end + local lx = pos.x + local ly = pos.y+1 + local lz = pos.z + local record = inv:get_stack("main", 1) + minetest.add_item({x=lx, y=ly, z=lz}, record:get_name()) + inv:set_stack("main", 1, "") + if active_tracks[puncher:get_player_name()] ~= nil then + minetest.sound_stop(active_tracks[puncher:get_player_name()]) + end + else + -- Jukebox is empty: Play track if player holds music record + local wield = puncher:get_wielded_item():get_name() + local record_id = minetest.get_item_group(wield, "music_record") + if record_id ~= 0 then + if active_tracks[puncher:get_player_name()] ~= nil then + minetest.sound_stop(active_tracks[puncher:get_player_name()]) + end + puncher:set_wielded_item("") + active_tracks[puncher:get_player_name()] = minetest.sound_play("mcl_jukebox_track_"..record_id, { + to_player = puncher:get_player_name(), + --max_hear_distance = 16, + gain = 1, + }) + inv:set_stack("main", 1, wield) + end + end + end, + after_dig_node = function(pos, oldnode, oldmetadata, digger) + local meta = minetest.get_meta(pos) + local meta2 = meta + meta:from_table(oldmetadata) + local inv = meta:get_inventory() + local stack = inv:get_stack("main", 1) + if not stack:is_empty() then + local p = {x=pos.x+math.random(0, 10)/10-0.5, y=pos.y, z=pos.z+math.random(0, 10)/10-0.5} + minetest.add_item(p, stack) + end + meta:from_table(meta2:to_table()) + end, +}) + diff --git a/mods/mcl_jukebox/mod.conf b/mods/mcl_jukebox/mod.conf new file mode 100644 index 0000000000..ec39a7be96 --- /dev/null +++ b/mods/mcl_jukebox/mod.conf @@ -0,0 +1 @@ +name = mcl_jukebox diff --git a/mods/mcl_jukebox/sounds/mcl_jukebox_track_1.ogg b/mods/mcl_jukebox/sounds/mcl_jukebox_track_1.ogg new file mode 100644 index 0000000000..c97a779750 Binary files /dev/null and b/mods/mcl_jukebox/sounds/mcl_jukebox_track_1.ogg differ diff --git a/mods/mcl_jukebox/sounds/mcl_jukebox_track_2.ogg b/mods/mcl_jukebox/sounds/mcl_jukebox_track_2.ogg new file mode 100644 index 0000000000..e727dc8130 Binary files /dev/null and b/mods/mcl_jukebox/sounds/mcl_jukebox_track_2.ogg differ diff --git a/mods/mcl_jukebox/sounds/mcl_jukebox_track_3.ogg b/mods/mcl_jukebox/sounds/mcl_jukebox_track_3.ogg new file mode 100644 index 0000000000..d691313d38 Binary files /dev/null and b/mods/mcl_jukebox/sounds/mcl_jukebox_track_3.ogg differ diff --git a/mods/mcl_jukebox/sounds/mcl_jukebox_track_4.ogg b/mods/mcl_jukebox/sounds/mcl_jukebox_track_4.ogg new file mode 100644 index 0000000000..da842630bc Binary files /dev/null and b/mods/mcl_jukebox/sounds/mcl_jukebox_track_4.ogg differ diff --git a/mods/mcl_jukebox/sounds/mcl_jukebox_track_5.ogg b/mods/mcl_jukebox/sounds/mcl_jukebox_track_5.ogg new file mode 100644 index 0000000000..dcad499d96 Binary files /dev/null and b/mods/mcl_jukebox/sounds/mcl_jukebox_track_5.ogg differ diff --git a/mods/mcl_jukebox/sounds/mcl_jukebox_track_6.ogg b/mods/mcl_jukebox/sounds/mcl_jukebox_track_6.ogg new file mode 100644 index 0000000000..425002ca90 Binary files /dev/null and b/mods/mcl_jukebox/sounds/mcl_jukebox_track_6.ogg differ diff --git a/mods/mcl_jukebox/sounds/mcl_jukebox_track_7.ogg b/mods/mcl_jukebox/sounds/mcl_jukebox_track_7.ogg new file mode 100644 index 0000000000..125eff574c Binary files /dev/null and b/mods/mcl_jukebox/sounds/mcl_jukebox_track_7.ogg differ diff --git a/mods/mcl_jukebox/sounds/mcl_jukebox_track_8.ogg b/mods/mcl_jukebox/sounds/mcl_jukebox_track_8.ogg new file mode 100644 index 0000000000..d6ad04b22a Binary files /dev/null and b/mods/mcl_jukebox/sounds/mcl_jukebox_track_8.ogg differ diff --git a/mods/mcl_jukebox/textures/mcl_jukebox_record_11.png b/mods/mcl_jukebox/textures/mcl_jukebox_record_11.png new file mode 100644 index 0000000000..db6ecf3313 Binary files /dev/null and b/mods/mcl_jukebox/textures/mcl_jukebox_record_11.png differ diff --git a/mods/mcl_jukebox/textures/mcl_jukebox_record_13.png b/mods/mcl_jukebox/textures/mcl_jukebox_record_13.png new file mode 100644 index 0000000000..ad18077b77 Binary files /dev/null and b/mods/mcl_jukebox/textures/mcl_jukebox_record_13.png differ diff --git a/mods/mcl_jukebox/textures/mcl_jukebox_record_blocks.png b/mods/mcl_jukebox/textures/mcl_jukebox_record_blocks.png new file mode 100644 index 0000000000..7615fa0636 Binary files /dev/null and b/mods/mcl_jukebox/textures/mcl_jukebox_record_blocks.png differ diff --git a/mods/mcl_jukebox/textures/mcl_jukebox_record_cat.png b/mods/mcl_jukebox/textures/mcl_jukebox_record_cat.png new file mode 100644 index 0000000000..91e63472e3 Binary files /dev/null and b/mods/mcl_jukebox/textures/mcl_jukebox_record_cat.png differ diff --git a/mods/mcl_jukebox/textures/mcl_jukebox_record_chirp.png b/mods/mcl_jukebox/textures/mcl_jukebox_record_chirp.png new file mode 100644 index 0000000000..c0240f64c6 Binary files /dev/null and b/mods/mcl_jukebox/textures/mcl_jukebox_record_chirp.png differ diff --git a/mods/mcl_jukebox/textures/mcl_jukebox_record_far.png b/mods/mcl_jukebox/textures/mcl_jukebox_record_far.png new file mode 100644 index 0000000000..92049af25c Binary files /dev/null and b/mods/mcl_jukebox/textures/mcl_jukebox_record_far.png differ diff --git a/mods/mcl_jukebox/textures/mcl_jukebox_record_mall.png b/mods/mcl_jukebox/textures/mcl_jukebox_record_mall.png new file mode 100644 index 0000000000..d54cafd887 Binary files /dev/null and b/mods/mcl_jukebox/textures/mcl_jukebox_record_mall.png differ diff --git a/mods/mcl_jukebox/textures/mcl_jukebox_record_mellohi.png b/mods/mcl_jukebox/textures/mcl_jukebox_record_mellohi.png new file mode 100644 index 0000000000..996a494a32 Binary files /dev/null and b/mods/mcl_jukebox/textures/mcl_jukebox_record_mellohi.png differ diff --git a/mods/mcl_jukebox/textures/mcl_jukebox_record_stal.png b/mods/mcl_jukebox/textures/mcl_jukebox_record_stal.png new file mode 100644 index 0000000000..5afc44ee87 Binary files /dev/null and b/mods/mcl_jukebox/textures/mcl_jukebox_record_stal.png differ diff --git a/mods/mcl_jukebox/textures/mcl_jukebox_record_strad.png b/mods/mcl_jukebox/textures/mcl_jukebox_record_strad.png new file mode 100644 index 0000000000..9728c485dd Binary files /dev/null and b/mods/mcl_jukebox/textures/mcl_jukebox_record_strad.png differ diff --git a/mods/mcl_jukebox/textures/mcl_jukebox_record_wait.png b/mods/mcl_jukebox/textures/mcl_jukebox_record_wait.png new file mode 100644 index 0000000000..038ad1063b Binary files /dev/null and b/mods/mcl_jukebox/textures/mcl_jukebox_record_wait.png differ diff --git a/mods/mcl_jukebox/textures/mcl_jukebox_record_ward.png b/mods/mcl_jukebox/textures/mcl_jukebox_record_ward.png new file mode 100644 index 0000000000..ee5e7168b2 Binary files /dev/null and b/mods/mcl_jukebox/textures/mcl_jukebox_record_ward.png differ diff --git a/mods/mcl_jukebox/textures/mcl_jukebox_side.png b/mods/mcl_jukebox/textures/mcl_jukebox_side.png new file mode 100644 index 0000000000..2d602a2536 Binary files /dev/null and b/mods/mcl_jukebox/textures/mcl_jukebox_side.png differ diff --git a/mods/mcl_jukebox/textures/mcl_jukebox_top.png b/mods/mcl_jukebox/textures/mcl_jukebox_top.png new file mode 100644 index 0000000000..bcabbc3156 Binary files /dev/null and b/mods/mcl_jukebox/textures/mcl_jukebox_top.png differ