-
Notifications
You must be signed in to change notification settings - Fork 151
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* aaa * Update GhostSystem.cs * Update GhostSystem.cs * Feature: Back in Round Button * Update CCVars.cs * up1 * up2 * upd * update test --------- Co-authored-by: Zack Backmen <[email protected]>
- Loading branch information
Showing
24 changed files
with
539 additions
and
72 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,124 @@ | ||
using Content.Shared.Backmen.CCVar; | ||
using Content.Shared.Backmen.Standing; | ||
using Content.Shared.Buckle; | ||
using Content.Shared.Rotation; | ||
using Content.Shared.Standing; | ||
using Robust.Client.GameObjects; | ||
using Robust.Client.Graphics; | ||
using Robust.Shared.Configuration; | ||
using Robust.Shared.Player; | ||
using Robust.Shared.Timing; | ||
|
||
namespace Content.Client.Backmen.Standing; | ||
|
||
public sealed class LayingDownSystem : SharedLayingDownSystem | ||
{ | ||
[Dependency] private readonly IGameTiming _timing = default!; | ||
[Dependency] private readonly IEyeManager _eyeManager = default!; | ||
[Dependency] private readonly StandingStateSystem _standing = default!; | ||
[Dependency] private readonly AnimationPlayerSystem _animation = default!; | ||
[Dependency] private readonly SharedBuckleSystem _buckle = default!; | ||
[Dependency] private readonly IConfigurationManager _cfg = default!; | ||
[Dependency] private readonly SharedTransformSystem _transform = default!; | ||
|
||
public override void Initialize() | ||
{ | ||
base.Initialize(); | ||
|
||
SubscribeLocalEvent<LayingDownComponent, MoveEvent>(OnMovementInput); | ||
|
||
_cfg.OnValueChanged(CCVars.AutoGetUp, b => _autoGetUp = b, true); | ||
|
||
//SubscribeNetworkEvent<CheckAutoGetUpEvent>(OnCheckAutoGetUp); | ||
} | ||
|
||
private bool _autoGetUp; | ||
|
||
protected override bool GetAutoGetUp(Entity<LayingDownComponent> ent, ICommonSession session) | ||
{ | ||
return _autoGetUp; | ||
} | ||
|
||
private void OnMovementInput(EntityUid uid, LayingDownComponent component, MoveEvent args) | ||
{ | ||
if (!_timing.IsFirstTimePredicted) | ||
return; | ||
|
||
if (!_standing.IsDown(uid)) | ||
return; | ||
|
||
if (_buckle.IsBuckled(uid)) | ||
return; | ||
|
||
if (_animation.HasRunningAnimation(uid, "rotate")) | ||
return; | ||
|
||
if(TerminatingOrDeleted(uid)) | ||
return; | ||
|
||
var transform = Transform(uid); | ||
|
||
if (!TryComp<SpriteComponent>(uid, out var sprite) | ||
|| !TryComp<RotationVisualsComponent>(uid, out var rotationVisuals)) | ||
{ | ||
return; | ||
} | ||
|
||
ProcessVisuals((uid, transform, sprite, rotationVisuals)); | ||
} | ||
|
||
private void ProcessVisuals(Entity<TransformComponent, SpriteComponent?, RotationVisualsComponent> entity) | ||
{ | ||
var rotation = entity.Comp1.LocalRotation + (_eyeManager.CurrentEye.Rotation - (entity.Comp1.LocalRotation - _transform.GetWorldRotation(entity.Comp1))); | ||
|
||
if (rotation.GetDir() is Direction.SouthEast or Direction.East or Direction.NorthEast or Direction.North) | ||
{ | ||
entity.Comp3.HorizontalRotation = Angle.FromDegrees(270); | ||
if(entity.Comp2 != null) | ||
entity.Comp2.Rotation = Angle.FromDegrees(270); | ||
return; | ||
} | ||
|
||
entity.Comp3.HorizontalRotation = Angle.FromDegrees(90); | ||
if(entity.Comp2 != null) | ||
entity.Comp2.Rotation = Angle.FromDegrees(90); | ||
} | ||
|
||
public override void AutoGetUp(Entity<LayingDownComponent> ent) | ||
{ | ||
if (!_timing.IsFirstTimePredicted) | ||
return; | ||
|
||
if(TerminatingOrDeleted(ent)) | ||
return; | ||
|
||
var transform = Transform(ent); | ||
|
||
if (!TryComp<RotationVisualsComponent>(ent, out var rotationVisuals)) | ||
return; | ||
|
||
ProcessVisuals((ent.Owner, transform, null, rotationVisuals)); | ||
} | ||
|
||
/* | ||
private void OnCheckAutoGetUp(CheckAutoGetUpEvent ev, EntitySessionEventArgs args) | ||
{ | ||
if (!_timing.IsFirstTimePredicted) | ||
return; | ||
var uid = GetEntity(ev.User); | ||
if (!TryComp<TransformComponent>(uid, out var transform) || !TryComp<RotationVisualsComponent>(uid, out var rotationVisuals)) | ||
return; | ||
var rotation = transform.LocalRotation + (_eyeManager.CurrentEye.Rotation - (transform.LocalRotation - transform.WorldRotation)); | ||
if (rotation.GetDir() is Direction.SouthEast or Direction.East or Direction.NorthEast or Direction.North) | ||
{ | ||
rotationVisuals.HorizontalRotation = Angle.FromDegrees(270); | ||
return; | ||
} | ||
rotationVisuals.HorizontalRotation = Angle.FromDegrees(90); | ||
}*/ | ||
} |
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,55 @@ | ||
using Content.Shared.Backmen.CCVar; | ||
using Content.Shared.Backmen.Standing; | ||
using Content.Shared.Rotation; | ||
using Robust.Shared.Configuration; | ||
using Robust.Shared.Player; | ||
|
||
namespace Content.Server.Backmen.Standing; | ||
|
||
public sealed class LayingDownSystem : SharedLayingDownSystem // WD EDIT | ||
{ | ||
[Dependency] private readonly INetConfigurationManager _cfg = default!; | ||
[Dependency] private readonly SharedTransformSystem _transform = default!; | ||
|
||
public override void Initialize() | ||
{ | ||
base.Initialize(); | ||
|
||
//SubscribeNetworkEvent<CheckAutoGetUpEvent>(OnCheckAutoGetUp); | ||
} | ||
|
||
public override void AutoGetUp(Entity<LayingDownComponent> ent) | ||
{ | ||
if(!TryComp<EyeComponent>(ent, out var eyeComp) || !TryComp<RotationVisualsComponent>(ent, out var rotationVisualsComp)) | ||
return; | ||
|
||
var xform = Transform(ent); | ||
|
||
var rotation = xform.LocalRotation + (eyeComp.Rotation - (xform.LocalRotation - _transform.GetWorldRotation(xform))); | ||
|
||
if (rotation.GetDir() is Direction.SouthEast or Direction.East or Direction.NorthEast or Direction.North) | ||
{ | ||
rotationVisualsComp.HorizontalRotation = Angle.FromDegrees(270); | ||
return; | ||
} | ||
|
||
rotationVisualsComp.HorizontalRotation = Angle.FromDegrees(90); | ||
} | ||
|
||
protected override bool GetAutoGetUp(Entity<LayingDownComponent> ent, ICommonSession session) | ||
{ | ||
return _cfg.GetClientCVar(session.Channel, CCVars.AutoGetUp); | ||
} | ||
/* | ||
private void OnCheckAutoGetUp(CheckAutoGetUpEvent ev, EntitySessionEventArgs args) | ||
{ | ||
var uid = GetEntity(ev.User); | ||
if (!TryComp(uid, out LayingDownComponent? layingDown)) | ||
return; | ||
layingDown.AutoGetUp = _cfg.GetClientCVar(args.SenderSession.Channel, CCVars.AutoGetUp); | ||
Dirty(uid, layingDown); | ||
} | ||
*/ | ||
} |
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.