Ghost hearing action (#19722)

This commit is contained in:
Kara
2023-09-24 13:34:08 -07:00
committed by GitHub
parent 5e405380ef
commit fb175a520d
11 changed files with 97 additions and 28 deletions

View File

@@ -1,8 +1,6 @@
using Content.Shared.Actions;
using Robust.Shared.GameStates;
using Robust.Shared.Prototypes;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
namespace Content.Shared.Ghost;
@@ -14,25 +12,40 @@ public sealed partial class GhostComponent : Component
[ViewVariables]
public bool IsAttached;
[DataField("toggleLightingAction", customTypeSerializer: typeof(PrototypeIdSerializer<EntityPrototype>))]
public string ToggleLightingAction = "ActionToggleLighting";
// Actions
[DataField]
public EntProtoId ToggleLightingAction = "ActionToggleLighting";
[DataField, AutoNetworkedField]
public EntityUid? ToggleLightingActionEntity;
[DataField("toggleFovAction", customTypeSerializer: typeof(PrototypeIdSerializer<EntityPrototype>))]
public string ToggleFoVAction = "ActionToggleFov";
[DataField]
public EntProtoId ToggleFoVAction = "ActionToggleFov";
[DataField, AutoNetworkedField]
public EntityUid? ToggleFoVActionEntity;
[DataField("toggleGhostsAction", customTypeSerializer: typeof(PrototypeIdSerializer<EntityPrototype>))]
public string ToggleGhostsAction = "ActionToggleGhosts";
[DataField]
public EntProtoId ToggleGhostsAction = "ActionToggleGhosts";
[DataField, AutoNetworkedField]
public EntityUid? ToggleGhostsActionEntity;
[ViewVariables(VVAccess.ReadWrite), DataField("timeOfDeath", customTypeSerializer:typeof(TimeOffsetSerializer))]
[DataField]
public EntProtoId ToggleGhostHearingAction = "ActionToggleGhostHearing";
[DataField]
public EntityUid? ToggleGhostHearingActionEntity;
[DataField]
public EntProtoId BooAction = "ActionGhostBoo";
[DataField, AutoNetworkedField]
public EntityUid? BooActionEntity;
// End actions
[ViewVariables(VVAccess.ReadWrite), DataField]
public TimeSpan TimeOfDeath = TimeSpan.Zero;
[DataField("booRadius")]
@@ -41,12 +54,6 @@ public sealed partial class GhostComponent : Component
[DataField("booMaxTargets")]
public int BooMaxTargets = 3;
[DataField]
public EntProtoId BooAction = "ActionGhostBoo";
[DataField, AutoNetworkedField]
public EntityUid? BooActionEntity;
// TODO: instead of this funny stuff just give it access and update in system dirtying when needed
[ViewVariables(VVAccess.ReadWrite)]
public bool CanGhostInteract
@@ -90,10 +97,12 @@ public sealed partial class GhostComponent : Component
private bool _canReturnToBody;
}
public sealed partial class ToggleFoVActionEvent : InstantActionEvent { }
public sealed partial class ToggleGhostsActionEvent : InstantActionEvent { }
public sealed partial class ToggleLightingActionEvent : InstantActionEvent { }
public sealed partial class ToggleGhostHearingActionEvent : InstantActionEvent { }
public sealed partial class BooActionEvent : InstantActionEvent { }
public sealed partial class ToggleFoVActionEvent : InstantActionEvent { };
public sealed partial class ToggleGhostsActionEvent : InstantActionEvent { };
public sealed partial class ToggleLightingActionEvent : InstantActionEvent { };

View File

@@ -0,0 +1,9 @@
namespace Content.Shared.Ghost;
/// <summary>
/// This is used for marking entities which should receive all local chat message, even when out of range
/// </summary>
[RegisterComponent]
public sealed partial class GhostHearingComponent : Component
{
}

View File

@@ -2,6 +2,7 @@ using Content.Shared.Emoting;
using Content.Shared.Hands;
using Content.Shared.Interaction.Events;
using Content.Shared.Item;
using Content.Shared.Popups;
using Robust.Shared.Serialization;
namespace Content.Shared.Ghost
@@ -12,6 +13,8 @@ namespace Content.Shared.Ghost
/// </summary>
public abstract class SharedGhostSystem : EntitySystem
{
[Dependency] protected readonly SharedPopupSystem Popup = default!;
public override void Initialize()
{
base.Initialize();