commit
c2ee808af3
517
init.lua
517
init.lua
@ -1,6 +1,17 @@
|
|||||||
--init.lua
|
--init.lua
|
||||||
active_tracks = {}
|
local active_tracks = {}
|
||||||
|
|
||||||
|
local discs = {
|
||||||
|
-- Track name Color
|
||||||
|
{ "The Evil Sister (Jordach's Mix) - SoundHelix", "yellow", },
|
||||||
|
{ "The Energetic Rat (Jordach's Mix) - SoundHelix", "blue", },
|
||||||
|
{ "Eastern Feeling - Jordach", "pink", },
|
||||||
|
{ "Minetest - Jordach", "green", },
|
||||||
|
{ "Credit Roll (Jordach's HD Mix) - Junichi Masuda", "red", },
|
||||||
|
{ "Moonsong (Jordach's Mix) - HeroOfTheWinds", "white", },
|
||||||
|
{ "Synthgroove (Jordach's Mix) - HeroOfTheWinds", "cyan", },
|
||||||
|
{ "The Clueless Frog (Jordach's Mix) - SoundHelix", "violet", },
|
||||||
|
}
|
||||||
|
|
||||||
-- jukebox crafting
|
-- jukebox crafting
|
||||||
|
|
||||||
@ -18,467 +29,61 @@ minetest.register_craft({
|
|||||||
minetest.register_node("jdukebox:box", {
|
minetest.register_node("jdukebox:box", {
|
||||||
description = "Jukebox",
|
description = "Jukebox",
|
||||||
tiles = {"jdukebox_top.png", "deco_wood_oak_planks.png", "jdukebox_side.png"},
|
tiles = {"jdukebox_top.png", "deco_wood_oak_planks.png", "jdukebox_side.png"},
|
||||||
-- sounds = default.node_sounds_wood_defaults(),
|
--sounds = default.node_sounds_wood_defaults(),
|
||||||
--paramtype = "facedir",
|
--paramtype = "facedir",
|
||||||
groups = {oddly_breakable_by_hand=1, flammable=1, choppy=3},
|
groups = {oddly_breakable_by_hand=1, flammable=1, choppy=3},
|
||||||
})
|
on_punch = function(pos, node, puncher, pointed_thing)
|
||||||
|
if not puncher then return end
|
||||||
|
|
||||||
minetest.register_node("jdukebox:box1", {
|
local plname = puncher:get_player_name()
|
||||||
description = "Jukebox",
|
if not plname then return end
|
||||||
tiles = {"jdukebox_top.png", "deco_wood_oak_planks.png", "jdukebox_side.png"},
|
|
||||||
-- sounds = default.node_sounds_wood_defaults(),
|
|
||||||
--paramtype = "facedir",
|
|
||||||
drop = "jdukebox:disc_1",
|
|
||||||
groups = {oddly_breakable_by_hand=1, flammable=1, choppy=3, not_in_creative_inventory=1},
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_node("jdukebox:box2", {
|
local wield = puncher:get_wielded_item():get_name()
|
||||||
description = "Jukebox",
|
|
||||||
tiles = {"jdukebox_top.png", "deco_wood_oak_planks.png", "jdukebox_side.png"},
|
|
||||||
-- sounds = default.node_sounds_wood_defaults(),
|
|
||||||
--paramtype = "facedir",
|
|
||||||
drop = "jdukebox:disc_2",
|
|
||||||
groups = {oddly_breakable_by_hand=1, flammable=1, choppy=3, not_in_creative_inventory=1},
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_node("jdukebox:box3", {
|
local track = active_tracks[plname]
|
||||||
description = "Jukebox",
|
if track then
|
||||||
tiles = {"jdukebox_top.png", "deco_wood_oak_planks.png", "jdukebox_side.png"},
|
local sound = track.sound
|
||||||
-- sounds = default.node_sounds_wood_defaults(),
|
local discid = track.disc
|
||||||
paramtype = "facedir",
|
pos.y = pos.y + 1
|
||||||
drop = "jdukebox:disc_3",
|
minetest.add_item(pos, "jdukebox:disc_"..discid)
|
||||||
groups = {oddly_breakable_by_hand=1, flammable=1, choppy=3, not_in_creative_inventory=1},
|
minetest.sound_stop(sound)
|
||||||
})
|
active_tracks[plname] = nil
|
||||||
|
else
|
||||||
minetest.register_node("jdukebox:box4", {
|
local discid = wield:match("jdukebox:disc_(%d)")
|
||||||
description = "Jukebox",
|
if discid then
|
||||||
tiles = {"jdukebox_top.png", "deco_wood_oak_planks.png", "jdukebox_side.png"},
|
discid = tonumber(discid)
|
||||||
-- sounds = default.node_sounds_wood_defaults(),
|
puncher:set_wielded_item("")
|
||||||
--paramtype = "facedir",
|
local sound = minetest.sound_play("jukebox_track_"..discid, {
|
||||||
drop = "jdukebox:disc_4",
|
to_player = plname,
|
||||||
groups = {oddly_breakable_by_hand=1, flammable=1, choppy=3, not_in_creative_inventory=1},
|
--max_hear_distance = 16,
|
||||||
})
|
gain = 1,
|
||||||
|
})
|
||||||
minetest.register_node("jdukebox:box5", {
|
active_tracks[plname] = { disc=discid, sound=sound }
|
||||||
description = "Jukebox",
|
end
|
||||||
tiles = {"jdukebox_top.png", "deco_wood_oak_planks.png", "jdukebox_side.png"},
|
end
|
||||||
-- sounds = default.node_sounds_wood_defaults(),
|
end,
|
||||||
--paramtype = "facedir",
|
|
||||||
groups = {oddly_breakable_by_hand=1, flammable=1, choppy=3, not_in_creative_inventory=1},
|
|
||||||
drop = "jdukebox:disc_5",
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_node("jdukebox:box6", {
|
|
||||||
description = "Jukebox",
|
|
||||||
tiles = {"jdukebox_top.png", "deco_wood_oak_planks.png", "jdukebox_side.png"},
|
|
||||||
-- sounds = default.node_sounds_wood_defaults(),
|
|
||||||
--paramtype = "facedir",
|
|
||||||
groups = {oddly_breakable_by_hand=1, flammable=1, choppy=3, not_in_creative_inventory=1},
|
|
||||||
drop = "jdukebox:disc_6",
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_node("jdukebox:box7", {
|
|
||||||
description = "Jukebox",
|
|
||||||
tiles = {"jdukebox_top.png", "deco_wood_oak_planks.png", "jdukebox_side.png"},
|
|
||||||
-- sounds = default.node_sounds_wood_defaults(),
|
|
||||||
--paramtype = "facedir",
|
|
||||||
groups = {oddly_breakable_by_hand=1, flammable=1, choppy=3, not_in_creative_inventory=1},
|
|
||||||
drop = "jdukebox:disc_7",
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_node("jdukebox:box8", {
|
|
||||||
description = "Jukebox",
|
|
||||||
tiles = {"jdukebox_top.png", "deco_wood_oak_planks.png", "jdukebox_side.png"},
|
|
||||||
-- sounds = default.node_sounds_wood_defaults(),
|
|
||||||
--paramtype = "facedir",
|
|
||||||
groups = {oddly_breakable_by_hand=1, flammable=1, choppy=3, not_in_creative_inventory=1},
|
|
||||||
drop = "jdukebox:disc_8",
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_craftitem("jdukebox:disc_1", {
|
|
||||||
description = "The Evil Sister (Jordach's Mix) - SoundHelix",
|
|
||||||
inventory_image = "jdukebox_disc_1.png",
|
|
||||||
stack_max = 1,
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_craftitem("jdukebox:disc_2", {
|
|
||||||
description = "The Energetic Rat (Jordach's Mix) - SoundHelix",
|
|
||||||
inventory_image = "jdukebox_disc_2.png",
|
|
||||||
stack_max = 1,
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_craftitem("jdukebox:disc_3", {
|
|
||||||
description = "Eastern Feeling - Jordach",
|
|
||||||
inventory_image = "jdukebox_disc_3.png",
|
|
||||||
stack_max = 1,
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_craftitem("jdukebox:disc_4", {
|
|
||||||
description = "Minetest - Jordach",
|
|
||||||
inventory_image = "jdukebox_disc_4.png",
|
|
||||||
stack_max = 1,
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_craftitem("jdukebox:disc_5", {
|
|
||||||
description = "Credit Roll (Jordach's HD Mix) - Junichi Masuda",
|
|
||||||
inventory_image = "jdukebox_disc_5.png",
|
|
||||||
stack_max = 1,
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_craftitem("jdukebox:disc_6", {
|
|
||||||
description = "Moonsong (Jordach's Mix) - HeroOfTheWinds",
|
|
||||||
inventory_image = "jdukebox_disc_6.png",
|
|
||||||
stack_max = 1,
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_craftitem("jdukebox:disc_7", {
|
|
||||||
description = "Synthgroove (Jordach's Mix) - HeroOfTheWinds",
|
|
||||||
inventory_image = "jdukebox_disc_7.png",
|
|
||||||
stack_max = 1,
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_craftitem("jdukebox:disc_8", {
|
|
||||||
description = "The Clueless Frog (Jordach's Mix) - SoundHelix",
|
|
||||||
inventory_image = "jdukebox_disc_8.png",
|
|
||||||
stack_max = 1,
|
|
||||||
})
|
|
||||||
|
|
||||||
-- disc crafting
|
|
||||||
|
|
||||||
minetest.register_craft({
|
|
||||||
output = 'jdukebox:disc_1',
|
|
||||||
recipe = {
|
|
||||||
{'default:coal_lump', 'default:coal_lump', 'default:coal_lump'},
|
|
||||||
{'default:coal_lump', 'dye:yellow', 'default:coal_lump'},
|
|
||||||
{'default:coal_lump', 'default:coal_lump', 'default:coal_lump'},
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_craft({
|
|
||||||
output = 'jdukebox:disc_2',
|
|
||||||
recipe = {
|
|
||||||
{'default:coal_lump', 'default:coal_lump', 'default:coal_lump'},
|
|
||||||
{'default:coal_lump', 'dye:blue', 'default:coal_lump'},
|
|
||||||
{'default:coal_lump', 'default:coal_lump', 'default:coal_lump'},
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
|
|
||||||
minetest.register_craft({
|
|
||||||
output = 'jdukebox:disc_3',
|
|
||||||
recipe = {
|
|
||||||
{'default:coal_lump', 'default:coal_lump', 'default:coal_lump'},
|
|
||||||
{'default:coal_lump', 'dye:pink', 'default:coal_lump'},
|
|
||||||
{'default:coal_lump', 'default:coal_lump', 'default:coal_lump'},
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_craft({
|
|
||||||
output = 'jdukebox:disc_4',
|
|
||||||
recipe = {
|
|
||||||
{'default:coal_lump', 'default:coal_lump', 'default:coal_lump'},
|
|
||||||
{'default:coal_lump', 'dye:green', 'default:coal_lump'},
|
|
||||||
{'default:coal_lump', 'default:coal_lump', 'default:coal_lump'},
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_craft({
|
|
||||||
output = 'jdukebox:disc_5',
|
|
||||||
recipe = {
|
|
||||||
{'default:coal_lump', 'default:coal_lump', 'default:coal_lump'},
|
|
||||||
{'default:coal_lump', 'dye:red', 'default:coal_lump'},
|
|
||||||
{'default:coal_lump', 'default:coal_lump', 'default:coal_lump'},
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_craft({
|
|
||||||
output = 'jdukebox:disc_6',
|
|
||||||
recipe = {
|
|
||||||
{'default:coal_lump', 'default:coal_lump', 'default:coal_lump'},
|
|
||||||
{'default:coal_lump', 'dye:white', 'default:coal_lump'},
|
|
||||||
{'default:coal_lump', 'default:coal_lump', 'default:coal_lump'},
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_craft({
|
|
||||||
output = 'jdukebox:disc_7',
|
|
||||||
recipe = {
|
|
||||||
{'default:coal_lump', 'default:coal_lump', 'default:coal_lump'},
|
|
||||||
{'default:coal_lump', 'dye:cyan', 'default:coal_lump'},
|
|
||||||
{'default:coal_lump', 'default:coal_lump', 'default:coal_lump'},
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_craft({
|
|
||||||
output = 'jdukebox:disc_8',
|
|
||||||
recipe = {
|
|
||||||
{'default:coal_lump', 'default:coal_lump', 'default:coal_lump'},
|
|
||||||
{'default:coal_lump', 'dye:violet', 'default:coal_lump'},
|
|
||||||
{'default:coal_lump', 'default:coal_lump', 'default:coal_lump'},
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
-- welcome to the jukebox, we got music and discs
|
-- welcome to the jukebox, we got music and discs
|
||||||
|
|
||||||
minetest.register_on_punchnode(function(pos, node, puncher)
|
for i = 1, #discs do
|
||||||
if not puncher then return end
|
local track_name, dye = discs[i][1], discs[i][2]
|
||||||
|
|
||||||
wield = puncher:get_wielded_item():get_name()
|
minetest.register_alias("jdukebox:box"..i, "jdukebox:box")
|
||||||
jnodename = minetest.get_node(pos)
|
|
||||||
|
minetest.register_craftitem("jdukebox:disc_"..i, {
|
||||||
if jnodename.name == "jdukebox:box" then
|
description = track_name,
|
||||||
if wield == "jdukebox:disc_1" then
|
inventory_image = "jdukebox_disc_"..i..".png",
|
||||||
puncher:set_wielded_item("")
|
stack_max = 1,
|
||||||
minetest.set_node(pos, {name="jdukebox:box1"})
|
})
|
||||||
if active_tracks[puncher:get_player_name()] ~= nil then
|
|
||||||
minetest.sound_stop(active_tracks[puncher:get_player_name()])
|
minetest.register_craft({
|
||||||
else
|
output = "jdukebox:disc_"..i,
|
||||||
--dont die
|
recipe = {
|
||||||
end
|
{"default:coal_lump", "default:coal_lump", "default:coal_lump"},
|
||||||
active_tracks[puncher:get_player_name()] = minetest.sound_play("jukebox_track_1", {
|
{"default:coal_lump", "dye:"..dye, "default:coal_lump"},
|
||||||
to_player = puncher:get_player_name(),
|
{"default:coal_lump", "default:coal_lump", "default:coal_lump"},
|
||||||
--max_hear_distance = 16,
|
}
|
||||||
gain = 1,
|
})
|
||||||
})
|
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
if jnodename.name == "jdukebox:box1" then
|
|
||||||
if wield ~= "jdukebox:disc_1" then
|
|
||||||
lx = pos.x
|
|
||||||
ly = pos.y+1
|
|
||||||
lz = pos.z
|
|
||||||
minetest.add_item({x=lx, y=ly, z=lz}, "jdukebox:disc_1 1")
|
|
||||||
minetest.set_node(pos, {name="jdukebox:box"})
|
|
||||||
if active_tracks[puncher:get_player_name()] ~= nil then
|
|
||||||
minetest.sound_stop(active_tracks[puncher:get_player_name()])
|
|
||||||
else
|
|
||||||
--dont die
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
if jnodename.name == "jdukebox:box" then
|
|
||||||
if wield == "jdukebox:disc_2" then
|
|
||||||
puncher:set_wielded_item("")
|
|
||||||
minetest.set_node(pos, {name="jdukebox:box2"})
|
|
||||||
if active_tracks[puncher:get_player_name()] ~= nil then
|
|
||||||
minetest.sound_stop(active_tracks[puncher:get_player_name()])
|
|
||||||
else
|
|
||||||
--dont die
|
|
||||||
end
|
|
||||||
active_tracks[puncher:get_player_name()] = minetest.sound_play("jukebox_track_2", {
|
|
||||||
to_player = puncher:get_player_name(),
|
|
||||||
--max_hear_distance = 16,
|
|
||||||
gain = 1,
|
|
||||||
})
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
if jnodename.name == "jdukebox:box2" then
|
|
||||||
if wield ~= "jdukebox:disc_2" then
|
|
||||||
lx = pos.x
|
|
||||||
ly = pos.y+1
|
|
||||||
lz = pos.z
|
|
||||||
minetest.add_item({x=lx, y=ly, z=lz}, "jdukebox:disc_2 1")
|
|
||||||
minetest.set_node(pos, {name="jdukebox:box"})
|
|
||||||
if active_tracks[puncher:get_player_name()] ~= nil then
|
|
||||||
minetest.sound_stop(active_tracks[puncher:get_player_name()])
|
|
||||||
else
|
|
||||||
--dont die
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
if jnodename.name == "jdukebox:box" then
|
|
||||||
if wield == "jdukebox:disc_3" then
|
|
||||||
puncher:set_wielded_item("")
|
|
||||||
minetest.set_node(pos, {name="jdukebox:box3"})
|
|
||||||
if active_tracks[puncher:get_player_name()] ~= nil then
|
|
||||||
minetest.sound_stop(active_tracks[puncher:get_player_name()])
|
|
||||||
else
|
|
||||||
--dont die
|
|
||||||
end
|
|
||||||
active_tracks[puncher:get_player_name()] = minetest.sound_play("jukebox_track_3", {
|
|
||||||
to_player = puncher:get_player_name(),
|
|
||||||
--max_hear_distance = 16,
|
|
||||||
gain = 1,
|
|
||||||
})
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
if jnodename.name == "jdukebox:box3" then
|
|
||||||
if wield ~= "jdukebox:disc_3" then
|
|
||||||
lx = pos.x
|
|
||||||
ly = pos.y+1
|
|
||||||
lz = pos.z
|
|
||||||
minetest.add_item({x=lx, y=ly, z=lz}, "jdukebox:disc_3 1")
|
|
||||||
minetest.set_node(pos, {name="jdukebox:box"})
|
|
||||||
if active_tracks[puncher:get_player_name()] ~= nil then
|
|
||||||
minetest.sound_stop(active_tracks[puncher:get_player_name()])
|
|
||||||
else
|
|
||||||
--dont die
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
if jnodename.name == "jdukebox:box" then
|
|
||||||
if wield == "jdukebox:disc_4" then
|
|
||||||
puncher:set_wielded_item("")
|
|
||||||
minetest.set_node(pos, {name="jdukebox:box4"})
|
|
||||||
if active_tracks[puncher:get_player_name()] ~= nil then
|
|
||||||
minetest.sound_stop(active_tracks[puncher:get_player_name()])
|
|
||||||
else
|
|
||||||
--dont die
|
|
||||||
end
|
|
||||||
active_tracks[puncher:get_player_name()] = minetest.sound_play("jukebox_track_4", {
|
|
||||||
to_player = puncher:get_player_name(),
|
|
||||||
--max_hear_distance = 16,
|
|
||||||
gain = 1,
|
|
||||||
})
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
if jnodename.name == "jdukebox:box4" then
|
|
||||||
if wield ~= "jdukebox:disc_4" then
|
|
||||||
lx = pos.x
|
|
||||||
ly = pos.y+1
|
|
||||||
lz = pos.z
|
|
||||||
minetest.add_item({x=lx, y=ly, z=lz}, "jdukebox:disc_4 1")
|
|
||||||
minetest.set_node(pos, {name="jdukebox:box"})
|
|
||||||
if active_tracks[puncher:get_player_name()] ~= nil then
|
|
||||||
minetest.sound_stop(active_tracks[puncher:get_player_name()])
|
|
||||||
else
|
|
||||||
--dont die
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
if jnodename.name == "jdukebox:box" then
|
|
||||||
if wield == "jdukebox:disc_5" then
|
|
||||||
puncher:set_wielded_item("")
|
|
||||||
minetest.set_node(pos, {name="jdukebox:box5"})
|
|
||||||
if active_tracks[puncher:get_player_name()] ~= nil then
|
|
||||||
minetest.sound_stop(active_tracks[puncher:get_player_name()])
|
|
||||||
else
|
|
||||||
--dont die
|
|
||||||
end
|
|
||||||
active_tracks[puncher:get_player_name()] = minetest.sound_play("jukebox_track_5", {
|
|
||||||
to_player = puncher:get_player_name(),
|
|
||||||
--max_hear_distance = 16,
|
|
||||||
gain = 1,
|
|
||||||
})
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
if jnodename.name == "jdukebox:box5" then
|
|
||||||
if wield ~= "jdukebox:disc_5" then
|
|
||||||
lx = pos.x
|
|
||||||
ly = pos.y+1
|
|
||||||
lz = pos.z
|
|
||||||
minetest.add_item({x=lx, y=ly, z=lz}, "jdukebox:disc_5 1")
|
|
||||||
minetest.set_node(pos, {name="jdukebox:box"})
|
|
||||||
if active_tracks[puncher:get_player_name()] ~= nil then
|
|
||||||
minetest.sound_stop(active_tracks[puncher:get_player_name()])
|
|
||||||
else
|
|
||||||
--dont die
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
if jnodename.name == "jdukebox:box" then
|
|
||||||
if wield == "jdukebox:disc_6" then
|
|
||||||
puncher:set_wielded_item("")
|
|
||||||
minetest.set_node(pos, {name="jdukebox:box6"})
|
|
||||||
if active_tracks[puncher:get_player_name()] ~= nil then
|
|
||||||
minetest.sound_stop(active_tracks[puncher:get_player_name()])
|
|
||||||
else
|
|
||||||
--dont die
|
|
||||||
end
|
|
||||||
active_tracks[puncher:get_player_name()] = minetest.sound_play("jukebox_track_6", {
|
|
||||||
to_player = puncher:get_player_name(),
|
|
||||||
--max_hear_distance = 16,
|
|
||||||
gain = 1,
|
|
||||||
})
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
if jnodename.name == "jdukebox:box6" then
|
|
||||||
if wield ~= "jdukebox:disc_6" then
|
|
||||||
lx = pos.x
|
|
||||||
ly = pos.y+1
|
|
||||||
lz = pos.z
|
|
||||||
minetest.add_item({x=lx, y=ly, z=lz}, "jdukebox:disc_6 1")
|
|
||||||
minetest.set_node(pos, {name="jdukebox:box"})
|
|
||||||
if active_tracks[puncher:get_player_name()] ~= nil then
|
|
||||||
minetest.sound_stop(active_tracks[puncher:get_player_name()])
|
|
||||||
else
|
|
||||||
--dont die
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
if jnodename.name == "jdukebox:box" then
|
|
||||||
if wield == "jdukebox:disc_7" then
|
|
||||||
puncher:set_wielded_item("")
|
|
||||||
minetest.set_node(pos, {name="jdukebox:box7"})
|
|
||||||
if active_tracks[puncher:get_player_name()] ~= nil then
|
|
||||||
minetest.sound_stop(active_tracks[puncher:get_player_name()])
|
|
||||||
else
|
|
||||||
--dont die
|
|
||||||
end
|
|
||||||
active_tracks[puncher:get_player_name()] = minetest.sound_play("jukebox_track_7", {
|
|
||||||
to_player = puncher:get_player_name(),
|
|
||||||
--max_hear_distance = 16,
|
|
||||||
gain = 1,
|
|
||||||
})
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
if jnodename.name == "jdukebox:box7" then
|
|
||||||
if wield ~= "jdukebox:disc_7" then
|
|
||||||
lx = pos.x
|
|
||||||
ly = pos.y+1
|
|
||||||
lz = pos.z
|
|
||||||
minetest.add_item({x=lx, y=ly, z=lz}, "jdukebox:disc_7 1")
|
|
||||||
minetest.set_node(pos, {name="jdukebox:box"})
|
|
||||||
if active_tracks[puncher:get_player_name()] ~= nil then
|
|
||||||
minetest.sound_stop(active_tracks[puncher:get_player_name()])
|
|
||||||
else
|
|
||||||
--dont die
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
if jnodename.name == "jdukebox:box" then
|
|
||||||
if wield == "jdukebox:disc_8" then
|
|
||||||
puncher:set_wielded_item("")
|
|
||||||
minetest.set_node(pos, {name="jdukebox:box8"})
|
|
||||||
if active_tracks[puncher:get_player_name()] ~= nil then
|
|
||||||
minetest.sound_stop(active_tracks[puncher:get_player_name()])
|
|
||||||
else
|
|
||||||
--dont die
|
|
||||||
end
|
|
||||||
active_tracks[puncher:get_player_name()] = minetest.sound_play("jukebox_track_8", {
|
|
||||||
to_player = puncher:get_player_name(),
|
|
||||||
--max_hear_distance = 16,
|
|
||||||
gain = 1,
|
|
||||||
})
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
if jnodename.name == "jdukebox:box8" then
|
|
||||||
if wield ~= "jdukebox:disc_8" then
|
|
||||||
lx = pos.x
|
|
||||||
ly = pos.y+1
|
|
||||||
lz = pos.z
|
|
||||||
minetest.add_item({x=lx, y=ly, z=lz}, "jdukebox:disc_8 1")
|
|
||||||
minetest.set_node(pos, {name="jdukebox:box"})
|
|
||||||
if active_tracks[puncher:get_player_name()] ~= nil then
|
|
||||||
minetest.sound_stop(active_tracks[puncher:get_player_name()])
|
|
||||||
else
|
|
||||||
--dont die
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end)
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user