From f3a98592b378aa2e4ed1b1439680448f25914ca5 Mon Sep 17 00:00:00 2001 From: Kazhnuz Date: Fri, 7 May 2021 18:15:43 +0200 Subject: [PATCH] improvement: use directly a table for box attr --- .../birb/modules/world/actors/actor2D.lua | 11 ++++------- .../birb/modules/world/actors/actor3D.lua | 13 ++++--------- 2 files changed, 8 insertions(+), 16 deletions(-) diff --git a/sonic-radiance.love/birb/modules/world/actors/actor2D.lua b/sonic-radiance.love/birb/modules/world/actors/actor2D.lua index cedd3d7..7a86b74 100644 --- a/sonic-radiance.love/birb/modules/world/actors/actor2D.lua +++ b/sonic-radiance.love/birb/modules/world/actors/actor2D.lua @@ -145,20 +145,17 @@ end function Actor2D:addHitboxFromFrameData(framedata, animationID, frameID, hitboxID) local sx, sy = self:getSpriteScalling() local type = framedata[1] - local ox = framedata[2] - local oy = framedata[3] - local w = framedata[4] - local h = framedata[5] - local isSolid = framedata[6] or false + local data = framedata[2] + local isSolid = framedata[3] or false local anim = animationID or "null" local frame = frameID or 0 local id = hitboxID or 0 if (type == "main") then - self.mainHitbox:setFromData({ox, oy, w, h}, sx, sy) + self.mainHitbox:setFromData(data, sx, sy) else local hitboxName = anim .. frame .. type .. id - self:addHitbox(hitboxName, type, {ox, oy, w, h}, sx, sy, isSolid) + self:addHitbox(hitboxName, type, data, sx, sy, isSolid) return hitboxName end end diff --git a/sonic-radiance.love/birb/modules/world/actors/actor3D.lua b/sonic-radiance.love/birb/modules/world/actors/actor3D.lua index faa4691..670b255 100644 --- a/sonic-radiance.love/birb/modules/world/actors/actor3D.lua +++ b/sonic-radiance.love/birb/modules/world/actors/actor3D.lua @@ -168,22 +168,17 @@ end function Actor3D:addHitboxFromFrameData(framedata, animationID, frameID, hitboxID) local sx, sy = self:getSpriteScalling() local type = framedata[1] - local ox = framedata[2] - local oy = framedata[3] - local oz = framedata[4] - local w = framedata[5] - local h = framedata[6] - local d = framedata[7] - local isSolid = framedata[8] or false + local data = framedata[2] + local isSolid = framedata[3] or false local anim = animationID or "null" local frame = frameID or 0 local id = hitboxID or 0 if (type == "main") then - self.mainHitbox:setFromData({ox, oy, oz, w, h, d}, sx, sy) + self.mainHitbox:setFromData(data, sx, sy) else local hitboxName = anim .. frame .. type .. id - self:addHitbox(hitboxName, type, {ox, oy, oz, w, h, d}, sx, sy, isSolid) + self:addHitbox(hitboxName, type, data, sx, sy, isSolid) return hitboxName end end