Skip to content

polymorph#998

Merged
Spatison merged 7 commits intoWWhiteDreamProject:masterfrom
kekoven1:е353е
Jan 3, 2026

Hidden character warning

The head ref may contain hidden characters: "\u0435353\u0435"
Merged

polymorph#998
Spatison merged 7 commits intoWWhiteDreamProject:masterfrom
kekoven1:е353е

Conversation

@kekoven1
Copy link
Copy Markdown
Contributor

Описание PR

теперь копирует метаданные


Медиа

Список

Example Media Embed


Изменения

🆑

  • fix: Полиморф копирует метаданные

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Dec 31, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

При использовании способности полиморфии теперь после копирования внешности пользователя также копируются метаданные цели — имя и описание; в инициализации компонента отформатирована и инвертирована проверка наличия HumanoidAppearanceComponent, скорректирована логика установки OriginalProfile/LastProfileLoaded.

Changes

Когорта / Файл(ы) Описание изменений
Система полиморфизма
Content.Server/_White/Abilities/Psionics/Abilities/PolymorphPowerSystem.cs
В OnPowerUsed после клонирования внешности пользователя копируются EntityName и EntityDescription из MetaDataComponent цели в пользователя. В ComponentStart внесены форматирование/whitespace-изменения и инвертирована проверка HumanoidAppearanceComponent; скорректирована логика установки OriginalProfile и LastProfileLoaded.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Suggested reviewers

  • Remuchi

Pre-merge checks and finishing touches

❌ Failed checks (1 warning, 1 inconclusive)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
Title check ❓ Inconclusive Название «polymorph» является слишком кратким и неинформативным; оно не описывает конкретное изменение, которое было сделано в коде. Измените название на более описательное, например: «Add metadata copying to polymorph ability» или подобное, которое ясно указывает на суть изменения.
✅ Passed checks (1 passed)
Check name Status Explanation
Description check ✅ Passed Описание PR связано с изменениями в коде и кратко объясняет, что теперь копируются метаданные при использовании способности полиморфа.

📜 Recent review details

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 8b4dfa7 and 64aa959.

📒 Files selected for processing (1)
  • Content.Server/_White/Abilities/Psionics/Abilities/PolymorphPowerSystem.cs

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
Content.Server/_White/Abilities/Psionics/Abilities/PolymorphPowerSystem.cs (1)

45-49: Отличное дополнение функциональности полиморфа!

Логика копирования метаданных реализована корректно. Имя и описание сущности копируются от цели к пользователю, что соответствует описанию PR. Восстановление оригинальных значений корректно обрабатывается в ReturnAppearance.

Опциональное замечание: MetaDataComponent является фундаментальным компонентом в RobustToolbox и присутствует на всех сущностях. Проверка TryComp является избыточной, но не вредит и делает код более защищённым.

🔎 Опциональное упрощение (можно применить позже)
-        if (TryComp<MetaDataComponent>(target, out var targetMeta))
-        {
-            _meta.SetEntityName(user, targetMeta.EntityName);
-            _meta.SetEntityDescription(user, targetMeta.EntityDescription);
-        }
+        var targetMeta = MetaData(target);
+        _meta.SetEntityName(user, targetMeta.EntityName);
+        _meta.SetEntityDescription(user, targetMeta.EntityDescription);
📜 Review details

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 6535f0c and 79396b4.

📒 Files selected for processing (1)
  • Content.Server/_White/Abilities/Psionics/Abilities/PolymorphPowerSystem.cs
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: build (ubuntu-latest)
  • GitHub Check: build (ubuntu-latest)
  • GitHub Check: Test Packaging
  • GitHub Check: YAML Linter
🔇 Additional comments (1)
Content.Server/_White/Abilities/Psionics/Abilities/PolymorphPowerSystem.cs (1)

88-89: Улучшение обработки компонента!

Изменение с раннего возврата на условное присваивание — хорошее решение. Теперь компонент может корректно инициализироваться для сущностей без HumanoidAppearanceComponent, при этом ReturnAppearance безопасно обрабатывает случай отсутствия профиля благодаря проверке на линии 71.


component.OriginalProfile = humanoid.LastProfileLoaded;
if (TryComp<HumanoidAppearanceComponent>(uid, out var humanoid))
component.OriginalProfile = humanoid.LastProfileLoaded;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Это то же самое, лучше оставь как было

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 79396b4 and 26389c0.

📒 Files selected for processing (1)
  • Content.Server/_White/Abilities/Psionics/Abilities/PolymorphPowerSystem.cs
🧰 Additional context used
🧠 Learnings (1)
📓 Common learnings
Learnt from: Lachklen
Repo: WWhiteDreamProject/wwdpublic PR: 863
File: Resources/Locale/en-US/_white/cards/hobby.ftl:5-5
Timestamp: 2025-10-22T20:13:31.389Z
Learning: В PR по EvacPod для репозитория WWhiteDreamProject/wwdpublic: если опечатка в ключе локализации (например, card-ep_hobby_mashrooms) не влияет на отображение и используется последовательно, автор предпочитает не блокировать PR; вместо этого предлагать необязательный follow-up issue.
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (5)
  • GitHub Check: build (ubuntu-latest)
  • GitHub Check: Test Packaging
  • GitHub Check: YAML Linter
  • GitHub Check: build (ubuntu-latest)
  • GitHub Check: YAML map schema validator
🔇 Additional comments (1)
Content.Server/_White/Abilities/Psionics/Abilities/PolymorphPowerSystem.cs (1)

45-49: Копирование метаданных реализовано корректно.

Логика копирования имени и описания из целевой сущности работает правильно и соответствует описанию PR. Метаданные копируются после клонирования внешности, что является правильным порядком операций.

@RedFoxIV
Copy link
Copy Markdown
Contributor

RedFoxIV commented Dec 31, 2025

а можно использовать нормальные буквы в названиях веток?

Copy link
Copy Markdown
Contributor

@RedFoxIV RedFoxIV left a comment

Choose a reason for hiding this comment

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

Для чего конкретно это нужно? Я был под впечатлением, что и без этого полиморф отлично работает.

А ещё я не вижу, как восстанавливаются оригинальные значения.

Comment on lines +45 to +50
if (TryComp<MetaDataComponent>(target, out var targetMeta))
{
_meta.SetEntityName(user, targetMeta.EntityName);
_meta.SetEntityDescription(user, targetMeta.EntityDescription);
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

MetaDataComponent есть на всех сущностях в игре, для энтсистем даже сокращённый метод сделали

    /// <summary>
    ///     Returns the <see cref="MetaDataComponent"/> on an entity.
    /// </summary>
    /// <exception cref="KeyNotFoundException">Thrown when the entity doesn't exist.</exception>
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    protected MetaDataComponent MetaData(EntityUid uid)
    {
        return EntityManager.MetaQuery.GetComponent(uid);
    }
    ```

if (!TryComp<HumanoidAppearanceComponent>(uid, out var humanoid))
return;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

:/

@Spatison Spatison merged commit 2b1414c into WWhiteDreamProject:master Jan 3, 2026
7 of 8 checks passed
Cinkafox pushed a commit to Cinkafox/wwdpublic_branch that referenced this pull request Jan 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants