mirror of
https://git.minetest.land/VoxeLibre/VoxeLibre.git
synced 2024-11-25 12:01:06 +01:00
24 lines
488 B
Lua
24 lines
488 B
Lua
MCLDamageSource = class()
|
|
|
|
function MCLDamageSource:constructor(tbl, hitter)
|
|
for k, v in pairs(tbl or {}) do
|
|
self[k] = v
|
|
end
|
|
self.hitter = hitter
|
|
end
|
|
|
|
MCLDamageSource:__getter("direct_object", function(self)
|
|
local hitter = self.hitter
|
|
if not hitter then
|
|
return
|
|
end
|
|
return mcl_object_mgr.get(hitter)
|
|
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)
|