[Fix] Unpunchable Mouse Bug
Description
Fix bug that causes mice not be punchable, take 2. As described by this issue.
Media
https://private-user-images.githubusercontent.com/112904295/421005549-300bf922-d296-4549-a1b2-af7081a155c9.mp4?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3NDE2MzIxOTEsIm5iZiI6MTc0MTYzMTg5MSwicGF0aCI6Ii8xMTI5MDQyOTUvNDIxMDA1NTQ5LTMwMGJmOTIyLWQyOTYtNDU0OS1hMWIyLWFmNzA4MWExNTVjOS5tcDQ_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjUwMzEwJTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI1MDMxMFQxODM4MTFaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT1mYTMyZTMzODk0NjAxMjBlMjlmODRmNmFmN2FmZjc2MDVlNjJhZjY2MzlhOGI5ZjE0M2ZlNmE3MTE5Nzc4YWExJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.gygRlvUJbohK1BWfMEBOSsCMW3hpEJ1_auG4aB7Bru8
Changelog
:cl:
- fix: Now you can punch mice!
Walkthrough
The pull request modifies the logic in the OnCombatModeShouldHandInteract method of the mob state system to prioritize hand interactions based on the mob's state. The changes introduce a new boolean field, AllowHandInteractWhileAlive, to the MobStateComponent class, allowing for configuration of hand interactions while the mob is alive. No alterations were made to public or exported entities.
Changes
| File(s) | Change Summary |
|---|---|
Content.Shared/Mobs/Systems/MobStateSystem.Subscribers.cs |
Modified OnCombatModeShouldHandInteract to prioritize Critical state and allow hand interactions based on new conditions. |
Content.Shared/Mobs/Components/MobStateComponent.cs |
Added new boolean field AllowHandInteractWhileAlive initialized to false for configuring hand interactions in the Alive state. |
Suggested reviewers
- Remuchi
- sleepyyapril
- VMSolidus
Poem
In the code of our fleet, a new light does shine,
With states realigned, our logic's divine.
Alive and critical, hand interactions flow,
A streamlined approach, watch our efficiency grow!
Hail to the changes, in unity we stand,
For the freedom of code, we’ll always command!
📜 Recent review details
Configuration used: CodeRabbit UI Review profile: CHILL Plan: Pro
📥 Commits
Reviewing files that changed from the base of the PR and between 01c560a68f1950b10c221c7731a5248df2a1fc3b and e6feebdfb008c9d5a437fb677a094fa2cb7f42b5.
📒 Files selected for processing (1)
Content.Shared/Mobs/Components/MobStateComponent.cs(1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
- Content.Shared/Mobs/Components/MobStateComponent.cs
⏰ Context from checks skipped due to timeout of 90000ms (6)
- GitHub Check: build (ubuntu-latest)
- GitHub Check: Test Packaging
- GitHub Check: build (ubuntu-latest)
- GitHub Check: YAML map schema validator
- GitHub Check: YAML Linter
- GitHub Check: YAML RGA schema validator
🪧 Tips
Chat
There are 3 ways to chat with CodeRabbit:
- Review comments: Directly reply to a review comment made by CodeRabbit. Example:
I pushed a fix in commit <commit_id>, please review it.Generate unit testing code for this file.Open a follow-up GitHub issue for this discussion.
- Files and specific lines of code (under the "Files changed" tab): Tag
@coderabbitaiin a new review comment at the desired location with your query. Examples:@coderabbitai generate unit testing code for this file.@coderabbitai modularize this function.
- PR comments: Tag
@coderabbitaiin a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:@coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.@coderabbitai read src/utils.ts and generate unit testing code.@coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.@coderabbitai help me debug CodeRabbit configuration file.
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)
@coderabbitai pauseto pause the reviews on a PR.@coderabbitai resumeto resume the paused reviews.@coderabbitai reviewto trigger an incremental review. This is useful when automatic reviews are disabled for the repository.@coderabbitai full reviewto do a full review from scratch and review all the files again.@coderabbitai summaryto regenerate the summary of the PR.@coderabbitai generate docstringsto generate docstrings for this PR.@coderabbitai resolveresolve all the CodeRabbit review comments.@coderabbitai configurationto show the current CodeRabbit configuration for the repository.@coderabbitai helpto get help.
Other keywords and placeholders
- Add
@coderabbitai ignoreanywhere in the PR description to prevent this PR from being reviewed. - Add
@coderabbitai summaryto generate the high-level summary at a specific location in the PR description. - Add
@coderabbitaianywhere in the PR title to generate the title automatically.
CodeRabbit Configuration File (.coderabbit.yaml)
- You can programmatically configure CodeRabbit by adding a
.coderabbit.yamlfile to the root of your repository. - Please see the configuration documentation for more information.
- If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation:
# yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json
Documentation and Community
- Visit our Documentation for detailed information on how to use CodeRabbit.
- Join our Discord Community to get help, request features, and share feedback.
- Follow us on X/Twitter for updates and announcements.
why make another pr?
Because the last one's code had bad formatting and the tests failed
you can edit the last one
Okay, I didn't know.
Ack Heisen test. Random crash, nothing wrong with your code it just does that sometimes. You did pass 359 others though.
okay, just got home, the code seems to be working just fine at least for me.
That's the reason why it's impossible punch mice. What is the reason for these existing anyway? I could simply move the mobstate checks to the bottom of the code if that works, something like:
// Disallow empty-hand-interacting in combat mode
// for non-dead mobs
if (!IsDead(uid, component))
args.Cancelled = true;
if (component.CurrentState is MobState.Alive
|| component.CurrentState is MobState.Critical
&& component.AllowHandInteractWhileCrit
|| component.CurrentState is MobState.SoftCritical
&& component.AllowHandInteractWhileSoftCrit
|| component.CurrentState is MobState.Dead
&& component.AllowHandInteractWhileDead)
return;
args.Cancelled = true;
wait hold on, i think i know a way of doing this without nuking this code, give me a minute
I managed to do it using another way but its causing visual glitching (i think it's here even before I touched this code), it's causing the harm animation to play without the target being damaged. I should flag this as an issue.
I just edited the PR.
https://github.com/user-attachments/assets/9a850d02-87aa-4845-bb75-0f53582a4689
@AlgumCorrupto What is the current status of this PR? I see you've pushed some new changes to the PR after your last video, could you record a new clip?