Merge branch 'master' of https://github.com/space-wizards/space-station-14 into map-load-refactor
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
using Content.Shared.Wieldable;
|
||||
using Robust.Shared.GameStates;
|
||||
|
||||
namespace Content.Shared.Movement.Components;
|
||||
|
||||
/// <summary>
|
||||
/// Indicates that this item requires wielding for the cursor offset effect to be active.
|
||||
/// </summary>
|
||||
[RegisterComponent, NetworkedComponent, Access(typeof(SharedWieldableSystem))]
|
||||
public sealed partial class CursorOffsetRequiresWieldComponent : Component
|
||||
{
|
||||
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
using System.Numerics;
|
||||
using Content.Shared.Movement.Systems;
|
||||
using Robust.Shared.GameStates;
|
||||
|
||||
namespace Content.Shared.Movement.Components;
|
||||
|
||||
/// <summary>
|
||||
/// Displaces SS14 eye data when given to an entity.
|
||||
/// </summary>
|
||||
[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.
|
||||
/// Measured in tiles.
|
||||
/// </summary>
|
||||
[DataField]
|
||||
public float MaxOffset = 3f;
|
||||
|
||||
/// <summary>
|
||||
/// The speed which the camera adjusts to new positions. 0.5f seems like a good value, but can be changed if you want very slow/instant adjustments.
|
||||
/// </summary>
|
||||
[DataField]
|
||||
public float OffsetSpeed = 0.5f;
|
||||
|
||||
/// <summary>
|
||||
/// The amount the PVS should increase to account for the max offset.
|
||||
/// Should be 1/10 of MaxOffset most of the time.
|
||||
/// </summary>
|
||||
[DataField]
|
||||
public float PvsIncrease = 0.3f;
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
using Content.Shared.Wieldable;
|
||||
using Robust.Shared.GameStates;
|
||||
|
||||
namespace Content.Shared.Movement.Components;
|
||||
|
||||
/// <summary>
|
||||
/// Modifies the speed when an entity with this component is wielded.
|
||||
/// </summary>
|
||||
[RegisterComponent, NetworkedComponent, Access(typeof(SharedWieldableSystem)), AutoGenerateComponentState]
|
||||
public sealed partial class SpeedModifiedOnWieldComponent : Component
|
||||
{
|
||||
/// <summary>
|
||||
/// How much the wielder's sprint speed is modified when the component owner is wielded.
|
||||
/// </summary>
|
||||
[DataField, AutoNetworkedField]
|
||||
public float SprintModifier = 1f;
|
||||
|
||||
/// <summary>
|
||||
/// How much the wielder's walk speed is modified when the component owner is wielded.
|
||||
/// </summary>
|
||||
[DataField, AutoNetworkedField]
|
||||
public float WalkModifier = 1f;
|
||||
}
|
||||
@@ -140,11 +140,29 @@ public abstract class SharedContentEyeSystem : EntitySystem
|
||||
Dirty(uid, component);
|
||||
}
|
||||
|
||||
public void UpdateEyeOffset(Entity<EyeComponent?> eye)
|
||||
public void UpdateEyeOffset(Entity<EyeComponent> eye)
|
||||
{
|
||||
var ev = new GetEyeOffsetEvent();
|
||||
RaiseLocalEvent(eye, ref ev);
|
||||
_eye.SetOffset(eye, ev.Offset, eye);
|
||||
|
||||
var evRelayed = new GetEyeOffsetRelayedEvent();
|
||||
RaiseLocalEvent(eye, ref evRelayed);
|
||||
|
||||
_eye.SetOffset(eye, ev.Offset + evRelayed.Offset, eye);
|
||||
}
|
||||
|
||||
public void UpdatePvsScale(EntityUid uid, ContentEyeComponent? contentEye = null, EyeComponent? eye = null)
|
||||
{
|
||||
if (!Resolve(uid, ref contentEye) || !Resolve(uid, ref eye))
|
||||
return;
|
||||
|
||||
var ev = new GetEyePvsScaleEvent();
|
||||
RaiseLocalEvent(uid, ref ev);
|
||||
|
||||
var evRelayed = new GetEyePvsScaleRelayedEvent();
|
||||
RaiseLocalEvent(uid, ref evRelayed);
|
||||
|
||||
_eye.SetPvsScale((uid, eye), 1 + ev.Scale + evRelayed.Scale);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
Reference in New Issue
Block a user