Add Enabled property to SubFloorHideComponent, make it networked. (#4404)
This commit is contained in:
committed by
GitHub
parent
331604cc66
commit
7e3d5f6cf1
@@ -1,4 +1,8 @@
|
||||
using System;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.GameStates;
|
||||
using Robust.Shared.Players;
|
||||
using Robust.Shared.Serialization;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
using Robust.Shared.ViewVariables;
|
||||
|
||||
@@ -10,6 +14,7 @@ namespace Content.Shared.SubFloor
|
||||
/// (plating).
|
||||
/// </summary>
|
||||
/// <seealso cref="P:Content.Shared.Maps.ContentTileDefinition.IsSubFloor" />
|
||||
[NetworkedComponent]
|
||||
[RegisterComponent]
|
||||
public sealed class SubFloorHideComponent : Component
|
||||
{
|
||||
@@ -17,10 +22,35 @@ namespace Content.Shared.SubFloor
|
||||
public override string Name => "SubFloorHide";
|
||||
|
||||
/// <summary>
|
||||
/// This entity needs to be anchored to be hid in the subfloor.
|
||||
/// Whether the entity will be hid when not in subfloor.
|
||||
/// </summary>
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
[DataField("enabled")]
|
||||
public bool Enabled { get; set; } = true;
|
||||
|
||||
/// <summary>
|
||||
/// This entity needs to be anchored to be hid when not in subfloor.
|
||||
/// </summary>
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
[DataField("requireAnchored")]
|
||||
public bool RequireAnchored { get; set; } = true;
|
||||
|
||||
public override ComponentState GetComponentState(ICommonSession player)
|
||||
{
|
||||
return new SubFloorHideComponentState(Enabled, RequireAnchored);
|
||||
}
|
||||
}
|
||||
|
||||
[Serializable, NetSerializable]
|
||||
public class SubFloorHideComponentState : ComponentState
|
||||
{
|
||||
public bool Enabled { get; }
|
||||
public bool RequireAnchored { get; }
|
||||
|
||||
public SubFloorHideComponentState(bool enabled, bool requireAnchored)
|
||||
{
|
||||
Enabled = enabled;
|
||||
RequireAnchored = requireAnchored;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user