mirror of
https://github.com/DeltaV-Station/Delta-v.git
synced 2026-10-04 05:17:28 +00:00
@@ -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
|
||||
{
|
||||
/// <summary>
|
||||
/// The location the offset will attempt to pan towards; based on the cursor's position in the game window.
|
||||
/// </summary>
|
||||
public Vector2 TargetPosition = Vector2.Zero;
|
||||
|
||||
/// <summary>
|
||||
/// The current positional offset being applied. Used to enable gradual panning.
|
||||
/// </summary>
|
||||
public Vector2 CurrentPosition = Vector2.Zero;
|
||||
}
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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<CursorOffsetActionComponent, CursorOffsetActionEvent>(OnAction);
|
||||
SubscribeLocalEvent<CursorOffsetActionComponent, GetEyeOffsetEvent>(OnGetEyeOffset);
|
||||
//SubscribeLocalEvent<CursorOffsetActionComponent, GetEyeOffsetEvent>(OnGetEyeOffset);
|
||||
}
|
||||
|
||||
protected override void OnAction(Entity<CursorOffsetActionComponent> 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<CursorOffsetActionComponent> ent, ref GetEyeOffsetEvent args)
|
||||
@@ -50,4 +42,16 @@ public sealed class CursorOffsetActionSystem : SharedCursorOffsetActionSystem
|
||||
|
||||
args.Offset += offset.Value;
|
||||
}
|
||||
|
||||
public override void AddOrRemoveEyeOffset(Entity<CursorOffsetActionComponent> ent, bool add)
|
||||
{
|
||||
if (add)
|
||||
{
|
||||
AddComp<EyeCursorOffsetComponent>(ent);
|
||||
}
|
||||
else
|
||||
{
|
||||
RemComp<EyeCursorOffsetComponent>(ent);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
{
|
||||
|
||||
}
|
||||
@@ -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<CursorOffsetActionComponent> ent, ref CursorOffsetActionEvent args)
|
||||
protected override void OnAction(Entity<CursorOffsetActionComponent> 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<CursorOffsetActionComponent> ent, bool add)
|
||||
{
|
||||
if (add)
|
||||
{
|
||||
AddComp<EyeCursorOffsetComponent>(ent);
|
||||
}
|
||||
else
|
||||
{
|
||||
RemComp<EyeCursorOffsetComponent>(ent);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,9 +7,8 @@ namespace Content.Shared.Movement.Components;
|
||||
/// <summary>
|
||||
/// Displaces SS14 eye data when given to an entity.
|
||||
/// </summary>
|
||||
[RegisterComponent, NetworkedComponent]
|
||||
[AutoGenerateComponentState]
|
||||
public sealed partial class EyeCursorOffsetComponent : Component
|
||||
[ComponentProtoName("EyeCursorOffset"), NetworkedComponent]
|
||||
public abstract partial class SharedEyeCursorOffsetComponent : Component
|
||||
{
|
||||
/// <summary>
|
||||
/// 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
|
||||
/// </summary>
|
||||
[DataField]
|
||||
public float PvsIncrease = 0.3f;
|
||||
|
||||
/// <summary>
|
||||
/// The location the offset will attempt to pan towards; based on the cursor's position in the game window.
|
||||
/// </summary>
|
||||
[DataField]
|
||||
[AutoNetworkedField]
|
||||
public Vector2 TargetPosition = Vector2.Zero;
|
||||
|
||||
/// <summary>
|
||||
/// The current positional offset being applied. Used to enable gradual panning.
|
||||
/// </summary>
|
||||
[DataField]
|
||||
[AutoNetworkedField]
|
||||
public Vector2 CurrentPosition = Vector2.Zero;
|
||||
|
||||
[DataField]
|
||||
public bool Enabled = true;
|
||||
}
|
||||
|
||||
@@ -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<EyeCursorOffsetComponent>(ent.Owner);
|
||||
Log.Debug("we ADDING this component for REAL!");
|
||||
//AddComp<SharedEyeCursorOffsetComponent>(ent.Owner);
|
||||
AddOrRemoveEyeOffset(ent, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
RemComp<EyeCursorOffsetComponent>(ent.Owner);
|
||||
Log.Debug("we REMOVING this component for REAL!");
|
||||
}*/
|
||||
|
||||
//RemComp<EyeCursorOffsetComponent>(ent.Owner);
|
||||
AddOrRemoveEyeOffset(ent, false);
|
||||
}
|
||||
Dirty(ent);
|
||||
|
||||
args.Handled = true;
|
||||
}
|
||||
|
||||
public abstract void AddOrRemoveEyeOffset(Entity<CursorOffsetActionComponent> ent, bool add);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user