/// <summary> /// Check if any thresholds were reached. if they were, execute them. /// </summary> public void Execute(EntityUid uid, DestructibleComponent component, DamageChangedEvent args) { foreach (var threshold in component.Thresholds) { if (threshold.Reached(args.Damageable, this)) { RaiseLocalEvent(uid, new DamageThresholdReached(component, threshold)); threshold.Execute(component.Owner, this); } } }
/// <summary> /// Check if any thresholds were reached. if they were, execute them. /// </summary> public void Execute(EntityUid uid, DestructibleComponent component, DamageChangedEvent args) { foreach (var threshold in component.Thresholds) { if (threshold.Reached(args.Damageable, this)) { RaiseLocalEvent(uid, new DamageThresholdReached(component, threshold)); threshold.Execute(uid, this, EntityManager); } // if destruction behavior (or some other deletion effect) occurred, don't run other triggers. if (EntityManager.IsQueuedForDeletion(uid) || Deleted(uid)) { return; } } }
public DamageThresholdReached(DestructibleComponent parent, DamageThreshold threshold) { Parent = parent; Threshold = threshold; }
public DestructibleThresholdReachedMessage(DestructibleComponent parent, Threshold threshold) { Parent = parent; Threshold = threshold; }