-
Notifications
You must be signed in to change notification settings - Fork 6
Любимый, родной, забагованный, небалансный, а главное - твой. #218
base: master
Are you sure you want to change the base?
Conversation
|
todo: todo Фичи: |
This comment was marked as spam.
This comment was marked as spam.
WalkthroughОбновления вносят значительные улучшения в систему управления диалогами и механическими компонентами, повышая возможности взаимодействия с пользователем. Ключевые особенности включают новый класс Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant DialogSystem
participant DialogWindow
participant QDEntry
User->>DialogSystem: Открыть диалог
DialogSystem->>DialogWindow: Инициализировать диалог
DialogWindow->>QDEntry: Создать записи
QDEntry->>DialogWindow: Вернуть записи
DialogWindow->>User: Показать диалог
User->>DialogWindow: Ввести ответ
DialogWindow->>DialogSystem: Отправить ответ
DialogSystem->>User: Обработать ответ
📜 Recent review detailsConfiguration used: CodeRabbit UI ⛔ Files ignored due to path filters (28)
📒 Files selected for processing (39)
Note 🎁 Summarized by CodeRabbit FreeYour organization is on the Free plan. CodeRabbit will generate a high-level summary and a walkthrough for each pull request. For a comprehensive line-by-line review, please upgrade your subscription to CodeRabbit Pro by visiting https://app.coderabbit.ai/login. 🪧 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: 8
Outside diff range, codebase verification and nitpick comments (14)
Resources/Prototypes/Entities/Objects/Devices/MechComp/ports.yml (2)
16-16: Remove trailing spaces.Trailing spaces are present on these lines. Removing them will improve the file's formatting.
- +Also applies to: 48-48, 50-51
Tools
yamllint
[error] 16-16: trailing spaces
(trailing-spaces)
23-23: Reduce excessive blank lines.There are too many blank lines here. Reducing them to two will improve readability.
-Tools
yamllint
[warning] 23-23: too many blank lines
(3 > 2) (empty-lines)
Content.Server/DeviceLinking/NetworkPayloadHelper.cs (1)
19-19: Remove unprofessional language from comments.The comments contain unprofessional language. Consider rephrasing to maintain a professional tone.
- // DeviceNetworkConstants is in Content.Server, which cannot be accessed from shared. Fuck you whoever designed this. + // DeviceNetworkConstants is in Content.Server and cannot be accessed from shared. This design choice limits access.Also applies to: 24-24
Content.Shared/Administration/QDEntry.cs (1)
11-12: Consider rephrasing the warning comment.The comment in the class documentation uses strong language. Consider rephrasing it to maintain a professional tone while still conveying the importance of not passing null values incorrectly.
/// Avoid passing <see langword="null"/> to Value unless the type is <see langword="null"/>, typeof(void), or typeof(VoidOption). Incorrect usage may lead to errors.Resources/Prototypes/Entities/Objects/Devices/MechComp/some.yml (6)
30-30: Reduce the number of blank lines.There are too many blank lines here. Consider reducing them to improve readability.
-Tools
yamllint
[warning] 30-30: too many blank lines
(3 > 2) (empty-lines)
83-83: Remove trailing spaces.Trailing spaces are present on this line. Removing them can improve the file's cleanliness.
-Tools
yamllint
[error] 83-83: trailing spaces
(trailing-spaces)
106-106: Remove trailing spaces.Trailing spaces are present on this line. Removing them can improve the file's cleanliness.
-Tools
yamllint
[error] 106-106: trailing spaces
(trailing-spaces)
139-139: Correct indentation.The indentation is incorrect. It should be 12 spaces instead of 10.
- layer: + layer:Tools
yamllint
[warning] 139-139: wrong indentation: expected 12 but found 10
(indentation)
147-147: Correct indentation.The indentation is incorrect. It should be 12 spaces instead of 10.
- mask: + mask:Tools
yamllint
[warning] 147-147: wrong indentation: expected 12 but found 10
(indentation)
167-167: Add a newline at the end of the file.A newline at the end of the file is missing. Adding it improves compatibility with various tools.
-Tools
yamllint
[error] 167-167: no new line character at the end of file
(new-line-at-end-of-file)
Resources/Prototypes/Entities/Objects/Devices/MechComp/generic_ports.yml (4)
145-148: Remove excessive blank lines.There are too many blank lines here. Consider reducing them to improve readability.
-
146-146: Remove excessive blank lines.There are too many blank lines here. Consider reducing them to improve readability.
-
147-147: Remove excessive blank lines.There are too many blank lines here. Consider reducing them to improve readability.
-
148-148: Remove excessive blank lines.There are too many blank lines here. Consider reducing them to improve readability.
-
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files ignored due to path filters (28)
Resources/Audio/White/MechComp/emitter2.oggis excluded by!**/*.oggResources/Audio/White/MechComp/generic_energy_dryfire.oggis excluded by!**/*.oggResources/Textures/White/MechComp/base.rsi/icon.pngis excluded by!**/*.pngResources/Textures/White/MechComp/button.rsi/icon.pngis excluded by!**/*.pngResources/Textures/White/MechComp/button.rsi/piss.pngis excluded by!**/*.pngResources/Textures/White/MechComp/button.rsi/pressed.pngis excluded by!**/*.pngResources/Textures/White/MechComp/comparer.rsi/anchored.pngis excluded by!**/*.pngResources/Textures/White/MechComp/comparer.rsi/icon.pngis excluded by!**/*.pngResources/Textures/White/MechComp/math.rsi/anchored.pngis excluded by!**/*.pngResources/Textures/White/MechComp/math.rsi/icon.pngis excluded by!**/*.pngResources/Textures/White/MechComp/mechcomptool.rsi/icon.pngis excluded by!**/*.pngResources/Textures/White/MechComp/mechcomptool.rsi/inhand-left.pngis excluded by!**/*.pngResources/Textures/White/MechComp/mechcomptool.rsi/inhand-right.pngis excluded by!**/*.pngResources/Textures/White/MechComp/mechcomptool.rsi/open.pngis excluded by!**/*.pngResources/Textures/White/MechComp/pressurepad.rsi/anchored.pngis excluded by!**/*.pngResources/Textures/White/MechComp/pressurepad.rsi/icon.pngis excluded by!**/*.pngResources/Textures/White/MechComp/speaker.rsi/anchored.pngis excluded by!**/*.pngResources/Textures/White/MechComp/speaker.rsi/icon.pngis excluded by!**/*.pngResources/Textures/White/MechComp/speaker.rsi/speak.pngis excluded by!**/*.pngResources/Textures/White/MechComp/teleport.rsi/anchored.pngis excluded by!**/*.pngResources/Textures/White/MechComp/teleport.rsi/charging.pngis excluded by!**/*.pngResources/Textures/White/MechComp/teleport.rsi/firing.pngis excluded by!**/*.pngResources/Textures/White/MechComp/teleport.rsi/glow(unused).pngis excluded by!**/*.pngResources/Textures/White/MechComp/teleport.rsi/icon.pngis excluded by!**/*.pngResources/Textures/White/MechComp/teleport.rsi/ready.pngis excluded by!**/*.pngResources/Textures/White/MechComp/transeiver.rsi/anchored.pngis excluded by!**/*.pngResources/Textures/White/MechComp/transeiver.rsi/blink.pngis excluded by!**/*.pngResources/Textures/White/MechComp/transeiver.rsi/icon.pngis excluded by!**/*.png
Files selected for processing (39)
- Content.Client/UserInterface/Controls/DialogWindow.xaml.cs (7 hunks)
- Content.Client/_White/MechComp/MechCompSystem.cs (1 hunks)
- Content.Server/Administration/QuickDialogSystem.OpenDialog.cs (2 hunks)
- Content.Server/Administration/QuickDialogSystem.cs (8 hunks)
- Content.Server/Chemistry/EntitySystems/ReagentDispenserSystem.cs (4 hunks)
- Content.Server/DeviceLinking/Events/DeviceLinkTryConnectingAttemptEvent.cs (1 hunks)
- Content.Server/DeviceLinking/NetworkPayloadHelper.cs (1 hunks)
- Content.Server/DeviceLinking/Systems/DeviceLinkSystem.cs (1 hunks)
- Content.Server/DeviceLinking/Systems/DoorSignalControlSystem.cs (1 hunks)
- Content.Server/DeviceLinking/Systems/EdgeDetectorSystem.cs (1 hunks)
- Content.Server/DeviceLinking/Systems/LogicGateSystem.cs (1 hunks)
- Content.Server/DeviceNetwork/DeviceNetworkConstants.cs (1 hunks)
- Content.Server/DeviceNetwork/Systems/NetworkConfiguratorSystem.cs (2 hunks)
- Content.Server/Entry/IgnoredComponents.cs (1 hunks)
- Content.Server/_White/MechComp/Devices/Button.cs (1 hunks)
- Content.Server/_White/MechComp/Devices/Calculator.cs (1 hunks)
- Content.Server/_White/MechComp/Devices/Comparer.cs (1 hunks)
- Content.Server/_White/MechComp/Devices/PressurePad.cs (1 hunks)
- Content.Server/_White/MechComp/Devices/Speaker.cs (1 hunks)
- Content.Server/_White/MechComp/Devices/Teleporter.cs (1 hunks)
- Content.Server/_White/MechComp/Devices/Transeiver.cs (1 hunks)
- Content.Server/_White/MechComp/DisconnectOnUnanchor.cs (1 hunks)
- Content.Server/_White/MechComp/MechCompDeviceSystem.cs (1 hunks)
- Content.Shared/Administration/QDEntry.cs (1 hunks)
- Content.Shared/Administration/QuickDialogOpenEvent.cs (2 hunks)
- Content.Shared/DeviceLinking/SharedDeviceLinkSystem.cs (1 hunks)
- Content.Shared/_White/MechComp/MechComp.cs (1 hunks)
- Resources/Prototypes/Entities/Objects/Devices/MechComp/generic_ports.yml (1 hunks)
- Resources/Prototypes/Entities/Objects/Devices/MechComp/ports.yml (1 hunks)
- Resources/Prototypes/Entities/Objects/Devices/MechComp/some.yml (1 hunks)
- Resources/Textures/White/MechComp/base.rsi/meta.json (1 hunks)
- Resources/Textures/White/MechComp/button.rsi/meta.json (1 hunks)
- Resources/Textures/White/MechComp/comparer.rsi/meta.json (1 hunks)
- Resources/Textures/White/MechComp/math.rsi/meta.json (1 hunks)
- Resources/Textures/White/MechComp/mechcomptool.rsi/meta.json (1 hunks)
- Resources/Textures/White/MechComp/pressurepad.rsi/meta.json (1 hunks)
- Resources/Textures/White/MechComp/speaker.rsi/meta.json (1 hunks)
- Resources/Textures/White/MechComp/teleport.rsi/meta.json (1 hunks)
- Resources/Textures/White/MechComp/transeiver.rsi/meta.json (1 hunks)
Files skipped from review due to trivial changes (7)
- Content.Server/DeviceNetwork/DeviceNetworkConstants.cs
- Content.Server/Entry/IgnoredComponents.cs
- Resources/Textures/White/MechComp/base.rsi/meta.json
- Resources/Textures/White/MechComp/button.rsi/meta.json
- Resources/Textures/White/MechComp/comparer.rsi/meta.json
- Resources/Textures/White/MechComp/math.rsi/meta.json
- Resources/Textures/White/MechComp/pressurepad.rsi/meta.json
Additional context used
yamllint
Resources/Prototypes/Entities/Objects/Devices/MechComp/ports.yml
[error] 16-16: trailing spaces
(trailing-spaces)
[warning] 23-23: too many blank lines
(3 > 2) (empty-lines)
[error] 48-48: trailing spaces
(trailing-spaces)
[error] 50-50: trailing spaces
(trailing-spaces)
[error] 51-51: trailing spaces
(trailing-spaces)
Resources/Prototypes/Entities/Objects/Devices/MechComp/some.yml
[warning] 30-30: too many blank lines
(3 > 2) (empty-lines)
[error] 83-83: trailing spaces
(trailing-spaces)
[error] 106-106: trailing spaces
(trailing-spaces)
[warning] 139-139: wrong indentation: expected 12 but found 10
(indentation)
[warning] 147-147: wrong indentation: expected 12 but found 10
(indentation)
[error] 167-167: no new line character at the end of file
(new-line-at-end-of-file)
Additional comments not posted (59)
Resources/Textures/White/MechComp/transeiver.rsi/meta.json (1)
1-28: LGTM!The JSON structure is valid and the animation states are well-defined.
Resources/Textures/White/MechComp/speaker.rsi/meta.json (1)
1-30: LGTM!The JSON structure is valid and the animation states are well-defined.
Resources/Textures/White/MechComp/teleport.rsi/meta.json (1)
1-47: LGTM!The JSON structure is valid and the animation states are well-defined.
Resources/Textures/White/MechComp/mechcomptool.rsi/meta.json (1)
1-41: LGTM!The JSON structure is valid and the animation states are well-defined.
Content.Server/DeviceLinking/Events/DeviceLinkTryConnectingAttemptEvent.cs (1)
1-22: LGTM! Consider adding cancellation reasons.The class is well-structured. Consider implementing the commented-out cancellation reason for enhanced functionality.
Content.Server/_White/MechComp/DisconnectOnUnanchor.cs (1)
11-33: Clarify the purpose of commented-out code.The entire code is commented out. If this is a placeholder or deprecated code, consider removing it. If it's intended for future use, add a comment explaining its purpose and any pending tasks.
Content.Server/DeviceLinking/Systems/EdgeDetectorSystem.cs (1)
30-30: LGTM! Verify usage ofTryGetState.The change to use
TryGetStateenhances readability. Ensure that all relevant parts of the codebase are updated to use this new method.Verification successful
Verify consistent usage of
TryGetStateacross the codebaseThe
TryGetStatemethod is used consistently across multiple files in the codebase. Here are some key locations where it appears:
Content.Server/DeviceLinking/Systems/EdgeDetectorSystem.csContent.Server/DeviceLinking/Systems/DoorSignalControlSystem.csContent.Server/DeviceLinking/Systems/LogicGateSystem.csContent.Client/_Ohio/UI/AnimatedBackgroundControl.csContent.Client/SprayPainter/SprayPainterSystem.csEnsure that all usages align with the intended logic and functionality of the
TryGetStatemethod.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify usage of the `TryGetState` method across the codebase. # Test: Search for the method usage. Expect: Consistent usage across the codebase. rg --type-add 'cs' --type 'cs' -w 'TryGetState'Length of output: 103
Script:
#!/bin/bash # Description: Verify usage of the `TryGetState` method across the codebase. # Test: Search for the method usage. Expect: Consistent usage across the codebase. rg -t cs -w 'TryGetState'Length of output: 2605
Content.Server/_White/MechComp/Devices/PressurePad.cs (1)
11-18: Ensure all event handlers are necessary.The
InitPressurePadmethod subscribes to multiple events. Ensure that each event handler is required for the functionality of the pressure pad. Unused or unnecessary event handlers should be removed to avoid potential performance issues.Content.Server/_White/MechComp/Devices/Speaker.cs (2)
23-28: Ensure default values are set appropriately.In
OnSpeakerInit, ensure that the default name is set correctly and that_link.EnsureSinkPortsis called with the correct parameters. This helps avoid issues with uninitialized or incorrectly initialized components.
42-56: Review signal handling logic for potential improvements.The
OnSpeakerSignalmethod handles signals and sends messages. Ensure that the cooldown logic is correctly implemented and that the message sending logic adheres to the expected behavior. Consider refactoring the message sending logic into a separate method for clarity.Content.Server/_White/MechComp/Devices/Transeiver.cs (2)
26-30: Ensure ID assignment logic is robust.In
OnTranseiverInit, ensure that the ID assignment logic is robust and handles edge cases. Consider logging or handling cases where the ID is outside the expected range.
42-54: Review signal propagation logic.The
OnTranseiverSignalReceivedmethod propagates signals to other components. Ensure that the logic correctly identifies and activates the target components. Consider adding logging for signal propagation events for easier debugging.Content.Server/_White/MechComp/Devices/Calculator.cs (1)
34-35: Ensure default mode is valid.In
OnMathInit, ensure that the default mode is valid and corresponds to a key in_mathFuncs. Consider logging a warning if the mode is not found and a default is assigned.Content.Shared/_White/MechComp/MechComp.cs (8)
15-17: LGTM!The
SharedMechCompDeviceSystemclass is appropriately defined as an abstract class, ready for future expansion.
19-24: LGTM!The
BaseMechCompComponentclass is simple and correctly configured with aDataField.
30-39: LGTM!The
MechCompButtonComponentclass is well-defined with appropriate fields for sound and signal configuration.
41-49: LGTM!The
MechCompSpeakerComponentclass is correctly configured with fields for animation and radio settings.
52-62: LGTM! Consider verifying teleport ID uniqueness.The
MechCompTeleportComponentclass is well-structured, but ensure teleport IDs are unique across instances to prevent conflicts.
84-92: LGTM! Ensure mode synchronization.The
MechCompMathComponentclass is correctly defined. Verify that the mode is synchronized with server-side operations.
96-103: LGTM!The
MechCompPressurePadComponentclass is straightforward and correctly configured.
106-118: LGTM! Ensure mode synchronization.The
MechCompComparerComponentclass is well-structured. Verify that the mode is synchronized with server-side operations.Content.Server/DeviceLinking/Systems/DoorSignalControlSystem.cs (1)
40-40: Simplified state retrieval withTryGetState.The change to use
TryGetStateimproves readability and maintainability. Ensure thatTryGetStateis correctly implemented and used across the system.Verification successful
TryGetStateis correctly implemented and used across the system.The method
TryGetStateis implemented inContent.Server/DeviceLinking/NetworkPayloadHelper.csand is used in various places across the codebase, supporting the review comment's assertion about its readability and maintainability improvements.
- Implementation found in
Content.Server/DeviceLinking/NetworkPayloadHelper.cs.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the implementation of `TryGetState`. # Test: Search for the implementation of `TryGetState`. Expect: A method definition. rg --type python 'def TryGetState'Length of output: 67
Script:
#!/bin/bash # Description: Verify the implementation of `TryGetState` in C# files. # Test: Search for the implementation of `TryGetState`. Expect: A method definition. rg 'TryGetState' --type cs -A 5Length of output: 10205
Content.Shared/Administration/QuickDialogOpenEvent.cs (2)
155-157: NewOptionListentry type added.The addition of
OptionListtoQuickDialogEntryTypebroadens dialog capabilities. Ensure this type is supported in dialog implementations.
96-111: Enhanced dialog entry withInfoproperty.The addition of the
Infoproperty allows for more complex dialog controls. Ensure that this property is used correctly in dialog implementations.Verification successful
Infoproperty usage verified in dialog implementations.The
Infoproperty is being utilized in dialog-related code, confirming its integration for enhancing dialog entries with additional information. Notable usages include:
Content.Server/Administration/QuickDialogSystem.csContent.Client/UserInterface/Controls/DialogWindow.xaml.csScripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the usage of the `Info` property in dialog implementations. # Test: Search for the usage of `Info` in dialog-related code. Expect: Instances where `Info` is utilized. rg --type python '\.Info'Length of output: 58
Script:
#!/bin/bash # Description: Verify the usage of the `Info` property in dialog-related code within C# files. # Test: Search for the usage of `Info` in C# files. Expect: Instances where `Info` is utilized. rg --type cs '\.Info'Length of output: 23990
Content.Server/_White/MechComp/Devices/Teleporter.cs (4)
11-17: LGTM!The
InitTeleportmethod correctly initializes event subscriptions for teleportation components.
20-25: LGTM! Consider verifying teleport ID uniqueness.The
OnTeleportInitmethod is well-implemented. Ensure teleport IDs are unique across instances to prevent conflicts.
27-31: LGTM!The
OnTeleportConfigAttemptmethod correctly adds configuration entries for teleport components.
37-103: Verify signal handling and teleportation logic.The
OnTeleportSignalmethod is complex and handles various aspects of teleportation. Ensure correctness in signal parsing, target validation, and cooldown management.Content.Server/_White/MechComp/Devices/Comparer.cs (4)
11-17: LGTM!The
InitComparermethod correctly initializes event subscriptions for comparer components.
19-27: LGTM! Verify completeness of comparison modes.The
_compareFuncsdictionary is well-defined. Ensure all necessary comparison modes are included for the system's requirements.
48-57: LGTM!The
OnComparerConfigAttemptmethod correctly adds configuration entries for comparer components.
69-102: Verify signal handling and comparison evaluation.The
OnComparerSignalmethod processes signals and evaluates comparisons. Ensure correctness in signal handling and comparison logic.Content.Server/DeviceLinking/Systems/LogicGateSystem.cs (1)
101-101: EnsureTryGetStatemethod handles all expected cases.The change to use
TryGetStateinstead of a constant-based retrieval simplifies the code. Verify thatTryGetStatecan handle all expected signal states correctly.Verification successful
Verification Successful:
TryGetStateHandles Expected Signal StatesThe
TryGetStatemethod inContent.Server/DeviceLinking/NetworkPayloadHelper.csis implemented to manage different signal states by checking for both "logic_state" and "mechcomp_data". This ensures it handles expected cases appropriately.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Verify that `TryGetState` is implemented to handle all expected signal states. # Test: Search for the `TryGetState` implementation. Expect: The method should handle various signal states. ast-grep --lang csharp --pattern 'TryGetState(out $_)'Length of output: 56
Script:
#!/bin/bash # Search for the definition of the `TryGetState` method to verify its implementation. rg 'TryGetState' -A 10 --glob='*.cs'Length of output: 17137
Content.Server/DeviceLinking/Systems/DeviceLinkSystem.cs (1)
85-85: Confirm the usage of the newdataparameter inSignalReceivedEvent.The addition of the
dataparameter enriches the event payload. Ensure that all listeners ofSignalReceivedEventare updated to handle this new information.Content.Client/UserInterface/Controls/DialogWindow.xaml.cs (6)
39-39: Update theControlConstructordelegate.The addition of the
infoparameter allows for more flexible control setups. Ensure that all usages of this delegate are updated accordingly.
66-66: Ensureinfois correctly utilized in control setups.The
infoparameter is extracted fromQuickDialogEntry. Verify that this information is used effectively in control setups.
89-89: AddSetupRadioforOptionListentries.The new
SetupRadiomethod supportsOptionListentries, enhancing dialog flexibility. Ensure this method is complete and handles all necessary cases.
96-99: Review usage ofsetupmethod.The
setupmethod now includes theinfoparameter. Confirm that this parameter is used appropriately in all control setup methods.
Line range hint
170-217: Review changes to setup methods.The setup methods now include an additional parameter. Ensure that this parameter is used effectively and does not introduce any issues.
219-228: EnsureSetupRadiomethod is complete.The
SetupRadiomethod is introduced to handle radio button setups. Verify that it correctly processes theinfoparameter and populates options.Content.Server/Administration/QuickDialogSystem.cs (3)
121-123: LGTM!The use of the
infoparameter to handleOptionListentry types inTryParseQuickDialogListis appropriate and improves functionality.
202-214: LGTM!The implementation for the
OptionListentry type correctly utilizes theinfoparameter to validate input, enhancing the method's flexibility.
241-242: LGTM!Recognizing
List<string>asOptionListinTypeToEntryTypeis a necessary and well-implemented change to support the new entry type.Content.Client/_White/MechComp/MechCompSystem.cs (6)
30-33: LGTM!The
GetModemethod correctly uses the appearance system to retrieve the mode of a mechcomp device.
34-48: LGTM!The
_prepFlickAnimmethod is well-structured and effectively sets up an animation with the specified parameters.
51-64: LGTM!The event subscriptions in the
Initializemethod are appropriate for setting up the mechcomp system.
70-75: LGTM!The
OnButtonAppearanceChangemethod correctly handles appearance changes and plays the appropriate animation.
98-122: LGTM!The
OnTeleportAppearanceChangemethod is well-implemented, handling different modes and playing animations appropriately.
201-216: LGTM!The
SafePlayExt.SafePlaymethod is a useful addition for safely managing animations without conflicts.Content.Server/Chemistry/EntitySystems/ReagentDispenserSystem.cs (1)
59-59: LGTM!Subscribing to
SignalReceivedEventin theInitializemethod is a logical extension for handling signals related to reagent dispensing.Content.Server/_White/MechComp/MechCompDeviceSystem.cs (6)
69-83: LGTM!The event subscriptions in the
Initializemethod are appropriate for setting up the mechcomp system.
91-121: LGTM!The
OpenMechCompConfigDialogmethod is well-structured and effectively uses the dialog system to open configuration dialogs.
144-156: LGTM!The
Cooldownmethod is correctly implemented, providing a convenient way to manage cooldowns for mechcomp devices.
196-208: LGTM!The
SendMechCompSignalmethod is well-implemented, ensuring signals are sent with the correct payload using the device link system.
267-274: LGTM!The
OnConnectUIAttemptmethod correctly checks if the component is anchored before allowing connections, ensuring proper functionality.
287-297: LGTM!The
OnAnchorStateChangedmethod is well-implemented, managing device links based on the anchor state of mechcomp components.Content.Shared/DeviceLinking/SharedDeviceLinkSystem.cs (1)
368-378: LGTM!The
RemoveAllFromSourcemethod is well-implemented, providing useful functionality for managing device links by removing all links from a given source entity.Content.Server/Administration/QuickDialogSystem.OpenDialog.cs (1)
575-582: LGTM! Verify the usage of the newQDEntrytype.The transition from tuples to
QDEntryobjects enhances readability and type safety. Ensure that all usages of this method and theQDEntrytype are updated accordingly across the codebase.Verification successful
Verification Successful: Consistent Usage of
OpenDialogandQDEntryThe transition to using the
QDEntrytype in theOpenDialogmethod has been consistently applied across the codebase. The implicit operators inQDEntryensure backward compatibility and ease of use. All instances ofOpenDialogreflect the new method signature. No further action is required.
QDEntryis defined and used consistently inContent.Shared/Administration/QDEntry.cs.OpenDialogusages in various files align with the new method signature.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify all usages of the `OpenDialog` method and `QDEntry` type in the codebase. # Test: Search for the `OpenDialog` method usage. Expect: Only occurrences with the new signature. rg --type cs 'OpenDialog\(' # Test: Search for the `QDEntry` type usage. Expect: Consistent usage across the codebase. rg --type cs 'QDEntry'Length of output: 3719
Content.Server/DeviceNetwork/Systems/NetworkConfiguratorSystem.cs (1)
166-172: LGTM! Verify the event handling logic.The addition of
DeviceLinkTryConnectingAttemptEventprovides a robust mechanism for controlling device linking attempts. Ensure that the event is handled appropriately in all relevant parts of the codebase.Verification successful
Event Handling Logic Verified
The
OnConnectUIAttemptmethod effectively handles theDeviceLinkTryConnectingAttemptEventby ensuring that only anchored components can proceed with linking. This implementation aligns with the intended functionality of the event, providing robust control over the linking process. No further action is required.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the handling of `DeviceLinkTryConnectingAttemptEvent` across the codebase. # Test: Search for the event handling. Expect: Proper handling logic in relevant event subscribers. rg --type cs 'DeviceLinkTryConnectingAttemptEvent'Length of output: 941
Script:
#!/bin/bash # Description: Retrieve the implementation of the OnConnectUIAttempt method to verify the handling of the DeviceLinkTryConnectingAttemptEvent. ast-grep --lang cs --pattern 'private void OnConnectUIAttempt($_, $_, DeviceLinkTryConnectingAttemptEvent $_) { $$$ }'Length of output: 120
Script:
#!/bin/bash # Description: Search for the implementation of the OnConnectUIAttempt method using rg. rg --type cs 'OnConnectUIAttempt'Length of output: 436
Script:
#!/bin/bash # Description: Extract the implementation of the OnConnectUIAttempt method with context lines. rg --type cs 'private void OnConnectUIAttempt' -A 20Length of output: 2180
|
|
||
| private void OnButtonInit(EntityUid uid, MechCompButtonComponent comp, ComponentInit args) | ||
| { | ||
| _link.EnsureSourcePorts(uid, "MechCompStandardOutput"); |
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.
Use constants for signal strings.
Consider using constants for signal strings like "MechCompStandardOutput" to improve maintainability and reduce the risk of typos.
private const string MechCompStandardOutputSignal = "MechCompStandardOutput";
// Usage
_link.EnsureSourcePorts(uid, MechCompStandardOutputSignal);
SendMechCompSignal(uid, MechCompStandardOutputSignal, comp.outSignal);Also applies to: 45-45
| public void OnPressurePadConfigAttempt(EntityUid uid, MechCompPressurePadComponent comp, MechCompConfigAttemptEvent args) | ||
| { | ||
| args.entries.Add((typeof(bool), "Реагировать на существ", comp.reactToMobs)); | ||
| args.entries.Add((typeof(bool), "Реагировать на предметы", comp.reactToItems)); | ||
| } |
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.
Consider localization for configuration entries.
The configuration entries for the pressure pad use hardcoded strings in Russian. Consider using a localization system to support multiple languages and improve accessibility.
args.entries.Add((typeof(bool), Loc.GetString("react-to-mobs"), comp.reactToMobs));
args.entries.Add((typeof(bool), Loc.GetString("react-to-items"), comp.reactToItems));| if (HasComp<MobStateComponent>(args.Tripper) && comp.reactToMobs) | ||
| { | ||
| SendMechCompSignal(uid, "MechCompStandardOutput", Comp<MetaDataComponent>(args.Tripper).EntityName); | ||
| return; | ||
| } | ||
| if (HasComp<ItemComponent>(args.Tripper) && comp.reactToItems) | ||
| { | ||
| SendMechCompSignal(uid, "MechCompStandardOutput", Comp<MetaDataComponent>(args.Tripper).EntityName); | ||
| return; | ||
| } |
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 duplicate logic in step handling.
The logic for sending a mechcomp signal is duplicated for both mobs and items. Consider refactoring this into a helper method to improve maintainability and reduce code duplication.
private void HandleStep(EntityUid uid, MechCompPressurePadComponent comp, EntityUid tripper, bool condition)
{
if (condition)
{
SendMechCompSignal(uid, "MechCompStandardOutput", Comp<MetaDataComponent>(tripper).EntityName);
}
}
// Usage
if (HasComp<MobStateComponent>(args.Tripper))
{
HandleStep(uid, comp, args.Tripper, comp.reactToMobs);
}
else if (HasComp<ItemComponent>(args.Tripper))
{
HandleStep(uid, comp, args.Tripper, comp.reactToItems);
}| args.entries.Add((typeof(bool), "Голосить в радио (;)", comp.inRadio)); | ||
| args.entries.Add((typeof(string), "Имя", comp.name)); | ||
| } |
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.
Consider localization for configuration entries.
The configuration entries for the speaker use hardcoded strings in Russian. Consider using a localization system to support multiple languages and improve accessibility.
args.entries.Add((typeof(bool), Loc.GetString("speak-in-radio"), comp.inRadio));
args.entries.Add((typeof(string), Loc.GetString("name"), comp.name));| public QDEntry(Type? type, string description, object? Value = null, object? info = null) | ||
| { | ||
| this.type = type; | ||
| this.description = description; | ||
| this.Value = Value; | ||
| this.info = info; | ||
| } |
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.
Validate constructor parameters.
Consider adding validation for the constructor parameters to ensure that type, description, and Value are set to appropriate values. This can prevent potential errors when using the QDEntry class.
public QDEntry(Type? type, string description, object? Value = null, object? info = null)
{
if (type == null && Value != null)
throw new ArgumentException("Value must be null if type is null.", nameof(Value));
this.type = type;
this.description = description;
this.Value = Value;
this.info = info;
}| private Dictionary<string, Func<float, float, float?>> _mathFuncs = new() | ||
| { | ||
| ["A+B"] = (a, b) => { return a + b; }, | ||
| ["A-B"] = (a, b) => { return a - b; }, | ||
| ["A*B"] = (a, b) => { return a * b; }, | ||
| ["A/B"] = (a, b) => { if (b == 0) return null; return a / b; }, | ||
| ["A^B"] = (a, b) => { return MathF.Pow(a, b); }, | ||
| ["A//B"] = (a, b) => { return (float) (int) (a / b); }, | ||
| ["A%B"] = (a, b) => { return a % b; }, | ||
| ["sin(A)^B"] = (a, b) => { return MathF.Pow(MathF.Sin(a), b); }, | ||
| ["cos(A)^B"] = (a, b) => { return MathF.Pow(MathF.Cos(a), b); } | ||
| }; |
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.
Consider handling division by zero more gracefully.
In the _mathFuncs dictionary, the division operation returns null for division by zero. Consider logging a warning or providing a default value to prevent potential issues.
["A/B"] = (a, b) => { if (b == 0) { Log.Warning("Division by zero."); return 0; } return a / b; },| string sig; float num; // hurr durr | ||
| switch (args.Port) | ||
| { | ||
| case "MechCompNumericInputA": | ||
| if(TryGetMechCompSignal(args.Data, out sig) && float.TryParse(sig, out num)) | ||
| { | ||
| comp.A = num; | ||
| } | ||
| break; | ||
| case "MechCompNumericInputB": | ||
| if (TryGetMechCompSignal(args.Data, out sig) && float.TryParse(sig, out num)) | ||
| { | ||
| comp.B = num; | ||
| } | ||
| break; | ||
| case "Trigger": | ||
| float? result = _mathFuncs[comp.mode](comp.A, comp.B); | ||
| if (result != null) | ||
| { | ||
| SendMechCompSignal(uid, "MechCompNumericOutput", result.ToString()!); | ||
| } | ||
| break; | ||
| } |
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 signal handling logic for clarity.
The OnMathSignal method handles different signal ports. Consider refactoring the logic into separate methods for each port to improve clarity and maintainability.
private void HandleNumericInputA(EntityUid uid, MechCompMathComponent comp, string data)
{
if (float.TryParse(data, out var num))
{
comp.A = num;
}
}
private void HandleNumericInputB(EntityUid uid, MechCompMathComponent comp, string data)
{
if (float.TryParse(data, out var num))
{
comp.B = num;
}
}
private void HandleTrigger(EntityUid uid, MechCompMathComponent comp)
{
float? result = _mathFuncs[comp.mode](comp.A, comp.B);
if (result != null)
{
SendMechCompSignal(uid, "MechCompNumericOutput", result.ToString()!);
}
}
// Usage
switch (args.Port)
{
case "MechCompNumericInputA":
if (TryGetMechCompSignal(args.Data, out var sig))
HandleNumericInputA(uid, comp, sig);
break;
case "MechCompNumericInputB":
if (TryGetMechCompSignal(args.Data, out var sig))
HandleNumericInputB(uid, comp, sig);
break;
case "Trigger":
HandleTrigger(uid, comp);
break;
}| private void OnSignalReceived(EntityUid uid, ReagentDispenserComponent component, ref SignalReceivedEvent args) | ||
| { | ||
| //if (args.Data != null && args.Data.TryGetValue("mechcomp_data", out string? signal)) | ||
| //{ | ||
| // string[] arr = signal!.Split('='); // expecting signal of format reagentname=volume | ||
| // if (arr.Length != 2) return; | ||
| // if (!GetInventory((uid, component)).Contains(arr[0])) return; | ||
| // if (!int.TryParse(arr[1], out var num) || num <= 0) return; | ||
| // // todo: how the fuck do i make it piss out potassium??? | ||
| //} | ||
| } |
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.
Consider implementing the signal handling logic.
The OnSignalReceived method is currently commented out. Implementing this logic will enable dynamic reagent management based on incoming signals.
|
@coderabbitai configuration |
CodeRabbit configurationlanguage: en-US
tone_instructions: ''
early_access: false
enable_free_tier: true
reviews:
profile: chill
request_changes_workflow: false
high_level_summary: true
high_level_summary_placeholder: '@coderabbitai summary'
auto_title_placeholder: '@coderabbitai'
review_status: true
poem: true
collapse_walkthrough: false
sequence_diagrams: true
changed_files_summary: true
labeling_instructions: []
path_filters: []
path_instructions: []
abort_on_close: true
auto_review:
enabled: true
auto_incremental_review: true
ignore_title_keywords: []
labels: []
drafts: false
base_branches: []
tools:
shellcheck:
enabled: true
ruff:
enabled: true
markdownlint:
enabled: true
github-checks:
enabled: true
timeout_ms: 90000
languagetool:
enabled: true
enabled_only: false
level: default
biome:
enabled: true
hadolint:
enabled: true
swiftlint:
enabled: true
phpstan:
enabled: true
level: default
golangci-lint:
enabled: true
yamllint:
enabled: true
gitleaks:
enabled: true
checkov:
enabled: true
detekt:
enabled: true
eslint:
enabled: true
rubocop:
enabled: true
buf:
enabled: true
regal:
enabled: true
actionlint:
enabled: true
pmd:
enabled: true
cppcheck:
enabled: true
semgrep:
enabled: true
circleci:
enabled: true
chat:
auto_reply: true
knowledge_base:
opt_out: false
learnings:
scope: auto
issues:
scope: auto
jira:
project_keys: []
linear:
team_keys: []
pull_requests:
scope: auto
|
|
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
Описание PR
Скриншоты
mechcock.webm
Чек-лист:
typo:
Changelog
🆑
Summary by CodeRabbit
Новые функции
Исправления ошибок
Документация
Задачи