Station AI ability to electricute doors (#32012)
* Boom! Emergency access! * Emergency access sound * locale * Updated sounds * bleh * Door electrify base * feat: popups on attempt to activate AI action when wires cut * refactor: use SharedApcPowerReceiverComponent to check if AI can interact with door * refactor: added icon and sound for door overcharge * meta.json should use tabs not spaces * refactor: extracted sounds for airlock overcharge to static field in system * refactor: cleanup, ScarKy0 mentions for resources * refactor: removed unused textures * feat: now notification is displayed when AI attempting to interact with door which have wire cut * StationAiWhitelistComponent is properly gating BUI OnMessageAttempt, SharedPowerReceiverSystem.IsPowered is now used to check if device powered * refactor: use PlayLocal to play electrify sound only for AI player * refactor: SetBoltsDown now uses TrySetBoltDown, checks for power. * bolts now check for power using SharedPowerReceiverSystem * electrify localization and louder electrify sounds * extracted ShowDeviceNotRespondingPopup, reverted airlocks not opening/closing when ai wire was cut * refactor: cleanup * New sprites and fixes * Copyright * even more sprite changes * refactore: cleanup, rename overcharge => electrify --------- Co-authored-by: ScarKy0 <scarky0@onet.eu> Co-authored-by: pa.pecherskij <pa.pecherskij@interfax.ru> Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using Content.Shared.Doors.Components;
|
||||
using Content.Shared.Electrocution;
|
||||
using Content.Shared.Silicons.StationAi;
|
||||
using Robust.Shared.Utility;
|
||||
|
||||
@@ -6,25 +7,69 @@ namespace Content.Client.Silicons.StationAi;
|
||||
|
||||
public sealed partial class StationAiSystem
|
||||
{
|
||||
private readonly ResPath _aiActionsRsi = new ResPath("/Textures/Interface/Actions/actions_ai.rsi");
|
||||
|
||||
private void InitializeAirlock()
|
||||
{
|
||||
SubscribeLocalEvent<DoorBoltComponent, GetStationAiRadialEvent>(OnDoorBoltGetRadial);
|
||||
SubscribeLocalEvent<AirlockComponent, GetStationAiRadialEvent>(OnEmergencyAccessGetRadial);
|
||||
SubscribeLocalEvent<ElectrifiedComponent, GetStationAiRadialEvent>(OnDoorElectrifiedGetRadial);
|
||||
}
|
||||
|
||||
private void OnDoorBoltGetRadial(Entity<DoorBoltComponent> ent, ref GetStationAiRadialEvent args)
|
||||
{
|
||||
args.Actions.Add(new StationAiRadial()
|
||||
{
|
||||
Sprite = ent.Comp.BoltsDown ?
|
||||
new SpriteSpecifier.Rsi(
|
||||
new ResPath("/Textures/Structures/Doors/Airlocks/Standard/basic.rsi"), "open") :
|
||||
new SpriteSpecifier.Rsi(
|
||||
new ResPath("/Textures/Structures/Doors/Airlocks/Standard/basic.rsi"), "closed"),
|
||||
Tooltip = ent.Comp.BoltsDown ? Loc.GetString("bolt-open") : Loc.GetString("bolt-close"),
|
||||
Event = new StationAiBoltEvent()
|
||||
args.Actions.Add(
|
||||
new StationAiRadial
|
||||
{
|
||||
Bolted = !ent.Comp.BoltsDown,
|
||||
Sprite = ent.Comp.BoltsDown
|
||||
? new SpriteSpecifier.Rsi(_aiActionsRsi, "unbolt_door")
|
||||
: new SpriteSpecifier.Rsi(_aiActionsRsi, "bolt_door"),
|
||||
Tooltip = ent.Comp.BoltsDown
|
||||
? Loc.GetString("bolt-open")
|
||||
: Loc.GetString("bolt-close"),
|
||||
Event = new StationAiBoltEvent
|
||||
{
|
||||
Bolted = !ent.Comp.BoltsDown,
|
||||
}
|
||||
}
|
||||
});
|
||||
);
|
||||
}
|
||||
|
||||
private void OnEmergencyAccessGetRadial(Entity<AirlockComponent> ent, ref GetStationAiRadialEvent args)
|
||||
{
|
||||
args.Actions.Add(
|
||||
new StationAiRadial
|
||||
{
|
||||
Sprite = ent.Comp.EmergencyAccess
|
||||
? new SpriteSpecifier.Rsi(_aiActionsRsi, "emergency_off")
|
||||
: new SpriteSpecifier.Rsi(_aiActionsRsi, "emergency_on"),
|
||||
Tooltip = ent.Comp.EmergencyAccess
|
||||
? Loc.GetString("emergency-access-off")
|
||||
: Loc.GetString("emergency-access-on"),
|
||||
Event = new StationAiEmergencyAccessEvent
|
||||
{
|
||||
EmergencyAccess = !ent.Comp.EmergencyAccess,
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
private void OnDoorElectrifiedGetRadial(Entity<ElectrifiedComponent> ent, ref GetStationAiRadialEvent args)
|
||||
{
|
||||
args.Actions.Add(
|
||||
new StationAiRadial
|
||||
{
|
||||
Sprite = ent.Comp.Enabled
|
||||
? new SpriteSpecifier.Rsi(_aiActionsRsi, "door_overcharge_off")
|
||||
: new SpriteSpecifier.Rsi(_aiActionsRsi, "door_overcharge_on"),
|
||||
Tooltip = ent.Comp.Enabled
|
||||
? Loc.GetString("electrify-door-off")
|
||||
: Loc.GetString("electrify-door-on"),
|
||||
Event = new StationAiElectrifiedEvent
|
||||
{
|
||||
Electrified = !ent.Comp.Enabled,
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user