diff --git a/Content.Server/Holosign/HolosignComponent.cs b/Content.Server/Holosign/HolosignComponent.cs new file mode 100644 index 00000000000..66bfdd68e94 --- /dev/null +++ b/Content.Server/Holosign/HolosignComponent.cs @@ -0,0 +1,7 @@ +namespace Content.Server.Holosign +{ + [RegisterComponent] + public sealed partial class HolosignComponent : Component + { + } +} diff --git a/Content.Server/Holosign/HolosignSystem.cs b/Content.Server/Holosign/HolosignSystem.cs index a36603b01dd..5b1b3875eb5 100644 --- a/Content.Server/Holosign/HolosignSystem.cs +++ b/Content.Server/Holosign/HolosignSystem.cs @@ -4,6 +4,7 @@ using Content.Server.PowerCell; using Content.Shared.Interaction; using Content.Shared.Storage; +using System.Linq; namespace Content.Server.Holosign; @@ -11,6 +12,7 @@ public sealed class HolosignSystem : EntitySystem { [Dependency] private readonly PowerCellSystem _powerCell = default!; [Dependency] private readonly SharedTransformSystem _transform = default!; + [Dependency] private readonly EntityLookupSystem _lookup = default!; // ADT-Tweak public override void Initialize() @@ -41,13 +43,21 @@ private void OnExamine(EntityUid uid, HolosignProjectorComponent component, Exam private void OnBeforeInteract(EntityUid uid, HolosignProjectorComponent component, BeforeRangedInteractEvent args) { - - if (args.Handled + // ADT-Tweak-Start + if ( + args.Handled || !args.CanReach // prevent placing out of range || HasComp<StorageComponent>(args.Target) // if it's a storage component like a bag, we ignore usage so it can be stored + ) + return; + + var entities = _lookup.GetEntitiesInRange(args.ClickLocation.SnapToGrid(EntityManager), .1f).ToList().Where(e => HasComp<HolosignComponent>(e)); + if ( + entities.Any() || !_powerCell.TryUseCharge(uid, component.ChargeUse) // if no battery or no charge, doesn't work - ) + ) return; + // ADT-Tweak-End // places the holographic sign at the click location, snapped to grid. // overlapping of the same holo on one tile remains allowed to allow holofan refreshes diff --git a/Resources/Prototypes/Entities/Structures/Holographic/projections.yml b/Resources/Prototypes/Entities/Structures/Holographic/projections.yml index f9bf81695e9..36714c6a6c3 100644 --- a/Resources/Prototypes/Entities/Structures/Holographic/projections.yml +++ b/Resources/Prototypes/Entities/Structures/Holographic/projections.yml @@ -25,6 +25,7 @@ behaviors: - !type:DoActsBehavior acts: [ "Destruction" ] + - type: Holosign #ADT-Tweak - type: entity id: HoloFan