Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Fix] Moods fixes #1001

Merged
merged 2 commits into from
Jan 12, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions Content.Server/Backmen/Mood/MoodSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -84,17 +84,15 @@ private void OnAlertClicked(EntityUid uid, MoodComponent component, MoodCheckAle

foreach (var (_, protoId) in component.CategorisedEffects)
{
if (!_prototypeManager.TryIndex<MoodEffectPrototype>(protoId, out var proto)
|| proto.Hidden)
if (!_prototypeManager.TryIndex<MoodEffectPrototype>(protoId, out var proto))
continue;

SendDescToChat(proto, session);
}

foreach (var (protoId, _) in component.UncategorisedEffects)
{
if (!_prototypeManager.TryIndex<MoodEffectPrototype>(protoId, out var proto)
|| proto.Hidden)
if (!_prototypeManager.TryIndex<MoodEffectPrototype>(protoId, out var proto))
continue;

SendDescToChat(proto, session);
Expand Down
2 changes: 1 addition & 1 deletion Content.Shared/Backmen/Mood/MoodEffectPrototype.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public sealed class MoodEffectPrototype : IPrototype
public int Timeout;

/// <summary>
/// Should this moodlet be hidden from the player? EG: No popups or chat messages.
/// Should this moodlet be hidden from the player? EG: No popups.
/// </summary>
[DataField]
public bool Hidden;
Expand Down
8 changes: 8 additions & 0 deletions Resources/Prototypes/_Backmen/Mood/drugs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,14 @@
timeout: 900 #15 minutes
moodletOnEnd: LotoEnthrallment
category: "LotophagoiAddiction"
hidden: true

- type: moodEffect
id: LotoEnthrallment
moodChange: -30
timeout: 3600 #1 hour
category: "LotophagoiAddiction"
hidden: true

- type: moodCategory
id: LotophagoiAddiction
Expand All @@ -24,11 +26,13 @@
timeout: 600 #10 minutes
moodletOnEnd: NicotineWithdrawal
category: "NicotineAddiction"
hidden: true

- type: moodEffect
id: NicotineWithdrawal
moodChange: -7 #No timeout
category: "NicotineAddiction"
hidden: true
Comment on lines 33 to +35
Copy link
Contributor

Choose a reason for hiding this comment

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

💡 Codebase verification

Подтверждено отсутствие timeout у эффекта NicotineWithdrawal

Анализ кодовой базы показал, что все другие эффекты отмены имеют явно заданные таймауты:

  • SpaceDrugsWithdrawal: 20 минут
  • HappinessWithdrawal: 10 минут

Рекомендованное добавление таймаута в 30 минут для NicotineWithdrawal является обоснованным и соответствует общей логике работы эффектов отмены в игре.

🔗 Analysis chain

Проверьте отсутствие timeout у NicotineWithdrawal

Эффект отмены никотина (NicotineWithdrawal) не имеет таймаута, в отличие от других эффектов отмены. Это может привести к постоянному негативному настроению. Рекомендуется добавить разумный timeout.

Предлагаемые изменения:

  id: NicotineWithdrawal
  moodChange: -7 #No timeout
  category: "NicotineAddiction"
+ timeout: 1800 #30 minutes
  hidden: true
🏁 Scripts executed

The following scripts were executed for the analysis:

Error: No shell scripts found


Script:

#!/bin/bash
# Search for withdrawal effects in yml files
rg -l "Withdrawal" --glob "*.yml"

# Then get the content of these files to analyze timeout patterns
rg "Withdrawal" -A 5 -B 2 --glob "*.yml"

Length of output: 2687


- type: moodCategory
id: NicotineAddiction
Expand All @@ -40,12 +44,14 @@
timeout: 480 #6 minutes
moodletOnEnd: SpaceDrugsWithdrawal
category: "SpaceDrugsAddiction"
hidden: true

- type: moodEffect
id: SpaceDrugsWithdrawal
moodChange: -20
category: "SpaceDrugsAddiction"
timeout: 1200 #20 minutes
hidden: true

- type: moodCategory
id: SpaceDrugsAddiction
Expand All @@ -57,12 +63,14 @@
timeout: 300 #5 minutes
moodletOnEnd: HappinessWithdrawal
category: "HappinessAddiction"
hidden: true

- type: moodEffect
id: HappinessWithdrawal
moodChange: -20
category: "HappinessAddiction"
timeout: 600 #10 minutes
hidden: true

- type: moodCategory
id: HappinessAddiction
17 changes: 15 additions & 2 deletions Resources/Prototypes/_Backmen/Mood/genericNeeds.yml
Original file line number Diff line number Diff line change
@@ -1,68 +1,81 @@
# Hunger
- type: moodEffect
id: HungerOverfed
moodChange: -10
moodChange: 10
category: "Hunger"
hidden: true

- type: moodEffect
id: HungerOkay
moodChange: 7
category: "Hunger"
hidden: true

- type: moodEffect
id: HungerPeckish
moodChange: -3
category: "Hunger"
hidden: true

- type: moodEffect
id: HungerStarving
moodChange: -7
category: "Hunger"
hidden: true

# Thirst
- type: moodEffect
id: ThirstOverHydrated
moodChange: -3
moodChange: 10
category: "Thirst"
hidden: true
Comment on lines +29 to +31
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Необходимо согласовать значения эффектов жажды и голода

Обнаружены несоответствия в балансе эффектов:

  1. Значение ThirstOverHydrated (+10) не соответствует схожему эффекту HungerOverfed (+10), хотя базовые эффекты жажды и голода имеют одинаковые значения
  2. Переход от -3 к +10 для перенасыщения жидкостью создаёт слишком резкий скачок

Рекомендуется привести значения в соответствие с общей системой баланса эффектов настроения.

Also applies to: 37-37, 43-43, 49-49


- type: moodEffect
id: ThirstOkay
moodChange: 7
category: "Thirst"
hidden: true

- type: moodEffect
id: ThirstThirsty
moodChange: -3
category: "Thirst"
hidden: true

- type: moodEffect
id: ThirstParched
moodChange: -7
category: "Thirst"
hidden: true

# Health
- type: moodEffect
id: HealthNoDamage
moodChange: 0
hidden: true
category: "Health"
hidden: true
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

Исправьте дублирование ключа 'hidden'

В YAML файле обнаружено дублирование ключа 'hidden' для эффекта HealthNoDamage. Необходимо удалить дублирующую строку для корректной работы.

  id: HealthNoDamage
  moodChange: 0
  hidden: true
  category: "Health"
- hidden: true
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
hidden: true
id: HealthNoDamage
moodChange: 0
hidden: true
category: "Health"
🧰 Tools
🪛 yamllint (1.35.1)

[error] 57-57: duplication of key "hidden" in mapping

(key-duplicates)

🪛 GitHub Actions: YAML Linter

[error] Duplicate key 'hidden' found in YAML mapping. Each key in a YAML mapping must be unique.


- type: moodEffect
id: HealthLightDamage
moodChange: -3
category: "Health"
hidden: true

- type: moodEffect
id: HealthOkayDamage
moodChange: -7
category: "Health"
hidden: true

- type: moodEffect
id: HealthSevereDamage
moodChange: -12
category: "Health"
hidden: true

- type: moodEffect
id: HealthHeavyDamage
moodChange: -20
category: "Health"
hidden: true
Original file line number Diff line number Diff line change
@@ -1,31 +1,37 @@
- type: moodEffect
id: Handcuffed
moodChange: -3
hidden: true

- type: moodEffect
id: Suffocating
moodChange: -7
timeout: 6
hidden: true

- type: moodEffect
id: OnFire
moodChange: -10
timeout: 180
hidden: true

- type: moodEffect
id: Creampied
moodChange: -3
timeout: 180
hidden: true

- type: moodEffect
id: MobSlipped
moodChange: -3
timeout: 30
hidden: true

- type: moodEffect
id: MobVomit
moodChange: -5
timeout: 300
hidden: true

- type: moodEffect
id: MobLowPressure
Expand All @@ -36,14 +42,17 @@
id: MobHighPressure
moodChange: -7
timeout: 10
hidden: true

- type: moodEffect
id: TraitSaturnine
moodChange: -20
hidden: true

- type: moodEffect
id: TraitFortitude
moodChange: -10
hidden: true

- type: moodEffect
id: Dead
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,19 +36,24 @@
- type: moodEffect
id: TraitorFocused # Used for traitors to boost their goals completion.
moodChange: 7
hidden: true

- type: moodEffect
id: NukeopsFocused # Used for nukies
moodChange: 10
hidden: true

- type: moodEffect
id: RevolutionFocused # Used for revolution
moodChange: 7
hidden: true

- type: moodEffect
id: CultFocused
moodChange: 10
hidden: true

- type: moodEffect
id: TraitSanguine # Happi! Also used for Clown
moodChange: 15
hidden: true
Loading