-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #143 from Evgencheg/master
апстримец
- Loading branch information
Showing
51 changed files
with
1,614 additions
and
683 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
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
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,9 @@ | ||
using Robust.Shared.Serialization; | ||
|
||
namespace Content.Shared.Movement.Events; | ||
|
||
/// <summary> | ||
/// Raised from the client to the server to require the server to update the client's input CVars. | ||
/// </summary> | ||
[Serializable, NetSerializable] | ||
public sealed class UpdateInputCVarsMessage : EntityEventArgs { } |
43 changes: 43 additions & 0 deletions
43
Content.Shared/Movement/Systems/SharedMoverController.CVars.cs
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,43 @@ | ||
using Content.Shared.CCVar; | ||
using Content.Shared.Mind.Components; | ||
using Content.Shared.Movement.Components; | ||
using Content.Shared.Movement.Events; | ||
using Robust.Shared.Configuration; | ||
|
||
namespace Content.Shared.Movement.Systems; | ||
|
||
public abstract partial class SharedMoverController | ||
{ | ||
[Dependency] private readonly INetConfigurationManager _netConfig = default!; | ||
|
||
private void InitializeCVars() | ||
{ | ||
SubscribeLocalEvent<InputMoverComponent, MindAddedMessage>(OnMindAdded); | ||
SubscribeLocalEvent<InputMoverComponent, MindRemovedMessage>(OnMindRemoved); | ||
SubscribeNetworkEvent<UpdateInputCVarsMessage>(OnUpdateCVars); | ||
} | ||
|
||
private void OnMindAdded(Entity<InputMoverComponent> ent, ref MindAddedMessage args) | ||
{ | ||
if (args.Mind.Comp.Session?.Channel is not { } channel) | ||
return; | ||
|
||
ent.Comp.DefaultSprinting = _netConfig.GetClientCVar(channel, CCVars.DefaultWalk); | ||
WalkingAlert(ent, ent.Comp); | ||
} | ||
|
||
private void OnMindRemoved(Entity<InputMoverComponent> ent, ref MindRemovedMessage args) | ||
{ | ||
// If it's an ai-controlled mob, we probably want them sprinting by default. | ||
ent.Comp.DefaultSprinting = true; | ||
} | ||
|
||
private void OnUpdateCVars(UpdateInputCVarsMessage msg, EntitySessionEventArgs args) | ||
{ | ||
if (args.SenderSession.AttachedEntity is not { } uid || !TryComp<InputMoverComponent>(uid, out var mover)) | ||
return; | ||
|
||
mover.DefaultSprinting = _netConfig.GetClientCVar(args.SenderSession.Channel, CCVars.DefaultWalk); | ||
WalkingAlert(uid, mover); | ||
} | ||
} |
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
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
Oops, something went wrong.