Update deprecated get_attribute calls
This commit is contained in:
parent
41150c61f1
commit
40f4ffbb3c
@ -43,10 +43,11 @@ mpd.time_next=10 --sekunden
|
|||||||
mpd.id_last_played=nil
|
mpd.id_last_played=nil
|
||||||
|
|
||||||
minetest.register_on_joinplayer(function(player)
|
minetest.register_on_joinplayer(function(player)
|
||||||
local play_music = player:get_attribute("play_music")
|
local meta = player:get_meta()
|
||||||
|
local play_music = meta:get_string("play_music")
|
||||||
local play = true
|
local play = true
|
||||||
if play_music == "" then
|
if play_music == "" then
|
||||||
player:set_attribute("play_music", "1")
|
meta:set_string("play_music", "1")
|
||||||
elseif play_music == "0" then
|
elseif play_music == "0" then
|
||||||
play = false
|
play = false
|
||||||
end
|
end
|
||||||
@ -125,7 +126,7 @@ minetest.register_chatcommand("mpd_stop", {
|
|||||||
privs = {mpd=true},
|
privs = {mpd=true},
|
||||||
func = function(name, param)
|
func = function(name, param)
|
||||||
local player = minetest.get_player_by_name(name)
|
local player = minetest.get_player_by_name(name)
|
||||||
player:set_attribute("play_music", "0")
|
player:get_meta():set_string("play_music", "0")
|
||||||
mpd.stop_song()
|
mpd.stop_song()
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
@ -147,7 +148,7 @@ minetest.register_chatcommand("mpd_play", {
|
|||||||
id=tonumber(param)
|
id=tonumber(param)
|
||||||
if id and id>0 and id<=#mpd.songs then
|
if id and id>0 and id<=#mpd.songs then
|
||||||
local player = minetest.get_player_by_name(name)
|
local player = minetest.get_player_by_name(name)
|
||||||
player:set_attribute("play_music", "1")
|
player:get_meta():set_string("play_music", "1")
|
||||||
mpd.play_song(id)
|
mpd.play_song(id)
|
||||||
return true,"Playing: "..mpd.song_human_readable(id)
|
return true,"Playing: "..mpd.song_human_readable(id)
|
||||||
end
|
end
|
||||||
@ -169,7 +170,7 @@ minetest.register_chatcommand("mpd_next", {
|
|||||||
privs = {mpd=true},
|
privs = {mpd=true},
|
||||||
func = function(name, param)
|
func = function(name, param)
|
||||||
local player = minetest.get_player_by_name(name)
|
local player = minetest.get_player_by_name(name)
|
||||||
player:set_attribute("play_music", "1")
|
player:get_meta():set_string("play_music", "1")
|
||||||
mpd.stop_song()
|
mpd.stop_song()
|
||||||
if param and tonumber(param) then
|
if param and tonumber(param) then
|
||||||
mpd.time_next=tonumber(param)
|
mpd.time_next=tonumber(param)
|
||||||
@ -219,10 +220,10 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
|
|||||||
if(fields.togglemusic) then
|
if(fields.togglemusic) then
|
||||||
if mpd.playing then
|
if mpd.playing then
|
||||||
mpd.stop_song()
|
mpd.stop_song()
|
||||||
player:set_attribute("play_music", "0")
|
player:get_meta():set_string("play_music", "0")
|
||||||
else
|
else
|
||||||
mpd.next_song()
|
mpd.next_song()
|
||||||
player:set_attribute("play_music", "1")
|
player:get_meta():set_string("play_music", "1")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
@ -105,10 +105,10 @@ minetest.register_node("supplemental:loudspeaker", {
|
|||||||
on_rightclick = function(pos, node, clicker)
|
on_rightclick = function(pos, node, clicker)
|
||||||
if mpd.playing then
|
if mpd.playing then
|
||||||
mpd.stop_song()
|
mpd.stop_song()
|
||||||
clicker:set_attribute("play_music", "0")
|
clicker:get_meta():set_string("play_music", "0")
|
||||||
else
|
else
|
||||||
mpd.next_song()
|
mpd.next_song()
|
||||||
clicker:set_attribute("play_music", "1")
|
clicker:get_meta():set_string("play_music", "1")
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user