From 20aeb0c4bd9511b263c3840034542cbdf82d5cd1 Mon Sep 17 00:00:00 2001
From: CaypenNow <66198468+CaypenNow@users.noreply.github.com>
Date: Thu, 21 Mar 2024 04:44:18 +0500
Subject: [PATCH] =?UTF-8?q?=D0=A0=D0=B5=D0=BC=D0=B5=D0=B9=D0=BA=20=D0=B0?=
=?UTF-8?q?=D1=82=D0=BC=D0=BE=D1=81=20=D0=B3=D0=BE=D0=BB=D0=BE=D0=BF=D1=80?=
=?UTF-8?q?=D0=BE=D0=B5=D0=BA=D1=82=D0=BE=D1=80=D0=B0=20(#225)?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
* add: atmos holoprojector remake
* add: clean on use
* translate
---
.../Holosign/HolosignProjectorComponent.cs | 7 +-
Content.Server/Holosign/HolosignSystem.cs | 72 ++++++++++++-------
.../ru-RU/locales-new/autotranslate-56.ftl | 5 +-
.../Objects/Devices/holoprojectors.yml | 19 -----
.../Structures/Holographic/projections.yml | 4 --
5 files changed, 55 insertions(+), 52 deletions(-)
diff --git a/Content.Server/Holosign/HolosignProjectorComponent.cs b/Content.Server/Holosign/HolosignProjectorComponent.cs
index b1d2456221..0d3a1f25c7 100644
--- a/Content.Server/Holosign/HolosignProjectorComponent.cs
+++ b/Content.Server/Holosign/HolosignProjectorComponent.cs
@@ -13,7 +13,10 @@ namespace Content.Server.Holosign
///
/// How much charge a single use expends.
///
- [ViewVariables(VVAccess.ReadWrite), DataField("chargeUse")]
- public float ChargeUse = 50f;
+ [ViewVariables(VVAccess.ReadWrite), DataField]
+ public int Uses = 10;
+
+ [ViewVariables(VVAccess.ReadWrite), DataField]
+ public List Signs = new();
}
}
diff --git a/Content.Server/Holosign/HolosignSystem.cs b/Content.Server/Holosign/HolosignSystem.cs
index 58a0bf0d5f..33a08c0975 100644
--- a/Content.Server/Holosign/HolosignSystem.cs
+++ b/Content.Server/Holosign/HolosignSystem.cs
@@ -1,16 +1,16 @@
+using Content.Server.Popups;
using Content.Shared.Examine;
using Content.Shared.Coordinates.Helpers;
-using Content.Server.Power.Components;
-using Content.Server.PowerCell;
using Content.Shared.Interaction;
-using Content.Shared.Storage;
+using Content.Shared.Interaction.Events;
+using Content.Shared.Popups;
namespace Content.Server.Holosign;
public sealed class HolosignSystem : EntitySystem
{
- [Dependency] private readonly PowerCellSystem _powerCell = default!;
[Dependency] private readonly SharedTransformSystem _transform = default!;
+ [Dependency] private readonly PopupSystem _popupSystem = default!;
public override void Initialize()
@@ -18,19 +18,20 @@ public sealed class HolosignSystem : EntitySystem
base.Initialize();
SubscribeLocalEvent(OnBeforeInteract);
SubscribeLocalEvent(OnExamine);
+ SubscribeLocalEvent(OnComponentRemove);
+ SubscribeLocalEvent(OnUse);
}
private void OnExamine(EntityUid uid, HolosignProjectorComponent component, ExaminedEvent args)
{
- // TODO: This should probably be using an itemstatus
- // TODO: I'm too lazy to do this rn but it's literally copy-paste from emag.
- _powerCell.TryGetBatteryFromSlot(uid, out var battery);
- var charges = UsesRemaining(component, battery);
- var maxCharges = MaxUses(component, battery);
+ var charges = UsesRemaining(component);
+ var maxCharges = component.Uses;
+ var activeholo = ActiveHolo(component);
using (args.PushGroup(nameof(HolosignProjectorComponent)))
{
args.PushMarkup(Loc.GetString("limited-charges-charges-remaining", ("charges", charges)));
+ args.PushMarkup(Loc.GetString("holoprojector-active-holo", ("activeholo", activeholo)));
if (charges > 0 && charges == maxCharges)
{
@@ -39,39 +40,58 @@ public sealed class HolosignSystem : EntitySystem
}
}
+ private void OnUse(EntityUid uid, HolosignProjectorComponent comp, UseInHandEvent args)
+ {
+ foreach (var sign in comp.Signs)
+ {
+ comp.Signs.Remove(sign);
+ QueueDel(sign);
+ }
+ _popupSystem.PopupEntity(Loc.GetString("holoprojector-delete-signs"), args.User, args.User, PopupType.Medium);
+ }
+
private void OnBeforeInteract(EntityUid uid, HolosignProjectorComponent component, BeforeRangedInteractEvent args)
{
+ if (component.Signs.Contains(args.Target)) // wd edit
+ {
+ QueueDel(args.Target);
+ component.Signs.Remove(args.Target);
+ return;
+ }
- 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) // if no battery or no charge, doesn't work
- )
+ if (args.Handled || !args.CanReach)
return;
- // 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
+ if (component.Signs.Count >= component.Uses) // wd edit
+ {
+ _popupSystem.PopupEntity(Loc.GetString("holoprojector-uses-limit"), args.User, args.User, PopupType.Medium);
+ return;
+ }
+
var holoUid = EntityManager.SpawnEntity(component.SignProto, args.ClickLocation.SnapToGrid(EntityManager));
var xform = Transform(holoUid);
if (!xform.Anchored)
- _transform.AnchorEntity(holoUid, xform); // anchor to prevent any tempering with (don't know what could even interact with it)
+ _transform.AnchorEntity(holoUid, xform);
args.Handled = true;
+ component.Signs.Add(holoUid); // WD EDIT
}
- private int UsesRemaining(HolosignProjectorComponent component, BatteryComponent? battery = null)
+ private void OnComponentRemove(EntityUid uid, HolosignProjectorComponent comp, ComponentRemove args) // wd edit
{
- if (battery == null ||
- component.ChargeUse == 0f) return 0;
-
- return (int) (battery.CurrentCharge / component.ChargeUse);
+ foreach (var sign in comp.Signs)
+ {
+ QueueDel(sign);
+ }
}
- private int MaxUses(HolosignProjectorComponent component, BatteryComponent? battery = null)
+ private int UsesRemaining(HolosignProjectorComponent component)
{
- if (battery == null ||
- component.ChargeUse == 0f) return 0;
+ return (component.Uses - component.Signs.Count); // wd edit
+ }
- return (int) (battery.MaxCharge / component.ChargeUse);
+ private int ActiveHolo(HolosignProjectorComponent component) // wd edit
+ {
+ return (component.Signs.Count); // wd edit
}
}
diff --git a/Resources/Locale/ru-RU/locales-new/autotranslate-56.ftl b/Resources/Locale/ru-RU/locales-new/autotranslate-56.ftl
index 662dad5304..4e1cafbb1c 100644
--- a/Resources/Locale/ru-RU/locales-new/autotranslate-56.ftl
+++ b/Resources/Locale/ru-RU/locales-new/autotranslate-56.ftl
@@ -8,4 +8,7 @@ ent-ZipLock = зип пакет
.desc = Предназначен для хранения улик.
ent-BoxZipLocks = коробка зип пакетов
.desc = Заполнена зип пакетами. Обрадуйте детектива!
-clumsy-gun-delete-log = В следствии неуклюжести во время стрельбы от { $prettyUser }, было удалено { $prettyGun }
\ No newline at end of file
+clumsy-gun-delete-log = В следствии неуклюжести во время стрельбы от { $prettyUser }, было удалено { $prettyGun }
+holoprojector-active-holo = Активные проекции: [color=fuchsia]{ $activeholo }[/color]
+holoprojector-uses-limit = Было использовано максимальное количество проекций!
+holoprojector-delete-signs = Все проекции были удалены!
\ No newline at end of file
diff --git a/Resources/Prototypes/Entities/Objects/Devices/holoprojectors.yml b/Resources/Prototypes/Entities/Objects/Devices/holoprojectors.yml
index 4924a46fe8..6bb2f1b9df 100644
--- a/Resources/Prototypes/Entities/Objects/Devices/holoprojectors.yml
+++ b/Resources/Prototypes/Entities/Objects/Devices/holoprojectors.yml
@@ -6,16 +6,6 @@
components:
- type: HolosignProjector
- type: UseDelay
- - type: ContainerContainer
- containers:
- cell_slot: !type:ContainerSlot {}
- - type: PowerCellSlot
- cellSlotId: cell_slot
- - type: ItemSlots
- slots:
- cell_slot:
- name: power-cell-slot-component-slot-name-default
- startingItem: PowerCellMedium
- type: Sprite
sprite: Objects/Devices/Holoprojectors/custodial.rsi
state: icon
@@ -29,14 +19,6 @@
suffix: borg
components:
- type: HolosignProjector
- chargeUse: 240
- - type: ItemSlots
- slots:
- cell_slot:
- name: power-cell-slot-component-slot-name-default
- startingItem: PowerCellMicroreactor
- disableEject: true
- swap: false
- type: entity
parent: Holoprojector
@@ -46,7 +28,6 @@
components:
- type: HolosignProjector
signProto: HoloFan
- chargeUse: 120
- type: Sprite
sprite: Objects/Devices/Holoprojectors/atmos.rsi
state: icon
diff --git a/Resources/Prototypes/Entities/Structures/Holographic/projections.yml b/Resources/Prototypes/Entities/Structures/Holographic/projections.yml
index 1ac47624ee..beff8c4c6f 100644
--- a/Resources/Prototypes/Entities/Structures/Holographic/projections.yml
+++ b/Resources/Prototypes/Entities/Structures/Holographic/projections.yml
@@ -13,8 +13,6 @@
- type: Sprite
sprite: Structures/Holo/wetfloor.rsi
state: icon
- - type: TimedDespawn
- lifetime: 90
- type: Damageable
damageContainer: StructuralInorganic
- type: Destructible
@@ -41,8 +39,6 @@
shape:
!type:PhysShapeAabb
bounds: "-0.5,-0.5,0.5,0.5"
- - type: TimedDespawn
- lifetime: 180
- type: Airtight
noAirWhenFullyAirBlocked: false