Misc state handling changes (#9265)

* misc state handling changes

* ambient dirtying
This commit is contained in:
Leon Friedrich
2022-06-29 15:11:09 +12:00
committed by GitHub
parent 9064360fbc
commit 8df89bd055
8 changed files with 16 additions and 17 deletions

View File

@@ -409,7 +409,8 @@ public abstract class SharedActionsSystem : EntitySystem
var provided = comp.Actions.Where(act => act.Provider == provider).ToList();
RemoveActions(uid, provided, comp);
if (provided.Count > 0)
RemoveActions(uid, provided, comp);
}
public virtual void RemoveActions(EntityUid uid, IEnumerable<ActionType> actions, ActionsComponent? comp = null, bool dirty = true)

View File

@@ -20,7 +20,7 @@ namespace Content.Shared.Audio
ambience.Enabled == value) return;
ambience.Enabled = value;
ambience.Dirty();
Dirty(ambience);
}
private void HandleCompState(EntityUid uid, AmbientSoundComponent component, ref ComponentHandleState args)

View File

@@ -17,7 +17,7 @@ namespace Content.Shared.Movement.Components
public float SprintSpeedModifier = 1.0f;
[ViewVariables(VVAccess.ReadWrite)]
public float BaseWalkSpeedVV
private float _baseWalkSpeedVV
{
get => BaseWalkSpeed;
set
@@ -28,7 +28,7 @@ namespace Content.Shared.Movement.Components
}
[ViewVariables(VVAccess.ReadWrite)]
public float BaseSprintSpeedVV
private float _baseSprintSpeedVV
{
get => BaseSprintSpeed;
set

View File

@@ -42,9 +42,12 @@ namespace Content.Shared.Movement.Systems
var ev = new RefreshMovementSpeedModifiersEvent();
RaiseLocalEvent(uid, ev);
if (MathHelper.CloseTo(ev.WalkSpeedModifier, move.WalkSpeedModifier) &&
MathHelper.CloseTo(ev.SprintSpeedModifier, move.SprintSpeedModifier))
return;
move.WalkSpeedModifier = ev.WalkSpeedModifier;
move.SprintSpeedModifier = ev.SprintSpeedModifier;
Dirty(move);
}