diff --git a/Content.Client/Ghost/GhostComponent.cs b/Content.Client/Ghost/GhostComponent.cs deleted file mode 100644 index 5da997caf7..0000000000 --- a/Content.Client/Ghost/GhostComponent.cs +++ /dev/null @@ -1,50 +0,0 @@ -using Content.Shared.Actions; -using Content.Shared.Actions.ActionTypes; -using Content.Shared.Ghost; -using Robust.Shared.Utility; - -namespace Content.Client.Ghost -{ - [RegisterComponent] - [ComponentReference(typeof(SharedGhostComponent))] - public sealed partial class GhostComponent : SharedGhostComponent - { - public bool IsAttached { get; set; } - - public InstantAction ToggleLightingAction = new() - { - Icon = new SpriteSpecifier.Texture(new ("Interface/VerbIcons/light.svg.192dpi.png")), - DisplayName = "ghost-gui-toggle-lighting-manager-name", - Description = "ghost-gui-toggle-lighting-manager-desc", - ClientExclusive = true, - CheckCanInteract = false, - Event = new ToggleLightingActionEvent(), - }; - - public InstantAction ToggleFoVAction = new() - { - Icon = new SpriteSpecifier.Texture(new ("Interface/VerbIcons/vv.svg.192dpi.png")), - DisplayName = "ghost-gui-toggle-fov-name", - Description = "ghost-gui-toggle-fov-desc", - ClientExclusive = true, - CheckCanInteract = false, - Event = new ToggleFoVActionEvent(), - }; - - public InstantAction ToggleGhostsAction = new() - { - Icon = new SpriteSpecifier.Rsi(new ("Mobs/Ghosts/ghost_human.rsi"), "icon"), - DisplayName = "ghost-gui-toggle-ghost-visibility-name", - Description = "ghost-gui-toggle-ghost-visibility-desc", - ClientExclusive = true, - CheckCanInteract = false, - Event = new ToggleGhostsActionEvent(), - }; - } - - public sealed partial class ToggleLightingActionEvent : InstantActionEvent { }; - - public sealed partial class ToggleFoVActionEvent : InstantActionEvent { }; - - public sealed partial class ToggleGhostsActionEvent : InstantActionEvent { }; -} diff --git a/Content.Client/Ghost/GhostSystem.cs b/Content.Client/Ghost/GhostSystem.cs index 5f8f9688d0..8207e0eac9 100644 --- a/Content.Client/Ghost/GhostSystem.cs +++ b/Content.Client/Ghost/GhostSystem.cs @@ -11,7 +11,6 @@ using Robust.Shared.GameStates; namespace Content.Client.Ghost { - [UsedImplicitly] public sealed class GhostSystem : SharedGhostSystem { [Dependency] private readonly IClientConsoleHost _console = default!; @@ -60,7 +59,7 @@ namespace Content.Client.Ghost SubscribeLocalEvent(OnGhostInit); SubscribeLocalEvent(OnGhostRemove); - SubscribeLocalEvent(OnGhostState); + SubscribeLocalEvent(OnGhostState); SubscribeLocalEvent(OnGhostPlayerAttach); SubscribeLocalEvent(OnGhostPlayerDetach); @@ -77,7 +76,7 @@ namespace Content.Client.Ghost private void OnGhostInit(EntityUid uid, GhostComponent component, ComponentInit args) { - if (TryComp(component.Owner, out SpriteComponent? sprite)) + if (TryComp(uid, out SpriteComponent? sprite)) { sprite.Visible = GhostVisibility; } @@ -146,7 +145,7 @@ namespace Content.Client.Ghost PlayerAttached?.Invoke(component); } - private void OnGhostState(EntityUid uid, GhostComponent component, ref ComponentHandleState args) + private void OnGhostState(EntityUid uid, GhostComponent component, ref AfterAutoHandleStateEvent args) { if (TryComp(uid, out var sprite)) sprite.LayerSetColor(0, component.color); diff --git a/Content.IntegrationTests/Tests/Minds/GhostRoleTests.cs b/Content.IntegrationTests/Tests/Minds/GhostRoleTests.cs index a5f37b234e..adf06487a9 100644 --- a/Content.IntegrationTests/Tests/Minds/GhostRoleTests.cs +++ b/Content.IntegrationTests/Tests/Minds/GhostRoleTests.cs @@ -1,10 +1,10 @@ #nullable enable using System.Linq; -using Content.Server.Ghost.Components; using Content.Server.Ghost.Roles; using Content.Server.Ghost.Roles.Components; using Content.Server.Mind; using Content.Server.Players; +using Content.Shared.Ghost; using Robust.Shared.Console; using Robust.Shared.GameObjects; using Robust.Shared.Map; diff --git a/Content.IntegrationTests/Tests/Minds/MindTests.EntityDeletion.cs b/Content.IntegrationTests/Tests/Minds/MindTests.EntityDeletion.cs index 759ea1b9cb..52878f555b 100644 --- a/Content.IntegrationTests/Tests/Minds/MindTests.EntityDeletion.cs +++ b/Content.IntegrationTests/Tests/Minds/MindTests.EntityDeletion.cs @@ -1,7 +1,7 @@ using System.Linq; -using Content.Server.Ghost.Components; using Content.Server.Mind; using Content.Server.Players; +using Content.Shared.Ghost; using Robust.Server.Console; using Robust.Server.GameObjects; using Robust.Server.Player; diff --git a/Content.IntegrationTests/Tests/Minds/MindTests.Helpers.cs b/Content.IntegrationTests/Tests/Minds/MindTests.Helpers.cs index 221b8ac9df..1c663d1cce 100644 --- a/Content.IntegrationTests/Tests/Minds/MindTests.Helpers.cs +++ b/Content.IntegrationTests/Tests/Minds/MindTests.Helpers.cs @@ -1,8 +1,8 @@ using System.Linq; using Content.IntegrationTests.Pair; -using Content.Server.Ghost.Components; using Content.Server.Mind; using Content.Server.Players; +using Content.Shared.Ghost; using Robust.Server.GameObjects; using Robust.Server.Player; using Robust.Shared.Enums; diff --git a/Content.IntegrationTests/Tests/Minds/MindTests.ReconnectTests.cs b/Content.IntegrationTests/Tests/Minds/MindTests.ReconnectTests.cs index 68e7f2176c..a6db9bbd09 100644 --- a/Content.IntegrationTests/Tests/Minds/MindTests.ReconnectTests.cs +++ b/Content.IntegrationTests/Tests/Minds/MindTests.ReconnectTests.cs @@ -1,6 +1,6 @@ using System.Linq; -using Content.Server.Ghost.Components; using Content.Server.Mind; +using Content.Shared.Ghost; using Robust.Server.Player; using Robust.Shared.GameObjects; using Robust.Shared.Map; diff --git a/Content.Server/Administration/Commands/AGhost.cs b/Content.Server/Administration/Commands/AGhost.cs index 97b1c48ae1..99cb168438 100644 --- a/Content.Server/Administration/Commands/AGhost.cs +++ b/Content.Server/Administration/Commands/AGhost.cs @@ -1,5 +1,4 @@ using Content.Server.GameTicking; -using Content.Server.Ghost.Components; using Content.Server.Mind; using Content.Server.Players; using Content.Shared.Administration; diff --git a/Content.Server/Administration/Commands/WarpCommand.cs b/Content.Server/Administration/Commands/WarpCommand.cs index 282bb61cc0..5c61208b5b 100644 --- a/Content.Server/Administration/Commands/WarpCommand.cs +++ b/Content.Server/Administration/Commands/WarpCommand.cs @@ -1,9 +1,9 @@ using System.Linq; using System.Numerics; -using Content.Server.Ghost.Components; using Content.Server.Warps; using Content.Shared.Administration; using Content.Shared.Follower; +using Content.Shared.Ghost; using Robust.Server.Player; using Robust.Shared.Console; using Robust.Shared.Enums; diff --git a/Content.Server/Chat/Systems/ChatSystem.cs b/Content.Server/Chat/Systems/ChatSystem.cs index 0c9ebe4790..98e9ac268b 100644 --- a/Content.Server/Chat/Systems/ChatSystem.cs +++ b/Content.Server/Chat/Systems/ChatSystem.cs @@ -5,7 +5,6 @@ using Content.Server.Administration.Logs; using Content.Server.Administration.Managers; using Content.Server.Chat.Managers; using Content.Server.GameTicking; -using Content.Server.Ghost.Components; using Content.Server.Players; using Content.Server.Station.Components; using Content.Server.Station.Systems; @@ -13,6 +12,7 @@ using Content.Shared.ActionBlocker; using Content.Shared.CCVar; using Content.Shared.Chat; using Content.Shared.Database; +using Content.Shared.Ghost; using Content.Shared.IdentityManagement; using Content.Shared.Interaction; using Content.Shared.Inventory; diff --git a/Content.Server/Drone/DroneSystem.cs b/Content.Server/Drone/DroneSystem.cs index 1cffb79ae7..4cf047c95c 100644 --- a/Content.Server/Drone/DroneSystem.cs +++ b/Content.Server/Drone/DroneSystem.cs @@ -1,6 +1,5 @@ using Content.Server.Body.Systems; using Content.Server.Drone.Components; -using Content.Server.Ghost.Components; using Content.Server.Ghost.Roles.Components; using Content.Server.Mind.Components; using Content.Server.Popups; @@ -10,6 +9,7 @@ using Content.Shared.Body.Components; using Content.Shared.Drone; using Content.Shared.Emoting; using Content.Shared.Examine; +using Content.Shared.Ghost; using Content.Shared.IdentityManagement; using Content.Shared.Interaction.Components; using Content.Shared.Interaction.Events; diff --git a/Content.Server/Fax/AdminUI/AdminFaxEui.cs b/Content.Server/Fax/AdminUI/AdminFaxEui.cs index da7a0769ad..77b570bc0a 100644 --- a/Content.Server/Fax/AdminUI/AdminFaxEui.cs +++ b/Content.Server/Fax/AdminUI/AdminFaxEui.cs @@ -1,9 +1,9 @@ using Content.Server.DeviceNetwork.Components; using Content.Server.EUI; -using Content.Server.Ghost.Components; using Content.Shared.Eui; using Content.Shared.Fax; using Content.Shared.Follower; +using Content.Shared.Ghost; using Content.Shared.Paper; namespace Content.Server.Fax.AdminUI; diff --git a/Content.Server/GameTicking/GameTicker.GamePreset.cs b/Content.Server/GameTicking/GameTicker.GamePreset.cs index 9ccddd110d..a34fbaeae7 100644 --- a/Content.Server/GameTicking/GameTicker.GamePreset.cs +++ b/Content.Server/GameTicking/GameTicker.GamePreset.cs @@ -2,12 +2,12 @@ using System.Diagnostics.CodeAnalysis; using System.Linq; using System.Threading.Tasks; using Content.Server.GameTicking.Presets; -using Content.Server.Ghost.Components; using Content.Server.Maps; using Content.Shared.CCVar; using Content.Shared.Damage; using Content.Shared.Damage.Prototypes; using Content.Shared.Database; +using Content.Shared.Ghost; using Content.Shared.Mobs.Components; using JetBrains.Annotations; using Robust.Server.Player; @@ -273,13 +273,13 @@ namespace Content.Server.GameTicking if (mind.TimeOfDeath.HasValue) { - ghostComponent.TimeOfDeath = mind.TimeOfDeath!.Value; + _ghost.SetTimeOfDeath(ghost, mind.TimeOfDeath!.Value, ghostComponent); } if (playerEntity != null) _adminLogger.Add(LogType.Mind, $"{EntityManager.ToPrettyString(playerEntity.Value):player} ghosted{(!canReturn ? " (non-returnable)" : "")}"); - _ghosts.SetCanReturnToBody(ghostComponent, canReturn); + _ghost.SetCanReturnToBody(ghostComponent, canReturn); if (canReturn) _mind.Visit(mind, ghost); diff --git a/Content.Server/GameTicking/GameTicker.cs b/Content.Server/GameTicking/GameTicker.cs index 75ef58187b..2441075dea 100644 --- a/Content.Server/GameTicking/GameTicker.cs +++ b/Content.Server/GameTicking/GameTicker.cs @@ -34,14 +34,38 @@ namespace Content.Server.GameTicking { public sealed partial class GameTicker : SharedGameTicker { + [Dependency] private readonly IAdminLogManager _adminLogger = default!; + [Dependency] private readonly IBanManager _banManager = default!; + [Dependency] private readonly IBaseServer _baseServer = default!; + [Dependency] private readonly IChatManager _chatManager = default!; + [Dependency] private readonly IConfigurationManager _configurationManager = default!; + [Dependency] private readonly IConsoleHost _consoleHost = default!; + [Dependency] private readonly IGameMapManager _gameMapManager = default!; + [Dependency] private readonly IGameTiming _gameTiming = default!; + [Dependency] private readonly ILogManager _logManager = default!; + [Dependency] private readonly IMapManager _mapManager = default!; + [Dependency] private readonly IPrototypeManager _prototypeManager = default!; + [Dependency] private readonly IRobustRandom _robustRandom = default!; +#if EXCEPTION_TOLERANCE + [Dependency] private readonly IRuntimeLog _runtimeLog = default!; +#endif + [Dependency] private readonly IServerPreferencesManager _prefsManager = default!; + [Dependency] private readonly IServerDbManager _db = default!; [Dependency] private readonly ArrivalsSystem _arrivals = default!; + [Dependency] private readonly ChatSystem _chatSystem = default!; + [Dependency] private readonly DamageableSystem _damageable = default!; [Dependency] private readonly MapLoaderSystem _map = default!; - [Dependency] private readonly SharedTransformSystem _transform = default!; [Dependency] private readonly GhostSystem _ghost = default!; [Dependency] private readonly MindSystem _mind = default!; [Dependency] private readonly MindTrackerSystem _mindTracker = default!; [Dependency] private readonly MobStateSystem _mobState = default!; + [Dependency] private readonly PlayTimeTrackingSystem _playTimeTrackings = default!; [Dependency] private readonly PvsOverrideSystem _pvsOverride = default!; + [Dependency] private readonly ServerUpdateManager _serverUpdates = default!; + [Dependency] private readonly StationJobsSystem _stationJobs = default!; + [Dependency] private readonly StationSpawningSystem _stationSpawning = default!; + [Dependency] private readonly SharedTransformSystem _transform = default!; + [Dependency] private readonly UserDbDataManager _userDb = default!; [ViewVariables] private bool _initialized; [ViewVariables] private bool _postInitialized; @@ -106,31 +130,5 @@ namespace Content.Server.GameTicking base.Update(frameTime); UpdateRoundFlow(frameTime); } - - [Dependency] private readonly IMapManager _mapManager = default!; - [Dependency] private readonly IGameTiming _gameTiming = default!; - [Dependency] private readonly IConfigurationManager _configurationManager = default!; - [Dependency] private readonly IChatManager _chatManager = default!; - [Dependency] private readonly IPrototypeManager _prototypeManager = default!; - [Dependency] private readonly IRobustRandom _robustRandom = default!; - [Dependency] private readonly IServerPreferencesManager _prefsManager = default!; - [Dependency] private readonly IBaseServer _baseServer = default!; - [Dependency] private readonly IGameMapManager _gameMapManager = default!; - [Dependency] private readonly IServerDbManager _db = default!; - [Dependency] private readonly IAdminLogManager _adminLogger = default!; - [Dependency] private readonly ILogManager _logManager = default!; - [Dependency] private readonly IConsoleHost _consoleHost = default!; -#if EXCEPTION_TOLERANCE - [Dependency] private readonly IRuntimeLog _runtimeLog = default!; -#endif - [Dependency] private readonly StationSpawningSystem _stationSpawning = default!; - [Dependency] private readonly StationJobsSystem _stationJobs = default!; - [Dependency] private readonly DamageableSystem _damageable = default!; - [Dependency] private readonly GhostSystem _ghosts = default!; - [Dependency] private readonly IBanManager _banManager = default!; - [Dependency] private readonly ChatSystem _chatSystem = default!; - [Dependency] private readonly ServerUpdateManager _serverUpdates = default!; - [Dependency] private readonly PlayTimeTrackingSystem _playTimeTrackings = default!; - [Dependency] private readonly UserDbDataManager _userDb = default!; } } diff --git a/Content.Server/Ghost/Components/GhostComponent.cs b/Content.Server/Ghost/Components/GhostComponent.cs deleted file mode 100644 index 2a0026f4d7..0000000000 --- a/Content.Server/Ghost/Components/GhostComponent.cs +++ /dev/null @@ -1,33 +0,0 @@ -using Content.Shared.Actions; -using Content.Shared.Actions.ActionTypes; -using Content.Shared.Ghost; -using Robust.Shared.Utility; - -namespace Content.Server.Ghost.Components -{ - [RegisterComponent] - [ComponentReference(typeof(SharedGhostComponent))] - public sealed partial class GhostComponent : SharedGhostComponent - { - public TimeSpan TimeOfDeath { get; set; } = TimeSpan.Zero; - - [DataField("booRadius")] - public float BooRadius = 3; - - [DataField("booMaxTargets")] - public int BooMaxTargets = 3; - - [DataField("action")] - public InstantAction Action = new() - { - UseDelay = TimeSpan.FromSeconds(120), - Icon = new SpriteSpecifier.Texture(new ("Interface/Actions/scream.png")), - DisplayName = "action-name-boo", - Description = "action-description-boo", - CheckCanInteract = false, - Event = new BooActionEvent(), - }; - } - - public sealed partial class BooActionEvent : InstantActionEvent { } -} diff --git a/Content.Server/Ghost/GhostSystem.cs b/Content.Server/Ghost/GhostSystem.cs index 5d17820b84..af34f432ef 100644 --- a/Content.Server/Ghost/GhostSystem.cs +++ b/Content.Server/Ghost/GhostSystem.cs @@ -26,8 +26,7 @@ using Robust.Shared.Timing; namespace Content.Server.Ghost { - [UsedImplicitly] - public sealed class GhostSystem : SharedGhostSystem + public sealed partial class GhostSystem : SharedGhostSystem { [Dependency] private readonly IGameTiming _gameTiming = default!; [Dependency] private readonly IPlayerManager _playerManager = default!; diff --git a/Content.Server/Ghost/Roles/GhostRoleSystem.cs b/Content.Server/Ghost/Roles/GhostRoleSystem.cs index 09cb53392b..843341c6d4 100644 --- a/Content.Server/Ghost/Roles/GhostRoleSystem.cs +++ b/Content.Server/Ghost/Roles/GhostRoleSystem.cs @@ -1,6 +1,5 @@ using Content.Server.Administration.Logs; using Content.Server.EUI; -using Content.Server.Ghost.Components; using Content.Server.Ghost.Roles.Components; using Content.Server.Ghost.Roles.Events; using Content.Server.Ghost.Roles.UI; diff --git a/Content.Server/Mind/MindSystem.cs b/Content.Server/Mind/MindSystem.cs index af82c637eb..042e908313 100644 --- a/Content.Server/Mind/MindSystem.cs +++ b/Content.Server/Mind/MindSystem.cs @@ -3,7 +3,6 @@ using System.Linq; using Content.Server.Administration.Logs; using Content.Server.GameTicking; using Content.Server.Ghost; -using Content.Server.Ghost.Components; using Content.Server.Mind.Components; using Content.Server.Objectives; using Content.Server.Players; @@ -11,6 +10,7 @@ using Content.Server.Roles; using Content.Shared.Database; using Content.Shared.Examine; using Content.Shared.GameTicking; +using Content.Shared.Ghost; using Content.Shared.Mobs.Systems; using Content.Shared.Interaction.Events; using Content.Shared.Mobs.Components; diff --git a/Content.Server/Pointing/EntitySystems/PointingSystem.cs b/Content.Server/Pointing/EntitySystems/PointingSystem.cs index bcf6ca6657..89700c4f5b 100644 --- a/Content.Server/Pointing/EntitySystems/PointingSystem.cs +++ b/Content.Server/Pointing/EntitySystems/PointingSystem.cs @@ -1,11 +1,11 @@ using System.Linq; using Content.Server.Administration.Logs; -using Content.Server.Ghost.Components; using Content.Server.Players; using Content.Server.Pointing.Components; using Content.Server.Visible; using Content.Shared.Bed.Sleep; using Content.Shared.Database; +using Content.Shared.Ghost; using Content.Shared.IdentityManagement; using Content.Shared.Input; using Content.Shared.Interaction; diff --git a/Content.Server/Singularity/EntitySystems/EventHorizonSystem.cs b/Content.Server/Singularity/EntitySystems/EventHorizonSystem.cs index 470dcb43a5..80c4ffb4d5 100644 --- a/Content.Server/Singularity/EntitySystems/EventHorizonSystem.cs +++ b/Content.Server/Singularity/EntitySystems/EventHorizonSystem.cs @@ -1,5 +1,4 @@ using Content.Server.Administration.Logs; -using Content.Server.Ghost.Components; using Content.Server.Mind.Components; using Content.Server.Station.Components; using Content.Server.Singularity.Events; @@ -13,6 +12,7 @@ using Robust.Shared.Map; using Robust.Shared.Map.Components; using Robust.Shared.Physics.Events; using System.Numerics; +using Content.Shared.Ghost; namespace Content.Server.Singularity.EntitySystems; diff --git a/Content.Server/Singularity/EntitySystems/GravityWellSystem.cs b/Content.Server/Singularity/EntitySystems/GravityWellSystem.cs index 493f7deb93..b10685ed27 100644 --- a/Content.Server/Singularity/EntitySystems/GravityWellSystem.cs +++ b/Content.Server/Singularity/EntitySystems/GravityWellSystem.cs @@ -6,9 +6,8 @@ using Robust.Shared.Physics.Systems; using Robust.Shared.Timing; using Content.Shared.Singularity.EntitySystems; - -using Content.Server.Ghost.Components; using Content.Server.Singularity.Components; +using Content.Shared.Ghost; namespace Content.Server.Singularity.EntitySystems; diff --git a/Content.Server/Storage/EntitySystems/StorageSystem.cs b/Content.Server/Storage/EntitySystems/StorageSystem.cs index 0322af11fa..530aa726eb 100644 --- a/Content.Server/Storage/EntitySystems/StorageSystem.cs +++ b/Content.Server/Storage/EntitySystems/StorageSystem.cs @@ -1,6 +1,5 @@ using System.Linq; using Content.Server.Administration.Managers; -using Content.Server.Ghost.Components; using Content.Server.Interaction; using Content.Server.Popups; using Content.Server.Stack; @@ -11,6 +10,7 @@ using Content.Shared.CombatMode; using Content.Shared.Containers.ItemSlots; using Content.Shared.Destructible; using Content.Shared.DoAfter; +using Content.Shared.Ghost; using Content.Shared.Hands.Components; using Content.Shared.Hands.EntitySystems; using Content.Shared.Implants.Components; diff --git a/Content.Server/Teleportation/PortalSystem.cs b/Content.Server/Teleportation/PortalSystem.cs index 2ca10c6082..c3104f1219 100644 --- a/Content.Server/Teleportation/PortalSystem.cs +++ b/Content.Server/Teleportation/PortalSystem.cs @@ -1,7 +1,7 @@ -using Content.Server.Ghost.Components; -using Content.Server.Mind.Components; +using Content.Server.Mind.Components; using Content.Shared.Administration.Logs; using Content.Shared.Database; +using Content.Shared.Ghost; using Content.Shared.Teleportation.Systems; using Robust.Shared.Map; diff --git a/Content.Server/UserInterface/ActivatableUISystem.cs b/Content.Server/UserInterface/ActivatableUISystem.cs index eb1343560c..bde518cc96 100644 --- a/Content.Server/UserInterface/ActivatableUISystem.cs +++ b/Content.Server/UserInterface/ActivatableUISystem.cs @@ -1,6 +1,6 @@ using Content.Server.Administration.Managers; -using Content.Server.Ghost.Components; using Content.Shared.ActionBlocker; +using Content.Shared.Ghost; using Content.Shared.Hands; using Content.Shared.Hands.Components; using Content.Shared.Interaction; diff --git a/Content.Server/Warps/WarpPointSystem.cs b/Content.Server/Warps/WarpPointSystem.cs index 9798f3fe86..d3b978a147 100644 --- a/Content.Server/Warps/WarpPointSystem.cs +++ b/Content.Server/Warps/WarpPointSystem.cs @@ -1,5 +1,5 @@ -using Content.Server.Ghost.Components; using Content.Shared.Examine; +using Content.Shared.Ghost; namespace Content.Server.Warps; diff --git a/Content.Server/Worldgen/Systems/WorldControllerSystem.cs b/Content.Server/Worldgen/Systems/WorldControllerSystem.cs index e05c76e013..0eae3a274d 100644 --- a/Content.Server/Worldgen/Systems/WorldControllerSystem.cs +++ b/Content.Server/Worldgen/Systems/WorldControllerSystem.cs @@ -1,7 +1,7 @@ using System.Linq; -using Content.Server.Ghost.Components; using Content.Server.Mind.Components; using Content.Server.Worldgen.Components; +using Content.Shared.Ghost; using JetBrains.Annotations; using Robust.Server.GameObjects; using Robust.Shared.Map; diff --git a/Content.Shared/Follower/FollowerSystem.cs b/Content.Shared/Follower/FollowerSystem.cs index 98e4d69ab8..334b80466a 100644 --- a/Content.Shared/Follower/FollowerSystem.cs +++ b/Content.Shared/Follower/FollowerSystem.cs @@ -61,7 +61,7 @@ public sealed class FollowerSystem : EntitySystem if (ev.User == ev.Target || ev.Target.IsClientSide()) return; - if (HasComp(ev.User)) + if (HasComp(ev.User)) { var verb = new AlternativeVerb() { diff --git a/Content.Shared/Ghost/GhostComponent.cs b/Content.Shared/Ghost/GhostComponent.cs new file mode 100644 index 0000000000..b45bdb2cf3 --- /dev/null +++ b/Content.Shared/Ghost/GhostComponent.cs @@ -0,0 +1,118 @@ +using Content.Shared.Actions; +using Content.Shared.Actions.ActionTypes; +using Robust.Shared.GameStates; +using Robust.Shared.Serialization; +using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom; +using Robust.Shared.Utility; + +namespace Content.Shared.Ghost; + +[RegisterComponent, NetworkedComponent, Access(typeof(SharedGhostSystem))] +[AutoGenerateComponentState] +public sealed partial class GhostComponent : Component +{ + // I have no idea what this means I just wanted to kill comp references. + [ViewVariables] + public bool IsAttached; + + public InstantAction ToggleLightingAction = new() + { + Icon = new SpriteSpecifier.Texture(new ("Interface/VerbIcons/light.svg.192dpi.png")), + DisplayName = "ghost-gui-toggle-lighting-manager-name", + Description = "ghost-gui-toggle-lighting-manager-desc", + ClientExclusive = true, + CheckCanInteract = false, + Event = new ToggleLightingActionEvent(), + }; + + public InstantAction ToggleFoVAction = new() + { + Icon = new SpriteSpecifier.Texture(new ("Interface/VerbIcons/vv.svg.192dpi.png")), + DisplayName = "ghost-gui-toggle-fov-name", + Description = "ghost-gui-toggle-fov-desc", + ClientExclusive = true, + CheckCanInteract = false, + Event = new ToggleFoVActionEvent(), + }; + + public InstantAction ToggleGhostsAction = new() + { + Icon = new SpriteSpecifier.Rsi(new ("Mobs/Ghosts/ghost_human.rsi"), "icon"), + DisplayName = "ghost-gui-toggle-ghost-visibility-name", + Description = "ghost-gui-toggle-ghost-visibility-desc", + ClientExclusive = true, + CheckCanInteract = false, + Event = new ToggleGhostsActionEvent(), + }; + + [ViewVariables(VVAccess.ReadWrite), DataField("timeOfDeath", customTypeSerializer:typeof(TimeOffsetSerializer))] + public TimeSpan TimeOfDeath = TimeSpan.Zero; + + [DataField("booRadius")] + public float BooRadius = 3; + + [DataField("booMaxTargets")] + public int BooMaxTargets = 3; + + [DataField("action")] + public InstantAction Action = new() + { + UseDelay = TimeSpan.FromSeconds(120), + Icon = new SpriteSpecifier.Texture(new ("Interface/Actions/scream.png")), + DisplayName = "action-name-boo", + Description = "action-description-boo", + CheckCanInteract = false, + Event = new BooActionEvent(), + }; + + // TODO: instead of this funny stuff just give it access and update in system dirtying when needed + [ViewVariables(VVAccess.ReadWrite)] + public bool CanGhostInteract + { + get => _canGhostInteract; + set + { + if (_canGhostInteract == value) return; + _canGhostInteract = value; + Dirty(); + } + } + + [DataField("canInteract"), AutoNetworkedField] + private bool _canGhostInteract; + + /// + /// Changed by + /// + // TODO MIRROR change this to use friend classes when thats merged + [ViewVariables(VVAccess.ReadWrite)] + public bool CanReturnToBody + { + get => _canReturnToBody; + set + { + if (_canReturnToBody == value) return; + _canReturnToBody = value; + Dirty(); + } + } + + /// + /// Ghost color + /// + /// Used to allow admins to change ghost colors. Should be removed if the capability to edit existing sprite colors is ever added back. + [DataField("color"), AutoNetworkedField] + [ViewVariables(VVAccess.ReadWrite)] + public Color color = Color.White; + + [DataField("canReturnToBody"), AutoNetworkedField] + private bool _canReturnToBody; +} + +public sealed partial class BooActionEvent : InstantActionEvent { } + +public sealed partial class ToggleFoVActionEvent : InstantActionEvent { }; + +public sealed partial class ToggleGhostsActionEvent : InstantActionEvent { }; + +public sealed partial class ToggleLightingActionEvent : InstantActionEvent { }; diff --git a/Content.Shared/Ghost/SharedGhostComponent.cs b/Content.Shared/Ghost/SharedGhostComponent.cs deleted file mode 100644 index ef8221b423..0000000000 --- a/Content.Shared/Ghost/SharedGhostComponent.cs +++ /dev/null @@ -1,55 +0,0 @@ -using Robust.Shared.GameStates; -using Robust.Shared.Serialization; - -namespace Content.Shared.Ghost -{ - [NetworkedComponent] - [AutoGenerateComponentState] - public abstract partial class SharedGhostComponent : Component - { - // TODO: instead of this funny stuff just give it access and update in system dirtying when needed - [ViewVariables(VVAccess.ReadWrite)] - public bool CanGhostInteract - { - get => _canGhostInteract; - set - { - if (_canGhostInteract == value) return; - _canGhostInteract = value; - Dirty(); - } - } - - [DataField("canInteract"), AutoNetworkedField] - private bool _canGhostInteract; - - /// - /// Changed by - /// - // TODO MIRROR change this to use friend classes when thats merged - [ViewVariables(VVAccess.ReadWrite)] - public bool CanReturnToBody - { - get => _canReturnToBody; - set - { - if (_canReturnToBody == value) return; - _canReturnToBody = value; - Dirty(); - } - } - - /// - /// Ghost color - /// - /// Used to allow admins to change ghost colors. Should be removed if the capability to edit existing sprite colors is ever added back. - [DataField("color"), AutoNetworkedField] - [ViewVariables(VVAccess.ReadWrite)] - public Color color = Color.White; - - [DataField("canReturnToBody"), AutoNetworkedField] - private bool _canReturnToBody; - } -} - - diff --git a/Content.Shared/Ghost/SharedGhostSystem.cs b/Content.Shared/Ghost/SharedGhostSystem.cs index 73583e0154..2bd2f8788f 100644 --- a/Content.Shared/Ghost/SharedGhostSystem.cs +++ b/Content.Shared/Ghost/SharedGhostSystem.cs @@ -1,4 +1,3 @@ -using Content.Shared.DragDrop; using Content.Shared.Emoting; using Content.Shared.Hands; using Content.Shared.Interaction.Events; @@ -8,28 +7,36 @@ using Robust.Shared.Serialization; namespace Content.Shared.Ghost { /// - /// System for the . - /// Prevents ghosts from interacting when is false. + /// System for the . + /// Prevents ghosts from interacting when is false. /// public abstract class SharedGhostSystem : EntitySystem { public override void Initialize() { base.Initialize(); - SubscribeLocalEvent(OnAttempt); - SubscribeLocalEvent(OnAttempt); - SubscribeLocalEvent(OnAttempt); - SubscribeLocalEvent(OnAttempt); - SubscribeLocalEvent(OnAttempt); + SubscribeLocalEvent(OnAttempt); + SubscribeLocalEvent(OnAttempt); + SubscribeLocalEvent(OnAttempt); + SubscribeLocalEvent(OnAttempt); + SubscribeLocalEvent(OnAttempt); } - private void OnAttempt(EntityUid uid, SharedGhostComponent component, CancellableEntityEventArgs args) + private void OnAttempt(EntityUid uid, GhostComponent component, CancellableEntityEventArgs args) { if (!component.CanGhostInteract) args.Cancel(); } - public void SetCanReturnToBody(EntityUid uid, bool value, SharedGhostComponent? component = null) + public void SetTimeOfDeath(EntityUid uid, TimeSpan value, GhostComponent? component) + { + if (!Resolve(uid, ref component)) + return; + + component.TimeOfDeath = value; + } + + public void SetCanReturnToBody(EntityUid uid, bool value, GhostComponent? component = null) { if (!Resolve(uid, ref component)) return; @@ -37,7 +44,7 @@ namespace Content.Shared.Ghost component.CanReturnToBody = value; } - public void SetCanReturnToBody(SharedGhostComponent component, bool value) + public void SetCanReturnToBody(GhostComponent component, bool value) { component.CanReturnToBody = value; } diff --git a/Content.Shared/IdentityManagement/Identity.cs b/Content.Shared/IdentityManagement/Identity.cs index f3f3f1f121..20220e0326 100644 --- a/Content.Shared/IdentityManagement/Identity.cs +++ b/Content.Shared/IdentityManagement/Identity.cs @@ -54,7 +54,7 @@ public static class Identity { // Would check for uid == viewer here but I think it's better for you to see yourself // how everyone else will see you, otherwise people will probably get confused and think they aren't disguised - return ent.HasComponent(viewer); + return ent.HasComponent(viewer); } } diff --git a/Content.Shared/Movement/Systems/SharedContentEyeSystem.cs b/Content.Shared/Movement/Systems/SharedContentEyeSystem.cs index d822a4c772..df327ae35e 100644 --- a/Content.Shared/Movement/Systems/SharedContentEyeSystem.cs +++ b/Content.Shared/Movement/Systems/SharedContentEyeSystem.cs @@ -92,7 +92,7 @@ public abstract class SharedContentEyeSystem : EntitySystem if (args.SenderSession.AttachedEntity is not { } player) return; - if (!HasComp(player) && !_admin.IsAdmin(player)) + if (!HasComp(player) && !_admin.IsAdmin(player)) return; if (TryComp(player, out var eyeComp)) diff --git a/Content.Shared/Singularity/EntitySystems/SharedEventHorizonSystem.cs b/Content.Shared/Singularity/EntitySystems/SharedEventHorizonSystem.cs index 4b39ef50e7..f31dd8776a 100644 --- a/Content.Shared/Singularity/EntitySystems/SharedEventHorizonSystem.cs +++ b/Content.Shared/Singularity/EntitySystems/SharedEventHorizonSystem.cs @@ -219,7 +219,7 @@ public abstract class SharedEventHorizonSystem : EntitySystem // For prediction reasons always want the client to ignore these. if (HasComp(otherUid) || - HasComp(otherUid)) + HasComp(otherUid)) { args.Cancelled = true; return true; diff --git a/Content.Shared/Teleportation/Systems/SharedPortalSystem.cs b/Content.Shared/Teleportation/Systems/SharedPortalSystem.cs index 503b77d6ae..bb235bee5e 100644 --- a/Content.Shared/Teleportation/Systems/SharedPortalSystem.cs +++ b/Content.Shared/Teleportation/Systems/SharedPortalSystem.cs @@ -50,7 +50,7 @@ public abstract class SharedPortalSystem : EntitySystem private void OnGetVerbs(EntityUid uid, PortalComponent component, GetVerbsEvent args) { // Traversal altverb for ghosts to use that bypasses normal functionality - if (!args.CanAccess || !HasComp(args.User)) + if (!args.CanAccess || !HasComp(args.User)) return; // Don't use the verb with unlinked or with multi-output portals