-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
# Description This fixes the bug where consoles that are whitelisted by AI can only be accessed by AI. It does so by cherrypicking space-wizards/space-station-14#32012 and space-wizards/space-station-14#31170 (which the first cherrypick requires) and now space-wizards/space-station-14#29094 Also fixes AI Speech/Languages issue DO NOT SQUASH THIS, IT'S THREE PRS.
- Loading branch information
Showing
46 changed files
with
624 additions
and
177 deletions.
There are no files selected for viewing
67 changes: 56 additions & 11 deletions
67
Content.Client/Silicons/StationAi/StationAiSystem.Airlock.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,75 @@ | ||
using Content.Shared.Doors.Components; | ||
using Content.Shared.Electrocution; | ||
using Content.Shared.Silicons.StationAi; | ||
using Robust.Shared.Utility; | ||
|
||
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 | ||
{ | ||
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 | ||
{ | ||
Bolted = !ent.Comp.BoltsDown, | ||
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, | ||
} | ||
} | ||
}); | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
using Content.Server.Wires; | ||
using Content.Shared.Access; | ||
using Content.Shared.Access.Components; | ||
using Content.Shared.Access.Systems; | ||
using Content.Shared.Emag.Components; | ||
using Content.Shared.Wires; | ||
|
||
namespace Content.Server.Access; | ||
|
||
public sealed partial class LogWireAction : ComponentWireAction<AccessReaderComponent> | ||
{ | ||
public override Color Color { get; set; } = Color.Blue; | ||
public override string Name { get; set; } = "wire-name-log"; | ||
|
||
[DataField] | ||
public int PulseTimeout = 30; | ||
|
||
[DataField] | ||
public LocId PulseLog = "log-wire-pulse-access-log"; | ||
|
||
private AccessReaderSystem _access = default!; | ||
|
||
public override StatusLightState? GetLightState(Wire wire, AccessReaderComponent comp) | ||
{ | ||
return comp.LoggingDisabled ? StatusLightState.Off : StatusLightState.On; | ||
} | ||
|
||
public override object StatusKey => AccessWireActionKey.Status; | ||
|
||
public override void Initialize() | ||
{ | ||
base.Initialize(); | ||
|
||
_access = EntityManager.System<AccessReaderSystem>(); | ||
} | ||
|
||
public override bool Cut(EntityUid user, Wire wire, AccessReaderComponent comp) | ||
{ | ||
WiresSystem.TryCancelWireAction(wire.Owner, PulseTimeoutKey.Key); | ||
comp.LoggingDisabled = true; | ||
EntityManager.Dirty(wire.Owner, comp); | ||
return true; | ||
} | ||
|
||
public override bool Mend(EntityUid user, Wire wire, AccessReaderComponent comp) | ||
{ | ||
comp.LoggingDisabled = false; | ||
return true; | ||
} | ||
|
||
public override void Pulse(EntityUid user, Wire wire, AccessReaderComponent comp) | ||
{ | ||
_access.LogAccess((wire.Owner, comp), Loc.GetString(PulseLog)); | ||
comp.LoggingDisabled = true; | ||
WiresSystem.StartWireAction(wire.Owner, PulseTimeout, PulseTimeoutKey.Key, new TimedWireEvent(AwaitPulseCancel, wire)); | ||
} | ||
|
||
public override void Update(Wire wire) | ||
{ | ||
if (!IsPowered(wire.Owner)) | ||
WiresSystem.TryCancelWireAction(wire.Owner, PulseTimeoutKey.Key); | ||
} | ||
|
||
private void AwaitPulseCancel(Wire wire) | ||
{ | ||
if (!wire.IsCut && EntityManager.TryGetComponent<AccessReaderComponent>(wire.Owner, out var comp)) | ||
comp.LoggingDisabled = false; | ||
} | ||
|
||
private enum PulseTimeoutKey : byte | ||
{ | ||
Key | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
91 changes: 0 additions & 91 deletions
91
Content.Server/Electrocution/Components/ElectrifiedComponent.cs
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.