Make projectiles not hit crates unless clicked on (#28072)
This commit is contained in:
@@ -46,7 +46,6 @@ public partial class MobStateSystem
|
||||
SubscribeLocalEvent<MobStateComponent, TryingToSleepEvent>(OnSleepAttempt);
|
||||
SubscribeLocalEvent<MobStateComponent, CombatModeShouldHandInteractEvent>(OnCombatModeShouldHandInteract);
|
||||
SubscribeLocalEvent<MobStateComponent, AttemptPacifiedAttackEvent>(OnAttemptPacifiedAttack);
|
||||
SubscribeLocalEvent<MobStateComponent, PreventCollideEvent>(OnPreventCollide);
|
||||
}
|
||||
|
||||
private void OnStateExitSubscribers(EntityUid target, MobStateComponent component, MobState state)
|
||||
@@ -179,21 +178,5 @@ public partial class MobStateSystem
|
||||
args.Cancelled = true;
|
||||
}
|
||||
|
||||
private void OnPreventCollide(Entity<MobStateComponent> ent, ref PreventCollideEvent args)
|
||||
{
|
||||
if (args.Cancelled)
|
||||
return;
|
||||
|
||||
if (IsAlive(ent, ent))
|
||||
return;
|
||||
|
||||
var other = args.OtherEntity;
|
||||
if (HasComp<ProjectileComponent>(other) &&
|
||||
CompOrNull<TargetedProjectileComponent>(other)?.Target != ent.Owner)
|
||||
{
|
||||
args.Cancelled = true;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user