fix: damage overlay layers now render above iconsmooth layers - #54
fix: damage overlay layers now render above iconsmooth layers#54devin-ai-integration[bot] wants to merge 3 commits into
Conversation
Two bugs in DamageVisualsSystem: 1. CheckOverlayOrdering was only called when DamageOverlayGroups was set, skipping entities using TrackAllDamage + DamageOverlay (e.g. walls, windows). Broadened the condition so the reorder check fires for every overlay-mode entity without TargetLayers. 2. ReorderOverlaySprite re-added the layer at its old index instead of appending it at the end, so the layer never actually moved to the top. Removed the explicit index so AddLayer appends at the end of the sprite stack.
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
There was a problem hiding this comment.
🚩 DamageOverlayGroups iteration in CheckOverlayOrdering may update TopMostLayerKey multiple times
In CheckOverlayOrdering lines 442-451, when iterating over DamageOverlayGroups, each call to ReorderOverlaySprite sets damageVisComp.TopMostLayerKey = key (line 481). This means the last group in the dictionary iteration order becomes the tracked "top most" key. This is pre-existing behavior (not introduced by this PR), but it means the correctness of overlay ordering depends on dictionary iteration order being stable, and only the last group's layer is checked as the "top" on the next frame. If groups are added/removed or iteration order changes, the wrong layer could be checked. This is fragile but not a regression.
Was this helpful? React with 👍 or 👎 to provide feedback.
There was a problem hiding this comment.
Agreed — this is pre-existing behavior, not introduced by this PR. The TopMostLayerKey fragility around dictionary iteration order is a separate issue worth tracking but doesn't regress here.
|
Проблема в том что IconSmooth система каждый раз при обновлении спрайта помещает все слои в самый вверх. Это вызывает проблемы со ВСЕМИ другими системами визуализации, так как они будут оказываться под новыми слоями IconSmooth. Решение должно быть внутри IconSmooth какой нибудь пустой слой-ключ, по которому система определяет куда вставлять слои, и возможность через YML настраивать где этот ключ должен находиться по отношению к другим слоям, с которыми работают другие визуализаторы. |
|
Не дай Бог |
Краткое описание
Исправлены два бага в
DamageVisualsSystem, из-за которых спрайты дамага (трещины) отрисовывались под слоями IconSmooth (стены, окна и т.д.):CheckOverlayOrderingне вызывался дляTrackAllDamageсущностей. Условие вHandleDamageтребовалоDamageOverlayGroups != null, поэтому сущности сtrackAllDamage: true+damageOverlay(стены, окна) не получали проверку порядка слоёв. Условие расширено — теперь проверка срабатывает для всех overlay-сущностей безTargetLayers.ReorderOverlaySpriteне перемещал слой наверх. При пересоздании слоя передавался старый индекс вAddLayer, из-за чего слой вставлялся обратно на ту же позицию. Убран явный индекс — теперьAddLayerдобавляет слой в конец стека (поверх всех).Также добавлен SPDX-заголовок
MPL-2.0и// open-space edit start/endмаркеры на изменённые блоки.Связанные задачи
Нет.
Почему мы должны добавить это?
Без этого фикса любые сущности с
IconSmooth+DamageVisuals(стены, окна) не показывают трещины повреждений, потому что IconSmooth добавляет corner-слои поверх damage overlay. Попытка обойти это черезTargetLayersв прототипе приводит к крашу из-за того, что IconSmooth динамически пересоздаёт слои.Медиа (Видео/Скриншоты)
Не тестировалось в игре — требуется in-game проверка ревьюером.
Проверочный пункт
На что обратить внимание при ревью
TopMostLayerKeyне null? — Расширенное условие теперь вызываетCheckOverlayOrderingдля всех overlay-сущностей. Внутри метода обращениеspriteEnt.Comp[damageVisComp.TopMostLayerKey]упадёт если ключ не задан. По логике инициализацииTopMostLayerKeyвсегда задаётся когдаOverlay=true && TargetLayers=null, аVerifyVisualizerSetupотсекает невалидные конфигурации — но стоит убедиться что нет edge case.DamageOverlayGroups— убедиться что сущности использующие overlay по группам (неtrackAllDamage) по-прежнему корректно отображают повреждения. Обратите внимание: изменение вReorderOverlaySprite(убраноspriteLayerизAddLayer) затрагивает обе ветки (DamageOverlayGroupsиTrackAllDamage).Changelog
🆑
Link to Devin session: https://app.devin.ai/sessions/25d8481dd7374af3836651c1cafdad1c
Requested by: @cryals