Make jukebox accept and play old music records

With the introduction of the mcl_jukebox API, all music record items
were given new names. Old music record items were aliased, but never
worked with the jukebox. Apparently no one tested existing records.

By explicitly looking up the item name in minetest.registered_aliases,
the jukebox accepts old records, plays them, and gives out new records.
This commit is contained in:
Nils Dagsson Moskopp 2021-06-15 17:33:43 +02:00
parent 811b6d7058
commit 5f0710a486
Signed by untrusted user who does not match committer: erle
GPG Key ID: A3BC671C35191080
1 changed files with 3 additions and 1 deletions

View File

@ -92,7 +92,9 @@ minetest.register_craft({
})
local play_record = function(pos, itemstack, player)
local name = itemstack:get_name()
local item_name = itemstack:get_name()
-- ensure the jukebox uses the new record names for old records
local name = minetest.registered_aliases[item_name] or item_name
if mcl_jukebox.registered_records[name] then
local cname = player:get_player_name()
if active_tracks[cname] ~= nil then