Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: DEATHB4DEFEAT <[email protected]>
  • Loading branch information
Pspritechologist and DEATHB4DEFEAT committed Feb 8, 2024
1 parent d29cb66 commit 22d3845
Show file tree
Hide file tree
Showing 12 changed files with 19 additions and 37 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,4 @@ public override void Closed()
{
_window.Close();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ private void OnEntInserted(EntityUid uid, HologramServerComponent component, Ent

if (Exists(component.LinkedHologram))
if (!_hologram.TryKillHologram(component.LinkedHologram.Value))
return; // This is a werid situation to encounter, so we'll just stop doin stuff.
return; // This is a weird situation to encounter, so we'll just stop doin stuff.

if (TryGenerateHologram(uid, args.Entity, out var holo, component))
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ public sealed class HologramSystem : SharedHologramSystem
[Dependency] private readonly StationSystem _station = default!;

public readonly Dictionary<Mind.Mind, EntityUid> HologramsWaitingForMind = new();

/// <summary>
/// Handles killing a Hologram, with no checks in place.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public override void Initialize()
SubscribeLocalEvent<SurveillanceCameraComponent, SurveillanceCameraSetupSetName>(OnSetName);
SubscribeLocalEvent<SurveillanceCameraComponent, SurveillanceCameraSetupSetNetwork>(OnSetNetwork);
SubscribeLocalEvent<SurveillanceCameraComponent, GetVerbsEvent<AlternativeVerb>>(AddVerbs);

SubscribeLocalEvent<SurveillanceCameraComponent, EmpPulseEvent>(OnEmpPulse);
SubscribeLocalEvent<SurveillanceCameraComponent, EmpDisabledRemoved>(OnEmpDisabledRemoved);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,14 @@ public sealed partial class HologramProjectedComponent : Component
/// A whitelist to check for on projectors, to determine if they're valid.
/// </summary>
[DataField("validProjectorWhitelist"), ViewVariables(VVAccess.ReadWrite)]
[AutoNetworkedField]
public EntityWhitelist ValidProjectorWhitelist = new();

/// <summary>
/// A timer for a grace period before the Holo is returned, to allow for moving through doors.
/// </summary>
[DataField("gracePeriod"), ViewVariables(VVAccess.ReadWrite)]
[AutoNetworkedField]
public TimeSpan GracePeriod = TimeSpan.FromSeconds(0.1f);

/// <summary>
Expand All @@ -33,12 +35,14 @@ public sealed partial class HologramProjectedComponent : Component
/// Note that making this number larger than PVS is highly inadvisable, as the client will be stuck predicting the Hologram returning while the server confirms that they do not.
/// </remarks>
[DataField("projectorRange"), ViewVariables(VVAccess.ReadWrite)]
[AutoNetworkedField]
public float ProjectorRange = 14f;

/// <summary>
/// The prototype of the effect to spawn for the Hologram's projection. Leave null to disable the visual projection effect.
/// </summary>
[DataField("effectPrototype", customTypeSerializer: typeof(PrototypeIdSerializer<EntityPrototype>))]
[AutoNetworkedField]
public string? EffectPrototype;

/// <summary>
Expand All @@ -49,6 +53,7 @@ public sealed partial class HologramProjectedComponent : Component
/// Primarily used for the station AI.
/// </remarks>
[DataField("setEyeTarget"), ViewVariables(VVAccess.ReadWrite)]
[AutoNetworkedField]
public bool SetEyeTarget = false;

/// <summary>
Expand All @@ -65,6 +70,7 @@ public sealed partial class HologramProjectedComponent : Component
/// If set, the Hologram will only be able to be projected from this projector, simply ignoring all others.
/// </summary>
[ViewVariables(VVAccess.ReadOnly)]
[AutoNetworkedField]
public EntityUid? ProjectorOverride;

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public sealed partial class HologramServerLinkedComponent : Component
/// If true, it will be returned if it leaves the grid.
/// </summary>
[ViewVariables(VVAccess.ReadWrite)]
[DataField("gridBound")]
[DataField("gridBound"), AutoNetworkedField]
[AutoNetworkedField]

Check failure on line 20 in Content.Shared/SimpleStation14/Holograms/Components/HologramServerLinkedComponent.cs

View workflow job for this annotation

GitHub Actions / build

Duplicate 'AutoNetworkedField' attribute

Check failure on line 20 in Content.Shared/SimpleStation14/Holograms/Components/HologramServerLinkedComponent.cs

View workflow job for this annotation

GitHub Actions / build

Duplicate 'AutoNetworkedField' attribute

Check failure on line 20 in Content.Shared/SimpleStation14/Holograms/Components/HologramServerLinkedComponent.cs

View workflow job for this annotation

GitHub Actions / build

Duplicate 'AutoNetworkedField' attribute

Check failure on line 20 in Content.Shared/SimpleStation14/Holograms/Components/HologramServerLinkedComponent.cs

View workflow job for this annotation

GitHub Actions / build

Duplicate 'AutoNetworkedField' attribute

Check failure on line 20 in Content.Shared/SimpleStation14/Holograms/Components/HologramServerLinkedComponent.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

Duplicate 'AutoNetworkedField' attribute

Check failure on line 20 in Content.Shared/SimpleStation14/Holograms/Components/HologramServerLinkedComponent.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

Duplicate 'AutoNetworkedField' attribute

Check failure on line 20 in Content.Shared/SimpleStation14/Holograms/Components/HologramServerLinkedComponent.cs

View workflow job for this annotation

GitHub Actions / build

Duplicate 'AutoNetworkedField' attribute

Check failure on line 20 in Content.Shared/SimpleStation14/Holograms/Components/HologramServerLinkedComponent.cs

View workflow job for this annotation

GitHub Actions / build

Duplicate 'AutoNetworkedField' attribute

Check failure on line 20 in Content.Shared/SimpleStation14/Holograms/Components/HologramServerLinkedComponent.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

Duplicate 'AutoNetworkedField' attribute

Check failure on line 20 in Content.Shared/SimpleStation14/Holograms/Components/HologramServerLinkedComponent.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

Duplicate 'AutoNetworkedField' attribute
public bool GridBound = true;

Expand All @@ -28,5 +28,6 @@ public sealed partial class HologramServerLinkedComponent : Component
/// </remarks>
[ViewVariables(VVAccess.ReadOnly)]
[AutoNetworkedField]
[AutoNetworkedField]

Check failure on line 31 in Content.Shared/SimpleStation14/Holograms/Components/HologramServerLinkedComponent.cs

View workflow job for this annotation

GitHub Actions / build

Duplicate 'AutoNetworkedField' attribute

Check failure on line 31 in Content.Shared/SimpleStation14/Holograms/Components/HologramServerLinkedComponent.cs

View workflow job for this annotation

GitHub Actions / build

Duplicate 'AutoNetworkedField' attribute

Check failure on line 31 in Content.Shared/SimpleStation14/Holograms/Components/HologramServerLinkedComponent.cs

View workflow job for this annotation

GitHub Actions / build

Duplicate 'AutoNetworkedField' attribute

Check failure on line 31 in Content.Shared/SimpleStation14/Holograms/Components/HologramServerLinkedComponent.cs

View workflow job for this annotation

GitHub Actions / build

Duplicate 'AutoNetworkedField' attribute

Check failure on line 31 in Content.Shared/SimpleStation14/Holograms/Components/HologramServerLinkedComponent.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

Duplicate 'AutoNetworkedField' attribute

Check failure on line 31 in Content.Shared/SimpleStation14/Holograms/Components/HologramServerLinkedComponent.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

Duplicate 'AutoNetworkedField' attribute

Check failure on line 31 in Content.Shared/SimpleStation14/Holograms/Components/HologramServerLinkedComponent.cs

View workflow job for this annotation

GitHub Actions / build

Duplicate 'AutoNetworkedField' attribute

Check failure on line 31 in Content.Shared/SimpleStation14/Holograms/Components/HologramServerLinkedComponent.cs

View workflow job for this annotation

GitHub Actions / build

Duplicate 'AutoNetworkedField' attribute

Check failure on line 31 in Content.Shared/SimpleStation14/Holograms/Components/HologramServerLinkedComponent.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

Duplicate 'AutoNetworkedField' attribute

Check failure on line 31 in Content.Shared/SimpleStation14/Holograms/Components/HologramServerLinkedComponent.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

Duplicate 'AutoNetworkedField' attribute
public EntityUid? LinkedServer;
}
Original file line number Diff line number Diff line change
Expand Up @@ -42,17 +42,15 @@ public virtual void DoReturnHologram(EntityUid hologram, HologramProjectedCompon
if (!Resolve(hologram, ref holoProjectedComp))
return;

if (!IsHoloProjectorValid(hologram, holoProjectedComp.CurProjector, 0, false)) // If their last visited Projector is invalid ignoring occlusion...
// If their last visited Projector is invalid ignoring occlusion and none is found
if (!IsHoloProjectorValid(hologram, holoProjectedComp.CurProjector, 0, false) &&
!TryGetHoloProjector(hologram, holoProjectedComp.ProjectorRange, out holoProjectedComp.CurProjector, holoProjectedComp, false))
{
if (!TryGetHoloProjector(hologram, holoProjectedComp.ProjectorRange, out holoProjectedComp.CurProjector, holoProjectedComp, false))
{
TryKillHologram(hologram); // And if none is found, kill the hologram.
return;
}
// Kill the hologram.
TryKillHologram(hologram);
return;
}

// The two if statements above set the current projector, and kill if it's null, so we know it's not null moving forward.

var returnedEvent = new HologramReturnAttemptEvent();
RaiseLocalEvent(hologram, ref returnedEvent);
if (returnedEvent.Cancelled)
Expand All @@ -71,7 +69,7 @@ public virtual void DoReturnHologram(EntityUid hologram, HologramProjectedCompon
/// </summary>
/// <param name="coords">The coords to perform the check from.</param>
/// <param name="result">The UID of the projector, or null if no projectors are found.</param>
/// <param name="whiteList">A list of tags to check for on projectors, to determine if they're valid.</param>
/// <param name="whiteList">An EntityWhitelist to check for on projectors to determine if they're valid.</param>
/// <param name="range">The range it should check for projectors in, if occlude is true</param>
/// <param name="occlude">Should it check only for unoccluded and in range projectors?</param>
/// <returns>Returns true if a projector is found, false if not.</returns>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
- type: body
id: Scutter
name: "scutter"
name: scutter
root: hand 1
slots:
hand 1:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,6 @@
id: EffectHologramProjectionBeam
noSpawn: true
components:
# - type: PointLight
# radius: 10.5
# energy: 15
# color: "#18abf5"
# - type: TimedDespawn
# lifetime: 1
- type: Sprite
drawdepth: Effects
layers:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
# damageContainer: Inorganic
- type: InteractionOutline
- type: Sprite
netsync: false
noRot: true
drawdepth: Mobs
layers:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,7 @@
"states": [
{
"name": "beam",
"delays": [
[
0.2,
0.2,
0.2,
0.2,
0.2,
0.2
]
]
"delays": [ [ 0.2, 0.2, 0.2, 0.2, 0.2, 0.2 ] ]
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,6 @@
},
{
"name": "shell",
"delays": [
[
1
]
]
},
{
"name": "l_hand",
Expand Down

0 comments on commit 22d3845

Please sign in to comment.