add custom group filter for eatable and toxic

This commit is contained in:
Alexander Weber 2017-02-28 00:06:40 +01:00
parent 48e0b33330
commit ed683f06f1

View File

@ -97,6 +97,30 @@ filter.register_filter({
end
})
filter.register_filter({
name = "eatable",
filter_func = function(def, name)
if def.on_use then
local name,change=debug.getupvalue(def.on_use, 1)
if name~=nil and name=="hp_change" and change > 0 then
return tostring(change)
end
end
end
})
filter.register_filter({
name = "toxic",
filter_func = function(def, name)
if def.on_use then
local name,change=debug.getupvalue(def.on_use, 1)
if name~=nil and name=="hp_change" and change < 0 then
return tostring(change)
end
end
end
})
----------------
return filter