-
Notifications
You must be signed in to change notification settings - Fork 3.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Station AI ability to electricute doors #32012
Changes from 11 commits
bc88447
60bd34f
130a3ea
8d33a04
136f19b
265fd07
a08fffc
a5967bb
9050743
846cf95
ac19543
fc889c4
43261a5
d899a5a
36ff0ee
28f27fb
9b2f203
9d8d5d4
67e6875
5dc4dfc
7483434
0b81947
96c46fc
1a7eac5
fdc01d3
64094f9
c1f9f60
269ed7d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
using Content.Shared.DeviceLinking; | ||
using Content.Shared.Doors.Systems; | ||
using Robust.Shared.Audio; | ||
using Robust.Shared.GameStates; | ||
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype; | ||
|
||
|
@@ -23,6 +24,18 @@ public sealed partial class AirlockComponent : Component | |
[ViewVariables(VVAccess.ReadWrite)] | ||
[DataField, AutoNetworkedField] | ||
public bool EmergencyAccess = false; | ||
|
||
/// <summary> | ||
/// Sound to play when the airlock emergency access is turned on. | ||
/// </summary> | ||
[DataField, ViewVariables(VVAccess.ReadWrite)] | ||
public SoundSpecifier EmergencyOnSound = new SoundPathSpecifier("/Audio/Machines/airlock_emergencyon.ogg"); | ||
|
||
/// <summary> | ||
/// Sound to play when the airlock emergency access is turned off. | ||
/// </summary> | ||
[DataField, ViewVariables(VVAccess.ReadWrite)] | ||
public SoundSpecifier EmergencyOffSound = new SoundPathSpecifier("/Audio/Machines/airlock_emergencyoff.ogg"); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. VVRW is redundant with datafield. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. fixed |
||
|
||
/// <summary> | ||
/// Pry modifier for a powered airlock. | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
using Content.Shared.Doors.Components; | ||
using Robust.Shared.Audio.Systems; | ||
using Content.Shared.Popups; | ||
using Content.Shared.Prying.Components; | ||
using Content.Shared.Wires; | ||
|
@@ -11,6 +12,7 @@ public abstract class SharedAirlockSystem : EntitySystem | |
[Dependency] protected readonly SharedDoorSystem DoorSystem = default!; | ||
[Dependency] protected readonly SharedPopupSystem Popup = default!; | ||
[Dependency] private readonly SharedWiresSystem _wiresSystem = default!; | ||
[Dependency] protected readonly SharedAudioSystem Audio = default!; | ||
|
||
public override void Initialize() | ||
{ | ||
|
@@ -123,11 +125,20 @@ public void UpdateEmergencyLightStatus(EntityUid uid, AirlockComponent component | |
Appearance.SetData(uid, DoorVisuals.EmergencyLights, component.EmergencyAccess); | ||
} | ||
|
||
public void ToggleEmergencyAccess(EntityUid uid, AirlockComponent component) | ||
public void ToggleEmergencyAccess(Entity<AirlockComponent> ent, EntityUid? user = null, bool predicted = false) | ||
{ | ||
component.EmergencyAccess = !component.EmergencyAccess; | ||
Dirty(uid, component); // This only runs on the server apparently so we need this. | ||
UpdateEmergencyLightStatus(uid, component); | ||
if(!ent.Comp.Powered) | ||
return; | ||
|
||
ent.Comp.EmergencyAccess = !ent.Comp.EmergencyAccess; | ||
Dirty(ent, ent.Comp); // This only runs on the server apparently so we need this. | ||
UpdateEmergencyLightStatus(ent, ent.Comp); | ||
|
||
var sound = ent.Comp.EmergencyAccess ? ent.Comp.EmergencyOnSound : ent.Comp.EmergencyOffSound; | ||
if (predicted) | ||
Audio.PlayPredicted(sound, ent, user: user); | ||
else | ||
Audio.PlayPvs(sound, ent); | ||
} | ||
Comment on lines
+148
to
154
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do any of the callers even need this? This method is new... There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. AdminVerbSystem uses non-predicted version. is that wrong? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That's fine for now. |
||
|
||
public void SetAutoCloseDelayModifier(AirlockComponent component, float value) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,121 +1,128 @@ | ||
using Robust.Shared.GameStates; | ||
using Robust.Shared.Audio; | ||
|
||
namespace Content.Server.Electrocution; | ||
namespace Content.Shared.Electrocution; | ||
|
||
/// <summary> | ||
/// Component for things that shock users on touch. | ||
/// </summary> | ||
[RegisterComponent] | ||
[RegisterComponent, NetworkedComponent, AutoGenerateComponentState] | ||
public sealed partial class ElectrifiedComponent : Component | ||
{ | ||
[DataField("enabled")] | ||
[DataField, AutoNetworkedField] | ||
public bool Enabled = true; | ||
|
||
/// <summary> | ||
/// Should player get damage on collide | ||
/// </summary> | ||
[DataField("onBump")] | ||
[DataField, AutoNetworkedField] | ||
public bool OnBump = true; | ||
|
||
/// <summary> | ||
/// Should player get damage on attack | ||
/// </summary> | ||
[DataField("onAttacked")] | ||
[DataField, AutoNetworkedField] | ||
public bool OnAttacked = true; | ||
|
||
/// <summary> | ||
/// When true - disables power if a window is present in the same tile | ||
/// </summary> | ||
[DataField("noWindowInTile")] | ||
[DataField, AutoNetworkedField] | ||
public bool NoWindowInTile = false; | ||
|
||
/// <summary> | ||
/// Should player get damage on interact with empty hand | ||
/// </summary> | ||
[DataField("onHandInteract")] | ||
[DataField, AutoNetworkedField] | ||
public bool OnHandInteract = true; | ||
|
||
/// <summary> | ||
/// Should player get damage on interact while holding an object in their hand | ||
/// </summary> | ||
[DataField("onInteractUsing")] | ||
[DataField, AutoNetworkedField] | ||
public bool OnInteractUsing = true; | ||
|
||
/// <summary> | ||
/// Indicates if the entity requires power to function | ||
/// </summary> | ||
[DataField("requirePower")] | ||
[DataField, AutoNetworkedField] | ||
public bool RequirePower = true; | ||
|
||
/// <summary> | ||
/// Indicates if the entity uses APC power | ||
/// </summary> | ||
[DataField("usesApcPower")] | ||
[DataField, AutoNetworkedField] | ||
public bool UsesApcPower = false; | ||
|
||
/// <summary> | ||
/// Identifier for the high voltage node. | ||
/// </summary> | ||
[DataField("highVoltageNode")] | ||
[DataField, AutoNetworkedField] | ||
public string? HighVoltageNode; | ||
|
||
/// <summary> | ||
/// Identifier for the medium voltage node. | ||
/// </summary> | ||
[DataField("mediumVoltageNode")] | ||
[DataField, AutoNetworkedField] | ||
public string? MediumVoltageNode; | ||
|
||
/// <summary> | ||
/// Identifier for the low voltage node. | ||
/// </summary> | ||
[DataField("lowVoltageNode")] | ||
[DataField, AutoNetworkedField] | ||
public string? LowVoltageNode; | ||
|
||
/// <summary> | ||
/// Damage multiplier for HV electrocution | ||
/// </summary> | ||
[DataField] | ||
[DataField, AutoNetworkedField] | ||
public float HighVoltageDamageMultiplier = 3f; | ||
|
||
/// <summary> | ||
/// Shock time multiplier for HV electrocution | ||
/// </summary> | ||
[DataField] | ||
[DataField, AutoNetworkedField] | ||
public float HighVoltageTimeMultiplier = 1.5f; | ||
|
||
/// <summary> | ||
/// Damage multiplier for MV electrocution | ||
/// </summary> | ||
[DataField] | ||
[DataField, AutoNetworkedField] | ||
public float MediumVoltageDamageMultiplier = 2f; | ||
|
||
/// <summary> | ||
/// Shock time multiplier for MV electrocution | ||
/// </summary> | ||
[DataField] | ||
[DataField, AutoNetworkedField] | ||
public float MediumVoltageTimeMultiplier = 1.25f; | ||
|
||
[DataField("shockDamage")] | ||
[DataField, AutoNetworkedField] | ||
public float ShockDamage = 7.5f; | ||
|
||
/// <summary> | ||
/// Shock time, in seconds. | ||
/// </summary> | ||
[DataField("shockTime")] | ||
[DataField, AutoNetworkedField] | ||
public float ShockTime = 8f; | ||
|
||
[DataField("siemensCoefficient")] | ||
[DataField, AutoNetworkedField] | ||
public float SiemensCoefficient = 1f; | ||
|
||
[DataField("shockNoises")] | ||
[DataField, AutoNetworkedField] | ||
public SoundSpecifier ShockNoises = new SoundCollectionSpecifier("sparks"); | ||
|
||
[DataField("playSoundOnShock")] | ||
[DataField, AutoNetworkedField] | ||
public SoundSpecifier DoorElectrified = new SoundCollectionSpecifier("sparks"); | ||
|
||
[DataField, AutoNetworkedField] | ||
public bool PlaySoundOnShock = true; | ||
|
||
[DataField("shockVolume")] | ||
[DataField, AutoNetworkedField] | ||
public float ShockVolume = 20; | ||
|
||
[DataField] | ||
[DataField, AutoNetworkedField] | ||
public float Probability = 1f; | ||
|
||
[DataField, AutoNetworkedField] | ||
public bool IsWireCut = false; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should guard these values behind equals checks to avoid dirtying if the value hasn't changed because dirtying is expensive.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed