Skip to content

Conversation

@kekoven1
Copy link
Contributor

Описание PR

У меня чёт вылетала локалка из-за метеопсиопной машинки, ну я ей циферки покрутил немного
и добавил побольше рас для псиопа, весело же


Медиа

Список

Example Media Embed


Изменения

🆑

  • add: добавлено больше рас для метемпсихозной машины

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 20, 2026

Walkthrough

Обновлена система клонирования с изменением логики вероятностного выхода в методе GetSpawnEntity для случаев без истинного клонирования, добавлена новая конфигурация базового шанса гуманоидности к машине метемпсихоза и расширен список видов в пуле взвешенной случайности с переуведомлением приоритетов.

Changes

Cohort / File(s) Описание
Логика клонирования
Content.Server/Cloning/CloningSystem.cs
Изменена условная логика в GetSpawnEntity для ForcedMetempsychosisType.None: расширено условие раннего выхода с использованием вероятностного расчёта cloneChance как 1 - clamp(chance, 0, 1), позволяя probabilistic выход для всех случаев без NeverTrulyClone, с последующим clamping значения перед гуманоидной логикой
Конфигурация машины
Resources/Prototypes/Entities/Structures/Machines/metempsychoticMachine.yml
Добавлен параметр HumanoidBaseChance: 0.8 к компоненту CloningPod сущности MetempsychoticMachine
Веса видов
Resources/Prototypes/Nyanotrasen/metempsychoticHumanoids.yml
Повышены веса существующих видов (Diona, Reptilian, SlimePerson, Vulpkanin, Plasmaman) с 0.5/0.25 до 1, добавлены 13 новых видов с весом 1 в пул взвешенной случайности

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Suggested labels

Changes: C#, Changes: YML, Status: Needs Review

Suggested reviewers

  • Remuchi
  • DVOniksWyvern
🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed Заголовок '[add] metepsychosis' относится к основному изменению — добавлению новых рас и настроек для метемпсихозной машины, что соответствует содержимому PR.
Description check ✅ Passed Описание на русском языке объясняет исправления проблем локальной сессии и добавление новых рас для метемпсихозной машины, что соответствует изменениям в PR.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

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

🤖 Fix all issues with AI agents
In `@Content.Server/Cloning/CloningSystem.cs`:
- Around line 376-388: The early-return logic under
ForcedMetempsychosisType.None double-samples the same probability (via the two
_random.Prob calls around the cloneChance and the later _random.Prob(chance)),
causing the effective humanoid probability to be chance*chance; fix by
performing a single draw or by using a separate humanoid-selection parameter:
compute cloneChance = 1.0f - Math.Clamp(chance,0,1) and do one
_random.Prob(cloneChance) to decide cloning, otherwise use a single separate
humanoidRollChance (e.g., HumanoidSelectionChance or a local humanoidChance =
Math.Clamp(chance,0,1)) to choose humanoid without reusing the same random call,
updating the branches that reference ev.NeverTrulyClone, changeProfile and
returns (refer to ForcedMetempsychosisType.None, ev.NeverTrulyClone,
cloneChance, chance, and the two _random.Prob calls) so the final humanoid
probability equals the intended parameter.

Comment on lines 376 to 388
switch (ev.ForcedType)
{
case ForcedMetempsychosisType.None:
if (!ev.NeverTrulyClone
&& chance > 1
&& _random.Prob(chance - 1))
if (!ev.NeverTrulyClone)
{
changeProfile = false;
return oldSpecies.Prototype;
var cloneChance = 1.0f - Math.Clamp(chance, 0, 1);

if (_random.Prob(Math.Clamp(cloneChance, 0, 1)))
{
changeProfile = false;
return oldSpecies.Prototype;
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

wc -l Content.Server/Cloning/CloningSystem.cs

Repository: WWhiteDreamProject/wwdpublic

Length of output: 115


🏁 Script executed:

sed -n '350,420p' Content.Server/Cloning/CloningSystem.cs

Repository: WWhiteDreamProject/wwdpublic

Length of output: 2627


🏁 Script executed:

sed -n '1,50p' Content.Server/Cloning/CloningSystem.cs

Repository: WWhiteDreamProject/wwdpublic

Length of output: 1768


🏁 Script executed:

# Check git history for this method to understand if this is recent change
git log --oneline -20 -- Content.Server/Cloning/CloningSystem.cs

Repository: WWhiteDreamProject/wwdpublic

Length of output: 114


🏁 Script executed:

# Search for any tests related to this cloning logic
find . -name "*.cs" -type f | xargs grep -l "GetSpawnEntity\|MetempsychoticHumanoidPool" | head -20

Repository: WWhiteDreamProject/wwdpublic

Length of output: 924


🏁 Script executed:

# Check if there are any related configuration values or comments about the probability
rg "HumanoidBaseChance|MetempsychoticHumanoidPool" -A 3 -B 3

Repository: WWhiteDreamProject/wwdpublic

Length of output: 3734


Уточните распределение вероятностей в логике раннего возврата.

При ForcedMetempsychosisType.None вероятность гуманоида сокращается с chance до chance * chance из-за двух последовательных проверок на одну переменную:

  • Первая: _random.Prob(1.0f - clampedChance) для выхода с клоном (строка ~378)
  • Вторая: _random.Prob(chance) для выбора гуманоида (строка ~383)

При текущей конфигурации (HumanoidBaseChance = 0.8) вероятность гуманоида составляет 0.8 × 0.8 = 0.64 вместо ожидаемых 0.8. Подтвердите, что такое сокращение вероятности намеренно, или используйте отдельный параметр для выбора гуманоида.

🤖 Prompt for AI Agents
In `@Content.Server/Cloning/CloningSystem.cs` around lines 376 - 388, The
early-return logic under ForcedMetempsychosisType.None double-samples the same
probability (via the two _random.Prob calls around the cloneChance and the later
_random.Prob(chance)), causing the effective humanoid probability to be
chance*chance; fix by performing a single draw or by using a separate
humanoid-selection parameter: compute cloneChance = 1.0f -
Math.Clamp(chance,0,1) and do one _random.Prob(cloneChance) to decide cloning,
otherwise use a single separate humanoidRollChance (e.g.,
HumanoidSelectionChance or a local humanoidChance = Math.Clamp(chance,0,1)) to
choose humanoid without reusing the same random call, updating the branches that
reference ev.NeverTrulyClone, changeProfile and returns (refer to
ForcedMetempsychosisType.None, ev.NeverTrulyClone, cloneChance, chance, and the
two _random.Prob calls) so the final humanoid probability equals the intended
parameter.

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.

1 participant