1
0
mirror of https://github.com/sys4-fr/server-nalc.git synced 2024-12-25 02:00:37 +01:00

fix crash soundset

fix crash soundset init.lua:111: attempt to index field '?'
This commit is contained in:
crabman77 2015-03-31 23:44:22 +02:00
parent a9449a276f
commit 91b0f25735

View File

@ -23,7 +23,6 @@ local function load_sounds_config()
sounds.gainplayers = minetest.deserialize(file:read("*all"))
file:close()
end
print("type: "..tostring(type(sounds.gainplayers)))
if sounds.gainplayers == nil or type(sounds.gainplayers) ~= "table" then
sounds.gainplayers = {}
end
@ -108,6 +107,7 @@ end
minetest.register_on_player_receive_fields(function(player, formname, fields)
if formname == "soundset:settings" then
local name = player:get_player_name()
if not name then return end
local fmusic = sounds.tmp[name]["music"]
local fambience = sounds.tmp[name]["ambience"]
if fields["abort"] == "Ok" then
@ -168,6 +168,7 @@ if (minetest.get_modpath("unified_inventory")) then
tooltip = "sounds menu ",
action = function(player)
local name = player:get_player_name()
if not name then return end
on_show_settings(name, sounds.gainplayers[name]["music"], sounds.gainplayers[name]["ambience"])
end,
})
@ -178,6 +179,7 @@ minetest.register_chatcommand("soundset", {
description = "Display volume menu formspec",
privs = {interact=true},
func = function(name, param)
if not name then return end
on_show_settings(name, sounds.gainplayers[name]["music"], sounds.gainplayers[name]["ambience"])
end
})