Skip to content

Commit

Permalink
Making more things holograms
Browse files Browse the repository at this point in the history
  • Loading branch information
Pspritechologist committed Feb 9, 2024
1 parent 311227d commit f6706a9
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 29 deletions.
Original file line number Diff line number Diff line change
@@ -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!;
Expand All @@ -31,16 +23,19 @@ public sealed class HologramServerSystem : EntitySystem
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<HologramServerComponent, EntInsertedIntoContainerMessage>(OnEntInserted);
SubscribeLocalEvent<HologramServerComponent, EntRemovedFromContainerMessage>(OnEntRemoved);
SubscribeLocalEvent<HologramDiskComponent, AfterInteractEvent>(OnAfterInteract);
SubscribeLocalEvent<HologramServerComponent, PowerChangedEvent>(OnPowerChanged);

SubscribeLocalEvent<HologramServerComponent, EntInsertedIntoContainerMessage>(ServerOnEntInserted);
SubscribeLocalEvent<HologramServerComponent, EntRemovedFromContainerMessage>(ServerOnEntRemoved);
SubscribeLocalEvent<HologramDiskComponent, AfterInteractEvent>(DiskOnAfterInteract);
SubscribeLocalEvent<HologramServerComponent, PowerChangedEvent>(ServerOnPowerChanged);

InitializeStation();

Check failure on line 32 in Content.Server/SimpleStation14/Holograms/Systems/HologramServerSystem.cs

View workflow job for this annotation

GitHub Actions / build

The name 'InitializeStation' does not exist in the current context

Check failure on line 32 in Content.Server/SimpleStation14/Holograms/Systems/HologramServerSystem.cs

View workflow job for this annotation

GitHub Actions / build

The name 'InitializeStation' does not exist in the current context

Check failure on line 32 in Content.Server/SimpleStation14/Holograms/Systems/HologramServerSystem.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

The name 'InitializeStation' does not exist in the current context

Check failure on line 32 in Content.Server/SimpleStation14/Holograms/Systems/HologramServerSystem.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

The name 'InitializeStation' does not exist in the current context

Check failure on line 32 in Content.Server/SimpleStation14/Holograms/Systems/HologramServerSystem.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

The name 'InitializeStation' does not exist in the current context

Check failure on line 32 in Content.Server/SimpleStation14/Holograms/Systems/HologramServerSystem.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

The name 'InitializeStation' does not exist in the current context

Check failure on line 32 in Content.Server/SimpleStation14/Holograms/Systems/HologramServerSystem.cs

View workflow job for this annotation

GitHub Actions / build

The name 'InitializeStation' does not exist in the current context

Check failure on line 32 in Content.Server/SimpleStation14/Holograms/Systems/HologramServerSystem.cs

View workflow job for this annotation

GitHub Actions / build

The name 'InitializeStation' does not exist in the current context

Check failure on line 32 in Content.Server/SimpleStation14/Holograms/Systems/HologramServerSystem.cs

View workflow job for this annotation

GitHub Actions / build

The name 'InitializeStation' does not exist in the current context

Check failure on line 32 in Content.Server/SimpleStation14/Holograms/Systems/HologramServerSystem.cs

View workflow job for this annotation

GitHub Actions / build

The name 'InitializeStation' does not exist in the current context
}

/// <summary>
/// Handles generating a hologram from an inserted disk
/// </summary>
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;
Expand All @@ -59,7 +54,7 @@ private void OnEntInserted(EntityUid uid, HologramServerComponent component, Ent
/// <summary>
/// Handles killing a hologram when a disk is removed
/// </summary>
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;
Expand All @@ -74,7 +69,7 @@ private void OnEntRemoved(EntityUid uid, HologramServerComponent component, EntR
/// <param name="uid">The entity uid of the server</param>
/// <param name="component">The HologramServerComponent</param>
/// <param name="args">The PowerChangedEvent</param>
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))
Expand Down Expand Up @@ -115,10 +110,10 @@ public bool TryGenerateHologram(EntityUid server, EntityUid disk, [NotNullWhen(t
if (!TryComp<HologramDiskComponent>(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<MindContainerComponent>(args.Target, out var targetMind))
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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!;
Expand Down Expand Up @@ -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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ public override void Initialize()
SubscribeLocalEvent<HologramComponent, PreventCollideEvent>(OnHoloCollide);

InitializeServerLinked();
InitializeProjected();
SubscribeLocalEvent<HologramComponent, ComponentStartup>(hologramcomponentstartup);
}

Expand Down
6 changes: 6 additions & 0 deletions Resources/Prototypes/Entities/Mobs/NPCs/carp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,12 @@
- Opaque
- type: TypingIndicator
proto: robot
- type: Hologram
- type: Tag
tags:
- Carp
- DoorBumpOpener
- Hardlight

- type: entity
id: MobCarpSalvage
Expand Down
5 changes: 5 additions & 0 deletions Resources/Prototypes/Entities/Mobs/Player/guardian.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
state: icon
- type: TimedDespawn
lifetime: 90
- type: Hologram

- type: entity
id: HoloFan
Expand Down Expand Up @@ -74,3 +75,6 @@
color: red
- type: Climbable
- type: Clickable
- type: Tag
tags:
- Hardlight
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit f6706a9

Please sign in to comment.