From 6c8a802e488c453bc2c3aecff330f2878b886f26 Mon Sep 17 00:00:00 2001 From: brainfood1183 Date: Sun, 5 Nov 2023 16:15:36 +0000 Subject: [PATCH 01/19] Rodents can be Faxecuted (executed via Fax machine) --- Content.Server/Fax/FaxSystem.cs | 33 ++++++++++++++- Content.Shared/Fax/FaxVisuals.cs | 2 + Resources/Locale/en-US/fax/fax.ftl | 1 + Resources/Prototypes/Damage/groups.yml | 8 ++++ .../Prototypes/Entities/Mobs/NPCs/animals.yml | 2 + .../Structures/Machines/fax_machine.yml | 4 +- .../fax_machine.rsi/inserting_hamster.png | Bin 0 -> 23368 bytes .../fax_machine.rsi/inserting_mouse.png | Bin 0 -> 23808 bytes .../Machines/fax_machine.rsi/meta.json | 38 ++++++++++++++++++ 9 files changed, 85 insertions(+), 3 deletions(-) create mode 100644 Resources/Textures/Structures/Machines/fax_machine.rsi/inserting_hamster.png create mode 100644 Resources/Textures/Structures/Machines/fax_machine.rsi/inserting_mouse.png diff --git a/Content.Server/Fax/FaxSystem.cs b/Content.Server/Fax/FaxSystem.cs index ec95d71dcf4045..4301d520e931ff 100644 --- a/Content.Server/Fax/FaxSystem.cs +++ b/Content.Server/Fax/FaxSystem.cs @@ -1,13 +1,21 @@ +using System.Threading; using Content.Server.Administration; +using Content.Server.Administration.Commands; +using Content.Server.Administration.Components; using Content.Server.Administration.Managers; +using Content.Server.Body.Systems; using Content.Server.Chat.Managers; +using Content.Server.Destructible.Thresholds.Behaviors; using Content.Server.DeviceNetwork; using Content.Server.DeviceNetwork.Components; using Content.Server.DeviceNetwork.Systems; +using Content.Server.Explosion.EntitySystems; using Content.Server.Paper; +using Content.Shared.Popups; using Content.Server.Popups; using Content.Server.Power.Components; using Content.Server.Tools; +using Robust.Shared.Timing; using Content.Server.UserInterface; using Content.Shared.Administration.Logs; using Content.Shared.Containers.ItemSlots; @@ -16,11 +24,17 @@ using Content.Shared.Emag.Systems; using Content.Shared.Fax; using Content.Shared.Interaction; +using Content.Shared.Mobs.Components; using Content.Shared.Paper; using Robust.Server.GameObjects; using Robust.Shared.Audio; using Robust.Shared.Containers; using Robust.Shared.Player; +using Timer = Robust.Shared.Timing.Timer; +using Content.Shared.Damage; +using Content.Shared.Damage.Prototypes; +using Robust.Shared.Prototypes; +using Content.Server.Nutrition.Components; namespace Content.Server.Fax; @@ -39,6 +53,8 @@ public sealed class FaxSystem : EntitySystem [Dependency] private readonly UserInterfaceSystem _userInterface = default!; [Dependency] private readonly ISharedAdminLogManager _adminLogger = default!; [Dependency] private readonly MetaDataSystem _metaData = default!; + [Dependency] private readonly DamageableSystem _damageable = default!; + [Dependency] private readonly IPrototypeManager _proto = default!; private const string PaperSlotId = "Paper"; @@ -310,8 +326,12 @@ private void UpdateAppearance(EntityUid uid, FaxMachineComponent? component = nu if (!Resolve(uid, ref component)) return; - if (component.InsertingTimeRemaining > 0) + if (component.InsertingTimeRemaining > 0 && !HasComp(component.PaperSlot.Item)) _appearanceSystem.SetData(uid, FaxMachineVisuals.VisualState, FaxMachineVisualState.Inserting); + else if (component.InsertingTimeRemaining > 0 && HasComp(component.PaperSlot.Item)) + _appearanceSystem.SetData(uid, FaxMachineVisuals.VisualState, FaxMachineVisualState.InsertingMouse); + else if (component.InsertingTimeRemaining > 0) + _appearanceSystem.SetData(uid, FaxMachineVisuals.VisualState, FaxMachineVisualState.InsertingHamlet); else if (component.PrintingTimeRemaining > 0) _appearanceSystem.SetData(uid, FaxMachineVisuals.VisualState, FaxMachineVisualState.Printing); else @@ -388,9 +408,18 @@ public void Send(EntityUid uid, FaxMachineComponent? component = null, EntityUid return; if (!TryComp(sendEntity, out var metadata) || - !TryComp(sendEntity, out var paper)) + !TryComp(sendEntity, out var paper)) return; + if (HasComp(sendEntity)) + { + var damageSpec = new DamageSpecifier(_proto.Index("Physical"), 300); + _damageable.TryChangeDamage(sendEntity, damageSpec); + _popupSystem.PopupEntity(Loc.GetString("fax-machine-popup-error", ("target", uid)), uid, PopupType.LargeCaution); + _adminLogger.Add(LogType.Action, LogImpact.Low, $"{(sender != null ? ToPrettyString(sender.Value) : "Unknown"):user} tried to send foreign object from \"{component.FaxName}\" {ToPrettyString(uid)} to {faxName} ({component.DestinationFaxAddress}): {paper.Content}"); + return; + } + var payload = new NetworkPayload() { { DeviceNetworkConstants.Command, FaxConstants.FaxPrintCommand }, diff --git a/Content.Shared/Fax/FaxVisuals.cs b/Content.Shared/Fax/FaxVisuals.cs index bfda60cdec5b96..b8366bba7e0d5a 100644 --- a/Content.Shared/Fax/FaxVisuals.cs +++ b/Content.Shared/Fax/FaxVisuals.cs @@ -13,5 +13,7 @@ public enum FaxMachineVisualState : byte { Normal, Inserting, + InsertingHamlet, + InsertingMouse, Printing } diff --git a/Resources/Locale/en-US/fax/fax.ftl b/Resources/Locale/en-US/fax/fax.ftl index 1ea3582d14a3af..123f080000a59c 100644 --- a/Resources/Locale/en-US/fax/fax.ftl +++ b/Resources/Locale/en-US/fax/fax.ftl @@ -3,6 +3,7 @@ fax-machine-popup-received = Received correspondence from { $from }. fax-machine-popup-name-long = Fax name is too long fax-machine-popup-name-exist = Fax with same name already exist in network fax-machine-popup-name-set = Fax name has been updated +fax-machine-popup-error = ERROR - jam in paper feed fax-machine-dialog-rename = Rename fax-machine-dialog-field-name = Name diff --git a/Resources/Prototypes/Damage/groups.yml b/Resources/Prototypes/Damage/groups.yml index 07bfe2edcdd963..991216053a990e 100644 --- a/Resources/Prototypes/Damage/groups.yml +++ b/Resources/Prototypes/Damage/groups.yml @@ -35,3 +35,11 @@ id: Genetic damageTypes: - Cellular + +- type: damageGroup + id: Physical + damageTypes: + - Blunt + - Slash + - Piercing + diff --git a/Resources/Prototypes/Entities/Mobs/NPCs/animals.yml b/Resources/Prototypes/Entities/Mobs/NPCs/animals.yml index 3a60263540c135..cda4ed353f79ef 100644 --- a/Resources/Prototypes/Entities/Mobs/NPCs/animals.yml +++ b/Resources/Prototypes/Entities/Mobs/NPCs/animals.yml @@ -1174,6 +1174,7 @@ rootTask: task: MouseCompound - type: Physics + - type: Paper - type: Fixtures fixtures: fix1: @@ -2548,6 +2549,7 @@ - SmallMobLayer - type: MobState - type: Deathgasp + - type: Paper - type: MobStateActions actions: Critical: diff --git a/Resources/Prototypes/Entities/Structures/Machines/fax_machine.yml b/Resources/Prototypes/Entities/Structures/Machines/fax_machine.yml index 89e1e695eb6d87..c56fb8a9452e61 100644 --- a/Resources/Prototypes/Entities/Structures/Machines/fax_machine.yml +++ b/Resources/Prototypes/Entities/Structures/Machines/fax_machine.yml @@ -1,4 +1,4 @@ -- type: entity +- type: entity parent: BaseMachinePowered id: FaxMachineBase name: long range fax machine @@ -52,6 +52,8 @@ enum.FaxMachineVisuals.VisualState: base: Inserting: { state: inserting } + InsertingHamlet: { state: inserting_hamster } + InsertingMouse: { state: inserting_mouse } Printing: { state: printing } - type: ItemSlots - type: ContainerContainer diff --git a/Resources/Textures/Structures/Machines/fax_machine.rsi/inserting_hamster.png b/Resources/Textures/Structures/Machines/fax_machine.rsi/inserting_hamster.png new file mode 100644 index 0000000000000000000000000000000000000000..5f14e3013fe27a556cf939324a970734cb697eda GIT binary patch literal 23368 zcmeI4d033=`@rAiR8q2JO(Z)_Gw(a=+cNDNE!tF)dS~8uYP3u$S|o);e9;L>MK~!% z_DCUXh)A{;LK~uvLPg8(nTnX>%sD^5zJL6#Yr3wcd7k^d@8@|w&wby|GF`KAfwh^U z`~-Ojf)p*xjqSkSNbu_+Cj(v|hJ{&xKSTV@T>>F!*j3@L)Q-8sR3J#+hHqrFV1bt) zND$~H@K>`iGE(yo5b*du1O$bYr`UTs*uNg5+xqN-;rtDe+vf}HM$4($8E%SHj+-%O z%8=pnHcZ)9Hrn>m2osaRDmPL$NN?E^xp}m$hC;0T6WN+6`?st;up#!=mlrD!ct6T- zt-I58`Z2rya7)U`yRrpx3OmiIw)9AaLxz(^JYQRQ_4q?=>l(xi`QjqKRDWj!Q;~=$B#0F!?OB*_TcVVmv zOAd2mV=-JTVm5|4csZ&Fsb%~I&X|t2g z`?=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)X@2qRbT&EtN-&GRe=l)&A#!nyoM+jl`-&NvnSQ%&-^yuR zYuS>OnW;2v*vqRMN98mOjUMFS_|U}iRXG&9|5eE)101ovt?`(0Qo(ZXk;I1h7HEMq zVw>OIwt2hKYX2muK)ofj$4c`Vsc_qRsq~{}@887Ft@~_rS71R0RVtfCh2(4?`82ST z%af-M+A{%ywrFm}4(Q2QmHN+KshCg=2fB4N$exY=JYMgr-sOU>Q*SoL9H+05BbdJMUM^mGCI$cymqf|VP-#XwxQNlcl>AWJ(^#0s22xA{!_XkL3c;t`_6#eKt6cz;9}Lm&7IZS#XAU~IMkUFIEx?N@C&>_<_r?H=~;dp({j2CT7 z_6O8x`-fLI9lzTYGRDIpehGj1a>oq$8C8=nymQe{vx_D*zl%ysgh!~SQ9l9=>;_C>r0BpzHsm@#MNz&u~OiP*DOJojLMb=l-9j^9XB8R;cHw}Ds%C3evS6%P^;^k+o2lj-c7oT#MVKCMnV2n8ayV!>;H)R7IH?b=1b zpIsw;@19+o^<;0AL3kdFv!QDzq0DRQ+dA8C%R&WR9oaWz{m+qfcFa4jchRWLuUnA1 zO)B}>y7E;4-q4sRjX@Q`3-ewczFevwE0gL4ftMAbBc52VJ~#Hw!Ei{g&8}I>*y{Nw zjns-}sqzovuU2jaa^ztsfH+;oc%;oarHa@`6(M zk|8xa^qbsne`Du5{qq^9dB@WvrF&lKNxr3-Hw1g{hC{KQQVyF;Qct($yCfWY+ZED$ zz8ZA7s2vQka!IrD==OK--Rh+mXbhS?A#%UeEa6Lr?%{4($jsiP?3O^+RrrO37ADrl J*@hl#{s)EQ{v7}S literal 0 HcmV?d00001 diff --git a/Resources/Textures/Structures/Machines/fax_machine.rsi/inserting_mouse.png b/Resources/Textures/Structures/Machines/fax_machine.rsi/inserting_mouse.png new file mode 100644 index 0000000000000000000000000000000000000000..7fb87053f3f250022e7c0fb953b0405ed62bc123 GIT binary patch literal 23808 zcmeI42~EhWm2g_w)5%-}U~bs$J(g0H>(#ECva zkucat7@+T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ImGgJa&~3S0?{Yex zHkQQ5tx;7d)|+kf_T0f1i02B6JKAFPE_m36k(Sj&kSB}c_Cl5`$5-XY6w_LBbtcUL^U literal 0 HcmV?d00001 diff --git a/Resources/Textures/Structures/Machines/fax_machine.rsi/meta.json b/Resources/Textures/Structures/Machines/fax_machine.rsi/meta.json index 1a8856301d52af..1611093610f033 100644 --- a/Resources/Textures/Structures/Machines/fax_machine.rsi/meta.json +++ b/Resources/Textures/Structures/Machines/fax_machine.rsi/meta.json @@ -40,6 +40,44 @@ ] ] }, + { + "name": "inserting_hamster", + "delays": [ + [ + 0.2, + 0.2, + 0.2, + 0.2, + 0.2, + 0.2, + 0.2, + 0.2, + 0.2, + 0.2, + 0.2, + 0.2 + ] + ] + }, + { + "name": "inserting_mouse", + "delays": [ + [ + 0.2, + 0.2, + 0.2, + 0.2, + 0.2, + 0.2, + 0.2, + 0.2, + 0.2, + 0.2, + 0.2, + 0.2 + ] + ] + }, { "name": "printing", "delays": [ From 3a7b958517282283c5cf8322210bdedee72d0f1e Mon Sep 17 00:00:00 2001 From: brainfood1183 Date: Sun, 5 Nov 2023 16:53:46 +0000 Subject: [PATCH 02/19] use brute instead of new group. --- Content.Server/Fax/FaxSystem.cs | 2 +- Resources/Prototypes/Damage/groups.yml | 8 -------- 2 files changed, 1 insertion(+), 9 deletions(-) diff --git a/Content.Server/Fax/FaxSystem.cs b/Content.Server/Fax/FaxSystem.cs index 4301d520e931ff..165c01eee28a99 100644 --- a/Content.Server/Fax/FaxSystem.cs +++ b/Content.Server/Fax/FaxSystem.cs @@ -413,7 +413,7 @@ public void Send(EntityUid uid, FaxMachineComponent? component = null, EntityUid if (HasComp(sendEntity)) { - var damageSpec = new DamageSpecifier(_proto.Index("Physical"), 300); + var damageSpec = new DamageSpecifier(_proto.Index("Brute"), 300); _damageable.TryChangeDamage(sendEntity, damageSpec); _popupSystem.PopupEntity(Loc.GetString("fax-machine-popup-error", ("target", uid)), uid, PopupType.LargeCaution); _adminLogger.Add(LogType.Action, LogImpact.Low, $"{(sender != null ? ToPrettyString(sender.Value) : "Unknown"):user} tried to send foreign object from \"{component.FaxName}\" {ToPrettyString(uid)} to {faxName} ({component.DestinationFaxAddress}): {paper.Content}"); diff --git a/Resources/Prototypes/Damage/groups.yml b/Resources/Prototypes/Damage/groups.yml index 991216053a990e..07bfe2edcdd963 100644 --- a/Resources/Prototypes/Damage/groups.yml +++ b/Resources/Prototypes/Damage/groups.yml @@ -35,11 +35,3 @@ id: Genetic damageTypes: - Cellular - -- type: damageGroup - id: Physical - damageTypes: - - Blunt - - Slash - - Piercing - From b61d15a056eb8425548b5a5efda17ba18b845210 Mon Sep 17 00:00:00 2001 From: brainfood1183 Date: Sun, 5 Nov 2023 17:41:24 +0000 Subject: [PATCH 03/19] fax visuals now use tags for mouse and hamster instead of comps --- Content.Server/Fax/FaxSystem.cs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/Content.Server/Fax/FaxSystem.cs b/Content.Server/Fax/FaxSystem.cs index 165c01eee28a99..98eb303afa2c77 100644 --- a/Content.Server/Fax/FaxSystem.cs +++ b/Content.Server/Fax/FaxSystem.cs @@ -32,6 +32,8 @@ using Robust.Shared.Player; using Timer = Robust.Shared.Timing.Timer; using Content.Shared.Damage; +using Content.Shared.Random; +using Content.Shared.Tag; using Content.Shared.Damage.Prototypes; using Robust.Shared.Prototypes; using Content.Server.Nutrition.Components; @@ -55,6 +57,7 @@ public sealed class FaxSystem : EntitySystem [Dependency] private readonly MetaDataSystem _metaData = default!; [Dependency] private readonly DamageableSystem _damageable = default!; [Dependency] private readonly IPrototypeManager _proto = default!; + [Dependency] private readonly TagSystem _tagSystem = default!; private const string PaperSlotId = "Paper"; @@ -326,12 +329,12 @@ private void UpdateAppearance(EntityUid uid, FaxMachineComponent? component = nu if (!Resolve(uid, ref component)) return; - if (component.InsertingTimeRemaining > 0 && !HasComp(component.PaperSlot.Item)) - _appearanceSystem.SetData(uid, FaxMachineVisuals.VisualState, FaxMachineVisualState.Inserting); - else if (component.InsertingTimeRemaining > 0 && HasComp(component.PaperSlot.Item)) + if (component.InsertingTimeRemaining > 0 && _tagSystem.HasTag(component.PaperSlot.Item.Value, "Hamster")) + _appearanceSystem.SetData(uid, FaxMachineVisuals.VisualState, FaxMachineVisualState.InsertingHamlet); + else if (component.InsertingTimeRemaining > 0 && _tagSystem.HasTag(component.PaperSlot.Item.Value, "Mouse")) _appearanceSystem.SetData(uid, FaxMachineVisuals.VisualState, FaxMachineVisualState.InsertingMouse); else if (component.InsertingTimeRemaining > 0) - _appearanceSystem.SetData(uid, FaxMachineVisuals.VisualState, FaxMachineVisualState.InsertingHamlet); + _appearanceSystem.SetData(uid, FaxMachineVisuals.VisualState, FaxMachineVisualState.Inserting); else if (component.PrintingTimeRemaining > 0) _appearanceSystem.SetData(uid, FaxMachineVisuals.VisualState, FaxMachineVisualState.Printing); else From 4fc40774d6bd02453b7073f824918b79b85e1c1c Mon Sep 17 00:00:00 2001 From: brainfood1183 Date: Sun, 5 Nov 2023 18:47:14 +0000 Subject: [PATCH 04/19] fix for ubuntu, damn ubuntu bane of my life --- Content.Server/Fax/FaxSystem.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Content.Server/Fax/FaxSystem.cs b/Content.Server/Fax/FaxSystem.cs index 98eb303afa2c77..ec7a9b4e4dc5bf 100644 --- a/Content.Server/Fax/FaxSystem.cs +++ b/Content.Server/Fax/FaxSystem.cs @@ -329,9 +329,9 @@ private void UpdateAppearance(EntityUid uid, FaxMachineComponent? component = nu if (!Resolve(uid, ref component)) return; - if (component.InsertingTimeRemaining > 0 && _tagSystem.HasTag(component.PaperSlot.Item.Value, "Hamster")) + if (component.InsertingTimeRemaining > 0 && component.PaperSlot.Item != null && _tagSystem.HasTag(component.PaperSlot.Item.Value, "Hamster")) _appearanceSystem.SetData(uid, FaxMachineVisuals.VisualState, FaxMachineVisualState.InsertingHamlet); - else if (component.InsertingTimeRemaining > 0 && _tagSystem.HasTag(component.PaperSlot.Item.Value, "Mouse")) + else if (component.InsertingTimeRemaining > 0 && component.PaperSlot.Item != null && _tagSystem.HasTag(component.PaperSlot.Item.Value, "Mouse")) _appearanceSystem.SetData(uid, FaxMachineVisuals.VisualState, FaxMachineVisualState.InsertingMouse); else if (component.InsertingTimeRemaining > 0) _appearanceSystem.SetData(uid, FaxMachineVisuals.VisualState, FaxMachineVisualState.Inserting); From 3a5a578165ff98a4b58c1104740354e3003c48ae Mon Sep 17 00:00:00 2001 From: brainfood1183 Date: Fri, 5 Jan 2024 23:42:46 +0000 Subject: [PATCH 05/19] cant copy hamlet, can now faxecute mothroaches. --- Content.Server/Fax/FaxSystem.cs | 11 ++++++++++ Content.Shared/Fax/FaxVisuals.cs | 1 + Resources/Locale/en-US/fax/fax.ftl | 1 + .../Prototypes/Entities/Mobs/NPCs/animals.yml | 2 ++ .../Structures/Machines/fax_machine.yml | 1 + Resources/Prototypes/tags.yml | 4 +++- .../fax_machine.rsi/inserting_mothroach.png | Bin 0 -> 23838 bytes .../Machines/fax_machine.rsi/meta.json | 19 ++++++++++++++++++ 8 files changed, 38 insertions(+), 1 deletion(-) create mode 100644 Resources/Textures/Structures/Machines/fax_machine.rsi/inserting_mothroach.png diff --git a/Content.Server/Fax/FaxSystem.cs b/Content.Server/Fax/FaxSystem.cs index 71580e2f941f72..1478f153896faa 100644 --- a/Content.Server/Fax/FaxSystem.cs +++ b/Content.Server/Fax/FaxSystem.cs @@ -349,6 +349,8 @@ private void UpdateAppearance(EntityUid uid, FaxMachineComponent? component = nu _appearanceSystem.SetData(uid, FaxMachineVisuals.VisualState, FaxMachineVisualState.InsertingHamlet); else if (component.InsertingTimeRemaining > 0 && component.PaperSlot.Item != null && _tagSystem.HasTag(component.PaperSlot.Item.Value, "Mouse")) _appearanceSystem.SetData(uid, FaxMachineVisuals.VisualState, FaxMachineVisualState.InsertingMouse); + else if (component.InsertingTimeRemaining > 0 && component.PaperSlot.Item != null && _tagSystem.HasTag(component.PaperSlot.Item.Value, "MothRoach")) + _appearanceSystem.SetData(uid, FaxMachineVisuals.VisualState, FaxMachineVisualState.InsertingMothroach); else if (component.InsertingTimeRemaining > 0) _appearanceSystem.SetData(uid, FaxMachineVisuals.VisualState, FaxMachineVisualState.Inserting); else if (component.PrintingTimeRemaining > 0) @@ -423,6 +425,15 @@ public void Copy(EntityUid uid, FaxMachineComponent? component = null) if (sendEntity == null) return; + if (HasComp(sendEntity)) + { + var damageSpec = new DamageSpecifier(_proto.Index("Brute"), 300); + _damageable.TryChangeDamage(sendEntity, damageSpec); + _popupSystem.PopupEntity(Loc.GetString("fax-machine-popup-error", ("target", uid)), uid, PopupType.LargeCaution); + return; + } + + if (!TryComp(sendEntity, out var metadata) || !TryComp(sendEntity, out var paper)) return; diff --git a/Content.Shared/Fax/FaxVisuals.cs b/Content.Shared/Fax/FaxVisuals.cs index b8366bba7e0d5a..56f37056202dde 100644 --- a/Content.Shared/Fax/FaxVisuals.cs +++ b/Content.Shared/Fax/FaxVisuals.cs @@ -15,5 +15,6 @@ public enum FaxMachineVisualState : byte Inserting, InsertingHamlet, InsertingMouse, + InsertingMothroach, Printing } diff --git a/Resources/Locale/en-US/fax/fax.ftl b/Resources/Locale/en-US/fax/fax.ftl index 0f62fc3771470c..a7755a7450afbb 100644 --- a/Resources/Locale/en-US/fax/fax.ftl +++ b/Resources/Locale/en-US/fax/fax.ftl @@ -4,6 +4,7 @@ fax-machine-popup-name-long = Fax name is too long fax-machine-popup-name-exist = Fax with same name already exist in network fax-machine-popup-name-set = Fax name has been updated fax-machine-popup-error = ERROR - jam in paper feed +fax-machine-popup-copy-error = ERROR - unable to copy! fax-machine-dialog-rename = Rename fax-machine-dialog-field-name = Name diff --git a/Resources/Prototypes/Entities/Mobs/NPCs/animals.yml b/Resources/Prototypes/Entities/Mobs/NPCs/animals.yml index b195c1ac5b7c28..0da32a3a66f4dd 100644 --- a/Resources/Prototypes/Entities/Mobs/NPCs/animals.yml +++ b/Resources/Prototypes/Entities/Mobs/NPCs/animals.yml @@ -422,6 +422,7 @@ accent: mothroach - type: ZombieAccentOverride accent: zombieMoth + - type: Paper - type: Vocal sounds: Male: UnisexMoth @@ -435,6 +436,7 @@ - Trash - CannotSuicide - VimPilot + - MothRoach - type: CanEscapeInventory - type: NpcFactionMember factions: diff --git a/Resources/Prototypes/Entities/Structures/Machines/fax_machine.yml b/Resources/Prototypes/Entities/Structures/Machines/fax_machine.yml index c968fdbeb8e34e..ec0aa8ac8f03f6 100644 --- a/Resources/Prototypes/Entities/Structures/Machines/fax_machine.yml +++ b/Resources/Prototypes/Entities/Structures/Machines/fax_machine.yml @@ -54,6 +54,7 @@ Inserting: { state: inserting } InsertingHamlet: { state: inserting_hamster } InsertingMouse: { state: inserting_mouse } + InsertingMothroach: { state: inserting_mothroach } Printing: { state: printing } - type: ItemSlots - type: ContainerContainer diff --git a/Resources/Prototypes/tags.yml b/Resources/Prototypes/tags.yml index fd73e8adfcc6ad..c2ca1e6407f661 100644 --- a/Resources/Prototypes/tags.yml +++ b/Resources/Prototypes/tags.yml @@ -799,13 +799,15 @@ - type: Tag id: MopBasic +- type: Tag + id: MothRoach + - type: Tag id: Mouse - type: Tag id: Multitool - - type: Tag id: NoBlockAnchoring diff --git a/Resources/Textures/Structures/Machines/fax_machine.rsi/inserting_mothroach.png b/Resources/Textures/Structures/Machines/fax_machine.rsi/inserting_mothroach.png new file mode 100644 index 0000000000000000000000000000000000000000..d034322697ed03497fc66f815351a1c3966b4087 GIT binary patch literal 23838 zcmeI42{=?;{P?ewtwf79EodPbGxyGV#n_9Yg^{Jrow;|0EF%=DLuzp7 zZ=RdbU+Cv1^wF?3H`nm-74qFZ2?z>&6mKu!*uNfO)co|l+3bjrzh(>V)D$%A%(jLM zkD8*Zsi-WwA+e0pB^&kh}rld&o&h16+ExfHwjgm;4hG^8*HqRfxjG!^Q<8gjilabh5}F$Nkw zqtVf@VOpwcjV>S+bJ{Rt5^5Q`P=T~u-qBHiyiT$8$Z5kFSU)V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J}hi zv!Cu7w>ON}Pnf=q8J<<3Ele+coT%?o8?=d2YrN7_H~VqO5={rBWr?-h62)buEjQ#N zSc$FBkQ(X)jTdWP%3AC#SrZb`6r-ZrP%B`Yu@dSs%7#p5M~mx*{*YAnb;GQlOeisZ;;c#y~UlAaTOxHBj=p(els{ zj_96TaL@KampsUO+P(y%RywrRWJIV(z=2`bo{v#et1mX5c9 z^Wg~^8`nVTvnoD~Y%KkB*V0zw(f;B!A#c`XH_ME%eA>F8K4W3@=F-H$IfFjg%zHXv z=^u$!lWbzzTR-H;t9r7blaCX@>mXmBZ{+CaceEK)o>8cBfbx$*iKW4(oZhz)%h-tl zYcILkKI7DGdFPnLj;N?A9ad4_p+cXKb9|*w%H*p8HUvm$EM Date: Sat, 6 Jan 2024 19:08:19 +0000 Subject: [PATCH 06/19] fix --- Content.Server/Fax/FaxSystem.cs | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/Content.Server/Fax/FaxSystem.cs b/Content.Server/Fax/FaxSystem.cs index 1478f153896faa..610e510786de7e 100644 --- a/Content.Server/Fax/FaxSystem.cs +++ b/Content.Server/Fax/FaxSystem.cs @@ -345,14 +345,24 @@ private void UpdateAppearance(EntityUid uid, FaxMachineComponent? component = nu if (!Resolve(uid, ref component)) return; - if (component.InsertingTimeRemaining > 0 && component.PaperSlot.Item != null && _tagSystem.HasTag(component.PaperSlot.Item.Value, "Hamster")) - _appearanceSystem.SetData(uid, FaxMachineVisuals.VisualState, FaxMachineVisualState.InsertingHamlet); - else if (component.InsertingTimeRemaining > 0 && component.PaperSlot.Item != null && _tagSystem.HasTag(component.PaperSlot.Item.Value, "Mouse")) - _appearanceSystem.SetData(uid, FaxMachineVisuals.VisualState, FaxMachineVisualState.InsertingMouse); - else if (component.InsertingTimeRemaining > 0 && component.PaperSlot.Item != null && _tagSystem.HasTag(component.PaperSlot.Item.Value, "MothRoach")) - _appearanceSystem.SetData(uid, FaxMachineVisuals.VisualState, FaxMachineVisualState.InsertingMothroach); - else if (component.InsertingTimeRemaining > 0) - _appearanceSystem.SetData(uid, FaxMachineVisuals.VisualState, FaxMachineVisualState.Inserting); + if (component.InsertingTimeRemaining > 0 && component.PaperSlot.Item != null) + { + + if (HasComp(component.PaperSlot.Item)) + { + + if (_tagSystem.HasTag(component.PaperSlot.Item.Value, "Hamster")) + _appearanceSystem.SetData(uid, FaxMachineVisuals.VisualState, FaxMachineVisualState.InsertingHamlet); + else if(_tagSystem.HasTag(component.PaperSlot.Item.Value, "MothRoach")) + { + _appearanceSystem.SetData(uid, FaxMachineVisuals.VisualState, FaxMachineVisualState.InsertingMothroach); + } + else + _appearanceSystem.SetData(uid, FaxMachineVisuals.VisualState, FaxMachineVisualState.InsertingMouse); + } + else + _appearanceSystem.SetData(uid, FaxMachineVisuals.VisualState, FaxMachineVisualState.Inserting); + } else if (component.PrintingTimeRemaining > 0) _appearanceSystem.SetData(uid, FaxMachineVisuals.VisualState, FaxMachineVisualState.Printing); else From a3275fb555a10aca3f64e1143452a8fd6235b597 Mon Sep 17 00:00:00 2001 From: brainfood1183 Date: Sat, 6 Jan 2024 19:32:20 +0000 Subject: [PATCH 07/19] fix --- Content.Server/Fax/FaxSystem.cs | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/Content.Server/Fax/FaxSystem.cs b/Content.Server/Fax/FaxSystem.cs index 610e510786de7e..696d5f00401b6c 100644 --- a/Content.Server/Fax/FaxSystem.cs +++ b/Content.Server/Fax/FaxSystem.cs @@ -352,19 +352,29 @@ private void UpdateAppearance(EntityUid uid, FaxMachineComponent? component = nu { if (_tagSystem.HasTag(component.PaperSlot.Item.Value, "Hamster")) + { _appearanceSystem.SetData(uid, FaxMachineVisuals.VisualState, FaxMachineVisualState.InsertingHamlet); - else if(_tagSystem.HasTag(component.PaperSlot.Item.Value, "MothRoach")) + } + + if (_tagSystem.HasTag(component.PaperSlot.Item.Value, "MothRoach")) { _appearanceSystem.SetData(uid, FaxMachineVisuals.VisualState, FaxMachineVisualState.InsertingMothroach); + } - else + + if (_tagSystem.HasTag(component.PaperSlot.Item.Value, "Mouse")) + { _appearanceSystem.SetData(uid, FaxMachineVisuals.VisualState, FaxMachineVisualState.InsertingMouse); + } } else _appearanceSystem.SetData(uid, FaxMachineVisuals.VisualState, FaxMachineVisualState.Inserting); } - else if (component.PrintingTimeRemaining > 0) + + if (component.PrintingTimeRemaining > 0) + { _appearanceSystem.SetData(uid, FaxMachineVisuals.VisualState, FaxMachineVisualState.Printing); + } else _appearanceSystem.SetData(uid, FaxMachineVisuals.VisualState, FaxMachineVisualState.Normal); } From 3b97ef8e86ceeb543d230fd112b2d1c31d6b9eeb Mon Sep 17 00:00:00 2001 From: brainfood1183 Date: Sat, 20 Jan 2024 15:20:20 +0000 Subject: [PATCH 08/19] fixes --- Content.Server/Fax/FaxSystem.cs | 49 ++++++++++++++++++--------------- 1 file changed, 27 insertions(+), 22 deletions(-) diff --git a/Content.Server/Fax/FaxSystem.cs b/Content.Server/Fax/FaxSystem.cs index 696d5f00401b6c..2884181efa0422 100644 --- a/Content.Server/Fax/FaxSystem.cs +++ b/Content.Server/Fax/FaxSystem.cs @@ -345,40 +345,34 @@ private void UpdateAppearance(EntityUid uid, FaxMachineComponent? component = nu if (!Resolve(uid, ref component)) return; - if (component.InsertingTimeRemaining > 0 && component.PaperSlot.Item != null) + if (component.InsertingTimeRemaining > 0) { - - if (HasComp(component.PaperSlot.Item)) + if(HasComp(component.PaperSlot.Item)) { - - if (_tagSystem.HasTag(component.PaperSlot.Item.Value, "Hamster")) + if (_tagSystem.HasTag(component.PaperSlot.Item.Value, "Hamster") == true) { _appearanceSystem.SetData(uid, FaxMachineVisuals.VisualState, FaxMachineVisualState.InsertingHamlet); } - if (_tagSystem.HasTag(component.PaperSlot.Item.Value, "MothRoach")) + if (_tagSystem.HasTag(component.PaperSlot.Item.Value, "Mouse") == true) { - _appearanceSystem.SetData(uid, FaxMachineVisuals.VisualState, FaxMachineVisualState.InsertingMothroach); - + _appearanceSystem.SetData(uid, FaxMachineVisuals.VisualState, FaxMachineVisualState.InsertingMouse); } - if (_tagSystem.HasTag(component.PaperSlot.Item.Value, "Mouse")) + if (_tagSystem.HasTag(component.PaperSlot.Item.Value, "MothRoach") == true) { - _appearanceSystem.SetData(uid, FaxMachineVisuals.VisualState, FaxMachineVisualState.InsertingMouse); + _appearanceSystem.SetData(uid, FaxMachineVisuals.VisualState, FaxMachineVisualState.InsertingMothroach); } + } else _appearanceSystem.SetData(uid, FaxMachineVisuals.VisualState, FaxMachineVisualState.Inserting); } - - if (component.PrintingTimeRemaining > 0) - { + else if (component.PrintingTimeRemaining > 0) _appearanceSystem.SetData(uid, FaxMachineVisuals.VisualState, FaxMachineVisualState.Printing); - } else _appearanceSystem.SetData(uid, FaxMachineVisuals.VisualState, FaxMachineVisualState.Normal); } - private void UpdateUserInterface(EntityUid uid, FaxMachineComponent? component = null) { if (!Resolve(uid, ref component)) @@ -447,9 +441,7 @@ public void Copy(EntityUid uid, FaxMachineComponent? component = null) if (HasComp(sendEntity)) { - var damageSpec = new DamageSpecifier(_proto.Index("Brute"), 300); - _damageable.TryChangeDamage(sendEntity, damageSpec); - _popupSystem.PopupEntity(Loc.GetString("fax-machine-popup-error", ("target", uid)), uid, PopupType.LargeCaution); + CrushMob(uid); return; } @@ -474,6 +466,22 @@ public void Copy(EntityUid uid, FaxMachineComponent? component = null) UpdateUserInterface(uid, component); } + public void CrushMob(EntityUid uid, FaxMachineComponent? component = null) + { + if (!Resolve(uid, ref component)) + return; + + var sendEntity = component.PaperSlot.Item; + if (sendEntity == null) + return; + + var damageSpec = new DamageSpecifier(_proto.Index("Brute"), 300); + _damageable.TryChangeDamage(sendEntity, damageSpec); + _popupSystem.PopupEntity(Loc.GetString("fax-machine-popup-error", ("target", uid)), uid, PopupType.LargeCaution); + return; + + } + /// /// Sends message to addressee if paper is set and a known fax is selected /// A timeout is set after sending, which is shared by the copy button. @@ -499,10 +507,7 @@ public void Send(EntityUid uid, FaxMachineComponent? component = null, EntityUid if (HasComp(sendEntity)) { - var damageSpec = new DamageSpecifier(_proto.Index("Brute"), 300); - _damageable.TryChangeDamage(sendEntity, damageSpec); - _popupSystem.PopupEntity(Loc.GetString("fax-machine-popup-error", ("target", uid)), uid, PopupType.LargeCaution); - _adminLogger.Add(LogType.Action, LogImpact.Low, $"{(sender != null ? ToPrettyString(sender.Value) : "Unknown"):user} tried to send foreign object from \"{component.FaxName}\" {ToPrettyString(uid)} to {faxName} ({component.DestinationFaxAddress}): {paper.Content}"); + CrushMob(uid); return; } From b9b738e39f6dfdc78ca8b527cee7c774d26b0749 Mon Sep 17 00:00:00 2001 From: brainfood1183 Date: Sat, 27 Jan 2024 18:39:59 +0000 Subject: [PATCH 09/19] removed ifs now using switch, removed hastag now using string. --- Content.Server/Fax/FaxMachineComponent.cs | 47 ++++++++++------ Content.Server/Fax/FaxSystem.cs | 53 +++++++++---------- Content.Server/Fax/FaxableObjectComponent.cs | 18 +++++++ Content.Shared/Fax/DamageOnFaxecuteEvent.cs | 10 ++++ .../Prototypes/Entities/Mobs/NPCs/animals.yml | 10 ++-- .../Entities/Objects/Misc/paper.yml | 1 + .../Structures/Machines/fax_machine.yml | 2 +- Resources/Prototypes/tags.yml | 3 -- 8 files changed, 92 insertions(+), 52 deletions(-) create mode 100644 Content.Server/Fax/FaxableObjectComponent.cs create mode 100644 Content.Shared/Fax/DamageOnFaxecuteEvent.cs diff --git a/Content.Server/Fax/FaxMachineComponent.cs b/Content.Server/Fax/FaxMachineComponent.cs index d1f269dd37055b..2482faf4a4e357 100644 --- a/Content.Server/Fax/FaxMachineComponent.cs +++ b/Content.Server/Fax/FaxMachineComponent.cs @@ -1,4 +1,5 @@ using Content.Shared.Containers.ItemSlots; +using Content.Shared.Damage.Prototypes; using Content.Shared.Paper; using Robust.Shared.Audio; using Robust.Shared.Prototypes; @@ -13,20 +14,32 @@ public sealed partial class FaxMachineComponent : Component /// Name with which the fax will be visible to others on the network /// [ViewVariables(VVAccess.ReadWrite)] - [DataField("name")] + [DataField] public string FaxName { get; set; } = "Unknown"; + /// + /// Type of damage dealt when faxecuted. + /// + [DataField] + public ProtoId DamageType = "Brute"; + + /// + /// Amount of damage dealt when faxecuted. + /// + [DataField] + public int Damage = 300; + /// /// Device address of fax in network to which data will be send /// [ViewVariables(VVAccess.ReadWrite)] - [DataField("destinationAddress")] + [DataField] public string? DestinationFaxAddress { get; set; } /// /// Contains the item to be sent, assumes it's paper... /// - [DataField("paperSlot", required: true)] + [DataField(required: true)] public ItemSlot PaperSlot = new(); /// @@ -34,39 +47,39 @@ public sealed partial class FaxMachineComponent : Component /// This will make it visible to others on the network /// [ViewVariables(VVAccess.ReadWrite)] - [DataField("responsePings")] + [DataField] public bool ResponsePings { get; set; } = true; /// /// Should admins be notified on message receive /// [ViewVariables(VVAccess.ReadWrite)] - [DataField("notifyAdmins")] + [DataField] public bool NotifyAdmins { get; set; } = false; /// /// Should that fax receive nuke codes send by admins. Probably should be captain fax only /// [ViewVariables(VVAccess.ReadWrite)] - [DataField("receiveNukeCodes")] + [DataField] public bool ReceiveNukeCodes { get; set; } = false; /// /// Sound to play when fax has been emagged /// - [DataField("emagSound")] + [DataField] public SoundSpecifier EmagSound = new SoundCollectionSpecifier("sparks"); /// /// Sound to play when fax printing new message /// - [DataField("printSound")] + [DataField] public SoundSpecifier PrintSound = new SoundPathSpecifier("/Audio/Machines/printer.ogg"); /// /// Sound to play when fax successfully send message /// - [DataField("sendSound")] + [DataField] public SoundSpecifier SendSound = new SoundPathSpecifier("/Audio/Machines/high_tech_confirm.ogg"); /// @@ -79,27 +92,27 @@ public sealed partial class FaxMachineComponent : Component /// Print queue of the incoming message /// [ViewVariables] - [DataField("printingQueue")] + [DataField] public Queue PrintingQueue { get; private set; } = new(); /// /// Message sending timeout /// [ViewVariables] - [DataField("sendTimeoutRemaining")] + [DataField] public float SendTimeoutRemaining; /// /// Message sending timeout /// [ViewVariables] - [DataField("sendTimeout")] + [DataField] public float SendTimeout = 5f; /// /// Remaining time of inserting animation /// - [DataField("insertingTimeRemaining")] + [DataField] public float InsertingTimeRemaining; /// @@ -111,7 +124,7 @@ public sealed partial class FaxMachineComponent : Component /// /// Remaining time of printing animation /// - [DataField("printingTimeRemaining")] + [DataField] public float PrintingTimeRemaining; /// @@ -124,13 +137,13 @@ public sealed partial class FaxMachineComponent : Component [DataDefinition] public sealed partial class FaxPrintout { - [DataField("name", required: true)] + [DataField(required: true)] public string Name { get; private set; } = default!; - [DataField("content", required: true)] + [DataField(required: true)] public string Content { get; private set; } = default!; - [DataField("prototypeId", customTypeSerializer: typeof(PrototypeIdSerializer), required: true)] + [DataField(customTypeSerializer: typeof(PrototypeIdSerializer), required: true)] public string PrototypeId { get; private set; } = default!; [DataField("stampState")] diff --git a/Content.Server/Fax/FaxSystem.cs b/Content.Server/Fax/FaxSystem.cs index 2884181efa0422..3af62cee182053 100644 --- a/Content.Server/Fax/FaxSystem.cs +++ b/Content.Server/Fax/FaxSystem.cs @@ -39,6 +39,7 @@ using Robust.Shared.Prototypes; using Content.Server.Nutrition.Components; using Robust.Shared.Prototypes; +using Content.Shared.Weapons.Melee.Events; namespace Content.Server.Fax; @@ -345,28 +346,29 @@ private void UpdateAppearance(EntityUid uid, FaxMachineComponent? component = nu if (!Resolve(uid, ref component)) return; + if (!TryComp(component.PaperSlot.Item, out var faxable)) + return; + + if (component.PaperSlot.Item == null) + return; + if (component.InsertingTimeRemaining > 0) { - if(HasComp(component.PaperSlot.Item)) + switch (faxable.Identity) { - if (_tagSystem.HasTag(component.PaperSlot.Item.Value, "Hamster") == true) - { + case "hamster": _appearanceSystem.SetData(uid, FaxMachineVisuals.VisualState, FaxMachineVisualState.InsertingHamlet); - } - - if (_tagSystem.HasTag(component.PaperSlot.Item.Value, "Mouse") == true) - { + break; + case "mouse": _appearanceSystem.SetData(uid, FaxMachineVisuals.VisualState, FaxMachineVisualState.InsertingMouse); - } - - if (_tagSystem.HasTag(component.PaperSlot.Item.Value, "MothRoach") == true) - { + break; + case "mothroach": _appearanceSystem.SetData(uid, FaxMachineVisuals.VisualState, FaxMachineVisualState.InsertingMothroach); - } - + break; + default: + _appearanceSystem.SetData(uid, FaxMachineVisuals.VisualState, FaxMachineVisualState.Inserting); + break; } - else - _appearanceSystem.SetData(uid, FaxMachineVisuals.VisualState, FaxMachineVisualState.Inserting); } else if (component.PrintingTimeRemaining > 0) _appearanceSystem.SetData(uid, FaxMachineVisuals.VisualState, FaxMachineVisualState.Printing); @@ -441,7 +443,7 @@ public void Copy(EntityUid uid, FaxMachineComponent? component = null) if (HasComp(sendEntity)) { - CrushMob(uid); + Faxecute(uid, component); return; } @@ -466,16 +468,13 @@ public void Copy(EntityUid uid, FaxMachineComponent? component = null) UpdateUserInterface(uid, component); } - public void CrushMob(EntityUid uid, FaxMachineComponent? component = null) + public void Faxecute(EntityUid uid, FaxMachineComponent component, DamageOnFaxecuteEvent? args = null) { - if (!Resolve(uid, ref component)) - return; - var sendEntity = component.PaperSlot.Item; if (sendEntity == null) return; - var damageSpec = new DamageSpecifier(_proto.Index("Brute"), 300); + var damageSpec = new DamageSpecifier(_proto.Index(component.DamageType), component.Damage); _damageable.TryChangeDamage(sendEntity, damageSpec); _popupSystem.PopupEntity(Loc.GetString("fax-machine-popup-error", ("target", uid)), uid, PopupType.LargeCaution); return; @@ -501,16 +500,16 @@ public void Send(EntityUid uid, FaxMachineComponent? component = null, EntityUid if (!component.KnownFaxes.TryGetValue(component.DestinationFaxAddress, out var faxName)) return; - if (!TryComp(sendEntity, out var metadata) || - !TryComp(sendEntity, out var paper)) - return; - - if (HasComp(sendEntity)) + if (HasComp(sendEntity) && HasComp(sendEntity)) { - CrushMob(uid); + Faxecute(uid, component); return; } + if (!TryComp(sendEntity, out var metadata) || + !TryComp(sendEntity, out var paper)) + return; + var payload = new NetworkPayload() { { DeviceNetworkConstants.Command, FaxConstants.FaxPrintCommand }, diff --git a/Content.Server/Fax/FaxableObjectComponent.cs b/Content.Server/Fax/FaxableObjectComponent.cs new file mode 100644 index 00000000000000..0894a089fc9a8b --- /dev/null +++ b/Content.Server/Fax/FaxableObjectComponent.cs @@ -0,0 +1,18 @@ +using Content.Shared.Containers.ItemSlots; +using Content.Shared.Paper; +using Robust.Shared.Audio; +using Robust.Shared.Prototypes; +using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype; + +namespace Content.Server.Fax; + +[RegisterComponent] +public sealed partial class FaxableObjectComponent : Component +{ + /// + /// Name with which the fax will be visible to others on the network + /// + [ViewVariables(VVAccess.ReadWrite)] + [DataField] + public string Identity = "paper"; +} diff --git a/Content.Shared/Fax/DamageOnFaxecuteEvent.cs b/Content.Shared/Fax/DamageOnFaxecuteEvent.cs new file mode 100644 index 00000000000000..a03424b3859a2f --- /dev/null +++ b/Content.Shared/Fax/DamageOnFaxecuteEvent.cs @@ -0,0 +1,10 @@ + +namespace Content.Shared.Fax; + +/// +/// The components in the list are going to be hit, +/// give opportunities to change the damage or other stuff. +/// +public sealed class DamageOnFaxecuteEvent : EntityEventArgs +{ +} diff --git a/Resources/Prototypes/Entities/Mobs/NPCs/animals.yml b/Resources/Prototypes/Entities/Mobs/NPCs/animals.yml index 8755e9bee8b9d6..b72b1bd6fa5c85 100644 --- a/Resources/Prototypes/Entities/Mobs/NPCs/animals.yml +++ b/Resources/Prototypes/Entities/Mobs/NPCs/animals.yml @@ -439,6 +439,8 @@ - type: Speech speechVerb: Moth speechSounds: Squeak + - type: FaxableObject + identity: mothroach - type: MothAccent - type: Sprite sprite: Mobs/Animals/mothroach.rsi @@ -496,7 +498,6 @@ accent: mothroach - type: ZombieAccentOverride accent: zombieMoth - - type: Paper - type: Vocal sounds: Male: UnisexMoth @@ -510,7 +511,6 @@ - Trash - CannotSuicide - VimPilot - - MothRoach - type: CanEscapeInventory - type: NpcFactionMember factions: @@ -1481,7 +1481,8 @@ rootTask: task: MouseCompound - type: Physics - - type: Paper + - type: FaxableObject + identity: mouse - type: Fixtures fixtures: fix1: @@ -2931,6 +2932,8 @@ - type: Item size: Tiny - type: Physics + - type: FaxableObject + identity: hamster - type: Fixtures fixtures: fix1: @@ -2944,7 +2947,6 @@ - SmallMobLayer - type: MobState - type: Deathgasp - - type: Paper - type: MobStateActions actions: Critical: diff --git a/Resources/Prototypes/Entities/Objects/Misc/paper.yml b/Resources/Prototypes/Entities/Objects/Misc/paper.yml index 86dadb8da84306..c2eafb338b2626 100644 --- a/Resources/Prototypes/Entities/Objects/Misc/paper.yml +++ b/Resources/Prototypes/Entities/Objects/Misc/paper.yml @@ -29,6 +29,7 @@ - Document - Trash - type: Appearance + - type: FaxableObject - type: PaperVisuals - type: Flammable fireSpread: true diff --git a/Resources/Prototypes/Entities/Structures/Machines/fax_machine.yml b/Resources/Prototypes/Entities/Structures/Machines/fax_machine.yml index dc2fc29c4401f8..0179ac306e1d13 100644 --- a/Resources/Prototypes/Entities/Structures/Machines/fax_machine.yml +++ b/Resources/Prototypes/Entities/Structures/Machines/fax_machine.yml @@ -42,7 +42,7 @@ ejectSound: /Audio/Machines/tray_eject.ogg whitelist: components: - - Paper + - FaxableObject #used to be PaperComponent - brainfood1183 - type: GenericVisualizer visuals: enum.PowerDeviceVisuals.Powered: diff --git a/Resources/Prototypes/tags.yml b/Resources/Prototypes/tags.yml index 7d6460e0800d7e..61e2c56c4a9afe 100644 --- a/Resources/Prototypes/tags.yml +++ b/Resources/Prototypes/tags.yml @@ -829,9 +829,6 @@ - type: Tag id: MopBasic -- type: Tag - id: MothRoach - - type: Tag id: Mouse From aa29e68239617efec637bb2d5f43a0698655b13e Mon Sep 17 00:00:00 2001 From: brainfood1183 Date: Tue, 20 Feb 2024 17:36:30 +0000 Subject: [PATCH 10/19] fixes and no more switch --- Content.Client/Fax/FaxVisualsSystem.cs | 43 +++++++++++++++++++ .../TransformableContainerSystem.cs | 2 +- Content.Server/Fax/FaxSystem.cs | 43 ++++--------------- Content.Server/Fax/FaxableObjectComponent.cs | 18 -------- Content.Server/Nuke/NukeCodePaperSystem.cs | 1 + .../Fax/FaxMachineComponent.cs | 16 +++++-- Content.Shared/Fax/FaxVisuals.cs | 6 +-- Content.Shared/Fax/FaxableObjectComponent.cs | 15 +++++++ .../Prototypes/Entities/Mobs/NPCs/animals.yml | 6 +-- .../Structures/Machines/fax_machine.yml | 10 ++--- 10 files changed, 88 insertions(+), 72 deletions(-) create mode 100644 Content.Client/Fax/FaxVisualsSystem.cs delete mode 100644 Content.Server/Fax/FaxableObjectComponent.cs rename {Content.Server => Content.Shared}/Fax/FaxMachineComponent.cs (92%) create mode 100644 Content.Shared/Fax/FaxableObjectComponent.cs diff --git a/Content.Client/Fax/FaxVisualsSystem.cs b/Content.Client/Fax/FaxVisualsSystem.cs new file mode 100644 index 00000000000000..77ad612b18438c --- /dev/null +++ b/Content.Client/Fax/FaxVisualsSystem.cs @@ -0,0 +1,43 @@ +using System.Linq; +using Robust.Client.GameObjects; +using static Robust.Client.GameObjects.SpriteComponent; +using Content.Shared.Clothing; +using Content.Shared.Fax; +using Content.Shared.Hands; +using Robust.Client.Graphics; +using Robust.Shared.Prototypes; +using Robust.Shared.Utility; +using Content.Shared.Containers.ItemSlots; +using Content.Shared.Storage.Components; + +namespace Content.Client.Paint +{ + public sealed class FaxVisualsSystem : EntitySystem + { + /// + /// Visualizer for Paint which applies a shader and colors the entity. + /// + + [Dependency] private readonly SharedAppearanceSystem _appearance = default!; + [Dependency] private readonly IPrototypeManager _protoMan = default!; + + public override void Initialize() + { + base.Initialize(); + + SubscribeLocalEvent(OnAppearanceChanged); + } + + private void OnAppearanceChanged(EntityUid uid, FaxMachineComponent component, ref AppearanceChangeEvent args) + { + + if (args.Sprite == null) + return; + + if (_appearance.TryGetData(uid, FaxMachineVisuals.VisualState, out bool inserted)) + { + args.Sprite.LayerSetState(FaxMachineVisuals.VisualState, component.InsertingState); + } + } + } +} diff --git a/Content.Server/Chemistry/EntitySystems/TransformableContainerSystem.cs b/Content.Server/Chemistry/EntitySystems/TransformableContainerSystem.cs index 94a3fe2186168a..c375d97b8c3f7e 100644 --- a/Content.Server/Chemistry/EntitySystems/TransformableContainerSystem.cs +++ b/Content.Server/Chemistry/EntitySystems/TransformableContainerSystem.cs @@ -20,7 +20,7 @@ public override void Initialize() SubscribeLocalEvent(OnSolutionChange); } - private void OnMapInit(Entity entity, ref MapInitEvent args) + private void OnMapInit(Entity entity, ref MapInitEvent args) { var meta = MetaData(entity.Owner); if (string.IsNullOrEmpty(entity.Comp.InitialName)) diff --git a/Content.Server/Fax/FaxSystem.cs b/Content.Server/Fax/FaxSystem.cs index 337f231552a2f0..60f6792ae1a972 100644 --- a/Content.Server/Fax/FaxSystem.cs +++ b/Content.Server/Fax/FaxSystem.cs @@ -1,22 +1,14 @@ -using System.Threading; using Content.Server.Administration; -using Content.Server.Administration.Commands; -using Content.Server.Administration.Components; using Content.Server.Administration.Managers; -using Content.Server.Body.Systems; using Content.Server.Chat.Managers; -using Content.Server.Destructible.Thresholds.Behaviors; using Content.Server.DeviceNetwork; using Content.Server.DeviceNetwork.Components; using Content.Server.DeviceNetwork.Systems; -using Content.Server.Explosion.EntitySystems; using Content.Server.Paper; using Content.Shared.Popups; using Content.Server.Popups; using Content.Server.Power.Components; using Content.Server.Tools; -using Robust.Shared.Timing; -using Content.Server.UserInterface; using Content.Shared.UserInterface; using Content.Shared.Administration.Logs; using Content.Shared.Containers.ItemSlots; @@ -33,16 +25,10 @@ using Robust.Shared.Audio.Systems; using Robust.Shared.Containers; using Robust.Shared.Player; -using Timer = Robust.Shared.Timing.Timer; using Content.Shared.Damage; -using Content.Shared.Random; using Content.Shared.Tag; using Content.Shared.Damage.Prototypes; using Robust.Shared.Prototypes; -using Content.Server.Nutrition.Components; -using Robust.Shared.Prototypes; -using Content.Shared.Weapons.Melee.Events; - namespace Content.Server.Fax; @@ -73,7 +59,7 @@ public sealed class FaxSystem : EntitySystem /// [ValidatePrototypeId] private const string DefaultPaperPrototypeId = "Paper"; - + [ValidatePrototypeId] private const string OfficePaperPrototypeId = "PaperOffice"; @@ -358,29 +344,18 @@ private void UpdateAppearance(EntityUid uid, FaxMachineComponent? component = nu if (!Resolve(uid, ref component)) return; - if (!TryComp(component.PaperSlot.Item, out var faxable)) + if (component.PaperSlot.Item == null) return; - if (component.PaperSlot.Item == null) + if (!TryComp(component.PaperSlot.Item.Value, out var faxable)) return; + component.InsertingState = faxable.InsertingState; + if (component.InsertingTimeRemaining > 0) { - switch (faxable.Identity) - { - case "hamster": - _appearanceSystem.SetData(uid, FaxMachineVisuals.VisualState, FaxMachineVisualState.InsertingHamlet); - break; - case "mouse": - _appearanceSystem.SetData(uid, FaxMachineVisuals.VisualState, FaxMachineVisualState.InsertingMouse); - break; - case "mothroach": - _appearanceSystem.SetData(uid, FaxMachineVisuals.VisualState, FaxMachineVisualState.InsertingMothroach); - break; - default: - _appearanceSystem.SetData(uid, FaxMachineVisuals.VisualState, FaxMachineVisualState.Inserting); - break; - } + _appearanceSystem.SetData(uid, FaxMachineVisuals.VisualState, true); + Dirty(uid, component); } else if (component.PrintingTimeRemaining > 0) _appearanceSystem.SetData(uid, FaxMachineVisuals.VisualState, FaxMachineVisualState.Printing); @@ -452,8 +427,8 @@ public void PrintFile(EntityUid uid, FaxMachineComponent component, FaxFileMessa else prototype = DefaultPaperPrototypeId; - var name = Loc.GetString("fax-machine-printed-paper-name"); - + var name = Loc.GetString("fax-machine-printed-paper-name"); + var printout = new FaxPrintout(args.Content, name, prototype); component.PrintingQueue.Enqueue(printout); component.SendTimeoutRemaining += component.SendTimeout; diff --git a/Content.Server/Fax/FaxableObjectComponent.cs b/Content.Server/Fax/FaxableObjectComponent.cs deleted file mode 100644 index 0894a089fc9a8b..00000000000000 --- a/Content.Server/Fax/FaxableObjectComponent.cs +++ /dev/null @@ -1,18 +0,0 @@ -using Content.Shared.Containers.ItemSlots; -using Content.Shared.Paper; -using Robust.Shared.Audio; -using Robust.Shared.Prototypes; -using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype; - -namespace Content.Server.Fax; - -[RegisterComponent] -public sealed partial class FaxableObjectComponent : Component -{ - /// - /// Name with which the fax will be visible to others on the network - /// - [ViewVariables(VVAccess.ReadWrite)] - [DataField] - public string Identity = "paper"; -} diff --git a/Content.Server/Nuke/NukeCodePaperSystem.cs b/Content.Server/Nuke/NukeCodePaperSystem.cs index 8df25feebfabca..c4e4614dbd426f 100644 --- a/Content.Server/Nuke/NukeCodePaperSystem.cs +++ b/Content.Server/Nuke/NukeCodePaperSystem.cs @@ -1,6 +1,7 @@ using System.Diagnostics.CodeAnalysis; using Content.Server.Chat.Systems; using Content.Server.Fax; +using Content.Shared.Fax; using Content.Server.Paper; using Content.Server.Station.Components; using Content.Server.Station.Systems; diff --git a/Content.Server/Fax/FaxMachineComponent.cs b/Content.Shared/Fax/FaxMachineComponent.cs similarity index 92% rename from Content.Server/Fax/FaxMachineComponent.cs rename to Content.Shared/Fax/FaxMachineComponent.cs index 2482faf4a4e357..b64ca9ad077f1a 100644 --- a/Content.Server/Fax/FaxMachineComponent.cs +++ b/Content.Shared/Fax/FaxMachineComponent.cs @@ -2,19 +2,20 @@ using Content.Shared.Damage.Prototypes; using Content.Shared.Paper; using Robust.Shared.Audio; +using Robust.Shared.GameStates; using Robust.Shared.Prototypes; using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype; -namespace Content.Server.Fax; +namespace Content.Shared.Fax; -[RegisterComponent] +[RegisterComponent, NetworkedComponent, AutoGenerateComponentState] public sealed partial class FaxMachineComponent : Component { /// /// Name with which the fax will be visible to others on the network /// [ViewVariables(VVAccess.ReadWrite)] - [DataField] + [DataField("name")] public string FaxName { get; set; } = "Unknown"; /// @@ -23,6 +24,13 @@ public sealed partial class FaxMachineComponent : Component [DataField] public ProtoId DamageType = "Brute"; + /// + /// Sprite to use when inserting an object. + /// + [ViewVariables(VVAccess.ReadWrite)] + [DataField, AutoNetworkedField] + public string InsertingState = "inserting"; + /// /// Amount of damage dealt when faxecuted. /// @@ -33,7 +41,7 @@ public sealed partial class FaxMachineComponent : Component /// Device address of fax in network to which data will be send /// [ViewVariables(VVAccess.ReadWrite)] - [DataField] + [DataField("destinationAddress")] public string? DestinationFaxAddress { get; set; } /// diff --git a/Content.Shared/Fax/FaxVisuals.cs b/Content.Shared/Fax/FaxVisuals.cs index 56f37056202dde..28cb447af62795 100644 --- a/Content.Shared/Fax/FaxVisuals.cs +++ b/Content.Shared/Fax/FaxVisuals.cs @@ -5,16 +5,12 @@ namespace Content.Shared.Fax; [Serializable, NetSerializable] public enum FaxMachineVisuals : byte { - VisualState, + VisualState } [Serializable, NetSerializable] public enum FaxMachineVisualState : byte { Normal, - Inserting, - InsertingHamlet, - InsertingMouse, - InsertingMothroach, Printing } diff --git a/Content.Shared/Fax/FaxableObjectComponent.cs b/Content.Shared/Fax/FaxableObjectComponent.cs new file mode 100644 index 00000000000000..24d84c05c2cd72 --- /dev/null +++ b/Content.Shared/Fax/FaxableObjectComponent.cs @@ -0,0 +1,15 @@ +using Robust.Shared.Utility; +using Robust.Shared.GameStates; + +namespace Content.Shared.Fax; + +[RegisterComponent, NetworkedComponent, AutoGenerateComponentState] +public sealed partial class FaxableObjectComponent : Component +{ + /// + /// Sprite to use when inserting an object. + /// + [ViewVariables(VVAccess.ReadWrite)] + [DataField, AutoNetworkedField] + public string InsertingState = "inserting"; +} diff --git a/Resources/Prototypes/Entities/Mobs/NPCs/animals.yml b/Resources/Prototypes/Entities/Mobs/NPCs/animals.yml index be457b2fcfc6d4..ae6385573ca6d5 100644 --- a/Resources/Prototypes/Entities/Mobs/NPCs/animals.yml +++ b/Resources/Prototypes/Entities/Mobs/NPCs/animals.yml @@ -434,7 +434,7 @@ speechVerb: Moth speechSounds: Squeak - type: FaxableObject - identity: mothroach + insertingState: inserting_mothroach - type: MothAccent - type: Sprite sprite: Mobs/Animals/mothroach.rsi @@ -1481,7 +1481,7 @@ task: MouseCompound - type: Physics - type: FaxableObject - identity: mouse + insertingState: inserting_mouse - type: Fixtures fixtures: fix1: @@ -2926,7 +2926,7 @@ size: Tiny - type: Physics - type: FaxableObject - identity: hamster + insertingState: inserting_hamster - type: Fixtures fixtures: fix1: diff --git a/Resources/Prototypes/Entities/Structures/Machines/fax_machine.yml b/Resources/Prototypes/Entities/Structures/Machines/fax_machine.yml index 0179ac306e1d13..99ba7cc48eab43 100644 --- a/Resources/Prototypes/Entities/Structures/Machines/fax_machine.yml +++ b/Resources/Prototypes/Entities/Structures/Machines/fax_machine.yml @@ -9,7 +9,7 @@ drawdepth: SmallObjects layers: - state: icon - map: ["base"] + map: [ "enum.FaxMachineVisuals.VisualState" ] - type: Icon sprite: Structures/Machines/fax_machine.rsi state: icon @@ -46,15 +46,11 @@ - type: GenericVisualizer visuals: enum.PowerDeviceVisuals.Powered: - base: + enum.FaxMachineVisuals.VisualState: True: { state: idle } False: { state: icon } enum.FaxMachineVisuals.VisualState: - base: - Inserting: { state: inserting } - InsertingHamlet: { state: inserting_hamster } - InsertingMouse: { state: inserting_mouse } - InsertingMothroach: { state: inserting_mothroach } + enum.FaxMachineVisuals.VisualState: Printing: { state: printing } - type: ItemSlots - type: ContainerContainer From 280cb81e75049492f3e83fac65d1ea482289cc78 Mon Sep 17 00:00:00 2001 From: brainfood1183 Date: Tue, 20 Feb 2024 17:37:49 +0000 Subject: [PATCH 11/19] cleanup --- Content.Client/Fax/FaxVisualsSystem.cs | 9 --------- 1 file changed, 9 deletions(-) diff --git a/Content.Client/Fax/FaxVisualsSystem.cs b/Content.Client/Fax/FaxVisualsSystem.cs index 77ad612b18438c..27cb3fde618446 100644 --- a/Content.Client/Fax/FaxVisualsSystem.cs +++ b/Content.Client/Fax/FaxVisualsSystem.cs @@ -1,14 +1,6 @@ -using System.Linq; using Robust.Client.GameObjects; -using static Robust.Client.GameObjects.SpriteComponent; -using Content.Shared.Clothing; using Content.Shared.Fax; -using Content.Shared.Hands; -using Robust.Client.Graphics; using Robust.Shared.Prototypes; -using Robust.Shared.Utility; -using Content.Shared.Containers.ItemSlots; -using Content.Shared.Storage.Components; namespace Content.Client.Paint { @@ -19,7 +11,6 @@ public sealed class FaxVisualsSystem : EntitySystem /// [Dependency] private readonly SharedAppearanceSystem _appearance = default!; - [Dependency] private readonly IPrototypeManager _protoMan = default!; public override void Initialize() { From 841db5241207c55f6961681a3d1796cb24a1586b Mon Sep 17 00:00:00 2001 From: brainfood1183 Date: Tue, 20 Feb 2024 17:38:49 +0000 Subject: [PATCH 12/19] more cleanup --- Content.Client/Fax/FaxVisualsSystem.cs | 1 - Content.Shared/Fax/FaxableObjectComponent.cs | 1 - 2 files changed, 2 deletions(-) diff --git a/Content.Client/Fax/FaxVisualsSystem.cs b/Content.Client/Fax/FaxVisualsSystem.cs index 27cb3fde618446..4762b1c5ef173a 100644 --- a/Content.Client/Fax/FaxVisualsSystem.cs +++ b/Content.Client/Fax/FaxVisualsSystem.cs @@ -1,6 +1,5 @@ using Robust.Client.GameObjects; using Content.Shared.Fax; -using Robust.Shared.Prototypes; namespace Content.Client.Paint { diff --git a/Content.Shared/Fax/FaxableObjectComponent.cs b/Content.Shared/Fax/FaxableObjectComponent.cs index 24d84c05c2cd72..022509e0c25689 100644 --- a/Content.Shared/Fax/FaxableObjectComponent.cs +++ b/Content.Shared/Fax/FaxableObjectComponent.cs @@ -1,4 +1,3 @@ -using Robust.Shared.Utility; using Robust.Shared.GameStates; namespace Content.Shared.Fax; From 62a8aefb8e383a9a62e456d76a52a57ad04cb807 Mon Sep 17 00:00:00 2001 From: brainfood1183 Date: Tue, 20 Feb 2024 17:40:26 +0000 Subject: [PATCH 13/19] fix --- Content.Shared/Fax/FaxVisuals.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Content.Shared/Fax/FaxVisuals.cs b/Content.Shared/Fax/FaxVisuals.cs index 28cb447af62795..a97eb557fdda55 100644 --- a/Content.Shared/Fax/FaxVisuals.cs +++ b/Content.Shared/Fax/FaxVisuals.cs @@ -5,7 +5,7 @@ namespace Content.Shared.Fax; [Serializable, NetSerializable] public enum FaxMachineVisuals : byte { - VisualState + VisualState, } [Serializable, NetSerializable] From 02706ab60ee0d2db530376c24d159f22c844fd98 Mon Sep 17 00:00:00 2001 From: brainfood1183 Date: Tue, 20 Feb 2024 22:16:53 +0000 Subject: [PATCH 14/19] cleanup --- Content.Client/Fax/FaxVisualsSystem.cs | 2 -- 1 file changed, 2 deletions(-) diff --git a/Content.Client/Fax/FaxVisualsSystem.cs b/Content.Client/Fax/FaxVisualsSystem.cs index 4762b1c5ef173a..28dc9ab1d90c28 100644 --- a/Content.Client/Fax/FaxVisualsSystem.cs +++ b/Content.Client/Fax/FaxVisualsSystem.cs @@ -8,7 +8,6 @@ public sealed class FaxVisualsSystem : EntitySystem /// /// Visualizer for Paint which applies a shader and colors the entity. /// - [Dependency] private readonly SharedAppearanceSystem _appearance = default!; public override void Initialize() @@ -20,7 +19,6 @@ public override void Initialize() private void OnAppearanceChanged(EntityUid uid, FaxMachineComponent component, ref AppearanceChangeEvent args) { - if (args.Sprite == null) return; From 89f8a8799f155a818887e7b32496bb5f5b343d9f Mon Sep 17 00:00:00 2001 From: brainfood1183 Date: Wed, 21 Feb 2024 20:01:44 +0000 Subject: [PATCH 15/19] moved damage out of faxmachine and into own system and component. --- Content.Server/Fax/FaxSystem.cs | 48 +++++-------------- Content.Shared/Fax/FaxMachineComponent.cs | 13 ----- Content.Shared/Fax/FaxecuteComponent.cs | 16 +++++++ Content.Shared/Fax/FaxecuteSystem.cs | 33 +++++++++++++ .../Structures/Machines/fax_machine.yml | 4 ++ 5 files changed, 66 insertions(+), 48 deletions(-) create mode 100644 Content.Shared/Fax/FaxecuteComponent.cs create mode 100644 Content.Shared/Fax/FaxecuteSystem.cs diff --git a/Content.Server/Fax/FaxSystem.cs b/Content.Server/Fax/FaxSystem.cs index 60f6792ae1a972..d703199d7da08b 100644 --- a/Content.Server/Fax/FaxSystem.cs +++ b/Content.Server/Fax/FaxSystem.cs @@ -5,7 +5,6 @@ using Content.Server.DeviceNetwork.Components; using Content.Server.DeviceNetwork.Systems; using Content.Server.Paper; -using Content.Shared.Popups; using Content.Server.Popups; using Content.Server.Power.Components; using Content.Server.Tools; @@ -25,9 +24,6 @@ using Robust.Shared.Audio.Systems; using Robust.Shared.Containers; using Robust.Shared.Player; -using Content.Shared.Damage; -using Content.Shared.Tag; -using Content.Shared.Damage.Prototypes; using Robust.Shared.Prototypes; namespace Content.Server.Fax; @@ -47,9 +43,7 @@ public sealed class FaxSystem : EntitySystem [Dependency] private readonly UserInterfaceSystem _userInterface = default!; [Dependency] private readonly ISharedAdminLogManager _adminLogger = default!; [Dependency] private readonly MetaDataSystem _metaData = default!; - [Dependency] private readonly DamageableSystem _damageable = default!; - [Dependency] private readonly IPrototypeManager _proto = default!; - [Dependency] private readonly TagSystem _tagSystem = default!; + [Dependency] private readonly FaxecuteSystem _faxecute = default!; private const string PaperSlotId = "Paper"; @@ -321,12 +315,22 @@ private void OnFileButtonPressed(EntityUid uid, FaxMachineComponent component, F private void OnCopyButtonPressed(EntityUid uid, FaxMachineComponent component, FaxCopyMessage args) { - Copy(uid, component); + if (HasComp(component.PaperSlot.Item)) + { + _faxecute.Faxecute(uid, component); /// when button pressed it will hurt the mob. + } + else + Copy(uid, component); } private void OnSendButtonPressed(EntityUid uid, FaxMachineComponent component, FaxSendMessage args) { - Send(uid, component, args.Session.AttachedEntity); + if (HasComp(component.PaperSlot.Item)) + { + _faxecute.Faxecute(uid, component); /// when button pressed it will hurt the mob. + } + else + Send(uid, component, args.Session.AttachedEntity); } private void OnRefreshButtonPressed(EntityUid uid, FaxMachineComponent component, FaxRefreshMessage args) @@ -449,13 +453,6 @@ public void Copy(EntityUid uid, FaxMachineComponent? component = null) if (sendEntity == null) return; - if (HasComp(sendEntity)) - { - Faxecute(uid, component); - return; - } - - if (!TryComp(sendEntity, out var metadata) || !TryComp(sendEntity, out var paper)) return; @@ -476,19 +473,6 @@ public void Copy(EntityUid uid, FaxMachineComponent? component = null) UpdateUserInterface(uid, component); } - public void Faxecute(EntityUid uid, FaxMachineComponent component, DamageOnFaxecuteEvent? args = null) - { - var sendEntity = component.PaperSlot.Item; - if (sendEntity == null) - return; - - var damageSpec = new DamageSpecifier(_proto.Index(component.DamageType), component.Damage); - _damageable.TryChangeDamage(sendEntity, damageSpec); - _popupSystem.PopupEntity(Loc.GetString("fax-machine-popup-error", ("target", uid)), uid, PopupType.LargeCaution); - return; - - } - /// /// Sends message to addressee if paper is set and a known fax is selected /// A timeout is set after sending, which is shared by the copy button. @@ -508,12 +492,6 @@ public void Send(EntityUid uid, FaxMachineComponent? component = null, EntityUid if (!component.KnownFaxes.TryGetValue(component.DestinationFaxAddress, out var faxName)) return; - if (HasComp(sendEntity) && HasComp(sendEntity)) - { - Faxecute(uid, component); - return; - } - if (!TryComp(sendEntity, out var metadata) || !TryComp(sendEntity, out var paper)) return; diff --git a/Content.Shared/Fax/FaxMachineComponent.cs b/Content.Shared/Fax/FaxMachineComponent.cs index b64ca9ad077f1a..00ff5820238ede 100644 --- a/Content.Shared/Fax/FaxMachineComponent.cs +++ b/Content.Shared/Fax/FaxMachineComponent.cs @@ -1,5 +1,4 @@ using Content.Shared.Containers.ItemSlots; -using Content.Shared.Damage.Prototypes; using Content.Shared.Paper; using Robust.Shared.Audio; using Robust.Shared.GameStates; @@ -18,12 +17,6 @@ public sealed partial class FaxMachineComponent : Component [DataField("name")] public string FaxName { get; set; } = "Unknown"; - /// - /// Type of damage dealt when faxecuted. - /// - [DataField] - public ProtoId DamageType = "Brute"; - /// /// Sprite to use when inserting an object. /// @@ -31,12 +24,6 @@ public sealed partial class FaxMachineComponent : Component [DataField, AutoNetworkedField] public string InsertingState = "inserting"; - /// - /// Amount of damage dealt when faxecuted. - /// - [DataField] - public int Damage = 300; - /// /// Device address of fax in network to which data will be send /// diff --git a/Content.Shared/Fax/FaxecuteComponent.cs b/Content.Shared/Fax/FaxecuteComponent.cs new file mode 100644 index 00000000000000..52c282f458cdec --- /dev/null +++ b/Content.Shared/Fax/FaxecuteComponent.cs @@ -0,0 +1,16 @@ +using Content.Shared.Damage; +using Robust.Shared.GameStates; + +namespace Content.Shared.Fax; + +[RegisterComponent, NetworkedComponent, AutoGenerateComponentState] +public sealed partial class FaxecuteComponent : Component +{ + + /// + /// Type of damage dealt when faxecuted. + /// + [DataField, AutoNetworkedField] + public DamageSpecifier Damage = new(); +} + diff --git a/Content.Shared/Fax/FaxecuteSystem.cs b/Content.Shared/Fax/FaxecuteSystem.cs new file mode 100644 index 00000000000000..2e854e779a51ce --- /dev/null +++ b/Content.Shared/Fax/FaxecuteSystem.cs @@ -0,0 +1,33 @@ +using Content.Shared.Damage; +using Content.Shared.Popups; + +namespace Content.Shared.Fax; + +public sealed class FaxecuteSystem : EntitySystem +{ + [Dependency] private readonly DamageableSystem _damageable = default!; + [Dependency] private readonly SharedPopupSystem _popupSystem = default!; + + public override void Initialize() + { + base.Initialize(); + + SubscribeLocalEvent(Faxecute); + } + + public void Faxecute(EntityUid uid, FaxMachineComponent component, DamageOnFaxecuteEvent? args = null) + { + var sendEntity = component.PaperSlot.Item; + if (sendEntity == null) + return; + + if (!TryComp(uid, out var faxecute)) + return; + + var damageSpec = faxecute.Damage; + _damageable.TryChangeDamage(sendEntity, damageSpec); + _popupSystem.PopupEntity(Loc.GetString("fax-machine-popup-error", ("target", uid)), uid, PopupType.LargeCaution); + return; + + } +} diff --git a/Resources/Prototypes/Entities/Structures/Machines/fax_machine.yml b/Resources/Prototypes/Entities/Structures/Machines/fax_machine.yml index 99ba7cc48eab43..318ff1d95bd93c 100644 --- a/Resources/Prototypes/Entities/Structures/Machines/fax_machine.yml +++ b/Resources/Prototypes/Entities/Structures/Machines/fax_machine.yml @@ -36,6 +36,10 @@ type: FaxBoundUi - type: ApcPowerReceiver powerLoad: 250 + - type: Faxecute + damage: + types: + Blunt: 100 - type: FaxMachine paperSlot: insertSound: /Audio/Machines/scanning.ogg From e6a52c01aa78584b5067bb6d1852018a3f64b53c Mon Sep 17 00:00:00 2001 From: brainfood1183 Date: Thu, 18 Apr 2024 20:02:35 +0100 Subject: [PATCH 16/19] changes --- .../Fax/{ => System}/FaxVisualsSystem.cs | 12 +++++---- Content.Server/Fax/AdminUI/AdminFaxEui.cs | 1 + Content.Server/Fax/FaxSystem.cs | 7 +++--- Content.Server/Nuke/NukeCodePaperSystem.cs | 2 +- .../{ => Components}/FaxMachineComponent.cs | 2 +- .../FaxableObjectComponent.cs | 6 +++-- .../Fax/Components/FaxecuteComponent.cs | 25 +++++++++++++++++++ Content.Shared/Fax/DamageOnFaxecuteEvent.cs | 13 +++++----- Content.Shared/Fax/FaxecuteComponent.cs | 16 ------------ .../Fax/{ => Systems}/FaxecuteSystem.cs | 9 ++++--- .../Structures/Machines/fax_machine.yml | 3 --- 11 files changed, 53 insertions(+), 43 deletions(-) rename Content.Client/Fax/{ => System}/FaxVisualsSystem.cs (70%) rename Content.Shared/Fax/{ => Components}/FaxMachineComponent.cs (99%) rename Content.Shared/Fax/{ => Components}/FaxableObjectComponent.cs (76%) create mode 100644 Content.Shared/Fax/Components/FaxecuteComponent.cs delete mode 100644 Content.Shared/Fax/FaxecuteComponent.cs rename Content.Shared/Fax/{ => Systems}/FaxecuteSystem.cs (82%) diff --git a/Content.Client/Fax/FaxVisualsSystem.cs b/Content.Client/Fax/System/FaxVisualsSystem.cs similarity index 70% rename from Content.Client/Fax/FaxVisualsSystem.cs rename to Content.Client/Fax/System/FaxVisualsSystem.cs index 28dc9ab1d90c28..c929b1dd1d0205 100644 --- a/Content.Client/Fax/FaxVisualsSystem.cs +++ b/Content.Client/Fax/System/FaxVisualsSystem.cs @@ -1,13 +1,15 @@ using Robust.Client.GameObjects; +using Content.Shared.Fax.Components; using Content.Shared.Fax; -namespace Content.Client.Paint +namespace Content.Client.Fax.System { + /// + /// Visualizer for the fax machine which displays the correct sprite based on the inserted entity. + /// public sealed class FaxVisualsSystem : EntitySystem { - /// - /// Visualizer for Paint which applies a shader and colors the entity. - /// + [Dependency] private readonly SharedAppearanceSystem _appearance = default!; public override void Initialize() @@ -22,7 +24,7 @@ private void OnAppearanceChanged(EntityUid uid, FaxMachineComponent component, r if (args.Sprite == null) return; - if (_appearance.TryGetData(uid, FaxMachineVisuals.VisualState, out bool inserted)) + if (_appearance.TryGetData(uid, FaxMachineVisuals.VisualState, out bool inserted)) { args.Sprite.LayerSetState(FaxMachineVisuals.VisualState, component.InsertingState); } diff --git a/Content.Server/Fax/AdminUI/AdminFaxEui.cs b/Content.Server/Fax/AdminUI/AdminFaxEui.cs index c8be6618e45eda..5153e6219565af 100644 --- a/Content.Server/Fax/AdminUI/AdminFaxEui.cs +++ b/Content.Server/Fax/AdminUI/AdminFaxEui.cs @@ -1,6 +1,7 @@ using Content.Server.DeviceNetwork.Components; using Content.Server.EUI; using Content.Shared.Eui; +using Content.Shared.Fax.Components; using Content.Shared.Fax; using Content.Shared.Follower; using Content.Shared.Ghost; diff --git a/Content.Server/Fax/FaxSystem.cs b/Content.Server/Fax/FaxSystem.cs index 1d705a661111c2..4b760266c32927 100644 --- a/Content.Server/Fax/FaxSystem.cs +++ b/Content.Server/Fax/FaxSystem.cs @@ -16,6 +16,8 @@ using Content.Shared.Emag.Components; using Content.Shared.Emag.Systems; using Content.Shared.Fax; +using Content.Shared.Fax.Systems; +using Content.Shared.Fax.Components; using Content.Shared.Interaction; using Content.Shared.Mobs.Components; using Content.Shared.Paper; @@ -348,10 +350,7 @@ private void UpdateAppearance(EntityUid uid, FaxMachineComponent? component = nu if (!Resolve(uid, ref component)) return; - if (component.PaperSlot.Item == null) - return; - - if (!TryComp(component.PaperSlot.Item.Value, out var faxable)) + if (!TryComp(component.PaperSlot.Item, out var faxable)) return; component.InsertingState = faxable.InsertingState; diff --git a/Content.Server/Nuke/NukeCodePaperSystem.cs b/Content.Server/Nuke/NukeCodePaperSystem.cs index c4e4614dbd426f..c1725536e7cea3 100644 --- a/Content.Server/Nuke/NukeCodePaperSystem.cs +++ b/Content.Server/Nuke/NukeCodePaperSystem.cs @@ -1,7 +1,7 @@ using System.Diagnostics.CodeAnalysis; using Content.Server.Chat.Systems; using Content.Server.Fax; -using Content.Shared.Fax; +using Content.Shared.Fax.Components; using Content.Server.Paper; using Content.Server.Station.Components; using Content.Server.Station.Systems; diff --git a/Content.Shared/Fax/FaxMachineComponent.cs b/Content.Shared/Fax/Components/FaxMachineComponent.cs similarity index 99% rename from Content.Shared/Fax/FaxMachineComponent.cs rename to Content.Shared/Fax/Components/FaxMachineComponent.cs index 00ff5820238ede..ee9459f5084057 100644 --- a/Content.Shared/Fax/FaxMachineComponent.cs +++ b/Content.Shared/Fax/Components/FaxMachineComponent.cs @@ -5,7 +5,7 @@ using Robust.Shared.Prototypes; using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype; -namespace Content.Shared.Fax; +namespace Content.Shared.Fax.Components; [RegisterComponent, NetworkedComponent, AutoGenerateComponentState] public sealed partial class FaxMachineComponent : Component diff --git a/Content.Shared/Fax/FaxableObjectComponent.cs b/Content.Shared/Fax/Components/FaxableObjectComponent.cs similarity index 76% rename from Content.Shared/Fax/FaxableObjectComponent.cs rename to Content.Shared/Fax/Components/FaxableObjectComponent.cs index 022509e0c25689..57b6e610a329d0 100644 --- a/Content.Shared/Fax/FaxableObjectComponent.cs +++ b/Content.Shared/Fax/Components/FaxableObjectComponent.cs @@ -1,7 +1,9 @@ using Robust.Shared.GameStates; -namespace Content.Shared.Fax; - +namespace Content.Shared.Fax.Components; +/// +/// Entity with this component can be faxed. +/// [RegisterComponent, NetworkedComponent, AutoGenerateComponentState] public sealed partial class FaxableObjectComponent : Component { diff --git a/Content.Shared/Fax/Components/FaxecuteComponent.cs b/Content.Shared/Fax/Components/FaxecuteComponent.cs new file mode 100644 index 00000000000000..cda5c7da31496c --- /dev/null +++ b/Content.Shared/Fax/Components/FaxecuteComponent.cs @@ -0,0 +1,25 @@ +using Content.Shared.Damage; +using Robust.Shared.GameStates; + +namespace Content.Shared.Fax.Components; + +/// +/// A fax component which stores a damage specifier for attempting to fax a mob. +/// +[RegisterComponent, NetworkedComponent, AutoGenerateComponentState] +public sealed partial class FaxecuteComponent : Component +{ + + /// + /// Type of damage dealt when entity is faxecuted. + /// + [DataField, AutoNetworkedField] + public DamageSpecifier Damage = new() + { + DamageDict = new() + { + { "Blunt", 100 } + } + }; +} + diff --git a/Content.Shared/Fax/DamageOnFaxecuteEvent.cs b/Content.Shared/Fax/DamageOnFaxecuteEvent.cs index a03424b3859a2f..b36f55ab5d2846 100644 --- a/Content.Shared/Fax/DamageOnFaxecuteEvent.cs +++ b/Content.Shared/Fax/DamageOnFaxecuteEvent.cs @@ -1,10 +1,9 @@ -namespace Content.Shared.Fax; +namespace Content.Shared.Fax.Components; /// -/// The components in the list are going to be hit, -/// give opportunities to change the damage or other stuff. -/// -public sealed class DamageOnFaxecuteEvent : EntityEventArgs -{ -} +/// Event for killing any mob within the fax machine. +/// - /// Type of damage dealt when faxecuted. - /// - [DataField, AutoNetworkedField] - public DamageSpecifier Damage = new(); -} - diff --git a/Content.Shared/Fax/FaxecuteSystem.cs b/Content.Shared/Fax/Systems/FaxecuteSystem.cs similarity index 82% rename from Content.Shared/Fax/FaxecuteSystem.cs rename to Content.Shared/Fax/Systems/FaxecuteSystem.cs index 2e854e779a51ce..7768c7a3d2e959 100644 --- a/Content.Shared/Fax/FaxecuteSystem.cs +++ b/Content.Shared/Fax/Systems/FaxecuteSystem.cs @@ -1,8 +1,11 @@ using Content.Shared.Damage; using Content.Shared.Popups; +using Content.Shared.Fax.Components; -namespace Content.Shared.Fax; - +namespace Content.Shared.Fax.Systems; +/// +/// System for handling execution of a mob within fax when copy or send attempt is made. +/// public sealed class FaxecuteSystem : EntitySystem { [Dependency] private readonly DamageableSystem _damageable = default!; @@ -11,8 +14,6 @@ public sealed class FaxecuteSystem : EntitySystem public override void Initialize() { base.Initialize(); - - SubscribeLocalEvent(Faxecute); } public void Faxecute(EntityUid uid, FaxMachineComponent component, DamageOnFaxecuteEvent? args = null) diff --git a/Resources/Prototypes/Entities/Structures/Machines/fax_machine.yml b/Resources/Prototypes/Entities/Structures/Machines/fax_machine.yml index 318ff1d95bd93c..7faacfe1dbaf84 100644 --- a/Resources/Prototypes/Entities/Structures/Machines/fax_machine.yml +++ b/Resources/Prototypes/Entities/Structures/Machines/fax_machine.yml @@ -37,9 +37,6 @@ - type: ApcPowerReceiver powerLoad: 250 - type: Faxecute - damage: - types: - Blunt: 100 - type: FaxMachine paperSlot: insertSound: /Audio/Machines/scanning.ogg From ddeba8793420943d6ac7bee3791109d5a9dc98a3 Mon Sep 17 00:00:00 2001 From: brainfood1183 Date: Fri, 19 Apr 2024 16:32:22 +0100 Subject: [PATCH 17/19] fixes and done i think. --- Content.Client/Fax/System/FaxVisualsSystem.cs | 2 +- Content.Server/Fax/FaxSystem.cs | 6 +++--- Content.Shared/Fax/Components/FaxecuteComponent.cs | 10 ++-------- .../Entities/Structures/Machines/fax_machine.yml | 4 ++++ 4 files changed, 10 insertions(+), 12 deletions(-) diff --git a/Content.Client/Fax/System/FaxVisualsSystem.cs b/Content.Client/Fax/System/FaxVisualsSystem.cs index c929b1dd1d0205..a1b3caf22d9a3d 100644 --- a/Content.Client/Fax/System/FaxVisualsSystem.cs +++ b/Content.Client/Fax/System/FaxVisualsSystem.cs @@ -24,7 +24,7 @@ private void OnAppearanceChanged(EntityUid uid, FaxMachineComponent component, r if (args.Sprite == null) return; - if (_appearance.TryGetData(uid, FaxMachineVisuals.VisualState, out bool inserted)) + if (_appearance.TryGetData(uid, FaxMachineVisuals.VisualState, out bool _)) { args.Sprite.LayerSetState(FaxMachineVisuals.VisualState, component.InsertingState); } diff --git a/Content.Server/Fax/FaxSystem.cs b/Content.Server/Fax/FaxSystem.cs index 4b760266c32927..a5cd65db7c44f2 100644 --- a/Content.Server/Fax/FaxSystem.cs +++ b/Content.Server/Fax/FaxSystem.cs @@ -108,6 +108,7 @@ private void ProcessPrintingAnimation(EntityUid uid, float frameTime, FaxMachine { comp.PrintingTimeRemaining -= frameTime; UpdateAppearance(uid, comp); + Dirty(uid, comp); var isAnimationEnd = comp.PrintingTimeRemaining <= 0; if (isAnimationEnd) @@ -350,10 +351,9 @@ private void UpdateAppearance(EntityUid uid, FaxMachineComponent? component = nu if (!Resolve(uid, ref component)) return; - if (!TryComp(component.PaperSlot.Item, out var faxable)) - return; + if (TryComp(component.PaperSlot.Item, out var faxable)) + component.InsertingState = faxable.InsertingState; - component.InsertingState = faxable.InsertingState; if (component.InsertingTimeRemaining > 0) { diff --git a/Content.Shared/Fax/Components/FaxecuteComponent.cs b/Content.Shared/Fax/Components/FaxecuteComponent.cs index cda5c7da31496c..9c9bd0302033c0 100644 --- a/Content.Shared/Fax/Components/FaxecuteComponent.cs +++ b/Content.Shared/Fax/Components/FaxecuteComponent.cs @@ -13,13 +13,7 @@ public sealed partial class FaxecuteComponent : Component /// /// Type of damage dealt when entity is faxecuted. /// - [DataField, AutoNetworkedField] - public DamageSpecifier Damage = new() - { - DamageDict = new() - { - { "Blunt", 100 } - } - }; + [DataField(required: true), AutoNetworkedField] + public DamageSpecifier Damage = new(); } diff --git a/Resources/Prototypes/Entities/Structures/Machines/fax_machine.yml b/Resources/Prototypes/Entities/Structures/Machines/fax_machine.yml index 7faacfe1dbaf84..98efcfe7e9f958 100644 --- a/Resources/Prototypes/Entities/Structures/Machines/fax_machine.yml +++ b/Resources/Prototypes/Entities/Structures/Machines/fax_machine.yml @@ -37,6 +37,9 @@ - type: ApcPowerReceiver powerLoad: 250 - type: Faxecute + damage: + types: + Blunt: 100 - type: FaxMachine paperSlot: insertSound: /Audio/Machines/scanning.ogg @@ -53,6 +56,7 @@ enum.FaxMachineVisuals.VisualState: enum.FaxMachineVisuals.VisualState: Printing: { state: printing } + Normal: {state: idle} - type: ItemSlots - type: ContainerContainer containers: From 16d8bd38486fdd2258c54d368287c60bef19f651 Mon Sep 17 00:00:00 2001 From: brainfood1183 Date: Fri, 19 Apr 2024 16:36:27 +0100 Subject: [PATCH 18/19] tidy --- Content.Server/Fax/FaxSystem.cs | 5 ----- 1 file changed, 5 deletions(-) diff --git a/Content.Server/Fax/FaxSystem.cs b/Content.Server/Fax/FaxSystem.cs index a5cd65db7c44f2..ba07e174c6748b 100644 --- a/Content.Server/Fax/FaxSystem.cs +++ b/Content.Server/Fax/FaxSystem.cs @@ -108,7 +108,6 @@ private void ProcessPrintingAnimation(EntityUid uid, float frameTime, FaxMachine { comp.PrintingTimeRemaining -= frameTime; UpdateAppearance(uid, comp); - Dirty(uid, comp); var isAnimationEnd = comp.PrintingTimeRemaining <= 0; if (isAnimationEnd) @@ -319,9 +318,7 @@ private void OnFileButtonPressed(EntityUid uid, FaxMachineComponent component, F private void OnCopyButtonPressed(EntityUid uid, FaxMachineComponent component, FaxCopyMessage args) { if (HasComp(component.PaperSlot.Item)) - { _faxecute.Faxecute(uid, component); /// when button pressed it will hurt the mob. - } else Copy(uid, component, args); } @@ -329,9 +326,7 @@ private void OnCopyButtonPressed(EntityUid uid, FaxMachineComponent component, F private void OnSendButtonPressed(EntityUid uid, FaxMachineComponent component, FaxSendMessage args) { if (HasComp(component.PaperSlot.Item)) - { _faxecute.Faxecute(uid, component); /// when button pressed it will hurt the mob. - } else Send(uid, component, args.Session.AttachedEntity); } From 378f743fb9326591b57f5706536cb797ba18f017 Mon Sep 17 00:00:00 2001 From: metalgearsloth Date: Sat, 27 Apr 2024 23:46:23 +1000 Subject: [PATCH 19/19] Fixes --- Content.Client/Fax/System/FaxVisualsSystem.cs | 53 ++++++++++++------- Content.Server/Fax/FaxSystem.cs | 2 +- Content.Shared/Fax/FaxVisuals.cs | 1 + 3 files changed, 36 insertions(+), 20 deletions(-) diff --git a/Content.Client/Fax/System/FaxVisualsSystem.cs b/Content.Client/Fax/System/FaxVisualsSystem.cs index a1b3caf22d9a3d..892aec1d95490c 100644 --- a/Content.Client/Fax/System/FaxVisualsSystem.cs +++ b/Content.Client/Fax/System/FaxVisualsSystem.cs @@ -1,33 +1,48 @@ using Robust.Client.GameObjects; using Content.Shared.Fax.Components; using Content.Shared.Fax; +using Robust.Client.Animations; -namespace Content.Client.Fax.System +namespace Content.Client.Fax.System; + +/// +/// Visualizer for the fax machine which displays the correct sprite based on the inserted entity. +/// +public sealed class FaxVisualsSystem : EntitySystem { - /// - /// Visualizer for the fax machine which displays the correct sprite based on the inserted entity. - /// - public sealed class FaxVisualsSystem : EntitySystem - { + [Dependency] private readonly AnimationPlayerSystem _player = default!; + [Dependency] private readonly SharedAppearanceSystem _appearance = default!; - [Dependency] private readonly SharedAppearanceSystem _appearance = default!; + public override void Initialize() + { + base.Initialize(); - public override void Initialize() - { - base.Initialize(); + SubscribeLocalEvent(OnAppearanceChanged); + } - SubscribeLocalEvent(OnAppearanceChanged); - } + private void OnAppearanceChanged(EntityUid uid, FaxMachineComponent component, ref AppearanceChangeEvent args) + { + if (args.Sprite == null) + return; - private void OnAppearanceChanged(EntityUid uid, FaxMachineComponent component, ref AppearanceChangeEvent args) + if (_appearance.TryGetData(uid, FaxMachineVisuals.VisualState, out FaxMachineVisualState visuals) && visuals == FaxMachineVisualState.Inserting) { - if (args.Sprite == null) - return; - - if (_appearance.TryGetData(uid, FaxMachineVisuals.VisualState, out bool _)) + _player.Play(uid, new Animation() { - args.Sprite.LayerSetState(FaxMachineVisuals.VisualState, component.InsertingState); - } + Length = TimeSpan.FromSeconds(2.4), + AnimationTracks = + { + new AnimationTrackSpriteFlick() + { + LayerKey = FaxMachineVisuals.VisualState, + KeyFrames = + { + new AnimationTrackSpriteFlick.KeyFrame(component.InsertingState, 0f), + new AnimationTrackSpriteFlick.KeyFrame("icon", 2.4f), + } + } + } + }, "faxecute"); } } } diff --git a/Content.Server/Fax/FaxSystem.cs b/Content.Server/Fax/FaxSystem.cs index ba07e174c6748b..432e6ef253022a 100644 --- a/Content.Server/Fax/FaxSystem.cs +++ b/Content.Server/Fax/FaxSystem.cs @@ -352,7 +352,7 @@ private void UpdateAppearance(EntityUid uid, FaxMachineComponent? component = nu if (component.InsertingTimeRemaining > 0) { - _appearanceSystem.SetData(uid, FaxMachineVisuals.VisualState, true); + _appearanceSystem.SetData(uid, FaxMachineVisuals.VisualState, FaxMachineVisualState.Inserting); Dirty(uid, component); } else if (component.PrintingTimeRemaining > 0) diff --git a/Content.Shared/Fax/FaxVisuals.cs b/Content.Shared/Fax/FaxVisuals.cs index a97eb557fdda55..bfda60cdec5b96 100644 --- a/Content.Shared/Fax/FaxVisuals.cs +++ b/Content.Shared/Fax/FaxVisuals.cs @@ -12,5 +12,6 @@ public enum FaxMachineVisuals : byte public enum FaxMachineVisualState : byte { Normal, + Inserting, Printing }