Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down Expand Up @@ -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.");
}
Expand Down Expand Up @@ -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
Expand Down
41 changes: 41 additions & 0 deletions Content.Shared/Silicons/StationAi/SharedStationAiSystem.Held.cs
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,40 @@ private void OnHeldInteraction(Entity<StationAiHeldComponent> ent, ref Interacti
{
ShowDeviceNotRespondingPopup(ent.Owner);
}

// Fire edit start
// TODO: Сейчас при нажатии Alt + по шлюзу энергия списывается дважды, за взаимодействие + использование открытой панельки, нужно будет это исправить
if (args.Cancelled || args.Target == null)
return;

if (!TryGetCore(ent, out var core) ||
core.Comp == null)
return;

if (_whitelist.IsWhitelistPass(core.Comp.IncreasedChargeCostWhitelist, args.Target.Value))
{
if (_battery.GetCharge(core.Owner) < core.Comp.IncreasedInteractionChargeCost)
{
ShowNotChargeEnoughPopup(ent);
args.Cancelled = true;
return;
}

if (!_battery.TryUseCharge(core.Owner, core.Comp.IncreasedInteractionChargeCost))
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<StationAiWhitelistComponent> ent, ref GetVerbsEvent<AlternativeVerb> args)
Expand Down Expand Up @@ -211,6 +245,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
}

/// <summary>
Expand Down
3 changes: 3 additions & 0 deletions Content.Shared/Silicons/StationAi/SharedStationAiSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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!; // Fire edit
[Dependency] private readonly StationAiVisionSystem _vision = default!;
[Dependency] private readonly IPrototypeManager _protoManager = default!;
[Dependency] private readonly MobStateSystem _mobState = default!;
Expand Down
19 changes: 19 additions & 0 deletions Content.Shared/Silicons/StationAi/StationAiCoreComponent.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using Content.Shared.Whitelist; // Fire edit
using Robust.Shared.GameStates;
using Robust.Shared.Prototypes;

Expand Down Expand Up @@ -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
/// </summary>
public const string BrainContainer = "station_ai_brain_slot";

// Fire edit start

[DataField]
public float ControlDoorChargeCost = 7500f; // Joule's

[DataField]
public float IncreasedInteractionChargeCost = 10000f; // Joule's

[DataField]
public float OtherInteractionsChargeCost = 1500f; // Joule's

[DataField]
public EntityWhitelist IncreasedChargeCostWhitelist = new()
{
Components = ["SignalSwitch"]
};
// Fire edit end
}

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ai-not-charge-enough = Charge not enough
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ai-not-charge-enough = Недостаточно заряда
2 changes: 1 addition & 1 deletion Resources/Prototypes/Entities/Mobs/Player/silicon.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@
powerLoad: 500
- type: ExtensionCableReceiver
- type: Battery
netsync: false
netsync: true
maxCharge: 300000
startingCharge: 300000
- type: ApcPowerReceiverBattery
Expand Down
Loading