bug fixes

This commit is contained in:
Rubenwardy 2013-08-17 18:02:30 +01:00
parent e2ef7cccaa
commit 7e8d0aa144
5 changed files with 125 additions and 8 deletions

View File

@ -1,2 +1,2 @@
# Chatplus settings # Chatplus settings
chatplus_distance = 0 #(0=off) ##chatplus_distance = 10

114
mods/0a_mod_debug/init.lua Normal file
View File

@ -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)

View File

@ -26,7 +26,7 @@ cf.flag_func = {
return return
end 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 if cf.player(player).team ~= team then
local diplo = cf.diplo.get(team,cf.player(player).team) local diplo = cf.diplo.get(team,cf.player(player).team)
@ -39,7 +39,7 @@ cf.flag_func = {
return return
end end
local flag_name = meta:get_string("flag_name") local flag_name = flag.name
if flag_name and flag_name~="" then if flag_name and flag_name~="" then
minetest.chat_send_all(flag_name.." has been taken from "..team.." by "..cf.player(player).team.."!") 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"}) 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 cf.team(team).spawn = nil
if cf.settings.multiple_flags == true then if cf.settings.multiple_flags == true then
meta:set_string("infotext", team.."'s flag")
cf.area.delete_flag(team,pos) cf.area.delete_flag(team,pos)
cf.area.add_flag(cf.player(player).team,pos) cf.area.add_flag(cf.player(player).team,pos)
else else

View File

@ -46,7 +46,7 @@ if cf.settings.team_gui and cf.settings.gui then -- check if team guis are enabl
amount = amount + 1 amount = amount + 1
local height = (amount*0.5)+0.5 local height = (amount*0.5)+0.5
if height > 7 then if height > 5 then
print("break!") print("break!")
break break
end end
@ -85,7 +85,7 @@ if cf.settings.team_gui and cf.settings.gui then -- check if team guis are enabl
amount = i amount = i
local height = (i*0.5)+0.5 local height = (i*0.5)+0.5
if height > 7 then if height > 5 then
break break
end end
@ -123,7 +123,7 @@ if cf.settings.team_gui and cf.settings.gui then -- check if team guis are enabl
amount = i amount = i
local height = (i*1)+0.5 local height = (i*1)+0.5
if height > 6 then if height > 5 then
break break
end end

View File

@ -169,7 +169,11 @@ chatplus.register_handler(function(from,to,msg)
return nil return nil
end 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 return false
end end
return nil return nil