From a2ae334a941d26f78700a40df27746f15f62aced Mon Sep 17 00:00:00 2001 From: Daniel <77834935+Orvex07@users.noreply.github.com> Date: Thu, 25 Dec 2025 18:39:38 +0100 Subject: [PATCH] =?UTF-8?q?=D0=9B=D0=B8=D0=BC=D0=B8=D1=82=20=D1=83=D1=81?= =?UTF-8?q?=D1=82=D0=B0=D0=BD=D0=BE=D0=B2=D0=BA=D0=B8=20=D0=B3=D0=BE=D0=BB?= =?UTF-8?q?=D0=BE=D0=B3=D1=80=D0=B0=D1=84=D0=B8=D1=87=D0=B5=D1=81=D0=BA?= =?UTF-8?q?=D0=B8=D1=85=20=D0=B1=D0=B0=D1=80=D1=8C=D0=B5=D1=80=D0=BE=D0=B2?= =?UTF-8?q?.=20=20(#3437)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Holosign/HolosignProjectorComponent.cs | 8 +++++++ Content.Server/Holosign/HolosignSystem.cs | 23 +++++++++++++++++-- .../Objects/Devices/holoprojectors.yml | 9 +++++++- .../Structures/Holographic/projections.yml | 2 +- 4 files changed, 38 insertions(+), 4 deletions(-) diff --git a/Content.Server/Holosign/HolosignProjectorComponent.cs b/Content.Server/Holosign/HolosignProjectorComponent.cs index bdc826f130..d0a5681937 100644 --- a/Content.Server/Holosign/HolosignProjectorComponent.cs +++ b/Content.Server/Holosign/HolosignProjectorComponent.cs @@ -15,5 +15,13 @@ namespace Content.Server.Holosign /// [ViewVariables(VVAccess.ReadWrite), DataField("chargeUse")] public float ChargeUse = 50f; + + // Sunrise - Start + /// + /// How many holosigns can be in one tile at once. + /// + [DataField] + public int CountPerTileLimit = 3; + // Sunrise - End } } diff --git a/Content.Server/Holosign/HolosignSystem.cs b/Content.Server/Holosign/HolosignSystem.cs index beb5e909c0..806e83f9e9 100644 --- a/Content.Server/Holosign/HolosignSystem.cs +++ b/Content.Server/Holosign/HolosignSystem.cs @@ -11,6 +11,7 @@ public sealed class HolosignSystem : EntitySystem { [Dependency] private readonly PowerCellSystem _powerCell = default!; [Dependency] private readonly SharedTransformSystem _transform = default!; + private const float TileSearchRadius = 0.1f; // sunrise - add public override void Initialize() { @@ -40,14 +41,32 @@ public sealed class HolosignSystem : EntitySystem private void OnBeforeInteract(EntityUid uid, HolosignProjectorComponent component, BeforeRangedInteractEvent args) { - + // Sunrise - Start if (args.Handled || !args.CanReach // prevent placing out of range || HasComp(args.Target) // if it's a storage component like a bag, we ignore usage so it can be stored - || !_powerCell.TryUseCharge(uid, component.ChargeUse, user: args.User) // if no battery or no charge, doesn't work ) return; + var tileCoords = args.ClickLocation.SnapToGrid(EntityManager); + var mapCoords = _transform.ToMapCoordinates(tileCoords); + var lookup = EntityManager.System(); + + int count = 0; + foreach (var ent in lookup.GetEntitiesInRange(mapCoords, TileSearchRadius)) + { + if (MetaData(ent).EntityPrototype?.ID == component.SignProto) + { + count++; + if (count >= component.CountPerTileLimit) + return; + } + } + + if (!_powerCell.TryUseCharge(uid, component.ChargeUse, user: args.User)) + return; + // Sunrise - 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 var holoUid = Spawn(component.SignProto, args.ClickLocation.SnapToGrid(EntityManager)); diff --git a/Resources/Prototypes/Entities/Objects/Devices/holoprojectors.yml b/Resources/Prototypes/Entities/Objects/Devices/holoprojectors.yml index a7872fb18d..fffd5106c6 100644 --- a/Resources/Prototypes/Entities/Objects/Devices/holoprojectors.yml +++ b/Resources/Prototypes/Entities/Objects/Devices/holoprojectors.yml @@ -44,6 +44,7 @@ components: - type: HolosignProjector chargeUse: 240 + countPerTileLimit: 2 # Sunrise - Added - type: ItemSlots slots: cell_slot: @@ -62,6 +63,7 @@ - type: HolosignProjector signProto: HoloPeel chargeUse: 240 + countPerTileLimit: 2 # Sunrise - Added - type: Sprite sprite: Objects/Devices/Holoprojectors/peel.rsi state: icon @@ -82,6 +84,7 @@ - type: HolosignProjector signProto: HoloFan chargeUse: 120 + countPerTileLimit: 2 # Sunrise - Added - type: Sprite sprite: Objects/Devices/Holoprojectors/atmos.rsi state: icon @@ -128,7 +131,10 @@ components: - type: HolosignProjector signProto: HolosignForcefield - chargeUse: 120 + # Sunrise - Start + chargeUse: 350 + countPerTileLimit: 1 + # Sunrise - End - type: Sprite sprite: Objects/Devices/Holoprojectors/field.rsi state: icon @@ -157,6 +163,7 @@ - type: HolosignProjector signProto: HolosignSecurity chargeUse: 90 + countPerTileLimit: 2 # Sunrise - Added - type: Sprite sprite: Objects/Devices/Holoprojectors/security.rsi state: icon diff --git a/Resources/Prototypes/Entities/Structures/Holographic/projections.yml b/Resources/Prototypes/Entities/Structures/Holographic/projections.yml index 651f62fd66..d3e472042d 100644 --- a/Resources/Prototypes/Entities/Structures/Holographic/projections.yml +++ b/Resources/Prototypes/Entities/Structures/Holographic/projections.yml @@ -155,7 +155,7 @@ thresholds: - trigger: !type:DamageTrigger - damage: 60 + damage: 250 # Sunrise - Edit behaviors: - !type:DoActsBehavior acts: [ "Destruction" ]