-
Notifications
You must be signed in to change notification settings - Fork 195
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
Some MobState Refactoring #1382
Merged
VMSolidus
merged 6 commits into
Simple-Station:master
from
VMSolidus:refactor-MobState-in-prep-for-Soft-Crit
Jan 2, 2025
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
5e95c16
MobState Refactor Prep
VMSolidus 5e9495e
More touching stuffs
VMSolidus 7fe078c
CLEANUP
VMSolidus c764b0d
three state booleans my beloved
VMSolidus 9ccacac
Update TraitSystem.Functions.cs
VMSolidus ebdbcaa
Update Content.Shared/Mobs/MobState.cs
VMSolidus File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,105 @@ | ||
using Content.Shared.Damage; | ||
using Content.Shared.Mobs.Systems; | ||
using Robust.Shared.GameStates; | ||
using Robust.Shared.Serialization; | ||
|
||
namespace Content.Shared.Mobs.Components | ||
namespace Content.Shared.Mobs.Components; | ||
|
||
/// <summary> | ||
/// When attached to an <see cref="DamageableComponent"/>, | ||
/// this component will handle critical and death behaviors for mobs. | ||
/// Additionally, it handles sending effects to clients | ||
/// (such as blur effect for unconsciousness) and managing the health HUD. | ||
/// </summary> | ||
[RegisterComponent] | ||
[NetworkedComponent] | ||
[AutoGenerateComponentState] | ||
public sealed partial class MobStateComponent : Component | ||
{ | ||
/// <summary> | ||
/// When attached to an <see cref="DamageableComponent"/>, | ||
/// this component will handle critical and death behaviors for mobs. | ||
/// Additionally, it handles sending effects to clients | ||
/// (such as blur effect for unconsciousness) and managing the health HUD. | ||
/// </summary> | ||
[RegisterComponent] | ||
[NetworkedComponent] | ||
[AutoGenerateComponentState] | ||
[Access(typeof(MobStateSystem), typeof(MobThresholdSystem))] | ||
public sealed partial class MobStateComponent : Component | ||
{ | ||
//default mobstate is always the lowest state level | ||
[AutoNetworkedField, ViewVariables] | ||
public MobState CurrentState { get; set; } = MobState.Alive; | ||
|
||
[DataField] | ||
[AutoNetworkedField] | ||
public HashSet<MobState> AllowedStates = new() | ||
{ | ||
MobState.Alive, | ||
MobState.Critical, | ||
MobState.Dead | ||
}; | ||
} | ||
/// Whether this mob will be allowed to issue movement commands when in the Critical MobState. | ||
/// </summary> | ||
[DataField] | ||
public bool AllowMovementWhileCrit; | ||
|
||
/// <summary> | ||
/// Whether this mob will be allowed to issue movement commands when in the Soft-Crit MobState. | ||
/// </summary> | ||
[DataField] | ||
public bool AllowMovementWhileSoftCrit; | ||
|
||
/// <summary> | ||
/// Whether this mob will be allowed to issue movement commands when in the Dead MobState. | ||
/// This is provided for completeness sake, and *probably* shouldn't be used by default. | ||
/// </summary> | ||
[DataField] | ||
public bool AllowMovementWhileDead; | ||
|
||
/// <summary> | ||
/// Whether this mob will be allowed to talk while in the Critical MobState. | ||
/// </summary> | ||
[DataField] | ||
public bool AllowTalkingWhileCrit = true; | ||
|
||
/// <summary> | ||
/// Whether this mob will be allowed to talk while in the SoftCritical MobState. | ||
/// </summary> | ||
[DataField] | ||
public bool AllowTalkingWhileSoftCrit = true; | ||
|
||
/// <summary> | ||
/// Whether this mob will be allowed to talk while in the Dead MobState. | ||
/// This is provided for completeness sake, and *probably* shouldn't be used by default. | ||
/// </summary> | ||
[DataField] | ||
public bool AllowTalkingWhileDead; | ||
|
||
/// <summary> | ||
/// Whether this mob is forced to be downed when entering the Critical MobState. | ||
/// </summary> | ||
[DataField] | ||
public bool DownWhenCrit = true; | ||
|
||
/// <summary> | ||
/// Whether this mob is forced to be downed when entering the SoftCritical MobState. | ||
/// </summary> | ||
[DataField] | ||
public bool DownWhenSoftCrit = true; | ||
|
||
/// <summary> | ||
/// Whether this mob is forced to be downed when entering the Dead MobState. | ||
/// </summary> | ||
[DataField] | ||
public bool DownWhenDead = true; | ||
|
||
/// <summary> | ||
/// Whether this mob is allowed to perform hand interactions while in the Critical MobState. | ||
/// </summary> | ||
[DataField] | ||
public bool AllowHandInteractWhileCrit; | ||
|
||
/// <summary> | ||
/// Whether this mob is allowed to perform hand interactions while in the SoftCritical MobState. | ||
/// </summary> | ||
[DataField] | ||
public bool AllowHandInteractWhileSoftCrit; | ||
|
||
/// <summary> | ||
/// Whether this mob is allowed to perform hand interactions while in the Dead MobState. | ||
/// This is provided for completeness sake, and *probably* shouldn't be used by default. | ||
/// </summary> | ||
[DataField] | ||
public bool AllowHandInteractWhileDead; | ||
|
||
//default mobstate is always the lowest state level | ||
[AutoNetworkedField, ViewVariables] | ||
public MobState CurrentState { get; set; } = MobState.Alive; | ||
|
||
[DataField] | ||
[AutoNetworkedField] | ||
public HashSet<MobState> AllowedStates = new() | ||
{ | ||
MobState.Alive, | ||
MobState.Critical, | ||
MobState.SoftCritical, | ||
MobState.Dead | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
hate this, is there no better way?
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.
reflection could