Skip to content

Commit

Permalink
バリアとネームプレートが重ならないように修正
Browse files Browse the repository at this point in the history
  • Loading branch information
Gakuto1112 committed Aug 20, 2024
1 parent e674b0a commit 654adb5
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
12 changes: 10 additions & 2 deletions scripts/barrier.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ Barrier = {
---@type number[]
AnimationCounters = {},

---バリアが可視化状態かどうか
---@type boolean
BarrierVisible = false,

---前ティックの衝撃吸収のハートを持っていたかどうか
---@type boolean
HadAbsorptionPrev = false,
Expand Down Expand Up @@ -40,13 +44,17 @@ Barrier = {
models.models.main.Avatar.barrier:setVisible(false)
end
end, "barrier_render")

self.BarrierVisible = true
end,

---バリア機能を無効化する。
disable = function ()
---@param self Barrier
disable = function (self)
models.models.main.Avatar.barrier:setVisible(false)
events.TICK:remove("barrier_tick")
events.RENDER:remove("barrier_render")
self.BarrierVisible = false
end,

---初期化関数
Expand All @@ -59,7 +67,7 @@ Barrier = {
if hasAbsorption and not self.HadAbsorptionPrev then
Barrier:enable()
elseif not hasAbsorption and self.HadAbsorptionPrev then
Barrier.disable()
Barrier:disable()
end
self.HadAbsorptionPrev = hasAbsorption
end)
Expand Down
2 changes: 1 addition & 1 deletion scripts/nameplate.lua
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ Nameplate = {
end
events.RENDER:register(function (delta, context)
if context ~= "PAPERDOLL" then
nameplate.ENTITY:setPivot(ModelUtils.getModelWorldPos(models.models.main.Avatar.UpperBody.Body.NameplateAnchor):sub(player:getPos(delta)):add(0, 0.895, 0))
nameplate.ENTITY:setPivot(ModelUtils.getModelWorldPos(models.models.main.Avatar.UpperBody.Body.NameplateAnchor):sub(player:getPos(delta)):add(0, Barrier.BarrierVisible and 1.095 or 0.895, 0))
else
nameplate.ENTITY:setPivot()
end
Expand Down

0 comments on commit 654adb5

Please sign in to comment.