From 63a18b693ff0f28bfeaebf75e8fe16514113fa3f Mon Sep 17 00:00:00 2001 From: Wardex Date: Sun, 7 Jun 2026 18:01:50 +0300 Subject: [PATCH 1/5] 1 --- .../SharedStationAiSystem.Airlock.cs | 48 +++++++++++++++++++ .../StationAi/SharedStationAiSystem.Held.cs | 44 ++++++++++++++++- .../StationAi/SharedStationAiSystem.cs | 3 ++ .../StationAi/StationAiCoreComponent.cs | 19 ++++++++ .../_strings/_scp/silicons/station-ai.ftl | 1 + .../_strings/_scp/silicons/station-ai.ftl | 1 + .../Entities/Mobs/Player/silicon.yml | 2 +- 7 files changed, 115 insertions(+), 3 deletions(-) create mode 100644 Resources/Locale/en-US/_strings/_scp/silicons/station-ai.ftl create mode 100644 Resources/Locale/ru-RU/_strings/_scp/silicons/station-ai.ftl diff --git a/Content.Shared/Silicons/StationAi/SharedStationAiSystem.Airlock.cs b/Content.Shared/Silicons/StationAi/SharedStationAiSystem.Airlock.cs index ea358efc25..dc605d7a0e 100644 --- a/Content.Shared/Silicons/StationAi/SharedStationAiSystem.Airlock.cs +++ b/Content.Shared/Silicons/StationAi/SharedStationAiSystem.Airlock.cs @@ -40,6 +40,22 @@ private void OnAirlockBolt(EntityUid ent, DoorBoltComponent component, StationAi return; } + // Fire edit start + if (!TryGetCore(args.User, out var core) || + core.Comp == null) + return; + + if (_battery.GetCharge(core.Owner) < core.Comp.ControlDoorChargeCost) + { + ShowNotChargeEnoughPopup(args.User); + return; + } + + if (_net.IsServer) + if (!_battery.TryUseCharge(core.Owner, core.Comp.ControlDoorChargeCost)) + return; + // Fire edit end + var setResult = _doors.TrySetBoltDown((ent, component), args.Bolted, args.User, predicted: true); if (!setResult) { @@ -75,6 +91,22 @@ private void OnAirlockEmergencyAccess(EntityUid ent, AirlockComponent component, return; } + // Fire edit start + if (!TryGetCore(args.User, out var core) || + core.Comp == null) + return; + + if (_battery.GetCharge(core.Owner) < core.Comp.ControlDoorChargeCost) + { + ShowNotChargeEnoughPopup(args.User); + return; + } + + if (_net.IsServer) + if (!_battery.TryUseCharge(core.Owner, core.Comp.ControlDoorChargeCost)) + return; + // Fire edit end + _airlocks.SetEmergencyAccess((ent, component), args.EmergencyAccess, args.User, predicted: true); _adminLogger.Add(LogType.Action, $"{args.User} set emergency access status on {ent} to [{args.EmergencyAccess}] using the Station AI radial."); } @@ -104,6 +136,22 @@ private void OnElectrified(EntityUid ent, ElectrifiedComponent component, Statio return; } + // Fire edit start + if (!TryGetCore(args.User, out var core) || + core.Comp == null) + return; + + if (_battery.GetCharge(core.Owner) < core.Comp.ControlDoorChargeCost) + { + ShowNotChargeEnoughPopup(args.User); + return; + } + + if (_net.IsServer) + if (!_battery.TryUseCharge(core.Owner, core.Comp.ControlDoorChargeCost)) + return; + // Fire edit end + _adminLogger.Add(LogType.Action, $"{args.User} set electrified status on {ent} to [{args.Electrified}] using the Station AI radial."); _electrify.SetElectrified((ent, component), args.Electrified); var soundToPlay = component.Enabled diff --git a/Content.Shared/Silicons/StationAi/SharedStationAiSystem.Held.cs b/Content.Shared/Silicons/StationAi/SharedStationAiSystem.Held.cs index 91dd61d334..a14a98586f 100644 --- a/Content.Shared/Silicons/StationAi/SharedStationAiSystem.Held.cs +++ b/Content.Shared/Silicons/StationAi/SharedStationAiSystem.Held.cs @@ -124,7 +124,7 @@ private void OnRadialMessage(StationAiRadialMessage ev) return; ev.Event.User = ev.Actor; - RaiseLocalEvent(target.Value, (object) ev.Event); + RaiseLocalEvent(target.Value, (object)ev.Event); } private void OnMessageAttempt(Entity ent, ref BoundUserInterfaceMessageAttempt ev) @@ -164,6 +164,39 @@ private void OnHeldInteraction(Entity ent, ref Interacti { ShowDeviceNotRespondingPopup(ent.Owner); } + + // Fire edit start + if (args.Cancelled || args.Target == null) + return; + + if (!TryGetCore(ent, out var core) || + core.Comp == null) + return; + + if (_whitelist.IsWhitelistPass(core.Comp.SignalEntitiesWhitelist, args.Target.Value)) + { + if (_battery.GetCharge(core.Owner) < core.Comp.ButtonInteractionChargeCost) + { + ShowNotChargeEnoughPopup(ent); + args.Cancelled = true; + return; + } + + if (!_battery.TryUseCharge(core.Owner, core.Comp.ButtonInteractionChargeCost)) + args.Cancelled = true; + return; + } + + if (_battery.GetCharge(core.Owner) < core.Comp.OtherInteractionsChargeCost) + { + ShowNotChargeEnoughPopup(ent); + args.Cancelled = true; + return; + } + + if (!_battery.TryUseCharge(core.Owner, core.Comp.OtherInteractionsChargeCost)) + args.Cancelled = true; + // Fire edit end } private void OnTargetVerbs(Entity ent, ref GetVerbsEvent args) @@ -211,6 +244,13 @@ private void ShowDeviceNoAccessPopup(EntityUid toEntity) { _popup.PopupClient(Loc.GetString("ai-device-no-access"), toEntity, PopupType.MediumCaution); } + + // Fire edit start + private void ShowNotChargeEnoughPopup(EntityUid toEntity) + { + _popup.PopupClient(Loc.GetString("ai-not-charge-enough"), toEntity, PopupType.MediumCaution); + } + // Fire edit end } /// @@ -243,7 +283,7 @@ public sealed class StationAiRadial : BaseStationAiAction [Serializable, NetSerializable] public abstract class BaseStationAiAction { - [field:NonSerialized] + [field: NonSerialized] public EntityUid User { get; set; } } diff --git a/Content.Shared/Silicons/StationAi/SharedStationAiSystem.cs b/Content.Shared/Silicons/StationAi/SharedStationAiSystem.cs index e43247fdb0..4719c3d932 100644 --- a/Content.Shared/Silicons/StationAi/SharedStationAiSystem.cs +++ b/Content.Shared/Silicons/StationAi/SharedStationAiSystem.cs @@ -33,6 +33,7 @@ using Robust.Shared.Serialization; using Robust.Shared.Timing; using Robust.Shared.Utility; +using Content.Shared.Whitelist; // Fire edit namespace Content.Shared.Silicons.StationAi; @@ -61,6 +62,8 @@ public abstract partial class SharedStationAiSystem : EntitySystem [Dependency] private readonly SharedPowerReceiverSystem PowerReceiver = default!; [Dependency] private readonly SharedTransformSystem _xforms = default!; [Dependency] private readonly SharedUserInterfaceSystem _uiSystem = default!; + [Dependency] private readonly SharedBatterySystem _battery = default!; // Fire edit + [Dependency] private readonly EntityWhitelistSystem _whitelist = default!; [Dependency] private readonly StationAiVisionSystem _vision = default!; [Dependency] private readonly IPrototypeManager _protoManager = default!; [Dependency] private readonly MobStateSystem _mobState = default!; diff --git a/Content.Shared/Silicons/StationAi/StationAiCoreComponent.cs b/Content.Shared/Silicons/StationAi/StationAiCoreComponent.cs index ec3f308104..01d16b606a 100644 --- a/Content.Shared/Silicons/StationAi/StationAiCoreComponent.cs +++ b/Content.Shared/Silicons/StationAi/StationAiCoreComponent.cs @@ -1,3 +1,4 @@ +using Content.Shared.Whitelist; using Robust.Shared.GameStates; using Robust.Shared.Prototypes; @@ -47,6 +48,24 @@ public sealed partial class StationAiCoreComponent : Component /// Name of the container slot that holds the 'brain' used to construct the AI core /// public const string BrainContainer = "station_ai_brain_slot"; + + // Fire edit start + + [DataField] + public float ControlDoorChargeCost = 7500f; // Joule's + + [DataField] + public float ButtonInteractionChargeCost = 10000f; // Joule's + + [DataField] + public float OtherInteractionsChargeCost = 1500f; // Joule's + + [DataField] + public EntityWhitelist SignalEntitiesWhitelist = new() + { + Components = ["SignalSwitch"] + }; + // Fire edit end } /// diff --git a/Resources/Locale/en-US/_strings/_scp/silicons/station-ai.ftl b/Resources/Locale/en-US/_strings/_scp/silicons/station-ai.ftl new file mode 100644 index 0000000000..10bb5a7f1d --- /dev/null +++ b/Resources/Locale/en-US/_strings/_scp/silicons/station-ai.ftl @@ -0,0 +1 @@ +ai-not-charge-enough = Charge not enough diff --git a/Resources/Locale/ru-RU/_strings/_scp/silicons/station-ai.ftl b/Resources/Locale/ru-RU/_strings/_scp/silicons/station-ai.ftl new file mode 100644 index 0000000000..dd2aa8d6de --- /dev/null +++ b/Resources/Locale/ru-RU/_strings/_scp/silicons/station-ai.ftl @@ -0,0 +1 @@ +ai-not-charge-enough = Недостаточно заряда diff --git a/Resources/Prototypes/Entities/Mobs/Player/silicon.yml b/Resources/Prototypes/Entities/Mobs/Player/silicon.yml index 8b3e8434d1..92569a67bc 100644 --- a/Resources/Prototypes/Entities/Mobs/Player/silicon.yml +++ b/Resources/Prototypes/Entities/Mobs/Player/silicon.yml @@ -276,7 +276,7 @@ # Disable networking to prevent the battery getting continuously dirtied every tick as it interacts with the power network. # This can not be done by changing the charge rate as the power supply ramps up over time. # This disables prediction for this battery. - netsync: false + netsync: true # Fire edit maxCharge: 300000 startingCharge: 300000 - type: ApcPowerReceiverBattery From 229ac57854da78cd215b809e2ee8221404eb0d01 Mon Sep 17 00:00:00 2001 From: Wardex Date: Sun, 7 Jun 2026 18:54:18 +0300 Subject: [PATCH 2/5] 1 --- .../Silicons/StationAi/SharedStationAiSystem.Held.cs | 7 ++++--- .../Silicons/StationAi/StationAiCoreComponent.cs | 4 ++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/Content.Shared/Silicons/StationAi/SharedStationAiSystem.Held.cs b/Content.Shared/Silicons/StationAi/SharedStationAiSystem.Held.cs index a14a98586f..89256bf527 100644 --- a/Content.Shared/Silicons/StationAi/SharedStationAiSystem.Held.cs +++ b/Content.Shared/Silicons/StationAi/SharedStationAiSystem.Held.cs @@ -166,6 +166,7 @@ private void OnHeldInteraction(Entity ent, ref Interacti } // Fire edit start + // TODO: Сейчас при нажатии Alt + по шлюзу энергия списывается дважды, за взаимодействие + использование открытой панельки, нужно будет это исправить if (args.Cancelled || args.Target == null) return; @@ -173,16 +174,16 @@ private void OnHeldInteraction(Entity ent, ref Interacti core.Comp == null) return; - if (_whitelist.IsWhitelistPass(core.Comp.SignalEntitiesWhitelist, args.Target.Value)) + if (_whitelist.IsWhitelistPass(core.Comp.IncreasedChargeCostWhitelist, args.Target.Value)) { - if (_battery.GetCharge(core.Owner) < core.Comp.ButtonInteractionChargeCost) + if (_battery.GetCharge(core.Owner) < core.Comp.IncreasedInteractionChargeCost) { ShowNotChargeEnoughPopup(ent); args.Cancelled = true; return; } - if (!_battery.TryUseCharge(core.Owner, core.Comp.ButtonInteractionChargeCost)) + if (!_battery.TryUseCharge(core.Owner, core.Comp.IncreasedInteractionChargeCost)) args.Cancelled = true; return; } diff --git a/Content.Shared/Silicons/StationAi/StationAiCoreComponent.cs b/Content.Shared/Silicons/StationAi/StationAiCoreComponent.cs index 01d16b606a..b890ba9d10 100644 --- a/Content.Shared/Silicons/StationAi/StationAiCoreComponent.cs +++ b/Content.Shared/Silicons/StationAi/StationAiCoreComponent.cs @@ -55,13 +55,13 @@ public sealed partial class StationAiCoreComponent : Component public float ControlDoorChargeCost = 7500f; // Joule's [DataField] - public float ButtonInteractionChargeCost = 10000f; // Joule's + public float IncreasedInteractionChargeCost = 10000f; // Joule's [DataField] public float OtherInteractionsChargeCost = 1500f; // Joule's [DataField] - public EntityWhitelist SignalEntitiesWhitelist = new() + public EntityWhitelist IncreasedChargeCostWhitelist = new() { Components = ["SignalSwitch"] }; From a17c389b85a9f65acd0d4bf3371e9fced8da15c4 Mon Sep 17 00:00:00 2001 From: Wardex Date: Sun, 7 Jun 2026 18:57:52 +0300 Subject: [PATCH 3/5] fix --- Content.Shared/Silicons/StationAi/SharedStationAiSystem.Held.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Content.Shared/Silicons/StationAi/SharedStationAiSystem.Held.cs b/Content.Shared/Silicons/StationAi/SharedStationAiSystem.Held.cs index 89256bf527..8d91d9e048 100644 --- a/Content.Shared/Silicons/StationAi/SharedStationAiSystem.Held.cs +++ b/Content.Shared/Silicons/StationAi/SharedStationAiSystem.Held.cs @@ -124,7 +124,7 @@ private void OnRadialMessage(StationAiRadialMessage ev) return; ev.Event.User = ev.Actor; - RaiseLocalEvent(target.Value, (object)ev.Event); + RaiseLocalEvent(target.Value, (object) ev.Event); } private void OnMessageAttempt(Entity ent, ref BoundUserInterfaceMessageAttempt ev) From 94d4a777d9c1c02cb55abc6d0bbf09ca1cd495b6 Mon Sep 17 00:00:00 2001 From: Wardex Date: Sun, 7 Jun 2026 18:59:56 +0300 Subject: [PATCH 4/5] fixes --- Content.Shared/Silicons/StationAi/SharedStationAiSystem.Held.cs | 2 +- Content.Shared/Silicons/StationAi/SharedStationAiSystem.cs | 2 +- Content.Shared/Silicons/StationAi/StationAiCoreComponent.cs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Content.Shared/Silicons/StationAi/SharedStationAiSystem.Held.cs b/Content.Shared/Silicons/StationAi/SharedStationAiSystem.Held.cs index 8d91d9e048..d170652422 100644 --- a/Content.Shared/Silicons/StationAi/SharedStationAiSystem.Held.cs +++ b/Content.Shared/Silicons/StationAi/SharedStationAiSystem.Held.cs @@ -284,7 +284,7 @@ public sealed class StationAiRadial : BaseStationAiAction [Serializable, NetSerializable] public abstract class BaseStationAiAction { - [field: NonSerialized] + [field:NonSerialized] public EntityUid User { get; set; } } diff --git a/Content.Shared/Silicons/StationAi/SharedStationAiSystem.cs b/Content.Shared/Silicons/StationAi/SharedStationAiSystem.cs index 4719c3d932..7441558323 100644 --- a/Content.Shared/Silicons/StationAi/SharedStationAiSystem.cs +++ b/Content.Shared/Silicons/StationAi/SharedStationAiSystem.cs @@ -63,7 +63,7 @@ public abstract partial class SharedStationAiSystem : EntitySystem [Dependency] private readonly SharedTransformSystem _xforms = default!; [Dependency] private readonly SharedUserInterfaceSystem _uiSystem = default!; [Dependency] private readonly SharedBatterySystem _battery = default!; // Fire edit - [Dependency] private readonly EntityWhitelistSystem _whitelist = default!; + [Dependency] private readonly EntityWhitelistSystem _whitelist = default!; // Fire edit [Dependency] private readonly StationAiVisionSystem _vision = default!; [Dependency] private readonly IPrototypeManager _protoManager = default!; [Dependency] private readonly MobStateSystem _mobState = default!; diff --git a/Content.Shared/Silicons/StationAi/StationAiCoreComponent.cs b/Content.Shared/Silicons/StationAi/StationAiCoreComponent.cs index b890ba9d10..ae9b2ffa18 100644 --- a/Content.Shared/Silicons/StationAi/StationAiCoreComponent.cs +++ b/Content.Shared/Silicons/StationAi/StationAiCoreComponent.cs @@ -1,4 +1,4 @@ -using Content.Shared.Whitelist; +using Content.Shared.Whitelist; // Fire edit using Robust.Shared.GameStates; using Robust.Shared.Prototypes; From c50c26ebf872cf8b12f0a937a3f98fe825fc85f2 Mon Sep 17 00:00:00 2001 From: Wardex Date: Sun, 7 Jun 2026 19:01:00 +0300 Subject: [PATCH 5/5] netsync --- .../Prototypes/_Scp/Entities/Mobs/Player/Scp/Events/scp079.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Resources/Prototypes/_Scp/Entities/Mobs/Player/Scp/Events/scp079.yml b/Resources/Prototypes/_Scp/Entities/Mobs/Player/Scp/Events/scp079.yml index cc12662b68..652e1b7437 100644 --- a/Resources/Prototypes/_Scp/Entities/Mobs/Player/Scp/Events/scp079.yml +++ b/Resources/Prototypes/_Scp/Entities/Mobs/Player/Scp/Events/scp079.yml @@ -203,7 +203,7 @@ powerLoad: 500 - type: ExtensionCableReceiver - type: Battery - netsync: false + netsync: true maxCharge: 300000 startingCharge: 300000 - type: ApcPowerReceiverBattery