mirror of
https://github.com/sys4-fr/server-nalc.git
synced 2025-01-23 16:30:19 +01:00
Added basic of jukebox rewrite
- Added jukebox mod, with updated API and beginning of rewriting
This commit is contained in:
parent
94fcaaac6c
commit
3353cafbe1
47
mods/jukebox/README.txt
Normal file
47
mods/jukebox/README.txt
Normal file
@ -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.
|
||||
|
1
mods/jukebox/depends.txt
Normal file
1
mods/jukebox/depends.txt
Normal file
@ -0,0 +1 @@
|
||||
default
|
81
mods/jukebox/init.lua
Normal file
81
mods/jukebox/init.lua
Normal file
@ -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", "", }
|
||||
}
|
||||
})
|
BIN
mods/jukebox/sounds/jukebox_song.1.ogg
Normal file
BIN
mods/jukebox/sounds/jukebox_song.1.ogg
Normal file
Binary file not shown.
BIN
mods/jukebox/sounds/jukebox_song.2.ogg
Normal file
BIN
mods/jukebox/sounds/jukebox_song.2.ogg
Normal file
Binary file not shown.
BIN
mods/jukebox/sounds/jukebox_song.3.ogg
Normal file
BIN
mods/jukebox/sounds/jukebox_song.3.ogg
Normal file
Binary file not shown.
BIN
mods/jukebox/sounds/jukebox_song.4.ogg
Normal file
BIN
mods/jukebox/sounds/jukebox_song.4.ogg
Normal file
Binary file not shown.
BIN
mods/jukebox/sounds/jukebox_song.5.ogg
Normal file
BIN
mods/jukebox/sounds/jukebox_song.5.ogg
Normal file
Binary file not shown.
BIN
mods/jukebox/sounds/jukebox_song.6.ogg
Normal file
BIN
mods/jukebox/sounds/jukebox_song.6.ogg
Normal file
Binary file not shown.
BIN
mods/jukebox/textures/jukebox_disc.png
Normal file
BIN
mods/jukebox/textures/jukebox_disc.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 457 B |
BIN
mods/jukebox/textures/jukebox_front.png
Normal file
BIN
mods/jukebox/textures/jukebox_front.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 688 B |
BIN
mods/jukebox/textures/jukebox_side.png
Normal file
BIN
mods/jukebox/textures/jukebox_side.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 386 B |
BIN
mods/jukebox/textures/jukebox_top.png
Normal file
BIN
mods/jukebox/textures/jukebox_top.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 595 B |
Loading…
Reference in New Issue
Block a user