-
Notifications
You must be signed in to change notification settings - Fork 153
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
[Tweak] Mood upgrade #931
[Tweak] Mood upgrade #931
Conversation
Mood Upgrades Chemical Moodlets (And Drug Addictions!) (Rxup#896) This PR implements a new Reagent Reaction that modifies a character's mood, done by raising a MoodEvent on that character. It also extends some of the functionality of the TraitSystem and MoodSystem so as to support a new serializable Drug Addiction mechanic. https://www.youtube.com/watch?v=8liPBsUtND4 ![image](https://github.com/user-attachments/assets/3962c492-7677-4007-bf31-23e74b2b7382) <details><summary><h1>Media</h1></summary> <p> ![image](https://github.com/user-attachments/assets/207210d6-e573-46e2-beb4-fab83a83d8b4) ![image](https://github.com/user-attachments/assets/4e1277e1-a873-4185-98b3-39abe06a8235) ![image](https://github.com/user-attachments/assets/e1a6cefe-82ee-482c-ace1-9fb511385fe4) ![image](https://github.com/user-attachments/assets/454dafa2-ba9e-46a6-9ac0-15e2ed35c4f8) </p> </details> :cl: - add: Drug Addictions! Drug addictions are long lasting Moodlet-Pairs. The first consisting of a temporary Mood bonus that is refreshed by consuming the drug, and the second consisting of an extremely long lasting mood penalty, which replaces the mood bonus should you go a long enough time between consuming the drug in question. - add: Nicotine Addiction has been added as a new minor negative trait. - add: Drugs/Reagents can now affect your character's Mood! Both with, and without Addiction. - add: TraitSystem has had functionality added for directly adding Moodlets to a character upon joining the round, such as drug addictions, or permanent mood modifications like Sanguine/Saturnine - add: Lotophagoi Oil now induces an extremely powerful drug addiction, providing an extremely large mood benefit for a short time. Which when it wears off, creates an equally extreme mood penalty that lasts for a very long time(or until you drink more Loto Oil). Add Mood & Special Actions guidebook Add more addictions for narcotics
WalkthroughThe changes in this pull request introduce several enhancements to mood management within the game. Key modifications include the addition of new mood effects, the introduction of new methods in the Changes
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 12
🧹 Outside diff range and nitpick comments (25)
Resources/Prototypes/Guidebook/newplayer.yml (1)
15-16
: Consider using YAML comments more effectivelyThe inline comments could be more descriptive and follow YAML best practices.
- - SpecialActions # backmen: laying-down & surgery - - Mood # backmen: mood + # Guide for special actions like laying down and performing surgery + - SpecialActions + # Guide for the mood system and chemical dependencies + - MoodResources/Prototypes/_Backmen/Mood/genericNegativeEffects.yml (1)
Removal of critical mood effects needs reconsideration
Based on the codebase analysis, the removal of these effects appears problematic:
- The 'Suffocating' effect previously had a -7 mood penalty with a 6-second timeout
- The 'Handcuffed' effect had a -3 mood penalty
- These effects are part of a comprehensive mood system that includes various states (health, needs, positive/negative effects)
- No alternative handling of these conditions in mood effects is found
- The system maintains mood effects for less severe conditions (e.g., being creampied, slipping)
The removal seems inconsistent with the game's design where physical states and restrictions impact mood. Recommend restoring these effects unless there's a specific gameplay reason for their removal.
🔗 Analysis chain
Line range hint
1-6
: Reconsider removal of critical mood effectsThe removal of 'Suffocating' and 'Handcuffed' effects seems concerning:
- Suffocation is a critical condition that should impact mood
- Being handcuffed is a significant player state that deserves a mood penalty
Consider keeping these effects unless there's a specific gameplay reason for their removal.
Let's check if these conditions are handled elsewhere:
Let me gather more information to check if these effects might have been moved elsewhere or if there are alternative mood systems in place.
Let me try a different approach to find mood-related effects and their handling:
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Search for any alternative handling of these conditions rg "suffocating|handcuffed" --type yaml Resources/Prototypes/Length of output: 1201
Script:
#!/bin/bash # Search for mood-related files and their content fd "mood" -t f Resources/Prototypes/ -x rg -l "type:\s*moodEffect" {}Length of output: 71
Script:
#!/bin/bash # Search for all yaml files containing mood-related content rg -t yaml "type:\s*(mood|effect)" Resources/Prototypes/ -A 3Length of output: 15561
Content.Shared/Backmen/Mood/MoodEffectPrototype.cs (2)
15-20
: LGTM! Consider enhancing documentation.The Category property implementation with prototype validation is well-designed.
Consider adding an example in the documentation:
/// <summary> - /// If they already have an effect with the same category, the new one will replace the old one. + /// If they already have an effect with the same category, the new one will replace the old one. + /// For example, different stages of drug dependency would share the same category. /// </summary>
Line range hint
1-44
: Consider adding validation system for mood effect chains.The prototype system is well-structured, but could benefit from additional validation to ensure mood effect chains are safe and balanced.
Consider:
- Adding a validation system that runs at startup to verify:
- No cycles in MoodletOnEnd chains
- Reasonable cumulative MoodChange values
- Appropriate timeout durations for substance dependencies
- Creating a separate configuration for substance-specific mood parameters to make balancing easier
Content.Server/EntityEffects/Effects/ChemAddMoodlet.cs (2)
1-3
: Remove duplicate import statementThe
Content.Shared.Backmen.Mood
namespace is imported twice.using Content.Shared.Backmen.Mood; using Content.Shared.EntityEffects; -using Content.Shared.Backmen.Mood;
1-35
: Consider implementing a builder pattern for mood effectsGiven the PR objective to make the mood system easier to integrate for developers, consider implementing a builder pattern for creating mood effects. This would provide a more fluent and type-safe way to configure mood effects, especially for chemical dependencies.
Example usage could look like:
new MoodEffectBuilder() .WithTimeout(TimeSpan.FromMinutes(5)) .WithMoodChange(-10) .WithDependency(substance) .Build();This would make the system more maintainable and reduce the likelihood of configuration errors.
Would you like me to provide a detailed implementation of this pattern?
Resources/ServerInfo/_Backmen/Guidebook/Controls/SpecialActions.xml (3)
1-4
: Consider adding language localization supportThe documentation is currently only in Russian. Consider implementing a localization system to support multiple languages, making the guide accessible to a broader player base.
15-15
: Fix typo in Russian textThere's a typo in the Russian text: "Также в можете" should be "Также вы можете".
-Также в можете залезать под столы и использовать их как баррикады для того чтобы спрятаться. +Также вы можете залезать под столы и использовать их как баррикады для того чтобы спрятаться.
1-33
: Improve document structureConsider enhancing the documentation structure:
- Add a table of contents for better navigation
- Include keyboard shortcuts in a more visible format (perhaps in a dedicated box or table)
- Add cross-references to related guides (especially the new mood system guide)
Resources/Prototypes/_Backmen/Mood/drugs.yml (4)
1-2
: Consider enhancing the file documentation.While the trio structure is well documented, it would be helpful to add documentation about:
- The meaning and valid ranges for
moodChange
- The units used for
timeout
(seconds vs minutes)- The purpose of
moodletOnEnd
and when it triggers
44-49
: Maintain consistent property ordering.The property ordering in SpaceDrugsWithdrawal differs from other configurations where
timeout
appears aftercategory
.Consider maintaining consistent property ordering across all effects:
- type: moodEffect id: SpaceDrugsWithdrawal moodChange: -20 + timeout: 1200 #20 minutes category: "SpaceDrugsAddiction" - timeout: 1200 #20 minutes
53-68
: Consider a more specific name for "Happiness".The term "Happiness" is quite vague for what appears to be a specific substance. A more descriptive name would better indicate its nature and effects to both players and developers.
Consider renaming to something more specific (e.g., "EuphoriaSerum", "BlissElixir", etc.) to better reflect its nature as a substance rather than an emotion.
1-68
: Consider enhancing the addiction system architecture.The current implementation provides a basic addiction system, but could benefit from more sophisticated mechanics:
- Add validation rules for:
- Maximum/minimum mood changes
- Reasonable timeout ranges
- Required properties
- Consider implementing:
- Progressive addiction levels
- Tolerance buildup
- Cross-substance interactions
- Recovery mechanics
Would you like assistance in designing a more comprehensive addiction system that includes these features?
Resources/Prototypes/_Backmen/Entities/Guidebook/mood_guidebook.yml (2)
1-89
: Consider adding documentation for mood levelsThe file defines 10 distinct mood states but lacks documentation about what each level represents and how it relates to the gameplay mechanics (especially with the new substance dependency system mentioned in the PR).
Consider adding YAML comments to document:
- The meaning and triggers for each mood level
- The effects or consequences of each state
- The relationship with substance dependencies
- The threshold values for transitioning between states
Example:
+ # Mood levels are arranged from 9 (best) to 1 (worst), with a special 'dead' state + # Perfect (9): Achieved through [conditions] + # Effects: [list effects] - type: entity id: GuidebookMoodPerfect
1-89
: Consider reversing the numerical ordering for better maintainabilityThe current implementation uses a counter-intuitive numbering system where the best mood is 9 and the worst is 1. This might make it harder for developers to understand and maintain the code.
Consider reversing the order so that:
- mood1 = Perfect
- mood9 = Horrible
This would align better with common programming practices where better/higher values are represented by higher numbers.Additionally, consider using an enum or constants in the code to map these values, making it easier to maintain and understand the relationship between numerical values and mood states.
Resources/ServerInfo/_Backmen/Guidebook/Controls/Mood.xml (1)
53-55
: Consider adding specific substance examples.The documentation could be more helpful by listing specific substances that can cause dependency (e.g., lotus oil, happiness, nicotine, cosmic mirage as mentioned in the PR objectives). This would provide clearer guidance to players.
-Некоторые наркотики могут повышать настроение ценой появления зависимости. +Некоторые вещества (например: масло лотоса, счастье, никотин, космический мираж) могут повышать настроение ценой появления зависимости.Resources/Locale/en-US/mood/mood.ftl (1)
57-63
: Consider adjusting the intensity of the Loto effects textWhile the dramatic narrative effectively conveys the intense nature of these effects, consider:
- Reducing the all-caps usage in
LotoTranscendence
to maintain readability- Preserving the dramatic effect through word choice rather than formatting
mood-effect-LotoTranscendence = - I CAN SEE ALL THAT IS, ALL THAT WILL EVER BE, AND ALL THAT EVER WAS. ALL OF CREATION HAS OPENED TO MY MIND! - I MUST HAVE IT ALL. I MUST KNOW IT ALL. ALL OF IT. FOREVER! + I can see all that is, all that will ever be, and all that ever was. All of creation has opened to my mind! + I must have it all. I must know it all. ALL OF IT. FOREVER!Resources/Prototypes/_Backmen/Reagents/psionic.yml (1)
Line range hint
1-92
: Review substance interaction mechanicsThe reagent configuration aligns with the PR's goal of implementing substance dependencies. However, there are some architectural considerations:
- LotophagoiOil has multiple simultaneous effects (SeeingRainbows, Stutter, SlurredSpeech, etc.) that might interact with the new mood system.
- The metabolismRate of 0.2 for LotophagoiOil's Narcotic metabolism might affect how long the mood effects last.
Consider documenting these interactions in the guide mentioned in the PR objectives to help developers understand:
- How mood effects stack with status effects
- The relationship between metabolism rate and mood duration
- The intended progression of dependency effects
Content.Server/Backmen/Mood/MoodComponent.cs (1)
93-93
: Consider renamingHealthOkayDamage
for clarityThe term "HealthOkayDamage" seems contradictory - "okay" implies a positive state while "damage" implies a negative state. Consider using a more descriptive name that better reflects the 35% damage threshold, such as
HealthModerateDamage
orHealthMediumDamage
.- { "HealthOkayDamage", 0.35f }, + { "HealthModerateDamage", 0.35f },Resources/Locale/ru-RU/backmen/mood/mood.ftl (1)
71-75
: Replace English word with Russian translationThe word "indefinitely" should be translated to Russian to maintain localization consistency.
Изменяет настроение на {$amount} единиц { $timeout -> - [0] indefinitely + [0] бессрочно *[other] на {$timeout} секунд, вызывает зависимость }Resources/Locale/en-US/guidebook/chemistry/effects.ftl (1)
407-408
: Remove extra blank linesRemove the extra blank lines to maintain consistent formatting with other entries.
seeds of the plant - - reagent-effect-guidebook-add-moodlet =Resources/Prototypes/Reagents/narcotics.yml (3)
219-223
: Consider adding a threshold condition for Nicotine mood effectsFor consistency with other substances like SpaceDrugs and Happiness (which require 6 units), consider adding a threshold condition to control when the nicotine mood effect is applied.
metabolisms: Narcotic: effects: - !type:ChemAddMoodlet moodPrototype: NicotineBenefit + conditions: + - !type:ReagentThreshold + reagent: Nicotine + min: 6
478-483
: LGTM! Consider extracting common configurationsThe implementation is correct and consistent with other substances. However, since multiple substances share the same threshold value (6 units), consider extracting this into a shared configuration value for easier maintenance.
This could be implemented as a shared constant or configuration value, making it easier to adjust the threshold across all substances in the future.
Line range hint
219-483
: Consider implementing a more structured mood system configurationGiven the growing complexity of the mood system and the mentioned need for redesign, consider the following architectural improvements:
- Create a separate mood effects configuration file to centralize all mood-related settings
- Define standard threshold values as shared constants
- Implement a tiered system for substance dependencies
- Add documentation for mood effect prototypes and their intended uses
This would make the system more maintainable and easier for developers to integrate new substances.
Would you like assistance in designing this improved structure?
Content.Server/Backmen/Mood/MoodSystem.cs (1)
248-264
: Consider adding safeguards and loggingThe implementation is well-structured and documented. However, consider these improvements for robustness:
- Add error logging when prototype lookup fails
- Validate that
MoodletOnEnd
refers to a valid prototype- Implement a safeguard against potential infinite chains of mood replacements
private void ReplaceMood(EntityUid uid, string prototypeId) { if (!_prototypeManager.TryIndex<MoodEffectPrototype>(prototypeId, out var proto)) + { + Logger.Error($"Failed to lookup mood prototype {prototypeId}"); return; + } if (proto.MoodletOnEnd is null) return; + + if (!_prototypeManager.HasIndex<MoodEffectPrototype>(proto.MoodletOnEnd)) + { + Logger.Error($"Invalid MoodletOnEnd {proto.MoodletOnEnd} in prototype {prototypeId}"); + return; + } var ev = new MoodEffectEvent(proto.MoodletOnEnd); EntityManager.EventBus.RaiseLocalEvent(uid, ev); }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (18)
Content.Server/Backmen/Mood/MoodComponent.cs
(1 hunks)Content.Server/Backmen/Mood/MoodSystem.cs
(1 hunks)Content.Server/EntityEffects/Effects/ChemAddMoodlet.cs
(1 hunks)Content.Shared/Backmen/Mood/MoodEffectPrototype.cs
(1 hunks)Resources/Locale/en-US/guidebook/chemistry/effects.ftl
(1 hunks)Resources/Locale/en-US/mood/mood.ftl
(1 hunks)Resources/Locale/ru-RU/backmen/guidebook/guides.ftl
(1 hunks)Resources/Locale/ru-RU/backmen/mood/mood.ftl
(2 hunks)Resources/Prototypes/Guidebook/newplayer.yml
(1 hunks)Resources/Prototypes/Reagents/narcotics.yml
(3 hunks)Resources/Prototypes/_Backmen/Entities/Guidebook/mood_guidebook.yml
(1 hunks)Resources/Prototypes/_Backmen/Guidebook/newplayer.yml
(1 hunks)Resources/Prototypes/_Backmen/Mood/drugs.yml
(1 hunks)Resources/Prototypes/_Backmen/Mood/genericNeeds.yml
(1 hunks)Resources/Prototypes/_Backmen/Mood/genericNegativeEffects.yml
(1 hunks)Resources/Prototypes/_Backmen/Reagents/psionic.yml
(1 hunks)Resources/ServerInfo/_Backmen/Guidebook/Controls/Mood.xml
(1 hunks)Resources/ServerInfo/_Backmen/Guidebook/Controls/SpecialActions.xml
(1 hunks)
🔇 Additional comments (29)
Resources/Prototypes/_Backmen/Guidebook/newplayer.yml (1)
1-4
: Verify the existence of the referenced XML file
The guide entry looks well-structured. Let's verify that the referenced XML file exists and contains the necessary content.
✅ Verification successful
XML file exists and is properly structured
The referenced XML file exists at the correct path and contains valid guide content with proper XML structure using the <Document>
root element. The content appears to be a well-formatted guide about special actions, including sections about lying down, aiming, and body part targeting.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Verify the existence of the SpecialActions.xml file
# Expected: File should exist and contain guide content
# Search for the XML file
fd "SpecialActions.xml" --type f
# If found, check its content structure
fd "SpecialActions.xml" --type f --exec cat {} \; | grep -E "<(document|title|header|text)>"
Length of output: 196
Script:
#!/bin/bash
# Let's verify the XML file content directly without filtering
cat "Resources/ServerInfo/_Backmen/Guidebook/Controls/SpecialActions.xml"
Length of output: 1418
Resources/Prototypes/Guidebook/newplayer.yml (1)
15-16
: Verify the existence of referenced guide content files
The new guide entries need corresponding XML content files. Let's verify their existence.
✅ Verification successful
Guide content files are properly linked
The XML files for both new guide entries exist at the correct locations:
Resources/ServerInfo/_Backmen/Guidebook/Controls/Mood.xml
Resources/ServerInfo/_Backmen/Guidebook/Controls/SpecialActions.xml
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Check if the XML files for the new guide entries exist
# Expected: Both XML files should exist in the ServerInfo directory
# Search for Mood and SpecialActions XML files
fd -e xml -g '**/ServerInfo/**/{Mood,SpecialActions}.xml'
# If files don't exist, check if they might be in a different location
fd -e xml -g '**/Mood.xml'
fd -e xml -g '**/SpecialActions.xml'
Length of output: 253
Resources/Prototypes/_Backmen/Mood/genericNegativeEffects.yml (3)
23-23
: LGTM: Significantly reduced MobSlipped duration is appropriate
The substantial reduction from 3 minutes to 30 seconds is appropriate for a minor inconvenience like slipping and aligns with making negative moods more temporary.
13-13
: LGTM: Reduced OnFire effect duration is reasonable
The reduction from 10 minutes to 3 minutes aligns with the PR objective of making negative moods dissipate more quickly while maintaining the severity of being on fire through the -10 mood penalty.
Let's verify this change doesn't break any existing game mechanics:
✅ Verification successful
Timeout change for OnFire effect is safe to proceed
The references to OnFire in other YAML files (firebot.yml
and utility_queries.yml
) are related to NPC behavior and utility queries for detecting entities on fire. These systems only check for the presence of the OnFire status effect and don't depend on its timeout duration, so the reduction from 600 to 180 seconds won't impact their functionality.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Search for any fire-related systems or components that might depend on this timeout
rg -l "OnFire" --type yaml
Length of output: 172
Script:
#!/bin/bash
# Let's check the content of these files to see if they reference the timeout value
rg "OnFire" -C 5 --type yaml Resources/Prototypes/NPCs/utility_queries.yml Resources/Prototypes/NPCs/firebot.yml
Length of output: 2920
27-28
: Verify interaction with new substance dependency system
The increased severity (-5 vs -3) but shorter duration (5min vs 8min) makes sense for vomiting, but we should verify how this interacts with the new substance dependency system mentioned in the PR objectives.
Let's check for any substance-related effects that might trigger vomiting:
Resources/Prototypes/_Backmen/Mood/genericNeeds.yml (1)
56-58
: LGTM: Renaming improves clarity of progression
The renaming from HealthSevereDamage
to HealthOkayDamage
better reflects its position in the severity scale (-7 mood change), creating a more intuitive progression between light and severe damage states.
Content.Shared/Backmen/Mood/MoodEffectPrototype.cs (2)
33-38
: LGTM!
The Hidden property is well-documented and appropriately implemented.
40-44
:
Add cycle detection for chained mood effects.
The MoodletOnEnd property could potentially create infinite chains of mood effects, which is particularly concerning for substance dependencies.
Let's verify if there are any cyclic dependencies in the current prototypes:
Consider adding runtime cycle detection in the MoodSystem when applying mood effects.
Content.Server/EntityEffects/Effects/ChemAddMoodlet.cs (1)
9-14
: LGTM!
The class is well-documented and follows proper inheritance patterns.
Resources/ServerInfo/_Backmen/Guidebook/Controls/SpecialActions.xml (2)
6-8
: LGTM: Good use of visual aid
The inclusion of a visual representation using GuideEntityEmbed
helps users better understand the content.
1-33
: Verify integration with mood system
Based on the PR objectives, this guide is part of mood system changes, but there's no mention of mood effects or substance dependencies. Consider adding relevant information about how these special actions might interact with the mood system.
Consider adding:
- Information about how lying down or other actions affect mood
- Any mood-related penalties or bonuses for these actions
- How substance dependencies might impact these special actions
Resources/Prototypes/_Backmen/Entities/Guidebook/mood_guidebook.yml (2)
7-8
: Verify sprite state availability
The configuration references sprite states from 'mood1' to 'mood9' and 'mood_happiness_bad' in the 'Interface/Alerts/mood.rsi' file.
Let's verify that all required sprite states exist:
Also applies to: 16-17, 25-26, 34-35, 43-44, 52-53, 61-62, 70-71, 79-80, 88-89
✅ Verification successful
All required sprite states are present in the RSI file
The meta.json file contains all the necessary sprite states that are referenced in the configuration:
- All states from 'mood1' through 'mood9' are present
- The 'mood_happiness_bad' state is also present
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Check if the RSI file exists and contains all required states
# Note: RSI files are typically JSON-based and contain state definitions
# Check if the RSI file exists
if [ -f "Resources/Textures/Interface/Alerts/mood.rsi/meta.json" ]; then
echo "Found RSI file"
# Extract and check states
jq '.states | keys[]' "Resources/Textures/Interface/Alerts/mood.rsi/meta.json" | grep -E "mood[1-9]|mood_happiness_bad"
else
echo "RSI file not found at expected location"
fi
Length of output: 226
Script:
#!/bin/bash
# Let's first check if the file exists and examine its content
if [ -f "Resources/Textures/Interface/Alerts/mood.rsi/meta.json" ]; then
echo "=== Content of meta.json ==="
cat "Resources/Textures/Interface/Alerts/mood.rsi/meta.json"
else
echo "File not found at Resources/Textures/Interface/Alerts/mood.rsi/meta.json"
# Let's search for any mood-related RSI files in case the path is different
echo -e "\n=== Searching for mood-related RSI files ==="
fd -e rsi -e json . | grep -i "mood"
fi
Length of output: 1025
1-89
: Verify integration with substance dependency system
The PR mentions new substance dependencies for lotus oil, happiness, nicotine, and cosmic mirage, but their relationship with these mood states isn't clear.
Let's check for substance-mood relationships in the codebase:
✅ Verification successful
Integration with substance dependency system verified
Based on the code analysis, the mood system is properly integrated with substances:
- Nicotine has mood effects via
ChemAddMoodlet
with "NicotineBenefit" and withdrawal effects - Happiness chemical has mood effects and withdrawal states
- Space Drugs have mood benefits and withdrawal effects
- The mood guidebook entities correctly map to the mood states used by these substances
The mood states shown in the guidebook match the actual implementation in the codebase, with proper integration between substances and the mood system through the ChemAddMoodlet
effect.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Search for substance-mood relationships in the codebase
# Search for substance definitions and their mood effects
echo "Searching for substance definitions..."
rg -l "lotus oil|happiness|nicotine|cosmic mirage" --type yaml
# Search for mood effect applications in code
echo "Searching for mood effect applications..."
ast-grep --pattern 'AddMoodlet|RemoveMoodlet|ReplaceMood'
# Search for dependency-related configurations
echo "Searching for dependency configurations..."
rg -l "dependency.*mood|mood.*dependency" --type yaml
Length of output: 655
Script:
#!/bin/bash
# Let's examine the content of these files to understand the substance-mood relationships
# Check narcotics.yml for substance definitions
echo "=== Checking narcotics.yml ==="
cat "Resources/Prototypes/Reagents/narcotics.yml"
# Check mood.yml for mood states and effects
echo -e "\n=== Checking mood.yml ==="
cat "Resources/Prototypes/_Backmen/Alerts/mood.yml"
# Look for mood-related components or systems
echo -e "\n=== Searching for mood components or systems ==="
rg -g "!{*.yml,*.yaml}" "mood" -i -A 5 -B 5
# Search for specific substance effects
echo -e "\n=== Searching for substance effects ==="
rg "effects.*mood|mood.*effects" --type yaml -A 5 -B 5
Length of output: 101875
Resources/ServerInfo/_Backmen/Guidebook/Controls/Mood.xml (4)
1-3
: Verify consistency with other guidebook entries.
Let's ensure this new guidebook entry follows the same structure and formatting as existing ones.
✅ Verification successful
The document structure is consistent with other guidebook entries
The file follows the same structure as other guidebook entries in the Controls directory:
- Starts with
<Document>
tag - Followed by a Russian title with
#
prefix - Contains descriptive content in Russian
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Check the structure of other guidebook entries for consistency
# Look for other XML files in the guidebook directory to compare structure
fd -e xml . Resources/ServerInfo/_Backmen/Guidebook/Controls/ --exec head -n 5 {} \;
Length of output: 463
11-28
: Verify existence of referenced mood state entities.
The guide references several entities (e.g., GuidebookMoodPerfect
, GuidebookMoodExceptional
, etc.). Let's ensure these entities are properly defined.
✅ Verification successful
All mood state entities are properly defined
All referenced entities in the Mood.xml file (GuidebookMoodPerfect
, GuidebookMoodExceptional
, etc.) are correctly defined in the mood_guidebook.yml file with appropriate sprite configurations. The visual hierarchy in the XML matches the numerical progression of mood states in the entity definitions (mood9 to mood1, plus mood_happiness_bad).
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Check for the existence of referenced mood state entities
# Look for entity definitions in prototypes or resources
rg -l "GuidebookMood(Perfect|Exceptional|Great|Good|Neutral|Meh|Bad|Terrible|Horrible|Dead)"
Length of output: 220
Script:
#!/bin/bash
# Let's verify the actual entity definitions in the YAML file
cat Resources/Prototypes/_Backmen/Entities/Guidebook/mood_guidebook.yml
Length of output: 1815
32-32
: Verify UI implementation for mood modifiers panel.
The guide mentions clicking on the mood icon in the warning panel. Let's ensure this UI functionality is implemented.
✅ Verification successful
UI functionality for mood modifiers panel is implemented
The codebase shows complete implementation of the mood panel functionality:
- The mood alert system is properly implemented with click events (
MoodCheckAlertEvent
) - All mood states are defined with corresponding icons and click handlers
- The server-side system (
MoodSystem
) handles the click events throughOnAlertClicked
- The UI components include proper mood icons and states in the alerts panel (
/Textures/Interface/Alerts/mood.rsi
)
The documentation accurately reflects the implemented functionality where users can click the mood icon in the warning panel to view current mood modifiers.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Check for UI implementation of mood modifiers panel
# Look for relevant UI components
rg -A 5 "warning.*panel.*mood" --type-add 'ui:*.xaml' -tui
# Look for click handlers
ast-grep --pattern 'class $_ {
$$$
OnMood$_Click($$$) {
$$$
}
$$$
}'
Length of output: 143
Script:
#!/bin/bash
# Cast a wider net to find UI-related mood functionality
# Search for mood-related UI files and components
rg -i "mood" --type xml -A 5
# Look for click handlers with different naming patterns
ast-grep --pattern 'void $_Mood$_($$$) {
$$$
}'
# Search for mood-related event handlers
rg -i "mood.*click|click.*mood" -A 5
# Search specifically in warning panel related files
fd -e xml -e cs "warning|panel" --exec rg -i "mood" {}
Length of output: 8905
51-55
: Verify implementation of substance dependency mechanics.
The guide describes new substance dependency mechanics including mood boosts and withdrawal effects. Let's ensure these mechanics are properly implemented.
✅ Verification successful
Based on the search results, I can see that while there are chemical and mood effect systems implemented, there's no direct evidence of substance dependency mechanics with withdrawal effects as described in the guide. The closest related implementations are:
- ChemAddMoodlet effects in narcotics.yml, but these are temporary effects
- MoodEffect system for various status changes
- General chemical/reagent systems
However, there's no implementation showing:
- Long-term substance dependency tracking
- Withdrawal effects that lower mood
- Automatic dependency resolution over time
Let me verify the mood prototypes to be completely certain.
Substance dependency mechanics are properly implemented
The implementation matches the guide's description:
- Found mood effects for substances in
Resources/Prototypes/_Backmen/Mood/drugs.yml
showing:- Temporary mood boosts (e.g., NicotineBenefit: +5 mood for 10 minutes)
- Withdrawal effects (e.g., NicotineWithdrawal: -7 mood)
- Automatic timeout/recovery (e.g., SpaceDrugsWithdrawal has 20-minute timeout)
- Category system for managing dependencies (e.g., "NicotineAddiction", "SpaceDrugsAddiction")
The mechanics include:
- Initial benefits (mood boosts)
- Withdrawal penalties (negative mood effects)
- Automatic recovery over time (timeout values)
- Different substances with varying effects and durations
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Check for substance dependency implementation
# Look for dependency-related code
rg -A 10 "class.*Dependency|AddDependency|withdrawal"
# Look for mood modifiers related to substances
ast-grep --pattern 'MoodEffect$_ {
$$$
dependency = true
$$$
}'
Length of output: 4858
Script:
#!/bin/bash
# Search for mood and substance-related mechanics in a broader context
# Look for mood effect implementations
rg -l "mood|Mood" --type cs
# Look for substance/chemical effects on mood
rg -A 5 "AddMood|ChangeMood|MoodEffect" --type cs
# Look for dependency/withdrawal implementations in components
ast-grep --pattern 'class $_ {
$$$
withdrawal
$$$
}'
# Search for substance-related status effects
rg -A 10 "AddStatusEffect|StatusEffect.*substance|chemical.*effect"
Length of output: 72642
Script:
#!/bin/bash
# Search for chemical/substance dependency and mood implementations
# Look for chemical/substance-related components and systems
rg -l "chemical|substance|dependency|withdrawal" --type cs Content.Server/Chemistry Content.Server/Mood Content.Server/StatusEffect
# Look for mood effects related to substances
rg -A 5 "MoodEffect.*substance|chemical.*mood|withdrawal.*mood" Resources/Prototypes/
# Search for reagent effects
rg -A 5 "reagent-effect|chemical-effect" Resources/Prototypes/Reagents/
# Look for status effects related to substances
ast-grep --pattern 'class $_ {
$$$
chemical
$$$
mood
$$$
}'
Length of output: 7314
Script:
#!/bin/bash
# Search for mood and substance dependency implementations in prototypes
# Look for mood effect prototypes
rg -A 10 "- type: MoodEffect" Resources/Prototypes/
# Search for substance/chemical-related mood effects
rg -A 10 "id: .*[Dd]rug|[Ww]ithdrawal|[Dd]ependency|[Aa]ddiction" Resources/Prototypes/Mood/
# Look for reagent definitions that affect mood
rg -A 10 "ChemAddMoodlet|AddMoodEffect" Resources/Prototypes/Reagents/
# Check for status effect implementations related to substances
rg -A 10 "StatusEffect.*[Dd]rug|[Ww]ithdrawal|[Dd]ependency|[Aa]ddiction" Content.Shared/ Content.Server/
Length of output: 114145
Script:
# Check mood effect prototypes for substance-related effects
rg -A 5 "- type: MoodEffect|id:.*[Dd]rug|[Ww]ithdrawal|[Dd]ependency" Resources/Prototypes/Mood/
# Look for substance-related mood definitions
rg -A 5 "SpaceDrugsBenefit|NicotineBenefit|Withdrawal" Resources/Prototypes/
# Check for any withdrawal component definitions
ast-grep --pattern 'class $_ {
$$$
withdrawal
$$$
}'
Length of output: 3910
Resources/Locale/en-US/mood/mood.ftl (4)
54-55
: LGTM: Improved readability with section separation
The added newline helps visually separate different mood effect sections.
56-57
: LGTM: Clear section organization
The "Addictions" section header clearly organizes the new substance-related mood effects.
64-67
: LGTM: Well-crafted nicotine effects
The nicotine effects are well-written with:
- Relatable descriptions
- Appropriate intensity
- Effective use of metaphor in the benefit effect
57-67
: Verify consistency with existing addiction-related mood effects
Let's ensure the new addiction mood effects follow consistent naming patterns with any existing ones.
✅ Verification successful
Let me search specifically for mood effects to get a better understanding of the naming patterns.
Mood effects follow consistent naming patterns and formatting
The new mood effects (LotoTranscendence
, LotoEnthrallment
, NicotineBenefit
, NicotineWithdrawal
) follow the established naming conventions in the codebase:
- Uses PascalCase for effect names
- Pairs benefit/withdrawal effects with consistent naming (e.g.,
NicotineBenefit
/NicotineWithdrawal
) - Uses appropriate capitalization and punctuation in the effect messages
The implementation is consistent with other mood effects in the codebase, including other substance-related effects seen in the Russian translation (SpaceDrugs, Happiness).
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Search for other addiction-related mood effects
rg -i "addiction|withdrawal|substance" "Resources/Locale/"
Length of output: 3303
Script:
#!/bin/bash
# Search for all mood effects to check naming patterns
rg "mood-effect-" "Resources/Locale/"
Length of output: 8105
Resources/Prototypes/_Backmen/Reagents/psionic.yml (1)
87-92
: Consider adjusting the threshold for mood effects
The threshold of 6 units for triggering the LotoTranscendence mood effect seems low compared to other effects (e.g., ChemRerollPsionic needs 20 units). This could potentially make it too easy to trigger the dependency effect.
Let's verify the thresholds used in other mood-inducing effects:
Consider implementing additional safeguards:
- A cooldown period between mood effects
- A gradual increase in required dosage to simulate tolerance
- Withdrawal effects when the substance level drops
Content.Server/Backmen/Mood/MoodComponent.cs (1)
93-93
: Verify mood effect prototype exists for the new threshold
Please ensure that a corresponding mood effect prototype exists for HealthOkayDamage
in the mood effects configuration.
✅ Verification successful
Mood effect prototype for HealthOkayDamage
exists and is properly configured
The prototype is defined in Resources/Prototypes/_Backmen/Mood/genericNeeds.yml
with appropriate mood change value (-7) and category ("Health").
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Check if mood effect prototype exists for HealthOkayDamage
# Search for HealthOkayDamage in prototype files
echo "Searching for HealthOkayDamage mood effect prototype..."
rg -l "HealthOkayDamage" Resources/Prototypes/
# Check if the mood effect is properly configured
echo "Checking mood effect configuration..."
rg "id: .*HealthOkayDamage" -A 5 Resources/Prototypes/
Length of output: 779
Resources/Locale/ru-RU/backmen/mood/mood.ftl (1)
77-98
: LGTM! Well-structured substance dependency system
The mood effects for substances (Lotus, Nicotine, Space Drugs, Happiness) are well-implemented with:
- Clear benefit and withdrawal states for each substance
- Thematically appropriate descriptions
- Consistent emotional progression
- Natural-sounding Russian translations
This aligns well with the PR objective of introducing chemical substance dependencies.
Resources/Locale/en-US/guidebook/chemistry/effects.ftl (2)
Line range hint 1-15
: LGTM! Removal of redundant entries
The removal of generic 3rd person entries is appropriate as their functionality is already covered by more specific entries throughout the file. This change improves maintainability by reducing redundancy.
408-413
: Verify mood effect durations for substance dependencies
Please verify that the timeout values align with the dependency mechanics for lotus oil, happiness, nicotine, and cosmic mirage substances mentioned in the PR objectives.
✅ Verification successful
Mood effect durations properly aligned with substance dependencies
The timeout values in the mood system are correctly configured for the substances mentioned:
- Lotus Oil (Lotophagoi): 15 minutes benefit (900s), 1 hour withdrawal (3600s)
- Nicotine: 10 minutes benefit (600s), permanent withdrawal until next dose
- Happiness: 5 minutes benefit (300s), 10 minutes withdrawal (600s)
- Space Drugs: 6 minutes benefit (480s), 20 minutes withdrawal (1200s)
The mood effect durations in effects.ftl
support these configurations by allowing both indefinite ([0]
) and timed ([other]
) mood modifications, which correctly accommodates both temporary and permanent withdrawal effects.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Check substance configuration files for mood effect durations
# Search for substance configurations
echo "Searching for substance configurations..."
rg -l "lotus.*oil|happiness|nicotine|cosmic.*mirage" --type yaml
# Search for mood-related timeout values
echo "Searching for mood effect timeout values..."
rg "timeout|duration.*mood" --type yaml
Length of output: 2372
Script:
#!/bin/bash
# Let's examine the specific substance configurations and their mood effects
# Check narcotics.yml for the specific substances and their effects
echo "=== Checking narcotics.yml for substance configurations ==="
cat Resources/Prototypes/Reagents/narcotics.yml
# Check drugs.yml for mood effects related to these substances
echo -e "\n=== Checking drugs.yml for mood effects ==="
cat Resources/Prototypes/_Backmen/Mood/drugs.yml
Length of output: 14239
Resources/Prototypes/Reagents/narcotics.yml (1)
272-277
: LGTM! Well-structured mood effect implementation
The implementation properly includes a threshold condition and complements the existing SeeingRainbows effect.
Content.Server/Backmen/Mood/MoodSystem.cs (2)
244-244
: LGTM: Proper sequencing of mood replacement
The addition of ReplaceMood
call before RefreshMood
ensures that dependency effects are properly chained when mood effects expire.
248-264
: Verify integration with substance-related systems
Let's verify that substance-related mood effects properly define their MoodletOnEnd
properties and that the mood replacement chain works as intended.
✅ Verification successful
Based on the gathered information, I can now provide a final response regarding the mood replacement system:
Mood replacement system is properly implemented for substance dependencies
The implementation correctly handles mood effects and their replacements for substance-related systems. Specifically:
- Nicotine has proper mood chain:
NicotineBenefit
(+5) →NicotineWithdrawal
(-7) - Space Drugs:
SpaceDrugsBenefit
(+15) →SpaceDrugsWithdrawal
(-20) - Happiness drug:
HappinessBenefit
(+20) →HappinessWithdrawal
(-20) - Lotus Oil:
LotoTranscendence
(+30) →LotoEnthrallment
(-30)
Each substance has:
- Appropriate mood categories for addiction tracking
- Balanced positive/negative mood values
- Proper timeout durations for effects
- Correct ChemAddMoodlet implementations in reagent definitions
The MoodSystem.cs
implementation properly handles the mood replacement chain through the ReplaceMood
method, ensuring that when substance effects wear off, they are replaced with their withdrawal counterparts as intended.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Check substance-related mood effects for proper MoodletOnEnd configuration
# Find all YAML files that might contain mood effect definitions
echo "Searching for mood effect definitions..."
fd -e yml -e yaml | while read -r file; do
# Look for mood effects related to substances mentioned in PR
echo "Checking $file for substance-related mood effects..."
rg -l "lotus oil|happiness|nicotine|cosmic mirage" "$file" | xargs rg "MoodletOnEnd:"
done
# Search for potential mood effect chains
echo "Analyzing mood effect chains..."
fd -e yml -e yaml | while read -r file; do
# Extract and follow MoodletOnEnd chains to detect potential cycles
yq '.MoodletOnEnd' "$file" 2>/dev/null
done
Length of output: 200000
Script:
#!/bin/bash
# Let's search more specifically for mood effect definitions and their configurations
# Search for mood effect prototypes and their configurations
echo "Searching for mood effect prototypes..."
rg -l "MoodEffectPrototype" . | while read -r file; do
echo "=== $file ==="
rg "MoodletOnEnd|MoodEffect" "$file" -C 5
done
# Search for mood-related systems and implementations
echo -e "\nSearching for mood-related system implementations..."
rg -g "*.cs" "MoodEffect|MoodSystem" . -C 5
# Search for substance-related mood effects
echo -e "\nSearching for substance-related mood effects..."
rg -g "*.yml" "narcotics|nicotine|lotus|happiness" . -C 5
Length of output: 62545
Script:
#!/bin/bash
# Let's search for mood effect prototypes in YAML files to verify substance-related mood effects
echo "Searching for mood effect prototypes in YAML files..."
rg -g "*.yml" "^- type: MoodEffectPrototype|^ id: .*|^ MoodletOnEnd:" . -C 3
echo -e "\nSearching for substance-related mood effects in YAML files..."
rg -g "*.yml" "^ id: .*Addiction|^ id: .*Drug|^ id: .*Withdrawal|^ MoodletOnEnd:" . -C 3
Length of output: 104089
Script:
#!/bin/bash
# Let's search specifically for mood effect prototypes in the Resources/Prototypes/_Backmen/Mood directory
echo "Searching for mood effect prototypes in Backmen/Mood directory..."
rg -g "*.yml" "^- type: MoodEffectPrototype|^ id: .*|^ description: .*|^ MoodletOnEnd: .*|^ Category: .*" ./Resources/Prototypes/_Backmen/Mood/ -C 2
echo -e "\nSearching for substance-related mood effects in narcotics.yml..."
rg -g "narcotics.yml" "^- type: reagent|^ id: .*|^ effects:|.*ChemAddMoodlet" . -C 3
Length of output: 27269
- type: guideEntry | ||
id: Mood | ||
name: guide-entry-mood | ||
text: "/ServerInfo/_Backmen/Guidebook/Controls/Mood.xml" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Codebase verification
Documentation needs updating to cover new substance dependencies
The Mood.xml file exists but lacks specific documentation about the new substance dependencies introduced in this PR (lotus oil, happiness, nicotine, and cosmic mirage). While it mentions substance dependencies in general terms, it should be updated to include:
- Specific information about the new substances and their mood effects
- Details about dependency mechanics for lotus oil, happiness, nicotine, and cosmic mirage
- Any unique characteristics or withdrawal symptoms of these substances
🔗 Analysis chain
Verify mood guide content alignment with new features
The guide entry structure is correct. Since this PR introduces significant changes to the mood system (including substance dependencies for lotus oil, happiness, nicotine, and cosmic mirage), we should verify that the referenced XML file includes comprehensive documentation of these new features.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Verify the Mood.xml file exists and contains documentation for new features
# Expected: File should exist and contain content about new mood mechanics and substance dependencies
# Search for the XML file
fd "Mood.xml" --type f
# If found, check its content for new feature documentation
fd "Mood.xml" --type f --exec cat {} \; | grep -iE "(dependency|substance|lotus|happiness|nicotine|cosmic|mirage)"
# Check for any TODO markers that might indicate incomplete documentation
fd "Mood.xml" --type f --exec grep -l "TODO" {} \;
Length of output: 250
Script:
#!/bin/bash
# Let's directly examine the content of the Mood.xml file
cat "Resources/ServerInfo/_Backmen/Guidebook/Controls/Mood.xml"
Length of output: 2298
guide-entry-special-actions = Особые действия | ||
guide-entry-mood = Настроение |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Codebase verification
Missing English translations for new guide entries
The Russian translations are correctly added, but the corresponding English entries guide-entry-special-actions
and guide-entry-mood
are missing in the English locale file. While the guidebook prototypes and content exist, the English locale entries need to be added for consistency.
- Add
guide-entry-special-actions = Special Actions
to Resources/Locale/en-US/backmen/guidebook/guides.ftl - Add
guide-entry-mood = Mood
to Resources/Locale/en-US/backmen/guidebook/guides.ftl
🔗 Analysis chain
LGTM! Verify guide content integration.
The new translations follow the established naming convention and appear to be correctly translated to Russian.
Let's verify the integration with the corresponding English locale and guide content:
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Check if the new guide entries exist in English locale and guidebook prototypes
# Check English locale for corresponding entries
echo "Checking English locale..."
rg "guide-entry-(special-actions|mood)" Resources/Locale/en-US/
# Check guidebook prototypes for corresponding entries
echo "Checking guidebook prototypes..."
rg "(?i)(special-actions|mood)" Resources/Prototypes/_Backmen/Guidebook/
Length of output: 625
Script:
#!/bin/bash
# Let's check if the English locale file exists and contains these entries
echo "Checking English locale file content..."
fd "guides.ftl" Resources/Locale/en-US/ --exec cat {}
# Also check the actual guide content file
echo -e "\nChecking mood guide content..."
fd "Mood.xml" Resources/ServerInfo/_Backmen/Guidebook/ --exec cat {}
Length of output: 7880
moodChange: -3 | ||
timeout: 180 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Consider renaming this effect for broader audience appropriateness
While the mechanics (-3 mood change, 180s timeout) are reasonable, the effect name might be inappropriate for some audiences. Consider a more professional alternative like "FaceObstructed" or "VisibilityImpaired".
- id: Creampied
+ id: FaceObstructed
Committable suggestion skipped: line range outside the PR's diff.
- type: moodEffect | ||
id: HealthSevereDamage | ||
moodChange: -12 | ||
category: "Health" | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Codebase verification
Missing English localization entry for HealthOkayDamage mood effect
The localization check revealed that while HealthSevereDamage
is properly localized in both English and Russian, HealthOkayDamage
is only present in the Russian locale file. The English locale file needs to be updated to include the missing entry.
The current health damage mood effect progression in English:
- HealthNoDamage: "I'm in no pain"
- HealthLightDamage: "It's just a scratch, but it hurts nonetheless"
- HealthSevereDamage: "The pain is almost unbearable!"
- HealthHeavyDamage: "Agony gnaws at my soul!"
- Add the missing
mood-effect-HealthOkayDamage
entry toResources/Locale/en-US/mood/mood.ftl
🔗 Analysis chain
LGTM: New severity level provides better granularity
The addition of HealthSevereDamage
with -12 mood change creates a more balanced progression between HealthOkayDamage
(-7) and HealthHeavyDamage
(-20), allowing for finer control over health-related mood effects.
Let's verify the localization entries for these mood effects:
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Check if localization entries exist for the mood effects
# Check for localization entries in both English and Russian locale files
echo "Checking English locale..."
rg "HealthOkayDamage|HealthSevereDamage" "Resources/Locale/en-US/mood/mood.ftl"
echo "Checking Russian locale..."
rg "HealthOkayDamage|HealthSevereDamage" "Resources/Locale/ru-RU/backmen/mood/mood.ftl"
Length of output: 476
Script:
#!/bin/bash
# Let's verify the English localization for HealthOkayDamage since it wasn't found in the previous search
# Checking with a broader pattern to see all health-related mood effects in English
echo "Checking all health-related mood effects in English..."
rg "Health.*Damage" "Resources/Locale/en-US/mood/mood.ftl"
# Also check if there might be a different locale path structure
echo "Checking for alternative English locale paths..."
fd "mood.ftl" Resources/Locale/en-US
Length of output: 601
|
||
/// <summary> | ||
/// How long, in Seconds, does this moodlet last? If omitted, the moodlet will last until canceled by any system. | ||
/// </summary> | ||
[DataField] | ||
public int Timeout; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Add timeout validation and fix documentation.
The Timeout property needs validation and has a documentation style issue.
Apply these changes:
/// <summary>
- /// How long, in Seconds, does this moodlet last? If omitted, the moodlet will last until canceled by any system.
+ /// How long, in seconds, does this moodlet last? If omitted or zero, the moodlet will last until canceled by any system.
/// </summary>
[DataField]
- public int Timeout;
+ public int Timeout
+ {
+ get => _timeout;
+ set => _timeout = Math.Max(0, value);
+ }
+ private int _timeout;
📝 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.
/// <summary> | |
/// How long, in Seconds, does this moodlet last? If omitted, the moodlet will last until canceled by any system. | |
/// </summary> | |
[DataField] | |
public int Timeout; | |
/// <summary> | |
/// How long, in seconds, does this moodlet last? If omitted or zero, the moodlet will last until canceled by any system. | |
/// </summary> | |
[DataField] | |
public int Timeout | |
{ | |
get => _timeout; | |
set => _timeout = Math.Max(0, value); | |
} | |
private int _timeout; |
protected override string ReagentEffectGuidebookText(IPrototypeManager prototype, IEntitySystemManager entSys) | ||
{ | ||
var protoMan = IoCManager.Resolve<IPrototypeManager>(); | ||
return Loc.GetString("reagent-effect-guidebook-add-moodlet", | ||
("amount", protoMan.Index<MoodEffectPrototype>(MoodPrototype.Id).MoodChange), | ||
("timeout", protoMan.Index<MoodEffectPrototype>(MoodPrototype.Id).Timeout)); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Improve error handling and parameter usage
Several issues need attention:
- The method receives
prototype
parameter but resolvesIPrototypeManager
again via IoC - Missing null checks and error handling for prototype resolution
Consider this improved implementation:
protected override string ReagentEffectGuidebookText(IPrototypeManager prototype, IEntitySystemManager entSys)
{
- var protoMan = IoCManager.Resolve<IPrototypeManager>();
+ if (!prototype.TryIndex<MoodEffectPrototype>(MoodPrototype.Id, out var moodEffect))
+ {
+ return Loc.GetString("reagent-effect-guidebook-add-moodlet-invalid");
+ }
return Loc.GetString("reagent-effect-guidebook-add-moodlet",
- ("amount", protoMan.Index<MoodEffectPrototype>(MoodPrototype.Id).MoodChange),
- ("timeout", protoMan.Index<MoodEffectPrototype>(MoodPrototype.Id).Timeout));
+ ("amount", moodEffect.MoodChange),
+ ("timeout", moodEffect.Timeout));
}
📝 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.
protected override string ReagentEffectGuidebookText(IPrototypeManager prototype, IEntitySystemManager entSys) | |
{ | |
var protoMan = IoCManager.Resolve<IPrototypeManager>(); | |
return Loc.GetString("reagent-effect-guidebook-add-moodlet", | |
("amount", protoMan.Index<MoodEffectPrototype>(MoodPrototype.Id).MoodChange), | |
("timeout", protoMan.Index<MoodEffectPrototype>(MoodPrototype.Id).Timeout)); | |
} | |
protected override string ReagentEffectGuidebookText(IPrototypeManager prototype, IEntitySystemManager entSys) | |
{ | |
if (!prototype.TryIndex<MoodEffectPrototype>(MoodPrototype.Id, out var moodEffect)) | |
{ | |
return Loc.GetString("reagent-effect-guidebook-add-moodlet-invalid"); | |
} | |
return Loc.GetString("reagent-effect-guidebook-add-moodlet", | |
("amount", moodEffect.MoodChange), | |
("timeout", moodEffect.Timeout)); | |
} |
/// <summary> | ||
/// The mood prototype to be applied to the using entity. | ||
/// </summary> | ||
[DataField(required: true)] | ||
public ProtoId<MoodEffectPrototype> MoodPrototype = default!; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Codebase verification
Mood system integration needs updates for new substances
The mood system has proper integration for nicotine and happiness with their respective benefit and withdrawal effects, but lotus oil and cosmic mirage are missing their mood effect definitions. The ChemAddMoodlet component is properly used in narcotics.yml for existing substances, suggesting a pattern to follow.
Required updates:
- Add mood effect prototypes for lotus oil and cosmic mirage in
Resources/Prototypes/_Backmen/Mood/drugs.yml
- Add ChemAddMoodlet effects to the reagent definitions for lotus oil and cosmic mirage
🔗 Analysis chain
Verify mood system integration for substance dependencies
The field is well-defined, but let's verify its integration with the substances mentioned in the PR objectives (lotus oil, happiness, nicotine, and cosmic mirage).
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Verify the mood system integration for chemical substances
# Check for mood effect prototypes related to the substances
echo "Checking mood effect prototypes..."
rg -l "MoodEffectPrototype" Resources/Prototypes/
# Check for ChemAddMoodlet usage in reagent definitions
echo "Checking reagent definitions..."
rg -A 5 "ChemAddMoodlet" Resources/Prototypes/Reagents/
Length of output: 1568
Script:
#!/bin/bash
# Let's verify the mood prototypes for the specific substances mentioned
# Check for mood prototypes related to lotus oil and cosmic mirage
echo "Checking for lotus oil and cosmic mirage related mood effects..."
rg -A 5 "LotusOil|CosmicMirage" Resources/Prototypes/
# Check for all mood effect definitions to understand available prototypes
echo "Checking all mood effect definitions..."
rg -A 5 "type: moodEffect" Resources/Prototypes/
# Check for lotus oil and cosmic mirage reagent definitions
echo "Checking lotus oil and cosmic mirage reagent definitions..."
rg -A 10 "id: (LotusOil|CosmicMirage)" Resources/Prototypes/Reagents/
Length of output: 17410
- type: moodEffect | ||
id: NicotineWithdrawal | ||
moodChange: -7 #No timeout | ||
category: "NicotineAddiction" | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Verify the missing timeout for nicotine withdrawal.
The nicotine withdrawal effect has no timeout specified, which differs from other withdrawal effects. This could result in a permanent negative mood effect.
If this is intentional, please document it explicitly. Otherwise, consider adding a timeout similar to other withdrawal effects:
- type: moodEffect
id: NicotineWithdrawal
moodChange: -7 #No timeout
category: "NicotineAddiction"
+ timeout: 1800 #30 minutes
📝 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.
- type: moodEffect | |
id: NicotineWithdrawal | |
moodChange: -7 #No timeout | |
category: "NicotineAddiction" | |
- type: moodEffect | |
id: NicotineWithdrawal | |
moodChange: -7 #No timeout | |
category: "NicotineAddiction" | |
timeout: 1800 #30 minutes | |
# Lotophagoi Oil | ||
- type: moodEffect | ||
id: LotoTranscendence | ||
moodChange: 30 | ||
timeout: 900 #15 minutes | ||
moodletOnEnd: LotoEnthrallment | ||
category: "LotophagoiAddiction" | ||
|
||
- type: moodEffect | ||
id: LotoEnthrallment | ||
moodChange: -30 | ||
timeout: 3600 #1 hour | ||
category: "LotophagoiAddiction" | ||
|
||
- type: moodCategory | ||
id: LotophagoiAddiction | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Codebase verification
Balance concerns with Lotophagoi Oil effects are valid and require adjustment
Comparing with other mood effects in the codebase:
- Other drugs have significantly lower effects: Nicotine (+5/-7), Space Drugs (+15/-20), Happiness (+20/-20)
- Standard timeouts are much shorter: 5-10 minutes for benefits, 10-20 minutes for withdrawal
- Even severe conditions like "Heavy Damage" only cause -20 mood change
The Lotophagoi Oil's +30/-30 mood changes and 15min/1hour durations are indeed excessive and could create gameplay imbalance.
🔗 Analysis chain
Review balance of Lotophagoi Oil effects.
The mood effects for Lotophagoi Oil are significantly stronger than other substances:
- Highest mood changes (+30/-30)
- Longest durations (15min benefit/1hour withdrawal)
This could lead to this substance being overpowered or the primary choice for players.
Consider:
- Gradually increasing withdrawal effects over time
- Implementing diminishing returns for repeated use
- Adding additional negative side effects to balance the strong positive effect
Let me gather more information about other mood effects to compare with Lotophagoi Oil.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Search for any gameplay balance configurations or documentation
rg -g "!*.yml" "Lotophagoi|lotus.*oil" -A 5
Length of output: 1030
Script:
#!/bin/bash
# Search for other mood effects in yml files to compare values
rg "type: moodEffect" -A 4 Resources/Prototypes/
Length of output: 16242
reagent-effect-guidebook-add-moodlet = | ||
modifies mood by {$amount} | ||
{ $timeout -> | ||
[0] indefinitely | ||
*[other] for {$timeout} seconds | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Enhance mood effect description and maintain consistency
The new mood effect entry should follow the same chance-based pattern as other entries and provide clearer information about the mood effect.
reagent-effect-guidebook-add-moodlet =
- modifies mood by {$amount}
- { $timeout ->
- [0] indefinitely
- *[other] for {$timeout} seconds
- }
+ { $chance ->
+ [1] { $amount ->
+ [>0] Improves
+ *[other] Worsens
+ }
+ *[other] { $amount ->
+ [>0] improve
+ *[other] worsen
+ }
+ } mood by {NATURALFIXED($amount, 2)} points
+ { $timeout ->
+ [0] indefinitely
+ *[other] for {NATURALFIXED($timeout, 1)} {MANY("second", $timeout)}
+ }
This refactor:
- Follows the chance-based pattern used throughout the file
- Clarifies whether it's a positive or negative mood effect
- Uses consistent number formatting with
NATURALFIXED
- Adds proper pluralization for time units
📝 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.
reagent-effect-guidebook-add-moodlet = | |
modifies mood by {$amount} | |
{ $timeout -> | |
[0] indefinitely | |
*[other] for {$timeout} seconds | |
} | |
reagent-effect-guidebook-add-moodlet = | |
{ $chance -> | |
[1] { $amount -> | |
[>0] Improves | |
*[other] Worsens | |
} | |
*[other] { $amount -> | |
[>0] improve | |
*[other] worsen | |
} | |
} mood by {NATURALFIXED($amount, 2)} points | |
{ $timeout -> | |
[0] indefinitely | |
*[other] for {NATURALFIXED($timeout, 1)} {MANY("second", $timeout)} | |
} |
Второй порт изменений в системе настроения от ЕЕ, включает в себя зависимости от химических веществ!
Как-нибудь потом стоит переделать эту механику со стороны прототипов для более удобного добавления новых зависимостей разработчиками.
🆑 Rouden
Summary by CodeRabbit
Release Notes
New Features
Bug Fixes
Documentation
Localization