diff --git a/minetest.conf b/minetest.conf index b1b7c88..102fce6 100644 --- a/minetest.conf +++ b/minetest.conf @@ -1,2 +1,2 @@ # Chatplus settings -chatplus_distance = 0 #(0=off) +##chatplus_distance = 10 \ No newline at end of file diff --git a/mods/0a_mod_debug/init.lua b/mods/0a_mod_debug/init.lua new file mode 100644 index 0000000..2a68225 --- /dev/null +++ b/mods/0a_mod_debug/init.lua @@ -0,0 +1,114 @@ +-- check the settings +if minetest.setting_getbool("mod_debug")~=true then + return +end + +print("[DEBUG] Mod debug loaded") + +local mod = {} +mod.recipes = {} +mod.aliases = {} + +local register_craft = minetest.register_craft +local register_alias = minetest.register_alias + +local function get_items_in_group(groupname) + local items = {} + for name, def in pairs(minetest.registered_nodes) do + local g = def.groups and def.groups[groupname] or 0 + if g > 0 then + items[name] = def + end + end + return items +end + +minetest.register_craft = function(recipe) + register_craft(recipe) + + local name = mod.strip_name(recipe.output) + if name~=nil then + --print("[DEBUG] recipe for "..name.." registered") + table.insert(mod.recipes,recipe) + end +end + +minetest.register_alias = function(new,old) + register_alias (new,old) + + local name = mod.strip_name(new) + local name2 = mod.strip_name(old) + if name~=nil and name2~=nil then + --print("[DEBUG] alias for "..name2.." to "..name.." registered") + mod.aliases[new] = old + end +end + +function mod.assert(_name,output) + local name = mod.strip_name(_name) + if (name==nil) then + return + end + + if (mod.aliases[name]~=nil) then + name = mod.aliases[name] + end + + if (minetest.registered_items[name] == nil and next(get_items_in_group(name:gsub('%group:', '')))==nil) then + print("[RECIPE ERROR] "..name.." in recipe for "..mod.strip_name(output)) + end +end + +function mod.strip_name(name) + if (name==nil) then + return + end + + res = name:gsub('%"', '') + + if res:sub(1,1) == ":" then + res = table.concat{res:sub(1,1-1), "", res:sub(1+1)} + end + + for str in string.gmatch(res, "([^ ]+)") do + if (str~=" " and str~=nil) then + res=str + break + end + end + + if (res==nil) then + res="" + end + + return res +end + +-- Recursion method +function mod.check_recipe(table,output) + if type(table) == "table" then + for i=1,# table do + mod.check_recipe(table[i],output) + end + else + mod.assert(table,output) + end +end + + +minetest.after(0, function() + print("[DEBUG] checking recipes") + for i=1,# mod.recipes do + if mod.recipes[i] and mod.recipes[i].output then + mod.assert(mod.recipes[i].output,mod.recipes[i].output) + + if type(mod.recipes[i].recipe) == "table" then + for a=1,# mod.recipes[i].recipe do + mod.check_recipe(mod.recipes[i].recipe[a],mod.recipes[i].output) + end + else + mod.assert(mod.recipes[i].recipe,mod.recipes[i].output) + end + end + end +end) \ No newline at end of file diff --git a/mods/capturetheflag/flag.lua b/mods/capturetheflag/flag.lua index 80b83b0..43bf323 100644 --- a/mods/capturetheflag/flag.lua +++ b/mods/capturetheflag/flag.lua @@ -26,7 +26,7 @@ cf.flag_func = { return end - if meta and cf.players and cf.team(team) and cf.player(player) and cf.player(player).team then + if cf.players and cf.team(team) and cf.player(player) and cf.player(player).team then if cf.player(player).team ~= team then local diplo = cf.diplo.get(team,cf.player(player).team) @@ -39,7 +39,7 @@ cf.flag_func = { return end - local flag_name = meta:get_string("flag_name") + local flag_name = flag.name if flag_name and flag_name~="" then minetest.chat_send_all(flag_name.." has been taken from "..team.." by "..cf.player(player).team.."!") cf.post(team,{msg=flag_name.." has been captured by "..cf.player(player).team,icon="flag_red"}) @@ -52,7 +52,6 @@ cf.flag_func = { cf.team(team).spawn = nil if cf.settings.multiple_flags == true then - meta:set_string("infotext", team.."'s flag") cf.area.delete_flag(team,pos) cf.area.add_flag(cf.player(player).team,pos) else diff --git a/mods/capturetheflag/gui.lua b/mods/capturetheflag/gui.lua index 37eb11c..6aab70f 100644 --- a/mods/capturetheflag/gui.lua +++ b/mods/capturetheflag/gui.lua @@ -46,7 +46,7 @@ if cf.settings.team_gui and cf.settings.gui then -- check if team guis are enabl amount = amount + 1 local height = (amount*0.5)+0.5 - if height > 7 then + if height > 5 then print("break!") break end @@ -85,7 +85,7 @@ if cf.settings.team_gui and cf.settings.gui then -- check if team guis are enabl amount = i local height = (i*0.5)+0.5 - if height > 7 then + if height > 5 then break end @@ -123,7 +123,7 @@ if cf.settings.team_gui and cf.settings.gui then -- check if team guis are enabl amount = i local height = (i*1)+0.5 - if height > 6 then + if height > 5 then break end diff --git a/mods/chatplus/init.lua b/mods/chatplus/init.lua index 1a728ee..f89a4ee 100644 --- a/mods/chatplus/init.lua +++ b/mods/chatplus/init.lua @@ -169,7 +169,11 @@ chatplus.register_handler(function(from,to,msg) return nil end - if chatplus.distance ~= 0 and chatplus.distance ~= nil and (chatplus.get_distance(from_o:getpos(),to_o:getpos()) > tonumber(chatplus.distance)) then + if not chatplus.distance or tonumber(chatplus.distance)==0 then + return nil + end + + if chatplus.get_distance(from_o:getpos(),to_o:getpos()) > tonumber(chatplus.distance) then return false end return nil