Refactors stunnable to be ECS. (#4819)
Also cleans up StandingStatesystem.
This commit is contained in:
committed by
GitHub
parent
19a588a70a
commit
6eee256b11
@@ -1,7 +1,10 @@
|
||||
using System;
|
||||
using Content.Server.Damage.Components;
|
||||
using Content.Server.Stunnable;
|
||||
using Content.Server.Stunnable.Components;
|
||||
using Content.Shared.Audio;
|
||||
using Content.Shared.Damage;
|
||||
using Content.Shared.Stunnable;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Shared.Audio;
|
||||
using Robust.Shared.GameObjects;
|
||||
@@ -19,6 +22,7 @@ namespace Content.Server.Damage.Systems
|
||||
[Dependency] private readonly IRobustRandom _robustRandom = default!;
|
||||
[Dependency] private readonly IGameTiming _gameTiming = default!;
|
||||
[Dependency] private readonly DamageableSystem _damageableSystem = default!;
|
||||
[Dependency] private readonly StunSystem _stunSystem = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
@@ -43,7 +47,7 @@ namespace Content.Server.Damage.Systems
|
||||
component.LastHit = _gameTiming.CurTime;
|
||||
|
||||
if (EntityManager.TryGetComponent(uid, out StunnableComponent? stun) && _robustRandom.Prob(component.StunChance))
|
||||
stun.Stun(component.StunSeconds);
|
||||
_stunSystem.Stun(uid, TimeSpan.FromSeconds(component.StunSeconds), stun);
|
||||
|
||||
var damageScale = (speed / component.MinimumSpeed) * component.Factor;
|
||||
_damageableSystem.TryChangeDamage(uid, component.Damage * damageScale);
|
||||
|
||||
Reference in New Issue
Block a user