-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
It functions identically to how V1 of orientation worked and it's incredibly annoying.
- Loading branch information
1 parent
8522ffe
commit 11dbf50
Showing
4 changed files
with
60 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
using Content.Shared.CCVar; | ||
using Content.Shared.Movement.Components; | ||
using Robust.Shared.Configuration; | ||
using Robust.Shared.Timing; | ||
|
||
namespace Content.Shared.Movement.Systems; | ||
|
||
public sealed class AutoOrientSystem : EntitySystem | ||
{ | ||
[Dependency] private readonly IConfigurationManager _cfgManager = default!; | ||
[Dependency] private readonly IGameTiming _timing = default!; | ||
[Dependency] private readonly SharedMoverController _mover = default!; | ||
|
||
private TimeSpan _delay = TimeSpan.Zero; | ||
|
||
public override void Initialize() | ||
{ | ||
base.Initialize(); | ||
SubscribeLocalEvent<AutoOrientComponent, EntParentChangedMessage>(OnEntParentChanged); | ||
|
||
Subs.CVar(_cfgManager, CCVars.AutoOrientDelay, OnAutoOrient, true); | ||
} | ||
|
||
private void OnAutoOrient(double obj) | ||
{ | ||
_delay = TimeSpan.FromSeconds(obj); | ||
} | ||
|
||
private void OnEntParentChanged(Entity<AutoOrientComponent> ent, ref EntParentChangedMessage args) | ||
{ | ||
ent.Comp.NextChange = _timing.CurTime + _delay; | ||
Dirty(ent); | ||
} | ||
|
||
public override void Update(float frameTime) | ||
{ | ||
base.Update(frameTime); | ||
|
||
var query = EntityQueryEnumerator<AutoOrientComponent>(); | ||
|
||
while (query.MoveNext(out var uid, out var comp)) | ||
{ | ||
if (comp.NextChange <= _timing.CurTime) | ||
{ | ||
comp.NextChange = null; | ||
Dirty(uid, comp); | ||
_mover.ResetCamera(uid); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters