Turn interaction related attempt events into structs (#29168)
* Turn InteractionAttemptEvent into a struct event * readonly * GettingInteractedWithAttemptEvent * ConsciousAttemptEvent
This commit is contained in:
@@ -31,7 +31,7 @@ public partial class MobStateSystem
|
||||
SubscribeLocalEvent<MobStateComponent, ChangeDirectionAttemptEvent>(CheckAct);
|
||||
SubscribeLocalEvent<MobStateComponent, UseAttemptEvent>(CheckAct);
|
||||
SubscribeLocalEvent<MobStateComponent, AttackAttemptEvent>(CheckAct);
|
||||
SubscribeLocalEvent<MobStateComponent, ConsciousAttemptEvent>(CheckAct);
|
||||
SubscribeLocalEvent<MobStateComponent, ConsciousAttemptEvent>(CheckConcious);
|
||||
SubscribeLocalEvent<MobStateComponent, ThrowAttemptEvent>(CheckAct);
|
||||
SubscribeLocalEvent<MobStateComponent, SpeakAttemptEvent>(OnSpeakAttempt);
|
||||
SubscribeLocalEvent<MobStateComponent, IsEquippingAttemptEvent>(OnEquipAttempt);
|
||||
@@ -48,6 +48,17 @@ public partial class MobStateSystem
|
||||
SubscribeLocalEvent<MobStateComponent, AttemptPacifiedAttackEvent>(OnAttemptPacifiedAttack);
|
||||
}
|
||||
|
||||
private void CheckConcious(Entity<MobStateComponent> ent, ref ConsciousAttemptEvent args)
|
||||
{
|
||||
switch (ent.Comp.CurrentState)
|
||||
{
|
||||
case MobState.Dead:
|
||||
case MobState.Critical:
|
||||
args.Cancelled = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void OnStateExitSubscribers(EntityUid target, MobStateComponent component, MobState state)
|
||||
{
|
||||
switch (state)
|
||||
|
||||
Reference in New Issue
Block a user