From 13215437f8c04a443799b8d569ad5047a4e31abc Mon Sep 17 00:00:00 2001 From: Dvir Date: Wed, 3 Jan 2024 22:27:48 +0200 Subject: [PATCH 01/14] Emag --- .../VendingMachines/VendingMachineSystem.cs | 7 +++++ .../Emag/Components/EmagComponent.cs | 2 ++ Content.Shared/Emag/Systems/EmagSystem.cs | 26 ++++++++++++++++ .../_NF/Entities/Objects/Tools/emag.yml | 30 +++++++++++++++++++ 4 files changed, 65 insertions(+) create mode 100644 Resources/Prototypes/_NF/Entities/Objects/Tools/emag.yml diff --git a/Content.Server/VendingMachines/VendingMachineSystem.cs b/Content.Server/VendingMachines/VendingMachineSystem.cs index 3a9cb0e3550..16c621141f7 100644 --- a/Content.Server/VendingMachines/VendingMachineSystem.cs +++ b/Content.Server/VendingMachines/VendingMachineSystem.cs @@ -62,6 +62,7 @@ public override void Initialize() SubscribeLocalEvent(OnPowerChanged); SubscribeLocalEvent(OnBreak); SubscribeLocalEvent(OnEmagged); + SubscribeLocalEvent(OnReEmagged); SubscribeLocalEvent(OnDamage); SubscribeLocalEvent(OnVendingPrice); SubscribeLocalEvent(OnEmpPulse); @@ -186,6 +187,12 @@ private void OnEmagged(EntityUid uid, VendingMachineComponent component, ref Got args.Handled = component.EmaggedInventory.Count > 0; } + private void OnReEmagged(EntityUid uid, VendingMachineComponent component, ref GotReEmaggedEvent args) + { + // only emag if there are emag-only items + args.Handled = component.EmaggedInventory.Count > 0; + } + private void OnDamage(EntityUid uid, VendingMachineComponent component, DamageChangedEvent args) { if (component.Broken || component.DispenseOnHitCoolingDown || diff --git a/Content.Shared/Emag/Components/EmagComponent.cs b/Content.Shared/Emag/Components/EmagComponent.cs index 235cf0c7444..af5e40fe3db 100644 --- a/Content.Shared/Emag/Components/EmagComponent.cs +++ b/Content.Shared/Emag/Components/EmagComponent.cs @@ -17,4 +17,6 @@ public sealed partial class EmagComponent : Component [DataField("emagImmuneTag", customTypeSerializer: typeof(PrototypeIdSerializer)), ViewVariables(VVAccess.ReadWrite)] [AutoNetworkedField] public string EmagImmuneTag = "EmagImmune"; + + [ViewVariables(VVAccess.ReadWrite)] public bool Reverse = false; } diff --git a/Content.Shared/Emag/Systems/EmagSystem.cs b/Content.Shared/Emag/Systems/EmagSystem.cs index ebbd4c02ac6..070ba01f4d7 100644 --- a/Content.Shared/Emag/Systems/EmagSystem.cs +++ b/Content.Shared/Emag/Systems/EmagSystem.cs @@ -22,6 +22,8 @@ public sealed class EmagSystem : EntitySystem [Dependency] private readonly SharedChargesSystem _charges = default!; [Dependency] private readonly SharedPopupSystem _popup = default!; [Dependency] private readonly TagSystem _tag = default!; + + [Dependency] private readonly IEntityManager _entManager = default!; public override void Initialize() { @@ -57,6 +59,10 @@ public bool TryUseEmag(EntityUid uid, EntityUid user, EntityUid target, EmagComp } var handled = DoEmagEffect(user, target); + + if (comp.Reverse) + handled = DoReEmagEffect(user, target); + if (!handled) return false; @@ -86,7 +92,27 @@ public bool DoEmagEffect(EntityUid user, EntityUid target) EnsureComp(target); return emaggedEvent.Handled; } + + /// + /// Does the emag effect on a specified entity + /// + public bool DoReEmagEffect(EntityUid user, EntityUid target) + { + // prevent removel emagging twice + if (!HasComp(target)) + return false; + + var emaggedEvent = new GotReEmaggedEvent(user); + RaiseLocalEvent(target, ref emaggedEvent); + + if (emaggedEvent.Handled) + EntityManager.RemoveComponent(target); + return emaggedEvent.Handled; + } } [ByRefEvent] public record struct GotEmaggedEvent(EntityUid UserUid, bool Handled = false, bool Repeatable = false); + +[ByRefEvent] +public record struct GotReEmaggedEvent(EntityUid UserUid, bool Handled = false, bool Repeatable = false); diff --git a/Resources/Prototypes/_NF/Entities/Objects/Tools/emag.yml b/Resources/Prototypes/_NF/Entities/Objects/Tools/emag.yml new file mode 100644 index 00000000000..7862d5dda6e --- /dev/null +++ b/Resources/Prototypes/_NF/Entities/Objects/Tools/emag.yml @@ -0,0 +1,30 @@ +- type: entity + parent: BaseItem + id: ReEmag + name: cryptographic resequencer + description: The all-in-one unhacking solution. The thinking man's lock. The iconic EMAG fixer. + components: + - type: Emag + reverse: true + - type: LimitedCharges + - type: AutoRecharge + - type: Sprite + sprite: Objects/Tools/emag.rsi + state: icon + - type: Item + sprite: Objects/Tools/emag.rsi + +- type: entity + parent: BaseItem + id: ReEmagUnlimited + suffix: Unlimited + name: cryptographic resequencer + description: The all-in-one unhacking solution. The thinking man's lock. The iconic EMAG fixer. + components: + - type: Emag + reverse: true + - type: Sprite + sprite: Objects/Tools/emag.rsi + state: icon + - type: Item + sprite: Objects/Tools/emag.rsi From 2b19aff0560061747ddf742860749dacaa5d2ed2 Mon Sep 17 00:00:00 2001 From: Dvir Date: Thu, 4 Jan 2024 02:16:44 +0200 Subject: [PATCH 02/14] Unemag --- .../VendingMachines/VendingMachineSystem.cs | 6 ++--- .../Emag/Components/EmagComponent.cs | 3 ++- Content.Shared/Emag/Systems/EmagSystem.cs | 26 +++++++++---------- .../_NF/Entities/Objects/Tools/emag.yml | 8 +++--- 4 files changed, 22 insertions(+), 21 deletions(-) diff --git a/Content.Server/VendingMachines/VendingMachineSystem.cs b/Content.Server/VendingMachines/VendingMachineSystem.cs index 16c621141f7..9701f4085d9 100644 --- a/Content.Server/VendingMachines/VendingMachineSystem.cs +++ b/Content.Server/VendingMachines/VendingMachineSystem.cs @@ -62,7 +62,7 @@ public override void Initialize() SubscribeLocalEvent(OnPowerChanged); SubscribeLocalEvent(OnBreak); SubscribeLocalEvent(OnEmagged); - SubscribeLocalEvent(OnReEmagged); + SubscribeLocalEvent(OnUnEmagged); SubscribeLocalEvent(OnDamage); SubscribeLocalEvent(OnVendingPrice); SubscribeLocalEvent(OnEmpPulse); @@ -187,9 +187,9 @@ private void OnEmagged(EntityUid uid, VendingMachineComponent component, ref Got args.Handled = component.EmaggedInventory.Count > 0; } - private void OnReEmagged(EntityUid uid, VendingMachineComponent component, ref GotReEmaggedEvent args) + private void OnUnEmagged(EntityUid uid, VendingMachineComponent component, ref GotUnEmaggedEvent args) { - // only emag if there are emag-only items + // only unemag if there are emag-only items args.Handled = component.EmaggedInventory.Count > 0; } diff --git a/Content.Shared/Emag/Components/EmagComponent.cs b/Content.Shared/Emag/Components/EmagComponent.cs index af5e40fe3db..e230a89f59d 100644 --- a/Content.Shared/Emag/Components/EmagComponent.cs +++ b/Content.Shared/Emag/Components/EmagComponent.cs @@ -18,5 +18,6 @@ public sealed partial class EmagComponent : Component [AutoNetworkedField] public string EmagImmuneTag = "EmagImmune"; - [ViewVariables(VVAccess.ReadWrite)] public bool Reverse = false; + [DataField("unemag")] + public bool Unemag = false; } diff --git a/Content.Shared/Emag/Systems/EmagSystem.cs b/Content.Shared/Emag/Systems/EmagSystem.cs index 070ba01f4d7..269ff756852 100644 --- a/Content.Shared/Emag/Systems/EmagSystem.cs +++ b/Content.Shared/Emag/Systems/EmagSystem.cs @@ -22,8 +22,6 @@ public sealed class EmagSystem : EntitySystem [Dependency] private readonly SharedChargesSystem _charges = default!; [Dependency] private readonly SharedPopupSystem _popup = default!; [Dependency] private readonly TagSystem _tag = default!; - - [Dependency] private readonly IEntityManager _entManager = default!; public override void Initialize() { @@ -58,10 +56,12 @@ public bool TryUseEmag(EntityUid uid, EntityUid user, EntityUid target, EmagComp return false; } - var handled = DoEmagEffect(user, target); + bool handled; - if (comp.Reverse) - handled = DoReEmagEffect(user, target); + if (comp.Unemag) + handled = DoUnEmagEffect(user, target); + else + handled = DoEmagEffect(user, target); if (!handled) return false; @@ -94,20 +94,20 @@ public bool DoEmagEffect(EntityUid user, EntityUid target) } /// - /// Does the emag effect on a specified entity + /// Does the unemag effect on a specified entity /// - public bool DoReEmagEffect(EntityUid user, EntityUid target) + public bool DoUnEmagEffect(EntityUid user, EntityUid target) { - // prevent removel emagging twice + // prevent unemagging twice if (!HasComp(target)) return false; - var emaggedEvent = new GotReEmaggedEvent(user); - RaiseLocalEvent(target, ref emaggedEvent); + var unEmaggedEvent = new GotUnEmaggedEvent(user); + RaiseLocalEvent(target, ref unEmaggedEvent); - if (emaggedEvent.Handled) + if (unEmaggedEvent.Handled) EntityManager.RemoveComponent(target); - return emaggedEvent.Handled; + return unEmaggedEvent.Handled; } } @@ -115,4 +115,4 @@ public bool DoReEmagEffect(EntityUid user, EntityUid target) public record struct GotEmaggedEvent(EntityUid UserUid, bool Handled = false, bool Repeatable = false); [ByRefEvent] -public record struct GotReEmaggedEvent(EntityUid UserUid, bool Handled = false, bool Repeatable = false); +public record struct GotUnEmaggedEvent(EntityUid UserUid, bool Handled = false, bool Repeatable = false); diff --git a/Resources/Prototypes/_NF/Entities/Objects/Tools/emag.yml b/Resources/Prototypes/_NF/Entities/Objects/Tools/emag.yml index 7862d5dda6e..3acf9ce37f3 100644 --- a/Resources/Prototypes/_NF/Entities/Objects/Tools/emag.yml +++ b/Resources/Prototypes/_NF/Entities/Objects/Tools/emag.yml @@ -1,11 +1,11 @@ - type: entity parent: BaseItem - id: ReEmag + id: UnEmag name: cryptographic resequencer description: The all-in-one unhacking solution. The thinking man's lock. The iconic EMAG fixer. components: - type: Emag - reverse: true + unemag: true - type: LimitedCharges - type: AutoRecharge - type: Sprite @@ -16,13 +16,13 @@ - type: entity parent: BaseItem - id: ReEmagUnlimited + id: UnEmagUnlimited suffix: Unlimited name: cryptographic resequencer description: The all-in-one unhacking solution. The thinking man's lock. The iconic EMAG fixer. components: - type: Emag - reverse: true + unemag: true - type: Sprite sprite: Objects/Tools/emag.rsi state: icon From 8091d3f92ea30ef8578bc8a3ac930cc660c9cb9b Mon Sep 17 00:00:00 2001 From: Dvir Date: Thu, 4 Jan 2024 02:58:42 +0200 Subject: [PATCH 03/14] Demag --- .../Emag/Components/EmagComponent.cs | 4 ++-- Content.Shared/Emag/Systems/EmagSystem.cs | 2 +- .../_NF/Entities/Objects/Tools/emag.yml | 20 ++++++++-------- .../_NF/Objects/Tools/demag.rsi/icon.png | Bin 0 -> 367 bytes .../Objects/Tools/demag.rsi/inhand-left.png | Bin 0 -> 272 bytes .../Objects/Tools/demag.rsi/inhand-right.png | Bin 0 -> 269 bytes .../_NF/Objects/Tools/demag.rsi/meta.json | 22 ++++++++++++++++++ 7 files changed, 35 insertions(+), 13 deletions(-) create mode 100644 Resources/Textures/_NF/Objects/Tools/demag.rsi/icon.png create mode 100644 Resources/Textures/_NF/Objects/Tools/demag.rsi/inhand-left.png create mode 100644 Resources/Textures/_NF/Objects/Tools/demag.rsi/inhand-right.png create mode 100644 Resources/Textures/_NF/Objects/Tools/demag.rsi/meta.json diff --git a/Content.Shared/Emag/Components/EmagComponent.cs b/Content.Shared/Emag/Components/EmagComponent.cs index e230a89f59d..416e332bc5e 100644 --- a/Content.Shared/Emag/Components/EmagComponent.cs +++ b/Content.Shared/Emag/Components/EmagComponent.cs @@ -18,6 +18,6 @@ public sealed partial class EmagComponent : Component [AutoNetworkedField] public string EmagImmuneTag = "EmagImmune"; - [DataField("unemag")] - public bool Unemag = false; + [DataField("demag")] + public bool Demag = false; } diff --git a/Content.Shared/Emag/Systems/EmagSystem.cs b/Content.Shared/Emag/Systems/EmagSystem.cs index 269ff756852..f5343b496fa 100644 --- a/Content.Shared/Emag/Systems/EmagSystem.cs +++ b/Content.Shared/Emag/Systems/EmagSystem.cs @@ -58,7 +58,7 @@ public bool TryUseEmag(EntityUid uid, EntityUid user, EntityUid target, EmagComp bool handled; - if (comp.Unemag) + if (comp.Demag) handled = DoUnEmagEffect(user, target); else handled = DoEmagEffect(user, target); diff --git a/Resources/Prototypes/_NF/Entities/Objects/Tools/emag.yml b/Resources/Prototypes/_NF/Entities/Objects/Tools/emag.yml index 3acf9ce37f3..3ab2e8efc67 100644 --- a/Resources/Prototypes/_NF/Entities/Objects/Tools/emag.yml +++ b/Resources/Prototypes/_NF/Entities/Objects/Tools/emag.yml @@ -1,30 +1,30 @@ - type: entity parent: BaseItem - id: UnEmag + id: Demag name: cryptographic resequencer - description: The all-in-one unhacking solution. The thinking man's lock. The iconic EMAG fixer. + description: The all-in-one unhacking solution. The thinking man's lock. The iconic DEMAG fixer. components: - type: Emag - unemag: true + demag: true - type: LimitedCharges - type: AutoRecharge - type: Sprite - sprite: Objects/Tools/emag.rsi + sprite: _NF/Objects/Tools/demag.rsi state: icon - type: Item - sprite: Objects/Tools/emag.rsi + sprite: _NF/Objects/Tools/demag.rsi - type: entity parent: BaseItem - id: UnEmagUnlimited + id: DemagUnlimited suffix: Unlimited name: cryptographic resequencer - description: The all-in-one unhacking solution. The thinking man's lock. The iconic EMAG fixer. + description: The all-in-one unhacking solution. The thinking man's lock. The iconic DEMAG fixer. components: - type: Emag - unemag: true + demag: true - type: Sprite - sprite: Objects/Tools/emag.rsi + sprite: _NF/Objects/Tools/demag.rsi state: icon - type: Item - sprite: Objects/Tools/emag.rsi + sprite: _NF/Objects/Tools/demag.rsi diff --git a/Resources/Textures/_NF/Objects/Tools/demag.rsi/icon.png b/Resources/Textures/_NF/Objects/Tools/demag.rsi/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..6b28723f3c6878e31acc68d02ec53491d19ce8fb GIT binary patch literal 367 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE3?yBabR7dyjKx9jP7LeL$-D$|@&kNAT!FNz zs_Odn>!(baVsCGsm6gTd#h^MBD9rGGhXY?0!&U~p1_1_!fU7{!(9lr5rR+P|O?tU? z7(5UEIS~E-#P5(g$oz1UAvaSc@vZKx*|RXjfrf^4XnBI*1G3cTPI}q z?>RMb+d<}AdEFo@OM?7@8U7OiR?HQw25Lz5ba4!^=zTl!G$(^02kYKtjSnuK_!ggB z$6=WNIFE5=H+#F|gcq9@blkV^Fb)w&|06K#5bw*y>w{0-a6L@J#ddWzYh$Ie-`h RE(K2pQJ$`TF6*2UngGn{mWTiV literal 0 HcmV?d00001 diff --git a/Resources/Textures/_NF/Objects/Tools/demag.rsi/inhand-left.png b/Resources/Textures/_NF/Objects/Tools/demag.rsi/inhand-left.png new file mode 100644 index 0000000000000000000000000000000000000000..182dd00a01c98a2e0578e827eb4e740fc4e542aa GIT binary patch literal 272 zcmeAS@N?(olHy`uVBq!ia0vp^4j|0I1|(Ny7TyC=jKx9jP7LeL$-D$|Hh8)?hE&XX zdut=_VFiKK#3`0D4(U!x-I>Hw^`v)#dBOXMHy$l5GHS4Vz39(<2LC&p7e6=wwShoE zxK`-A&pwf|*R;Ny8tF`3l^N&mR_F8i)o-;WK}(A#s^tD&7})N+H0w6M=cIF~5$_82 zy2g5Ms9;`q=iZ|8tSuj6n_Rd3e#i(h4MSO*Ra2mPzSIcMG+$o^Eg%~x2?m#fCxd8DS3j3^P6AKb;e|U^u0MR zi{uyeEnU5-A^GK(na01FP5I|95qfuy5n>zzLxcN6?o+mlTQ2`*+`namae#}qHM8qh zAmdIvKR<)R?|W_4>9ZCpYlZ?f@TEq0ruq6ZXaU(APy;RnPX@6(UHx3vIVCg!0E Date: Thu, 4 Jan 2024 03:12:32 +0200 Subject: [PATCH 04/14] Update heads.yml --- Resources/Prototypes/Catalog/Fills/Lockers/heads.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Resources/Prototypes/Catalog/Fills/Lockers/heads.yml b/Resources/Prototypes/Catalog/Fills/Lockers/heads.yml index 8e44777dd06..7a2c7173d96 100644 --- a/Resources/Prototypes/Catalog/Fills/Lockers/heads.yml +++ b/Resources/Prototypes/Catalog/Fills/Lockers/heads.yml @@ -124,7 +124,7 @@ - id: IDComputerCircuitboard - id: CommsComputerCircuitboard # Frontier # - id: WeaponDisabler # Frontier - bloat - - id: ClothingOuterWinterHoP # Frontier - bloat +# - id: ClothingOuterWinterHoP # Frontier - bloat # - id: CigarGoldCase # Frontier # prob: 0.25 # Fuck the HoP they don't deserve fucking cigars. @@ -143,6 +143,7 @@ # - id: ClothingHandsGlovesCaptain #TODO replace with new item! # - id: ClothingOuterHardsuitCap #TODO replace with new item! # - id: ClothingMaskGasCaptain #TODO replace with new item! + - id: Demag # Frontier - type: entity id: LockerChiefEngineerFilledHardsuit @@ -347,6 +348,7 @@ - id: JetpackSecurityFilled # Frontier - id: HandheldGPSBasic # Frontier - id: ClothingShoesBootsMagCombatFilled # Frontier + - id: Demag # Frontier - type: entity id: LockerHeadOfSecurityFilled @@ -379,3 +381,4 @@ # - id: BookSecretDocuments # Frontier - id: ClothingNeckMantleHOS # Frontier - id: ClothingOuterWinterHoS # Frontier + - id: Demag # Frontier From 2ba3d85fbe647bd39cee05f27c392e43b58fdc43 Mon Sep 17 00:00:00 2001 From: Dvir Date: Thu, 4 Jan 2024 03:13:44 +0200 Subject: [PATCH 05/14] Update meta.json --- Resources/Textures/_NF/Objects/Tools/demag.rsi/meta.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Resources/Textures/_NF/Objects/Tools/demag.rsi/meta.json b/Resources/Textures/_NF/Objects/Tools/demag.rsi/meta.json index 66fc62d663d..add0c3d0f1e 100644 --- a/Resources/Textures/_NF/Objects/Tools/demag.rsi/meta.json +++ b/Resources/Textures/_NF/Objects/Tools/demag.rsi/meta.json @@ -1,7 +1,7 @@ { "version": 1, "license": "CC-BY-SA-3.0", - "copyright": "Taken from tgstation wiki at https://tgstation13.org/wiki/File:Emag.png, inhand sprites modified from tgstation at commit https://github.com/tgstation/tgstation/commit/d917f4c2a088419d5c3aec7656b7ff8cebd1822e", + "copyright": "Taken from tgstation wiki at https://tgstation13.org/wiki/File:Emag.png, edited by gentlebutter", "size": { "x": 32, "y": 32 From 6c1945d1ef90e1d32e5641493a19aa25272f18a1 Mon Sep 17 00:00:00 2001 From: Dvir <39403717+dvir001@users.noreply.github.com> Date: Thu, 4 Jan 2024 19:16:32 +0200 Subject: [PATCH 06/14] Update VendingMachineSystem.cs --- Content.Server/VendingMachines/VendingMachineSystem.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Content.Server/VendingMachines/VendingMachineSystem.cs b/Content.Server/VendingMachines/VendingMachineSystem.cs index 9701f4085d9..97cd57be716 100644 --- a/Content.Server/VendingMachines/VendingMachineSystem.cs +++ b/Content.Server/VendingMachines/VendingMachineSystem.cs @@ -187,7 +187,7 @@ private void OnEmagged(EntityUid uid, VendingMachineComponent component, ref Got args.Handled = component.EmaggedInventory.Count > 0; } - private void OnUnEmagged(EntityUid uid, VendingMachineComponent component, ref GotUnEmaggedEvent args) + private void OnUnEmagged(EntityUid uid, VendingMachineComponent component, ref GotUnEmaggedEvent args) # Frontier - Added DEMUG { // only unemag if there are emag-only items args.Handled = component.EmaggedInventory.Count > 0; From 48ace9bf6edcd42e4f03c7a131169a5a215cc81d Mon Sep 17 00:00:00 2001 From: Dvir <39403717+dvir001@users.noreply.github.com> Date: Thu, 4 Jan 2024 19:17:04 +0200 Subject: [PATCH 07/14] Update VendingMachineSystem.cs --- Content.Server/VendingMachines/VendingMachineSystem.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Content.Server/VendingMachines/VendingMachineSystem.cs b/Content.Server/VendingMachines/VendingMachineSystem.cs index 97cd57be716..4cf1a5623b2 100644 --- a/Content.Server/VendingMachines/VendingMachineSystem.cs +++ b/Content.Server/VendingMachines/VendingMachineSystem.cs @@ -187,7 +187,7 @@ private void OnEmagged(EntityUid uid, VendingMachineComponent component, ref Got args.Handled = component.EmaggedInventory.Count > 0; } - private void OnUnEmagged(EntityUid uid, VendingMachineComponent component, ref GotUnEmaggedEvent args) # Frontier - Added DEMUG + private void OnUnEmagged(EntityUid uid, VendingMachineComponent component, ref GotUnEmaggedEvent args) // Frontier - Added DEMUG { // only unemag if there are emag-only items args.Handled = component.EmaggedInventory.Count > 0; From fca62ead6eb7476da98ef4a72011d3d027bec3eb Mon Sep 17 00:00:00 2001 From: Dvir Date: Thu, 4 Jan 2024 19:22:32 +0200 Subject: [PATCH 08/14] Notes --- Content.Server/VendingMachines/VendingMachineSystem.cs | 4 ++-- Content.Shared/Emag/Components/EmagComponent.cs | 3 +++ Content.Shared/Emag/Systems/EmagSystem.cs | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/Content.Server/VendingMachines/VendingMachineSystem.cs b/Content.Server/VendingMachines/VendingMachineSystem.cs index 9701f4085d9..a4de64ec172 100644 --- a/Content.Server/VendingMachines/VendingMachineSystem.cs +++ b/Content.Server/VendingMachines/VendingMachineSystem.cs @@ -62,7 +62,7 @@ public override void Initialize() SubscribeLocalEvent(OnPowerChanged); SubscribeLocalEvent(OnBreak); SubscribeLocalEvent(OnEmagged); - SubscribeLocalEvent(OnUnEmagged); + SubscribeLocalEvent(OnUnEmagged); // Frontier SubscribeLocalEvent(OnDamage); SubscribeLocalEvent(OnVendingPrice); SubscribeLocalEvent(OnEmpPulse); @@ -187,7 +187,7 @@ private void OnEmagged(EntityUid uid, VendingMachineComponent component, ref Got args.Handled = component.EmaggedInventory.Count > 0; } - private void OnUnEmagged(EntityUid uid, VendingMachineComponent component, ref GotUnEmaggedEvent args) + private void OnUnEmagged(EntityUid uid, VendingMachineComponent component, ref GotUnEmaggedEvent args) // Frontier - DEMAG { // only unemag if there are emag-only items args.Handled = component.EmaggedInventory.Count > 0; diff --git a/Content.Shared/Emag/Components/EmagComponent.cs b/Content.Shared/Emag/Components/EmagComponent.cs index 416e332bc5e..36b6b5fe487 100644 --- a/Content.Shared/Emag/Components/EmagComponent.cs +++ b/Content.Shared/Emag/Components/EmagComponent.cs @@ -18,6 +18,9 @@ public sealed partial class EmagComponent : Component [AutoNetworkedField] public string EmagImmuneTag = "EmagImmune"; + /// + /// Frontier - Reverse emags + /// [DataField("demag")] public bool Demag = false; } diff --git a/Content.Shared/Emag/Systems/EmagSystem.cs b/Content.Shared/Emag/Systems/EmagSystem.cs index f5343b496fa..db06c93e6c8 100644 --- a/Content.Shared/Emag/Systems/EmagSystem.cs +++ b/Content.Shared/Emag/Systems/EmagSystem.cs @@ -94,7 +94,7 @@ public bool DoEmagEffect(EntityUid user, EntityUid target) } /// - /// Does the unemag effect on a specified entity + /// Frontier - Does the DEMAG effect on a specified entity /// public bool DoUnEmagEffect(EntityUid user, EntityUid target) { From 8c9fc98289bf774e4140718a2b0e6aadd489d8af Mon Sep 17 00:00:00 2001 From: Dvir Date: Thu, 4 Jan 2024 19:23:16 +0200 Subject: [PATCH 09/14] Update EmagSystem.cs --- Content.Shared/Emag/Systems/EmagSystem.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Content.Shared/Emag/Systems/EmagSystem.cs b/Content.Shared/Emag/Systems/EmagSystem.cs index db06c93e6c8..2a520c888e8 100644 --- a/Content.Shared/Emag/Systems/EmagSystem.cs +++ b/Content.Shared/Emag/Systems/EmagSystem.cs @@ -115,4 +115,4 @@ public bool DoUnEmagEffect(EntityUid user, EntityUid target) public record struct GotEmaggedEvent(EntityUid UserUid, bool Handled = false, bool Repeatable = false); [ByRefEvent] -public record struct GotUnEmaggedEvent(EntityUid UserUid, bool Handled = false, bool Repeatable = false); +public record struct GotUnEmaggedEvent(EntityUid UserUid, bool Handled = false, bool Repeatable = false); // Frontier From 592e4cbf37940f5b1d999f951832592730ad7d11 Mon Sep 17 00:00:00 2001 From: Dvir Date: Sun, 7 Jan 2024 01:24:46 +0200 Subject: [PATCH 10/14] DEMAG Doors --- Content.Server/Doors/Systems/DoorSystem.cs | 19 +++++++++++++++++++ .../Access/Systems/AccessReaderSystem.cs | 7 +++++++ 2 files changed, 26 insertions(+) diff --git a/Content.Server/Doors/Systems/DoorSystem.cs b/Content.Server/Doors/Systems/DoorSystem.cs index 560149f2289..d83a222c06a 100644 --- a/Content.Server/Doors/Systems/DoorSystem.cs +++ b/Content.Server/Doors/Systems/DoorSystem.cs @@ -6,6 +6,7 @@ using Content.Shared.Database; using Content.Shared.Doors.Components; using Content.Shared.Doors.Systems; +using Content.Shared.Emag.Components; using Content.Shared.Emag.Systems; using Content.Shared.Interaction; using Content.Shared.Prying.Components; @@ -33,6 +34,7 @@ public override void Initialize() SubscribeLocalEvent(OnWeldAttempt); SubscribeLocalEvent(OnWeldChanged); SubscribeLocalEvent(OnEmagged); + SubscribeLocalEvent(OnUnEmagged); SubscribeLocalEvent(OnAfterPry); } @@ -168,6 +170,23 @@ private void OnEmagged(EntityUid uid, DoorComponent door, ref GotEmaggedEvent ar } } + private void OnUnEmagged(EntityUid uid, DoorComponent door, ref GotUnEmaggedEvent args) // Frontier - Added DEMUG + { + if (TryComp(uid, out var airlockComponent)) + { + if (HasComp(uid)) + { + if (TryComp(uid, out var doorBoltComponent)) + { + _bolts.SetBoltsDown(uid, doorBoltComponent, !doorBoltComponent.BoltsDown); + SetState(uid, DoorState.Closing, door); + } + PlaySound(uid, door.SparkSound, AudioParams.Default.WithVolume(8), args.UserUid, false); + args.Handled = true; + } + } + } + public override void StartOpening(EntityUid uid, DoorComponent? door = null, EntityUid? user = null, bool predicted = false) { if (!Resolve(uid, ref door)) diff --git a/Content.Shared/Access/Systems/AccessReaderSystem.cs b/Content.Shared/Access/Systems/AccessReaderSystem.cs index 789fe5c3f35..723a3158460 100644 --- a/Content.Shared/Access/Systems/AccessReaderSystem.cs +++ b/Content.Shared/Access/Systems/AccessReaderSystem.cs @@ -29,6 +29,7 @@ public override void Initialize() base.Initialize(); SubscribeLocalEvent(OnEmagged); + SubscribeLocalEvent(OnUnEmagged); SubscribeLocalEvent(OnLinkAttempt); SubscribeLocalEvent(OnGetState); @@ -78,6 +79,12 @@ private void OnEmagged(EntityUid uid, AccessReaderComponent reader, ref GotEmagg Dirty(uid, reader); } + private void OnUnEmagged(EntityUid uid, AccessReaderComponent reader, ref GotUnEmaggedEvent args) + { + args.Handled = true; + reader.Enabled = true; + } + /// /// Searches the source for access tags /// then compares it with the all targets accesses to see if it is allowed. From 2db3b051808f9e716419baf467b4bd05de603050 Mon Sep 17 00:00:00 2001 From: Dvir Date: Sun, 7 Jan 2024 01:36:02 +0200 Subject: [PATCH 11/14] Door --- Content.Server/Doors/Systems/DoorBoltSystem.cs | 2 +- Content.Shared/Access/Systems/AccessReaderSystem.cs | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/Content.Server/Doors/Systems/DoorBoltSystem.cs b/Content.Server/Doors/Systems/DoorBoltSystem.cs index 133af0013d3..52ca58ff329 100644 --- a/Content.Server/Doors/Systems/DoorBoltSystem.cs +++ b/Content.Server/Doors/Systems/DoorBoltSystem.cs @@ -1,4 +1,4 @@ -using Content.Server.Power.Components; +using Content.Server.Power.Components; using Content.Server.Power.EntitySystems; using Content.Shared.Doors; using Content.Shared.Doors.Components; diff --git a/Content.Shared/Access/Systems/AccessReaderSystem.cs b/Content.Shared/Access/Systems/AccessReaderSystem.cs index 723a3158460..bbf33e0f374 100644 --- a/Content.Shared/Access/Systems/AccessReaderSystem.cs +++ b/Content.Shared/Access/Systems/AccessReaderSystem.cs @@ -83,6 +83,7 @@ private void OnUnEmagged(EntityUid uid, AccessReaderComponent reader, ref GotUnE { args.Handled = true; reader.Enabled = true; + Dirty(uid, reader); } /// From 9094f5d878d733de0a67d505525f38ce7cbc3497 Mon Sep 17 00:00:00 2001 From: Dvir Date: Sun, 7 Jan 2024 02:53:08 +0200 Subject: [PATCH 12/14] DEMAG Lockers --- Content.Server/Doors/Systems/DoorSystem.cs | 4 ++-- .../VendingMachines/VendingMachineSystem.cs | 2 +- .../Access/Systems/AccessReaderSystem.cs | 4 ++-- Content.Shared/Lock/LockSystem.cs | 19 +++++++++++++++++-- 4 files changed, 22 insertions(+), 7 deletions(-) diff --git a/Content.Server/Doors/Systems/DoorSystem.cs b/Content.Server/Doors/Systems/DoorSystem.cs index d83a222c06a..bcfded45f16 100644 --- a/Content.Server/Doors/Systems/DoorSystem.cs +++ b/Content.Server/Doors/Systems/DoorSystem.cs @@ -7,7 +7,6 @@ using Content.Shared.Doors.Components; using Content.Shared.Doors.Systems; using Content.Shared.Emag.Components; -using Content.Shared.Emag.Systems; using Content.Shared.Interaction; using Content.Shared.Prying.Components; using Content.Shared.Prying.Systems; @@ -15,6 +14,7 @@ using Robust.Shared.Audio; using Robust.Shared.Physics.Components; using Robust.Shared.Physics.Events; +using Content.Shared.Emag.Systems; // Frontier - Added DEMUG namespace Content.Server.Doors.Systems; @@ -34,7 +34,7 @@ public override void Initialize() SubscribeLocalEvent(OnWeldAttempt); SubscribeLocalEvent(OnWeldChanged); SubscribeLocalEvent(OnEmagged); - SubscribeLocalEvent(OnUnEmagged); + SubscribeLocalEvent(OnUnEmagged); // Frontier - Added DEMUG SubscribeLocalEvent(OnAfterPry); } diff --git a/Content.Server/VendingMachines/VendingMachineSystem.cs b/Content.Server/VendingMachines/VendingMachineSystem.cs index 86dfe177dba..9450591cecf 100644 --- a/Content.Server/VendingMachines/VendingMachineSystem.cs +++ b/Content.Server/VendingMachines/VendingMachineSystem.cs @@ -62,7 +62,7 @@ public override void Initialize() SubscribeLocalEvent(OnPowerChanged); SubscribeLocalEvent(OnBreak); SubscribeLocalEvent(OnEmagged); - SubscribeLocalEvent(OnUnEmagged); // Frontier + SubscribeLocalEvent(OnUnEmagged); // Frontier - Added DEMUG SubscribeLocalEvent(OnDamage); SubscribeLocalEvent(OnVendingPrice); SubscribeLocalEvent(OnEmpPulse); diff --git a/Content.Shared/Access/Systems/AccessReaderSystem.cs b/Content.Shared/Access/Systems/AccessReaderSystem.cs index bbf33e0f374..a8551e7cfc5 100644 --- a/Content.Shared/Access/Systems/AccessReaderSystem.cs +++ b/Content.Shared/Access/Systems/AccessReaderSystem.cs @@ -29,7 +29,7 @@ public override void Initialize() base.Initialize(); SubscribeLocalEvent(OnEmagged); - SubscribeLocalEvent(OnUnEmagged); + SubscribeLocalEvent(OnUnEmagged); // Frontier - DEMAG SubscribeLocalEvent(OnLinkAttempt); SubscribeLocalEvent(OnGetState); @@ -79,7 +79,7 @@ private void OnEmagged(EntityUid uid, AccessReaderComponent reader, ref GotEmagg Dirty(uid, reader); } - private void OnUnEmagged(EntityUid uid, AccessReaderComponent reader, ref GotUnEmaggedEvent args) + private void OnUnEmagged(EntityUid uid, AccessReaderComponent reader, ref GotUnEmaggedEvent args) // Frontier - DEMAG { args.Handled = true; reader.Enabled = true; diff --git a/Content.Shared/Lock/LockSystem.cs b/Content.Shared/Lock/LockSystem.cs index 23a14946aad..2190910abce 100644 --- a/Content.Shared/Lock/LockSystem.cs +++ b/Content.Shared/Lock/LockSystem.cs @@ -13,6 +13,8 @@ using Robust.Shared.Audio; using Robust.Shared.Utility; using Content.Shared._NF.Trade.Components; +using Content.Shared.Emag.Components; +using System.Text; // Frontier - DEMAG namespace Content.Shared.Lock; @@ -38,6 +40,7 @@ public override void Initialize() SubscribeLocalEvent(OnExamined); SubscribeLocalEvent>(AddToggleLockVerb); SubscribeLocalEvent(OnEmagged); + SubscribeLocalEvent(OnUnEmagged); // Frontier - Added DEMUG } private void OnStartup(EntityUid uid, LockComponent lockComp, ComponentStartup args) @@ -212,15 +215,27 @@ private void AddToggleLockVerb(EntityUid uid, LockComponent component, GetVerbsE private void OnEmagged(EntityUid uid, LockComponent component, ref GotEmaggedEvent args) { - if (HasComp(uid)) + if (HasComp(uid)) // Frontier - TradeCrates return; if (!component.Locked || !component.BreakOnEmag) return; _audio.PlayPredicted(component.UnlockSound, uid, null, AudioParams.Default.WithVolume(-5)); _appearanceSystem.SetData(uid, StorageVisuals.Locked, false); - RemComp(uid); //Literally destroys the lock as a tell it was emagged + //RemComp(uid); //Literally destroys the lock as a tell it was emagged // Frontier - Has to remove this to allow fixing locks + component.Locked = false; args.Handled = true; } + + private void OnUnEmagged(EntityUid uid, LockComponent component, ref GotUnEmaggedEvent args) // Frontier - DEMAG + { + if (HasComp(uid)) + { + _appearanceSystem.SetData(uid, StorageVisuals.Locked, true); + //EnsureComp(uid); //Literally addes the lock as a tell it was emagged + component.Locked = true; + args.Handled = true; + } + } } From 03994a78fc14745346355fde31b16ae62d75ed60 Mon Sep 17 00:00:00 2001 From: Dvir Date: Sun, 7 Jan 2024 03:27:33 +0200 Subject: [PATCH 13/14] Update LockSystem.cs --- Content.Shared/Lock/LockSystem.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Content.Shared/Lock/LockSystem.cs b/Content.Shared/Lock/LockSystem.cs index 2190910abce..0106d6f40b7 100644 --- a/Content.Shared/Lock/LockSystem.cs +++ b/Content.Shared/Lock/LockSystem.cs @@ -220,10 +220,10 @@ private void OnEmagged(EntityUid uid, LockComponent component, ref GotEmaggedEve if (!component.Locked || !component.BreakOnEmag) return; - _audio.PlayPredicted(component.UnlockSound, uid, null, AudioParams.Default.WithVolume(-5)); + //_audio.PlayPredicted(component.UnlockSound, uid, null, AudioParams.Default.WithVolume(-5)); // 2 Times audio _appearanceSystem.SetData(uid, StorageVisuals.Locked, false); //RemComp(uid); //Literally destroys the lock as a tell it was emagged // Frontier - Has to remove this to allow fixing locks - component.Locked = false; + component.Locked = false; // Disable lock args.Handled = true; } From 9329baf074425d6e2b81fb685ddbb3e2ca8168b8 Mon Sep 17 00:00:00 2001 From: Dvir Date: Sun, 7 Jan 2024 04:16:13 +0200 Subject: [PATCH 14/14] Update LockSystem.cs --- Content.Shared/Lock/LockSystem.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Content.Shared/Lock/LockSystem.cs b/Content.Shared/Lock/LockSystem.cs index 0106d6f40b7..ee819895473 100644 --- a/Content.Shared/Lock/LockSystem.cs +++ b/Content.Shared/Lock/LockSystem.cs @@ -220,7 +220,7 @@ private void OnEmagged(EntityUid uid, LockComponent component, ref GotEmaggedEve if (!component.Locked || !component.BreakOnEmag) return; - //_audio.PlayPredicted(component.UnlockSound, uid, null, AudioParams.Default.WithVolume(-5)); // 2 Times audio + _audio.PlayPredicted(component.UnlockSound, uid, null, AudioParams.Default.WithVolume(-5)); _appearanceSystem.SetData(uid, StorageVisuals.Locked, false); //RemComp(uid); //Literally destroys the lock as a tell it was emagged // Frontier - Has to remove this to allow fixing locks component.Locked = false; // Disable lock @@ -231,6 +231,7 @@ private void OnUnEmagged(EntityUid uid, LockComponent component, ref GotUnEmagge { if (HasComp(uid)) { + _audio.PlayPredicted(component.UnlockSound, uid, null, AudioParams.Default.WithVolume(-5)); _appearanceSystem.SetData(uid, StorageVisuals.Locked, true); //EnsureComp(uid); //Literally addes the lock as a tell it was emagged component.Locked = true;