Skip to content
This repository was archived by the owner on May 17, 2026. It is now read-only.

fix: damage overlay layers now render above iconsmooth layers - #54

Closed
devin-ai-integration[bot] wants to merge 3 commits into
masterfrom
devin/1777630751-fix-damage-overlay-ordering
Closed

fix: damage overlay layers now render above iconsmooth layers#54
devin-ai-integration[bot] wants to merge 3 commits into
masterfrom
devin/1777630751-fix-damage-overlay-ordering

Conversation

@devin-ai-integration

@devin-ai-integration devin-ai-integration Bot commented May 1, 2026

Copy link
Copy Markdown
Contributor

Краткое описание

Исправлены два бага в DamageVisualsSystem, из-за которых спрайты дамага (трещины) отрисовывались под слоями IconSmooth (стены, окна и т.д.):

  1. CheckOverlayOrdering не вызывался для TrackAllDamage сущностей. Условие в HandleDamage требовало DamageOverlayGroups != null, поэтому сущности с trackAllDamage: true + damageOverlay (стены, окна) не получали проверку порядка слоёв. Условие расширено — теперь проверка срабатывает для всех overlay-сущностей без TargetLayers.

  2. ReorderOverlaySprite не перемещал слой наверх. При пересоздании слоя передавался старый индекс в AddLayer, из-за чего слой вставлялся обратно на ту же позицию. Убран явный индекс — теперь AddLayer добавляет слой в конец стека (поверх всех).

Также добавлен SPDX-заголовок MPL-2.0 и // open-space edit start/end маркеры на изменённые блоки.

Связанные задачи

Нет.

Почему мы должны добавить это?

Без этого фикса любые сущности с IconSmooth + DamageVisuals (стены, окна) не показывают трещины повреждений, потому что IconSmooth добавляет corner-слои поверх damage overlay. Попытка обойти это через TargetLayers в прототипе приводит к крашу из-за того, что IconSmooth динамически пересоздаёт слои.

Медиа (Видео/Скриншоты)

Не тестировалось в игре — требуется in-game проверка ревьюером.

Проверочный пункт

  • Перед публикацией/запросом на проверку PR, я убедился что изменения работают.
  • Я добавил скриншоты/видео изменений, если только этот PR не изменит внутриигровую механику.
  • Я подтверждаю, что мои изменения лицензированы в соответствии с лицензией Open Space Лицензия и предоставляю разрешение на их использование в этом репозитории в соответствии с его условиями.

На что обратить внимание при ревью

  • TopMostLayerKey не null? — Расширенное условие теперь вызывает CheckOverlayOrdering для всех overlay-сущностей. Внутри метода обращение spriteEnt.Comp[damageVisComp.TopMostLayerKey] упадёт если ключ не задан. По логике инициализации TopMostLayerKey всегда задаётся когда Overlay=true && TargetLayers=null, а VerifyVisualizerSetup отсекает невалидные конфигурации — но стоит убедиться что нет edge case.
  • Проверить в игре — повредить стену/окно с IconSmooth и убедиться что трещины отрисовываются поверх.
  • Регрессия для DamageOverlayGroups — убедиться что сущности использующие overlay по группам (не trackAllDamage) по-прежнему корректно отображают повреждения. Обратите внимание: изменение в ReorderOverlaySprite (убрано spriteLayer из AddLayer) затрагивает обе ветки (DamageOverlayGroups и TrackAllDamage).

Changelog

🆑

  • fix: Слои повреждений (трещины) теперь корректно отображаются поверх спрайтов IconSmooth (стены, окна).

Link to Devin session: https://app.devin.ai/sessions/25d8481dd7374af3836651c1cafdad1c
Requested by: @cryals

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-integration

Copy link
Copy Markdown
Contributor Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 3 potential issues.

View 2 additional findings in Devin Review.

Open in Devin Review

@devin-ai-integration devin-ai-integration Bot May 1, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚩 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.

Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread Content.Client/Damage/DamageVisualsSystem.cs
Comment thread Content.Client/Damage/DamageVisualsSystem.cs
@github-actions github-actions Bot added size/S and removed size/XS labels May 1, 2026
@TheShuEd

TheShuEd commented May 8, 2026

Copy link
Copy Markdown
Contributor

Проблема в том что IconSmooth система каждый раз при обновлении спрайта помещает все слои в самый вверх. Это вызывает проблемы со ВСЕМИ другими системами визуализации, так как они будут оказываться под новыми слоями IconSmooth.

Решение должно быть внутри IconSmooth какой нибудь пустой слой-ключ, по которому система определяет куда вставлять слои, и возможность через YML настраивать где этот ключ должен находиться по отношению к другим слоям, с которыми работают другие визуализаторы.

@ReWAFFlution

Copy link
Copy Markdown
Member

Не дай Бог

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants