Class MobStateSystem
Inheritance
Namespace: Content.Shared.Mobs.Systems
Assembly: Content.Shared.dll
Syntax
public class MobStateSystem : EntitySystem
Methods
| Improve this Doc View SourceChangeMobState(EntityUid, MobState, MobStateComponent, Nullable<EntityUid>)
Change the MobState and trigger MobState update events
Declaration
public void ChangeMobState(EntityUid entity, MobState mobState, MobStateComponent component = null, EntityUid? origin = null)
Parameters
Type | Name | Description |
---|---|---|
EntityUid | entity | Target Entity we want to change the MobState of |
MobState | mobState | The new MobState we want to set |
MobStateComponent | component | MobState Component attached to the entity |
System.Nullable<EntityUid> | origin | Entity that caused the state update (if applicable) |
HasState(EntityUid, MobState, MobStateComponent)
Check if an Entity can be set to a particular MobState
Declaration
public bool HasState(EntityUid entity, MobState mobState, MobStateComponent component = null)
Parameters
Type | Name | Description |
---|---|---|
EntityUid | entity | Target Entity |
MobState | mobState | MobState to check |
MobStateComponent | component | MobState Component owned by the target |
Returns
Type | Description |
---|---|
System.Boolean | If the entity can be set to that MobState |
Initialize()
Declaration
public override void Initialize()
IsAlive(EntityUid, MobStateComponent)
Check if a Mob is Alive
Declaration
public bool IsAlive(EntityUid target, MobStateComponent component = null)
Parameters
Type | Name | Description |
---|---|---|
EntityUid | target | Target Entity |
MobStateComponent | component | The MobState component owned by the target |
Returns
Type | Description |
---|---|
System.Boolean | If the entity is alive |
IsCritical(EntityUid, MobStateComponent)
Check if a Mob is Critical
Declaration
public bool IsCritical(EntityUid target, MobStateComponent component = null)
Parameters
Type | Name | Description |
---|---|---|
EntityUid | target | Target Entity |
MobStateComponent | component | The MobState component owned by the target |
Returns
Type | Description |
---|---|
System.Boolean | If the entity is Critical |
IsDead(EntityUid, MobStateComponent)
Check if a Mob is Dead
Declaration
public bool IsDead(EntityUid target, MobStateComponent component = null)
Parameters
Type | Name | Description |
---|---|---|
EntityUid | target | Target Entity |
MobStateComponent | component | The MobState component owned by the target |
Returns
Type | Description |
---|---|
System.Boolean | If the entity is Dead |
IsIncapacitated(EntityUid, MobStateComponent)
Check if a Mob is Critical or Dead
Declaration
public bool IsIncapacitated(EntityUid target, MobStateComponent component = null)
Parameters
Type | Name | Description |
---|---|---|
EntityUid | target | Target Entity |
MobStateComponent | component | The MobState component owned by the target |
Returns
Type | Description |
---|---|
System.Boolean | If the entity is Critical or Dead |
IsInvalidState(EntityUid, MobStateComponent)
Check if a Mob is in an Invalid state
Declaration
public bool IsInvalidState(EntityUid target, MobStateComponent component = null)
Parameters
Type | Name | Description |
---|---|---|
EntityUid | target | Target Entity |
MobStateComponent | component | The MobState component owned by the target |
Returns
Type | Description |
---|---|
System.Boolean | If the entity is in an Invalid State |
OnEnterState(EntityUid, MobStateComponent, MobState)
Called when a new MobState is entered.
Declaration
protected virtual void OnEnterState(EntityUid entity, MobStateComponent component, MobState state)
Parameters
Type | Name | Description |
---|---|---|
EntityUid | entity | The owner of the MobState Component |
MobStateComponent | component | MobState Component owned by the target |
MobState | state | The new MobState |
OnExitState(EntityUid, MobStateComponent, MobState)
Called when a new MobState is exited.
Declaration
protected virtual void OnExitState(EntityUid entity, MobStateComponent component, MobState state)
Parameters
Type | Name | Description |
---|---|---|
EntityUid | entity | The owner of the MobState Component |
MobStateComponent | component | MobState Component owned by the target |
MobState | state | The old MobState |
OnStateChanged(EntityUid, MobStateComponent, MobState, MobState)
Called when this entity changes MobState
Declaration
protected virtual void OnStateChanged(EntityUid entity, MobStateComponent component, MobState oldState, MobState newState)
Parameters
Type | Name | Description |
---|---|---|
EntityUid | entity | The owner of the MobState Component |
MobStateComponent | component | MobState Component owned by the target |
MobState | oldState | The previous MobState |
MobState | newState | The new MobState |
UpdateMobState(EntityUid, MobStateComponent, Nullable<EntityUid>)
Run a MobState update check. This will trigger update events if the state has been changed.
Declaration
public void UpdateMobState(EntityUid entity, MobStateComponent component = null, EntityUid? origin = null)
Parameters
Type | Name | Description |
---|---|---|
EntityUid | entity | Target Entity we want to change the MobState of |
MobStateComponent | component | MobState Component attached to the entity |
System.Nullable<EntityUid> | origin | Entity that caused the state update (if applicable) |