diff --git a/Content.Client/Movement/Components/EyeCursorOffsetComponent.cs b/Content.Client/Movement/Components/EyeCursorOffsetComponent.cs new file mode 100644 index 00000000000..5ed1bf4a6cd --- /dev/null +++ b/Content.Client/Movement/Components/EyeCursorOffsetComponent.cs @@ -0,0 +1,19 @@ +using System.Numerics; +using Content.Client.Movement.Systems; +using Content.Shared.Movement.Components; + +namespace Content.Client.Movement.Components; + +[RegisterComponent] +public sealed partial class EyeCursorOffsetComponent : SharedEyeCursorOffsetComponent +{ + /// + /// The location the offset will attempt to pan towards; based on the cursor's position in the game window. + /// + public Vector2 TargetPosition = Vector2.Zero; + + /// + /// The current positional offset being applied. Used to enable gradual panning. + /// + public Vector2 CurrentPosition = Vector2.Zero; +} diff --git a/Content.Client/Movement/Systems/EyeCursorOffsetSystem.cs b/Content.Client/Movement/Systems/EyeCursorOffsetSystem.cs index 9f5f593f00f..eb524cf4ee2 100644 --- a/Content.Client/Movement/Systems/EyeCursorOffsetSystem.cs +++ b/Content.Client/Movement/Systems/EyeCursorOffsetSystem.cs @@ -1,6 +1,6 @@ using System.Numerics; +using Content.Client.Movement.Components; using Content.Shared.Camera; -using Content.Shared.Movement.Components; using Robust.Client.Graphics; using Robust.Client.Input; using Robust.Shared.Map; @@ -29,12 +29,6 @@ public sealed partial class EyeCursorOffsetSystem : EntitySystem private void OnGetEyeOffsetEvent(EntityUid uid, EyeCursorOffsetComponent component, ref GetEyeOffsetEvent args) { - if (!component.Enabled) - { - args.Offset = Vector2.Zero; - return; - } - var offset = OffsetAfterMouse(uid, component); if (offset == null) return; diff --git a/Content.Client/Wieldable/WieldableSystem.cs b/Content.Client/Wieldable/WieldableSystem.cs index c25881ba4c3..2de837923c8 100644 --- a/Content.Client/Wieldable/WieldableSystem.cs +++ b/Content.Client/Wieldable/WieldableSystem.cs @@ -1,4 +1,5 @@ using System.Numerics; +using Content.Client.Movement.Components; using Content.Client.Movement.Systems; using Content.Shared.Camera; using Content.Shared.Hands; diff --git a/Content.Client/_DV/Movement/CursorOffsetActionSystem.cs b/Content.Client/_DV/Movement/CursorOffsetActionSystem.cs index 427a2e1749e..49cf38b3487 100644 --- a/Content.Client/_DV/Movement/CursorOffsetActionSystem.cs +++ b/Content.Client/_DV/Movement/CursorOffsetActionSystem.cs @@ -1,5 +1,6 @@ using System.Diagnostics; using System.Numerics; +using Content.Client.Movement.Components; using Content.Client.Movement.Systems; using Content.Shared._DV.Movement; using Content.Shared.Camera; @@ -18,23 +19,14 @@ public sealed class CursorOffsetActionSystem : SharedCursorOffsetActionSystem base.Initialize(); //SubscribeLocalEvent(OnAction); - SubscribeLocalEvent(OnGetEyeOffset); + //SubscribeLocalEvent(OnGetEyeOffset); } protected override void OnAction(Entity ent, ref CursorOffsetActionEvent args) { base.OnAction(ent, ref args); - if (!TryComp(ent.Owner, out EyeCursorOffsetComponent? cursorOffsetComp)) - return; - - Log.Info("im gonna go fucking insane"); - - if (_gameTiming.IsFirstTimePredicted) - { - Log.Info("goidapredict"); - cursorOffsetComp.CurrentPosition = Vector2.Zero; - } + Log.Info("no OnAction client code (awesome)"); } private void OnGetEyeOffset(Entity ent, ref GetEyeOffsetEvent args) @@ -50,4 +42,16 @@ public sealed class CursorOffsetActionSystem : SharedCursorOffsetActionSystem args.Offset += offset.Value; } + + public override void AddOrRemoveEyeOffset(Entity ent, bool add) + { + if (add) + { + AddComp(ent); + } + else + { + RemComp(ent); + } + } } diff --git a/Content.Server/Movement/Components/EyeCursorOffsetComponent.cs b/Content.Server/Movement/Components/EyeCursorOffsetComponent.cs new file mode 100644 index 00000000000..b3809fe794b --- /dev/null +++ b/Content.Server/Movement/Components/EyeCursorOffsetComponent.cs @@ -0,0 +1,12 @@ +using System.Numerics; +using Content.Shared.Movement.Components; +using Content.Shared.Movement.Systems; +using Robust.Shared.GameStates; + +namespace Content.Server.Movement.Components; + +[RegisterComponent] +public sealed partial class EyeCursorOffsetComponent : SharedEyeCursorOffsetComponent +{ + +} diff --git a/Content.Server/_DV/Movement/CursorOffsetActionSystem.cs b/Content.Server/_DV/Movement/CursorOffsetActionSystem.cs index e00cc5add08..ad9b0d09814 100644 --- a/Content.Server/_DV/Movement/CursorOffsetActionSystem.cs +++ b/Content.Server/_DV/Movement/CursorOffsetActionSystem.cs @@ -1,7 +1,6 @@ using Content.Server.Movement.Components; using Content.Shared._DV.Movement; using Content.Shared.Actions; -using Content.Shared.Movement.Components; using Content.Shared.Movement.Systems; namespace Content.Server._DV.Movement; @@ -29,12 +28,24 @@ public sealed class CursorOffsetActionSystem : SharedCursorOffsetActionSystem } } - /* protected override void OnAction(Entity ent, ref CursorOffsetActionEvent args) + protected override void OnAction(Entity ent, ref CursorOffsetActionEvent args) { base.OnAction(ent, ref args); Log.Info("okay running the server code now trust (just pvsscale)"); _eye.UpdatePvsScale(args.Performer); - }*/ + } + + public override void AddOrRemoveEyeOffset(Entity ent, bool add) + { + if (add) + { + AddComp(ent); + } + else + { + RemComp(ent); + } + } } diff --git a/Content.Shared/Movement/Components/EyeCursorOffsetComponent.cs b/Content.Shared/Movement/Components/EyeCursorOffsetComponent.cs index 47b7dc59c48..e0884222f25 100644 --- a/Content.Shared/Movement/Components/EyeCursorOffsetComponent.cs +++ b/Content.Shared/Movement/Components/EyeCursorOffsetComponent.cs @@ -7,9 +7,8 @@ namespace Content.Shared.Movement.Components; /// /// Displaces SS14 eye data when given to an entity. /// -[RegisterComponent, NetworkedComponent] -[AutoGenerateComponentState] -public sealed partial class EyeCursorOffsetComponent : Component +[ComponentProtoName("EyeCursorOffset"), NetworkedComponent] +public abstract partial class SharedEyeCursorOffsetComponent : Component { /// /// The amount the view will be displaced when the cursor is positioned at/beyond the max offset distance. @@ -30,21 +29,4 @@ public sealed partial class EyeCursorOffsetComponent : Component /// [DataField] public float PvsIncrease = 0.3f; - - /// - /// The location the offset will attempt to pan towards; based on the cursor's position in the game window. - /// - [DataField] - [AutoNetworkedField] - public Vector2 TargetPosition = Vector2.Zero; - - /// - /// The current positional offset being applied. Used to enable gradual panning. - /// - [DataField] - [AutoNetworkedField] - public Vector2 CurrentPosition = Vector2.Zero; - - [DataField] - public bool Enabled = true; } diff --git a/Content.Shared/_DV/Movement/SharedCursorOffsetActionSystem.cs b/Content.Shared/_DV/Movement/SharedCursorOffsetActionSystem.cs index 1e8b48ff26c..e1750ea9ddb 100644 --- a/Content.Shared/_DV/Movement/SharedCursorOffsetActionSystem.cs +++ b/Content.Shared/_DV/Movement/SharedCursorOffsetActionSystem.cs @@ -35,23 +35,24 @@ public abstract class SharedCursorOffsetActionSystem : EntitySystem if (args.Handled) return; + Log.Info("kotob crashout arc 2025"); + ent.Comp.Active = !ent.Comp.Active; - Log.Debug("shared active is now " + ent.Comp.Active); - - /*if(ent.Comp.Active) + if(ent.Comp.Active) { - AddComp(ent.Owner); - Log.Debug("we ADDING this component for REAL!"); + //AddComp(ent.Owner); + AddOrRemoveEyeOffset(ent, true); } else { - RemComp(ent.Owner); - Log.Debug("we REMOVING this component for REAL!"); - }*/ - + //RemComp(ent.Owner); + AddOrRemoveEyeOffset(ent, false); + } Dirty(ent); args.Handled = true; } + + public abstract void AddOrRemoveEyeOffset(Entity ent, bool add); }