1v1 me first to 31 no powerups [Deathmatch Gamemode] (#19467)
Co-authored-by: Kara <lunarautomaton6@gmail.com>
This commit is contained in:
@@ -32,7 +32,7 @@ public partial class MobStateSystem
|
||||
|
||||
var ev = new UpdateMobStateEvent {Target = entity, Component = component, Origin = origin};
|
||||
RaiseLocalEvent(entity, ref ev);
|
||||
ChangeState(entity, component, ev.State);
|
||||
ChangeState(entity, component, ev.State, origin: origin);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -297,14 +297,14 @@ public sealed class MobThresholdSystem : EntitySystem
|
||||
#region Private Implementation
|
||||
|
||||
private void CheckThresholds(EntityUid target, MobStateComponent mobStateComponent,
|
||||
MobThresholdsComponent thresholdsComponent, DamageableComponent damageableComponent)
|
||||
MobThresholdsComponent thresholdsComponent, DamageableComponent damageableComponent, EntityUid? origin = null)
|
||||
{
|
||||
foreach (var (threshold, mobState) in thresholdsComponent.Thresholds.Reverse())
|
||||
{
|
||||
if (damageableComponent.TotalDamage < threshold)
|
||||
continue;
|
||||
|
||||
TriggerThreshold(target, mobState, mobStateComponent, thresholdsComponent);
|
||||
TriggerThreshold(target, mobState, mobStateComponent, thresholdsComponent, origin);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -313,7 +313,8 @@ public sealed class MobThresholdSystem : EntitySystem
|
||||
EntityUid target,
|
||||
MobState newState,
|
||||
MobStateComponent? mobState = null,
|
||||
MobThresholdsComponent? thresholds = null)
|
||||
MobThresholdsComponent? thresholds = null,
|
||||
EntityUid? origin = null)
|
||||
{
|
||||
if (!Resolve(target, ref mobState, ref thresholds) ||
|
||||
mobState.CurrentState == newState)
|
||||
@@ -327,7 +328,7 @@ public sealed class MobThresholdSystem : EntitySystem
|
||||
Dirty(target, thresholds);
|
||||
}
|
||||
|
||||
_mobStateSystem.UpdateMobState(target, mobState);
|
||||
_mobStateSystem.UpdateMobState(target, mobState, origin);
|
||||
}
|
||||
|
||||
private void UpdateAlerts(EntityUid target, MobState currentMobState, MobThresholdsComponent? threshold = null,
|
||||
@@ -374,7 +375,7 @@ public sealed class MobThresholdSystem : EntitySystem
|
||||
{
|
||||
if (!TryComp<MobStateComponent>(target, out var mobState))
|
||||
return;
|
||||
CheckThresholds(target, mobState, thresholds, args.Damageable);
|
||||
CheckThresholds(target, mobState, thresholds, args.Damageable, args.Origin);
|
||||
var ev = new MobThresholdChecked(target, mobState, thresholds, args.Damageable);
|
||||
RaiseLocalEvent(target, ref ev, true);
|
||||
UpdateAlerts(target, mobState.CurrentState, thresholds, args.Damageable);
|
||||
|
||||
Reference in New Issue
Block a user