Initial Commit
|
@ -0,0 +1,34 @@
|
|||
Minetest mod "Jukebox (plus)"
|
||||
=============================
|
||||
Version: 1.0
|
||||
|
||||
License of source code and textures: WTFPL
|
||||
------------------------------------------
|
||||
Copyright (C) 2013 BlockMen
|
||||
Copyright (C) 2015 LNJ
|
||||
|
||||
|
||||
License of music: CC0
|
||||
---------------------
|
||||
The authors are : (freesound.org)
|
||||
-cheesepuff (song1)
|
||||
-geerterig (song2)
|
||||
-rap2h (song3)
|
||||
-keffstay (song4)
|
||||
-usedtobe (song5)
|
||||
-zagi2 (song6)
|
||||
|
||||
|
||||
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
|
||||
|
||||
|
||||
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.
|
||||
|
|
@ -0,0 +1 @@
|
|||
default
|
|
@ -0,0 +1,143 @@
|
|||
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.env:get_meta(pos)
|
||||
local inv = meta:get_inventory()
|
||||
local item = nil
|
||||
if inv:is_empty("main") then
|
||||
item = clicker:get_wielded_item():get_name()
|
||||
if item == "jukebox:disc_1" then
|
||||
inv:set_stack("main",1, itemstack:take_item())
|
||||
meta:set_string("hwnd",minetest.sound_play("jukebox_disc_1", {gain = 0.5, max_hear_distance = 25}))
|
||||
elseif item == "jukebox:disc_2" then
|
||||
inv:set_stack("main",1, itemstack:take_item())
|
||||
meta:set_string("hwnd",minetest.sound_play("jukebox_disc_2", {gain = 0.5, max_hear_distance = 25}))
|
||||
elseif item == "jukebox:disc_3" then
|
||||
inv:set_stack("main",1, itemstack:take_item())
|
||||
meta:set_string("hwnd",minetest.sound_play("jukebox_disc_3", {gain = 0.5, max_hear_distance = 25}))
|
||||
elseif item == "jukebox:disc_4" then
|
||||
inv:set_stack("main",1, itemstack:take_item())
|
||||
meta:set_string("hwnd",minetest.sound_play("jukebox_disc_4", {gain = 0.5, max_hear_distance = 25}))
|
||||
elseif item == "jukebox:disc_5" then
|
||||
inv:set_stack("main",1, itemstack:take_item())
|
||||
meta:set_string("hwnd",minetest.sound_play("jukebox_disc_5", {gain = 0.5, max_hear_distance = 25}))
|
||||
elseif item == "jukebox:disc_6" then
|
||||
inv:set_stack("main",1, itemstack:take_item())
|
||||
meta:set_string("hwnd",minetest.sound_play("jukebox_disc_6", {gain = 0.5, max_hear_distance = 25}))
|
||||
elseif item == "jukebox:disc_7" then
|
||||
inv:set_stack("main",1, itemstack:take_item())
|
||||
meta:set_string("hwnd",minetest.sound_play("jukebox_disc_7", {gain = 0.5, max_hear_distance = 25}))
|
||||
elseif item == "jukebox:disc_8" then
|
||||
inv:set_stack("main",1, itemstack:take_item())
|
||||
meta:set_string("hwnd",minetest.sound_play("jukebox_disc_8", {gain = 0.5, max_hear_distance = 25}))
|
||||
elseif item == "jukebox:disc_9" then
|
||||
inv:set_stack("main",1, itemstack:take_item())
|
||||
meta:set_string("hwnd",minetest.sound_play("jukebox_disc_9", {gain = 0.5, max_hear_distance = 25}))
|
||||
end
|
||||
else
|
||||
local drop_pos = minetest.env: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.env:add_item(drop_pos, inv:get_stack("main",1))
|
||||
if meta:get_string("hwnd") then minetest.sound_stop(meta:get_string("hwnd")) end
|
||||
inv:remove_item("main",inv:get_stack("main",1))
|
||||
end
|
||||
|
||||
end,
|
||||
on_construct = function(pos)
|
||||
local meta = minetest.env: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.env: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.env:add_item(drop_pos, inv:get_stack("main",1))
|
||||
if meta:get_string("hwnd") then minetest.sound_stop(meta:get_string("hwnd")) end
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_craftitem("jukebox:disc_1", {
|
||||
description = "Music Disc 1",
|
||||
inventory_image = "jukebox_disc_1.png",
|
||||
stack_max = 1
|
||||
})
|
||||
minetest.register_craftitem("jukebox:disc_2", {
|
||||
description = "Music Disc 2",
|
||||
inventory_image = "jukebox_disc_2.png",
|
||||
stack_max = 1
|
||||
})
|
||||
minetest.register_craftitem("jukebox:disc_3", {
|
||||
description = "Music Disc 3",
|
||||
inventory_image = "jukebox_disc_3.png",
|
||||
stack_max = 1
|
||||
})
|
||||
minetest.register_craftitem("jukebox:disc_4", {
|
||||
description = "Music Disc 4",
|
||||
inventory_image = "jukebox_disc_4.png",
|
||||
stack_max = 1
|
||||
})
|
||||
minetest.register_craftitem("jukebox:disc_5", {
|
||||
description = "Music Disc 5",
|
||||
inventory_image = "jukebox_disc_5.png",
|
||||
stack_max = 1
|
||||
})
|
||||
minetest.register_craftitem("jukebox:disc_6", {
|
||||
description = "Music Disc 6",
|
||||
inventory_image = "jukebox_disc_6.png",
|
||||
stack_max = 1
|
||||
})
|
||||
minetest.register_craftitem("jukebox:disc_7", {
|
||||
description = "Music Disc 7",
|
||||
inventory_image = "jukebox_disc_7.png",
|
||||
stack_max = 1
|
||||
})
|
||||
minetest.register_craftitem("jukebox:disc_8", {
|
||||
description = "Music Disc 8",
|
||||
inventory_image = "jukebox_disc_8.png",
|
||||
stack_max = 1
|
||||
})
|
||||
minetest.register_craftitem("jukebox:disc_9", {
|
||||
description = "Music Disc 9",
|
||||
inventory_image = "jukebox_disc_9.png",
|
||||
stack_max = 1
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "jukebox:box",
|
||||
recipe = {
|
||||
{"group:wood", "group:wood", "group:wood", },
|
||||
{"group:wood", "default:mese_crystal", "group:wood", },
|
||||
{"group:wood", "group:wood", "group:wood", }
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "jukebox:disc_1",
|
||||
recipe = {
|
||||
{"", "default:coal_lump", "", },
|
||||
{"default:coal_lump", "default:gold_lump", "default:coal_lump", },
|
||||
{"", "default:coal_lump", "", }
|
||||
}
|
||||
})
|
After Width: | Height: | Size: 457 B |
After Width: | Height: | Size: 457 B |
After Width: | Height: | Size: 457 B |
After Width: | Height: | Size: 457 B |
After Width: | Height: | Size: 457 B |
After Width: | Height: | Size: 457 B |
After Width: | Height: | Size: 457 B |
After Width: | Height: | Size: 457 B |
After Width: | Height: | Size: 457 B |
After Width: | Height: | Size: 688 B |
After Width: | Height: | Size: 386 B |
After Width: | Height: | Size: 595 B |