Skip to content
Snippets Groups Projects
Commit 48dc2193 authored by Grayswandir's avatar Grayswandir
Browse files

Mess with upvalues so arrows can shoot.

parent c7c4b3d2
No related branches found
No related tags found
No related merge requests found
......@@ -123,12 +123,15 @@ function _M:init(t, no_default)
end
if config.settings.cheat then
local ok, err = table.check(self, function(t, where, v, tv)
local ok, err = table.check(
self,
function(t, where, v, tv)
if tv ~= "function" then return true end
local n, v = debug.getupvalue(v, 1)
if not n then return true end
return nil, ("Entity closure checker: %s has upvalue %s"):format(tostring(where), tostring(n))
end)
end,
function(value) return not value._allow_upvalues end)
if not ok then
error("Entity definition has a closure: "..err)
end
......
......@@ -318,7 +318,7 @@ function _M:projectile(t, x, y, damtype, dam, particles)
typ.line_function:set_corner_block(block_corner)
local proj = require(self.projectile_class):makeProject(self, t.display, {x=x, y=y, start_x=typ.start_x, start_y=typ.start_y, damtype=damtype, tg=t, typ=typ, dam=dam, particles=particles})
local proj = require(self.projectile_class):makeProject(self, t.display, {x=x, y=y, start_x=typ.start_x, start_y=typ.start_y, damtype=damtype, tg=t, typ=typ, dam=dam, particles=particles, _allow_upvalues = true,})
game.zone:addEntity(game.level, proj, "projectile", typ.start_x, typ.start_y)
self:check("on_projectile_fired", proj, typ, x, y, damtype, dam, particles)
......
......@@ -45,6 +45,7 @@ end
--- Defines one talent type(group)
-- Static!
function _M:newTalentType(t)
t.__CLASSNAME = 'engine.interface.ActorTalents.TalentType'
assert(t.name, "no talent type name")
assert(t.type, "no talent type type")
t.description = t.description or ""
......@@ -57,6 +58,7 @@ end
--- Defines one talent
-- Static!
function _M:newTalent(t)
t.__CLASSNAME = 'engine.interface.ActorTalents.Talent'
assert(t.name, "no talent name")
assert(t.type, "no or unknown talent type")
if type(t.type) == "string" then t.type = {t.type, 1} end
......
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