Skip to content
Snippets Groups Projects
Commit d95fa0d6 authored by dg's avatar dg
Browse files

Various fixes

git-svn-id: http://svn.net-core.org/repos/t-engine4@5112 51575b47-30f0-44d4-a5cc-537603b46e54
parent aed1b29d
No related branches found
No related tags found
No related merge requests found
......@@ -74,7 +74,7 @@ function _M:addEntity(e, after, no_error)
return
end
if self.entities[e.uid] then if no_error then return else error("Entity "..e.uid.."("..e.name..") already present on the level") end end
if self.entities[e.uid] then if no_error then return else error("Entity "..e.uid.."("..(e.name or "???")..") already present on the level") end end
self.entities[e.uid] = e
if e.addEntityOrder then after = e:addEntityOrder(level) end
if not after or not self:hasEntity(after) then
......@@ -107,7 +107,7 @@ function _M:removeEntity(e, force)
return
end
if not self.entities[e.uid] and not force then error("Entity "..e.uid.."("..e.name..") not present on the level") end
if not self.entities[e.uid] and not force then error("Entity "..e.uid.."("..(e.name or "???")..") not present on the level") end
self.entities[e.uid] = nil
for i = 1, #self.e_array do
if self.e_array[i] == e then
......
......@@ -58,7 +58,7 @@ function _M:saveUUID(do_charball)
if not data or not title then return end
profile:registerSaveChardump(game.__mod_info.short_name, self.__te4_uuid, title, tags, core.zlib.compress(data))
if do_charball then
if do_charball then pcall(function()
savefile_pipe:push(do_charball.name, "entity", do_charball, "engine.CharacterBallSave", function(save)
f = fs.open("/charballs/"..save:nameSaveEntity(do_charball), "r")
if f then
......@@ -73,7 +73,7 @@ function _M:saveUUID(do_charball)
profile:registerSaveCharball(game.__mod_info.short_name, self.__te4_uuid, table.concat(data))
end
end)
end
end) end
end
--- Override this method to define dump sections
......
......@@ -65,6 +65,7 @@ function _M:getIngredient(id)
end
function _M:collectIngredient(id, nb, silent)
if not self.ingredients then return end
if not self.__ingredients_def[id] then return end
local d = self.__ingredients_def[id]
nb = nb or 1
......@@ -84,6 +85,7 @@ function _M:collectIngredient(id, nb, silent)
end
function _M:hasIngredient(id, nb)
if not self.ingredients then return end
if not self.__ingredients_def[id] then return false end
local d = self.__ingredients_def[id]
nb = nb or 1
......@@ -95,6 +97,7 @@ function _M:hasIngredient(id, nb)
end
function _M:useIngredient(id, nb)
if not self.ingredients then return end
if not self.__ingredients_def[id] then return false end
local d = self.__ingredients_def[id]
nb = nb or 1
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment