From f6706a9a892d86b49563cf56751ab73b0ea42f18 Mon Sep 17 00:00:00 2001 From: Pspritechologist Date: Thu, 8 Feb 2024 23:50:43 -0500 Subject: [PATCH] Making more things holograms --- .../Holograms/Systems/HologramServerSystem.cs | 31 ++++++++----------- .../Holograms/Systems/HologramSystem.cs | 9 +----- .../Holograms/Systems/SharedHologramSystem.cs | 1 + .../Prototypes/Entities/Mobs/NPCs/carp.yml | 6 ++++ .../Entities/Mobs/Player/guardian.yml | 5 +++ .../Structures/Holographic/projections.yml | 4 +++ .../Entities/Mobs/Player/hologram.yml | 6 ++-- 7 files changed, 33 insertions(+), 29 deletions(-) diff --git a/Content.Server/SimpleStation14/Holograms/Systems/HologramServerSystem.cs b/Content.Server/SimpleStation14/Holograms/Systems/HologramServerSystem.cs index 1ac876c674..0dc248903b 100644 --- a/Content.Server/SimpleStation14/Holograms/Systems/HologramServerSystem.cs +++ b/Content.Server/SimpleStation14/Holograms/Systems/HologramServerSystem.cs @@ -1,25 +1,17 @@ -using Content.Server.Humanoid; -using Content.Server.Mind; -using Content.Server.Preferences.Managers; using Content.Server.Power.Components; using Content.Shared.Tag; using Content.Shared.Popups; using Content.Shared.SimpleStation14.Holograms; -using Content.Shared.Administration.Logs; -using Content.Shared.Mobs.Systems; using Content.Shared.Interaction; -using Robust.Server.Player; using Robust.Shared.Containers; -using Content.Shared.Movement.Systems; using Content.Server.Mind.Components; using Content.Shared.SimpleStation14.Holograms.Components; using System.Diagnostics.CodeAnalysis; -using Content.Server.EUI; using Robust.Server.GameObjects; namespace Content.Server.SimpleStation14.Holograms; -public sealed class HologramServerSystem : EntitySystem +public sealed partial class HologramServerSystem : EntitySystem { [Dependency] private readonly SharedPopupSystem _popup = default!; [Dependency] private readonly TagSystem _tags = default!; @@ -31,16 +23,19 @@ public sealed class HologramServerSystem : EntitySystem public override void Initialize() { base.Initialize(); - SubscribeLocalEvent(OnEntInserted); - SubscribeLocalEvent(OnEntRemoved); - SubscribeLocalEvent(OnAfterInteract); - SubscribeLocalEvent(OnPowerChanged); + + SubscribeLocalEvent(ServerOnEntInserted); + SubscribeLocalEvent(ServerOnEntRemoved); + SubscribeLocalEvent(DiskOnAfterInteract); + SubscribeLocalEvent(ServerOnPowerChanged); + + InitializeStation(); } /// /// Handles generating a hologram from an inserted disk /// - private void OnEntInserted(EntityUid uid, HologramServerComponent component, EntInsertedIntoContainerMessage args) + private void ServerOnEntInserted(EntityUid uid, HologramServerComponent component, EntInsertedIntoContainerMessage args) { if (args.Container.ID != component.DiskSlot || !_tags.HasTag(args.Entity, TagHoloDisk)) return; @@ -59,7 +54,7 @@ private void OnEntInserted(EntityUid uid, HologramServerComponent component, Ent /// /// Handles killing a hologram when a disk is removed /// - private void OnEntRemoved(EntityUid uid, HologramServerComponent component, EntRemovedFromContainerMessage args) + private void ServerOnEntRemoved(EntityUid uid, HologramServerComponent component, EntRemovedFromContainerMessage args) { if (args.Container.ID != component.DiskSlot || !_tags.HasTag(args.Entity, TagHoloDisk)) return; @@ -74,7 +69,7 @@ private void OnEntRemoved(EntityUid uid, HologramServerComponent component, EntR /// The entity uid of the server /// The HologramServerComponent /// The PowerChangedEvent - private void OnPowerChanged(EntityUid uid, HologramServerComponent component, ref PowerChangedEvent args) + private void ServerOnPowerChanged(EntityUid uid, HologramServerComponent component, ref PowerChangedEvent args) { // If the server is no longer powered and the hologram exists if (!args.Powered && Exists(component.LinkedHologram)) @@ -115,10 +110,10 @@ public bool TryGenerateHologram(EntityUid server, EntityUid disk, [NotNullWhen(t if (!TryComp(disk, out var diskComp) || diskComp.HoloMind == null) return false; - return _hologram.TryGenerateHologram(diskComp.HoloMind, _transform.GetMoverCoordinates(server), out hologram); + return _hologram.TryGenerateHumanoidHologram(diskComp.HoloMind, _transform.GetMoverCoordinates(server), out hologram); } - private void OnAfterInteract(EntityUid uid, HologramDiskComponent component, AfterInteractEvent args) + private void DiskOnAfterInteract(EntityUid uid, HologramDiskComponent component, AfterInteractEvent args) { if (args.Target == null || !TryComp(args.Target, out var targetMind)) return; diff --git a/Content.Server/SimpleStation14/Holograms/Systems/HologramSystem.cs b/Content.Server/SimpleStation14/Holograms/Systems/HologramSystem.cs index f5b67677e0..9e63987833 100644 --- a/Content.Server/SimpleStation14/Holograms/Systems/HologramSystem.cs +++ b/Content.Server/SimpleStation14/Holograms/Systems/HologramSystem.cs @@ -26,10 +26,6 @@ using Robust.Server.Player; using Robust.Shared.Containers; using Robust.Shared.GameObjects.Components.Localization; -using Content.Shared.Movement.Systems; -using System.Threading.Tasks; -using Content.Shared.SimpleStation14.Holograms.Components; -using Content.Server.SimpleStation14.Holograms.Components; using System.Diagnostics.CodeAnalysis; using Content.Server.EUI; using Robust.Server.GameObjects; @@ -52,10 +48,7 @@ public sealed class HologramSystem : SharedHologramSystem [Dependency] private readonly HumanoidAppearanceSystem _humanoid = default!; [Dependency] private readonly MobStateSystem _mobState = default!; [Dependency] private readonly MindSystem _mind = default!; - [Dependency] private readonly TagSystem _tag = default!; [Dependency] private readonly IServerPreferencesManager _prefs = default!; - [Dependency] private readonly TagSystem _tags = default!; - [Dependency] private readonly SharedMoverController _mover = default!; [Dependency] private readonly EuiManager _eui = default!; [Dependency] private readonly TransformSystem _transform = default!; [Dependency] private readonly MetaDataSystem _meta = default!; @@ -89,7 +82,7 @@ public override void DoKillHologram(EntityUid hologram, HologramComponent? holoC _adminLogger.Add(LogType.Mind, LogImpact.Medium, $"{ToPrettyString(hologram):mob} was killed!"); } - public bool TryGenerateHologram(Mind.Mind mind, EntityCoordinates coords, [NotNullWhen(true)] out EntityUid? holo) + public bool TryGenerateHumanoidHologram(Mind.Mind mind, EntityCoordinates coords, [NotNullWhen(true)] out EntityUid? holo) { holo = null; diff --git a/Content.Shared/SimpleStation14/Holograms/Systems/SharedHologramSystem.cs b/Content.Shared/SimpleStation14/Holograms/Systems/SharedHologramSystem.cs index dc3171afe5..ee3c6d1f75 100644 --- a/Content.Shared/SimpleStation14/Holograms/Systems/SharedHologramSystem.cs +++ b/Content.Shared/SimpleStation14/Holograms/Systems/SharedHologramSystem.cs @@ -32,6 +32,7 @@ public override void Initialize() SubscribeLocalEvent(OnHoloCollide); InitializeServerLinked(); + InitializeProjected(); SubscribeLocalEvent(hologramcomponentstartup); } diff --git a/Resources/Prototypes/Entities/Mobs/NPCs/carp.yml b/Resources/Prototypes/Entities/Mobs/NPCs/carp.yml index 22b2761922..af6c4da262 100644 --- a/Resources/Prototypes/Entities/Mobs/NPCs/carp.yml +++ b/Resources/Prototypes/Entities/Mobs/NPCs/carp.yml @@ -130,6 +130,12 @@ - Opaque - type: TypingIndicator proto: robot + - type: Hologram + - type: Tag + tags: + - Carp + - DoorBumpOpener + - Hardlight - type: entity id: MobCarpSalvage diff --git a/Resources/Prototypes/Entities/Mobs/Player/guardian.yml b/Resources/Prototypes/Entities/Mobs/Player/guardian.yml index 425a964424..a474457c72 100644 --- a/Resources/Prototypes/Entities/Mobs/Player/guardian.yml +++ b/Resources/Prototypes/Entities/Mobs/Player/guardian.yml @@ -122,6 +122,11 @@ map: [ "enum.DamageStateVisualLayers.BaseUnshaded" ] color: "#40a7d7" shader: unshaded + - type: Hologram + - type: Tag + tags: + - CannotSuicide + - Hardlight # From Wizard deck of cards - type: entity diff --git a/Resources/Prototypes/Entities/Structures/Holographic/projections.yml b/Resources/Prototypes/Entities/Structures/Holographic/projections.yml index d49ee0c635..f7ce889ad4 100644 --- a/Resources/Prototypes/Entities/Structures/Holographic/projections.yml +++ b/Resources/Prototypes/Entities/Structures/Holographic/projections.yml @@ -15,6 +15,7 @@ state: icon - type: TimedDespawn lifetime: 90 + - type: Hologram - type: entity id: HoloFan @@ -74,3 +75,6 @@ color: red - type: Climbable - type: Clickable + - type: Tag + tags: + - Hardlight diff --git a/Resources/Prototypes/SimpleStation14/Entities/Mobs/Player/hologram.yml b/Resources/Prototypes/SimpleStation14/Entities/Mobs/Player/hologram.yml index 2a330a3972..d063c4c90f 100644 --- a/Resources/Prototypes/SimpleStation14/Entities/Mobs/Player/hologram.yml +++ b/Resources/Prototypes/SimpleStation14/Entities/Mobs/Player/hologram.yml @@ -164,9 +164,9 @@ interactSuccessString: hugging-success-hologram # interactSuccessSound: /Audio/Effects/thudswoosh.ogg messagePerceivedByOthers: hugging-success-hologram-others - # - type: Faction - # factions: - # - NanoTrasen + - type: NpcFactionMember + factions: + - NanoTrasen - type: PointLight radius: 1.0 softness: 1.4