Class MobThresholdSystem
Inheritance
Namespace: Content.Shared.Mobs.Systems
Assembly: Content.Shared.dll
Syntax
public sealed class MobThresholdSystem : EntitySystem
Methods
| Improve this Doc View SourceGetScaledDamage(EntityUid, EntityUid, out DamageSpecifier)
Takes the damage from one entity and scales it relative to the health of another
Declaration
public bool GetScaledDamage(EntityUid target1, EntityUid target2, out DamageSpecifier damage)
Parameters
Type | Name | Description |
---|---|---|
EntityUid | target1 | The entity whose damage will be scaled |
EntityUid | target2 | The entity whose health the damage will scale to |
DamageSpecifier | damage | The newly scaled damage. Can be null |
Returns
Type | Description |
---|---|
System.Boolean |
GetThresholdForState(EntityUid, MobState, MobThresholdsComponent)
Get the Damage Threshold for the appropriate state if it exists
Declaration
public FixedPoint2 GetThresholdForState(EntityUid target, MobState mobState, MobThresholdsComponent thresholdComponent = null)
Parameters
Type | Name | Description |
---|---|---|
EntityUid | target | Target Entity |
MobState | mobState | MobState we want the Damage Threshold of |
MobThresholdsComponent | thresholdComponent | Threshold Component Owned by the target |
Returns
Type | Description |
---|---|
FixedPoint2 | the threshold or 0 if it doesn't exist |
Initialize()
Declaration
public override void Initialize()
SetAllowRevives(EntityUid, Boolean, MobThresholdsComponent)
Declaration
public void SetAllowRevives(EntityUid uid, bool val, MobThresholdsComponent component = null)
Parameters
Type | Name | Description |
---|---|---|
EntityUid | uid | |
System.Boolean | val | |
MobThresholdsComponent | component |
SetMobStateThreshold(EntityUid, FixedPoint2, MobState, MobThresholdsComponent)
Set a MobState Threshold or create a new one if it doesn't exist
Declaration
public void SetMobStateThreshold(EntityUid target, FixedPoint2 damage, MobState mobState, MobThresholdsComponent threshold = null)
Parameters
Type | Name | Description |
---|---|---|
EntityUid | target | Target Entity |
FixedPoint2 | damage | Damageable Component owned by the target |
MobState | mobState | MobState Component owned by the target |
MobThresholdsComponent | threshold | MobThreshold Component owned by the target |
TryGetDeadPercentage(EntityUid, FixedPoint2, out Nullable<FixedPoint2>, MobThresholdsComponent)
Try to get a percentage of the Damage Threshold for death
Declaration
public bool TryGetDeadPercentage(EntityUid target, FixedPoint2 damage, out FixedPoint2? percentage, MobThresholdsComponent thresholdComponent = null)
Parameters
Type | Name | Description |
---|---|---|
EntityUid | target | Target Entity |
FixedPoint2 | damage | The damage being applied |
System.Nullable<FixedPoint2> | percentage | Percentage of Damage compared to the Death Threshold |
MobThresholdsComponent | thresholdComponent | Threshold Component Owned by the target |
Returns
Type | Description |
---|---|
System.Boolean | true if successfully retrieved death percentage |
TryGetDeadThreshold(EntityUid, out Nullable<FixedPoint2>, MobThresholdsComponent)
Try to get the Damage Threshold for death
Declaration
public bool TryGetDeadThreshold(EntityUid target, out FixedPoint2? threshold, MobThresholdsComponent thresholdComponent = null)
Parameters
Type | Name | Description |
---|---|---|
EntityUid | target | Target Entity |
System.Nullable<FixedPoint2> | threshold | The Damage Threshold for death |
MobThresholdsComponent | thresholdComponent | Threshold Component owned by the target |
Returns
Type | Description |
---|---|
System.Boolean | true if successfully retrieved incapacitation threshold |
TryGetIncapPercentage(EntityUid, FixedPoint2, out Nullable<FixedPoint2>, MobThresholdsComponent)
Try to get a percentage of the Damage Threshold for crit or death. Outputs the first found percentage.
Declaration
public bool TryGetIncapPercentage(EntityUid target, FixedPoint2 damage, out FixedPoint2? percentage, MobThresholdsComponent thresholdComponent = null)
Parameters
Type | Name | Description |
---|---|---|
EntityUid | target | Target Entity |
FixedPoint2 | damage | The damage being applied |
System.Nullable<FixedPoint2> | percentage | Percentage of Damage compared to the Incapacitation Threshold |
MobThresholdsComponent | thresholdComponent | Threshold Component Owned by the target |
Returns
Type | Description |
---|---|
System.Boolean | true if successfully retrieved incapacitation percentage |
TryGetIncapThreshold(EntityUid, out Nullable<FixedPoint2>, MobThresholdsComponent)
Try to get the Damage Threshold for crit or death. Outputs the first found threshold.
Declaration
public bool TryGetIncapThreshold(EntityUid target, out FixedPoint2? threshold, MobThresholdsComponent thresholdComponent = null)
Parameters
Type | Name | Description |
---|---|---|
EntityUid | target | Target Entity |
System.Nullable<FixedPoint2> | threshold | The Damage Threshold for incapacitation |
MobThresholdsComponent | thresholdComponent | Threshold Component owned by the target |
Returns
Type | Description |
---|---|
System.Boolean | true if successfully retrieved incapacitation threshold |
TryGetNextState(EntityUid, MobState, out Nullable<MobState>, MobThresholdsComponent)
Gets the next available state for a mob.
Declaration
public bool TryGetNextState(EntityUid target, MobState mobState, out MobState? nextState, MobThresholdsComponent thresholdsComponent = null)
Parameters
Type | Name | Description |
---|---|---|
EntityUid | target | Target entity |
MobState | mobState | Supplied MobState |
System.Nullable<MobState> | nextState | The following MobState. Can be null if there isn't one. |
MobThresholdsComponent | thresholdsComponent | Threshold Component Owned by the target |
Returns
Type | Description |
---|---|
System.Boolean | True if the next mob state exists |
TryGetPercentageForState(EntityUid, MobState, FixedPoint2, out Nullable<FixedPoint2>, MobThresholdsComponent)
Try to get the a percentage of the Damage Threshold for the appropriate state if it exists
Declaration
public bool TryGetPercentageForState(EntityUid target, MobState mobState, FixedPoint2 damage, out FixedPoint2? percentage, MobThresholdsComponent thresholdComponent = null)
Parameters
Type | Name | Description |
---|---|---|
EntityUid | target | Target Entity |
MobState | mobState | MobState we want the Damage Threshold of |
FixedPoint2 | damage | The Damage being applied |
System.Nullable<FixedPoint2> | percentage | Percentage of Damage compared to the Threshold |
MobThresholdsComponent | thresholdComponent | Threshold Component Owned by the target |
Returns
Type | Description |
---|---|
System.Boolean | true if successfully retrieved a percentage |
TryGetThresholdForState(EntityUid, MobState, out Nullable<FixedPoint2>, MobThresholdsComponent)
Try to get the Damage Threshold for the appropriate state if it exists
Declaration
public bool TryGetThresholdForState(EntityUid target, MobState mobState, out FixedPoint2? threshold, MobThresholdsComponent thresholdComponent = null)
Parameters
Type | Name | Description |
---|---|---|
EntityUid | target | Target Entity |
MobState | mobState | MobState we want the Damage Threshold of |
System.Nullable<FixedPoint2> | threshold | The damage Threshold for the given state |
MobThresholdsComponent | thresholdComponent | Threshold Component Owned by the target |
Returns
Type | Description |
---|---|
System.Boolean | true if successfully retrieved a threshold |
VerifyThresholds(EntityUid, MobThresholdsComponent, MobStateComponent, DamageableComponent)
Checks to see if we should change states based on thresholds. Call this if you change the amount of damagable without triggering a damageChangedEvent or if you change
Declaration
public void VerifyThresholds(EntityUid target, MobThresholdsComponent threshold = null, MobStateComponent mobState = null, DamageableComponent damageable = null)
Parameters
Type | Name | Description |
---|---|---|
EntityUid | target | Target Entity |
MobThresholdsComponent | threshold | Threshold Component owned by the Target |
MobStateComponent | mobState | MobState Component owned by the Target |
DamageableComponent | damageable | Damageable Component owned by the Target |