VoxeLibre/mods/CORE/mcl_damage_source/init.lua

30 lines
522 B
Lua
Raw Normal View History

2021-03-17 11:08:14 +01:00
MCLDamageSource = class()
2021-03-17 15:21:27 +01:00
function MCLDamageSource:constructor(tbl)
2021-03-18 15:05:08 +01:00
if tbl then
for k, v in pairs(tbl) do
self[k] = v
end
2021-03-17 11:08:14 +01:00
end
end
2021-03-18 15:05:08 +01:00
function MCLDamageSource:from_mt(reason)
end
2021-03-17 11:08:14 +01:00
MCLDamageSource:__getter("direct_object", function(self)
2021-03-17 15:21:27 +01:00
local obj = self.raw_source_object
if not obj then
2021-03-17 11:08:14 +01:00
return
end
2021-03-17 15:21:27 +01:00
return mcl_object_mgr.get(obj)
2021-03-17 11:08:14 +01:00
end)
MCLDamageSource:__getter("source_object", function(self)
local direct = self:direct_object()
if not direct then
return
end
return direct.source_object or direct
end)