Files
RobustToolbox/Robust.Shared/GameObjects/Components/Eye/SharedEyeComponent.cs
Acruid dadd7b4cc3 Remove Static Component NetIds (#1842)
* ComponentNames are not sent over the network when components are created.

* Removed ComponentStates array from EntityState, now the state is stored directly inside the CompChange struct.

* Remove the unnecessary NetID property from ComponentState.

* Remove Component.NetworkSynchronizeExistence.

* Change GetNetComponents to return both the component and the component NetId.

* Remove public usages of the Component.NetID property.

* Adds the NetIDAttribute that can be applied to components.

* Removed Component.NetID.

* Revert changes to GetComponentState and how prediction works.

* Adds component netID automatic generation.

* Modifies ClientConsoleHost so that commands can be called before Initialize().

* Completely remove static NetIds.

* Renamed NetIDAttribute to NetworkedComponentAttribute.

* Fixing unit tests.
2021-07-12 10:23:13 +02:00

53 lines
1.6 KiB
C#

using System;
using Robust.Shared.GameStates;
using Robust.Shared.Maths;
using Robust.Shared.Serialization;
using Robust.Shared.ViewVariables;
namespace Robust.Shared.GameObjects
{
[NetworkedComponent()]
public class SharedEyeComponent : Component
{
public override string Name => "Eye";
[ViewVariables(VVAccess.ReadWrite)]
public virtual bool DrawFov { get; set; }
[ViewVariables(VVAccess.ReadWrite)]
public virtual Vector2 Zoom { get; set; }
[ViewVariables(VVAccess.ReadWrite)]
public virtual Vector2 Offset { get; set; }
[ViewVariables(VVAccess.ReadWrite)]
public virtual Angle Rotation { get; set; }
/// <summary>
/// The visibility mask for this eye.
/// The player will be able to get updates for entities whose layers match the mask.
/// </summary>
[ViewVariables(VVAccess.ReadWrite)]
public virtual uint VisibilityMask { get; set; }
}
[NetSerializable, Serializable]
public class EyeComponentState : ComponentState
{
public bool DrawFov { get; }
public Vector2 Zoom { get; }
public Vector2 Offset { get; }
public Angle Rotation { get; }
public uint VisibilityMask { get; }
public EyeComponentState(bool drawFov, Vector2 zoom, Vector2 offset, Angle rotation, uint visibilityMask)
{
DrawFov = drawFov;
Zoom = zoom;
Offset = offset;
Rotation = rotation;
VisibilityMask = visibilityMask;
}
}
}