diff --git a/Content.Client/GameObjects/Components/Power/PowerDeviceVisualizer2D.cs b/Content.Client/GameObjects/Components/Power/PowerDeviceVisualizer2D.cs new file mode 100644 index 0000000000..b9c7d2cf40 --- /dev/null +++ b/Content.Client/GameObjects/Components/Power/PowerDeviceVisualizer2D.cs @@ -0,0 +1,25 @@ +using Content.Shared.GameObjects.Components.Power; +using JetBrains.Annotations; +using Robust.Client.GameObjects; +using Robust.Client.Interfaces.GameObjects.Components; + +namespace Content.Client.GameObjects.Components.Power +{ + [UsedImplicitly] + public class PowerDeviceVisualizer2D : AppearanceVisualizer + { + public override void OnChangeData(AppearanceComponent component) + { + base.OnChangeData(component); + + var sprite = component.Owner.GetComponent(); + var powered = component.TryGetData(PowerDeviceVisuals.Powered, out bool poweredVar) && poweredVar; + sprite.LayerSetVisible(PowerDeviceVisualLayers.Powered, powered); + } + } + + public enum PowerDeviceVisualLayers + { + Powered + } +} diff --git a/Content.Server/GameObjects/Components/Power/PowerDevice.cs b/Content.Server/GameObjects/Components/Power/PowerDevice.cs index d155ece11c..b1b2a65983 100644 --- a/Content.Server/GameObjects/Components/Power/PowerDevice.cs +++ b/Content.Server/GameObjects/Components/Power/PowerDevice.cs @@ -2,6 +2,8 @@ using System.Collections.Generic; using System.Linq; using Content.Server.GameObjects.EntitySystems; +using Content.Shared.GameObjects.Components.Power; +using Robust.Server.GameObjects; using Robust.Shared.GameObjects; using Robust.Shared.Interfaces.GameObjects; using Robust.Shared.Interfaces.GameObjects.Components; @@ -248,15 +250,14 @@ namespace Content.Server.GameObjects.Components.Power { var oldPowered = Powered; Powered = !IsPowerCut && (ExternalPowered || InternalPowered); + if (oldPowered != Powered) { - if (Powered) + OnPowerStateChanged?.Invoke(this, new PowerStateEventArgs(Powered)); + + if (Owner.TryGetComponent(out AppearanceComponent appearance)) { - OnPowerStateChanged?.Invoke(this, new PowerStateEventArgs(true)); - } - else - { - OnPowerStateChanged?.Invoke(this, new PowerStateEventArgs(false)); + appearance.SetData(PowerDeviceVisuals.Powered, Powered); } } } diff --git a/Content.Shared/GameObjects/Components/Power/SharedPowerDeviceComponent.cs b/Content.Shared/GameObjects/Components/Power/SharedPowerDeviceComponent.cs new file mode 100644 index 0000000000..2f050760f4 --- /dev/null +++ b/Content.Shared/GameObjects/Components/Power/SharedPowerDeviceComponent.cs @@ -0,0 +1,11 @@ +using System; +using Robust.Shared.Serialization; + +namespace Content.Shared.GameObjects.Components.Power +{ + [Serializable, NetSerializable] + public enum PowerDeviceVisuals + { + Powered + } +} diff --git a/Resources/Prototypes/Entities/buildings/lathe.yml b/Resources/Prototypes/Entities/buildings/lathe.yml index 0ba9ae1184..5fe6db1e50 100644 --- a/Resources/Prototypes/Entities/buildings/lathe.yml +++ b/Resources/Prototypes/Entities/buildings/lathe.yml @@ -12,7 +12,7 @@ interfaces: - key: enum.LatheUiKey.Key type: LatheBoundUserInterface - + - type: PowerDevice - type: entity parent: BaseLathe @@ -21,10 +21,14 @@ components: - type: Sprite sprite: Buildings/autolathe.rsi - state: idle + layers: + - state: autolathe + - state: autolathe_unlit + shader: unshaded + map: ["enum.PowerDeviceVisualLayers.Powered"] - type: Icon sprite: Buildings/autolathe.rsi - state: idle + state: autolathe - type: Collidable shapes: - !type:PhysShapeAabb @@ -49,6 +53,9 @@ - CableStack - Crowbar - Multitool + - type: Appearance + visuals: + - type: PowerDeviceVisualizer2D - type: entity parent: BaseLathe @@ -57,7 +64,11 @@ components: - type: Sprite sprite: Buildings/research.rsi - state: protolathe + layers: + - state: protolathe + - state: protolathe_unlit + shader: unshaded + map: ["enum.PowerDeviceVisualLayers.Powered"] - type: Icon sprite: Buildings/research.rsi state: protolathe @@ -91,3 +102,6 @@ type: LatheBoundUserInterface - key: enum.ResearchClientUiKey.Key type: ResearchClientBoundUserInterface + - type: Appearance + visuals: + - type: PowerDeviceVisualizer2D diff --git a/Resources/Textures/Buildings/autolathe.rsi/autolathe.png b/Resources/Textures/Buildings/autolathe.rsi/autolathe.png new file mode 100644 index 0000000000..7c768b5563 Binary files /dev/null and b/Resources/Textures/Buildings/autolathe.rsi/autolathe.png differ diff --git a/Resources/Textures/Buildings/autolathe.rsi/autolathe_building.png b/Resources/Textures/Buildings/autolathe.rsi/autolathe_building.png new file mode 100644 index 0000000000..913e4daf89 Binary files /dev/null and b/Resources/Textures/Buildings/autolathe.rsi/autolathe_building.png differ diff --git a/Resources/Textures/Buildings/autolathe.rsi/autolathe_building_unlit.png b/Resources/Textures/Buildings/autolathe.rsi/autolathe_building_unlit.png new file mode 100644 index 0000000000..1930e8707d Binary files /dev/null and b/Resources/Textures/Buildings/autolathe.rsi/autolathe_building_unlit.png differ diff --git a/Resources/Textures/Buildings/autolathe.rsi/autolathe_inserting.png b/Resources/Textures/Buildings/autolathe.rsi/autolathe_inserting.png new file mode 100644 index 0000000000..a3974baed3 Binary files /dev/null and b/Resources/Textures/Buildings/autolathe.rsi/autolathe_inserting.png differ diff --git a/Resources/Textures/Buildings/autolathe.rsi/autolathe_inserting_unlit.png b/Resources/Textures/Buildings/autolathe.rsi/autolathe_inserting_unlit.png new file mode 100644 index 0000000000..87c876ff29 Binary files /dev/null and b/Resources/Textures/Buildings/autolathe.rsi/autolathe_inserting_unlit.png differ diff --git a/Resources/Textures/Buildings/autolathe.rsi/autolathe_panel.png b/Resources/Textures/Buildings/autolathe.rsi/autolathe_panel.png new file mode 100644 index 0000000000..898903cc0c Binary files /dev/null and b/Resources/Textures/Buildings/autolathe.rsi/autolathe_panel.png differ diff --git a/Resources/Textures/Buildings/autolathe.rsi/autolathe_r.png b/Resources/Textures/Buildings/autolathe.rsi/autolathe_r.png new file mode 100644 index 0000000000..09507aa57f Binary files /dev/null and b/Resources/Textures/Buildings/autolathe.rsi/autolathe_r.png differ diff --git a/Resources/Textures/Buildings/autolathe.rsi/autolathe_unlit.png b/Resources/Textures/Buildings/autolathe.rsi/autolathe_unlit.png new file mode 100644 index 0000000000..1395175b67 Binary files /dev/null and b/Resources/Textures/Buildings/autolathe.rsi/autolathe_unlit.png differ diff --git a/Resources/Textures/Buildings/autolathe.rsi/closing.png b/Resources/Textures/Buildings/autolathe.rsi/closing.png deleted file mode 100644 index f09e99cebc..0000000000 Binary files a/Resources/Textures/Buildings/autolathe.rsi/closing.png and /dev/null differ diff --git a/Resources/Textures/Buildings/autolathe.rsi/idle.png b/Resources/Textures/Buildings/autolathe.rsi/idle.png deleted file mode 100644 index f30326ab23..0000000000 Binary files a/Resources/Textures/Buildings/autolathe.rsi/idle.png and /dev/null differ diff --git a/Resources/Textures/Buildings/autolathe.rsi/meta.json b/Resources/Textures/Buildings/autolathe.rsi/meta.json index 9ec8665236..3bb1cccea4 100644 --- a/Resources/Textures/Buildings/autolathe.rsi/meta.json +++ b/Resources/Textures/Buildings/autolathe.rsi/meta.json @@ -1 +1,121 @@ -{"version": 1, "size": {"x": 32, "y": 32}, "license": "CC-BY-SA-3.0", "copyright": "Taken from https://github.com/discordia-space/CEV-Eris/blob/master/icons/obj/machines/excelsior/autolathe.dmi", "states": [{"name": "closing", "directions": 1, "delays": [[0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1]]}, {"name": "idle", "directions": 1, "delays": [[1.0]]}, {"name": "opening", "directions": 1, "delays": [[0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1]]}, {"name": "panel", "directions": 1, "delays": [[1.0]]}, {"name": "stanok", "directions": 1, "delays": [[1.0]]}, {"name": "workdone", "directions": 1, "delays": [[0.1, 0.1, 0.1, 0.1, 0.5, 0.1, 0.1, 0.5]]}, {"name": "working", "directions": 1, "delays": [[0.1, 0.1, 0.1, 0.1, 0.1]]}]} \ No newline at end of file +{ + "version": 1, + "size": { + "x": 32, + "y": 32 + }, + "states": [ + { + "name": "autolathe", + "directions": 1, + "delays": [ + [ + 1.0 + ] + ] + }, + { + "name": "autolathe_unlit", + "directions": 1, + "delays": [ + [ + 1.0 + ] + ] + }, + { + "name": "autolathe_building", + "directions": 1, + "delays": [ + [ + 0.15, + 0.15, + 0.15, + 0.15, + 0.15, + 0.15, + 0.15, + 0.15, + 0.15 + ] + ] + }, + { + "name": "autolathe_building_unlit", + "directions": 1, + "delays": [ + [ + 0.15, + 0.15, + 0.15, + 0.15, + 0.15, + 0.15, + 0.15, + 0.15, + 0.15 + ] + ] + }, + { + "name": "autolathe_inserting", + "directions": 1, + "delays": [ + [ + 0.1, + 0.1, + 0.1, + 0.1, + 0.1, + 0.1, + 0.1, + 0.1, + 0.1 + ] + ] + }, + { + "name": "autolathe_inserting_unlit", + "directions": 1, + "delays": [ + [ + 0.1, + 0.1, + 0.1, + 0.1, + 0.1, + 0.1, + 0.1, + 0.1, + 0.1 + ] + ] + }, + { + "name": "autolathe_panel", + "directions": 1, + "delays": [ + [ + 1.0 + ] + ] + }, + { + "name": "autolathe_r", + "directions": 1, + "delays": [ + [ + 0.1, + 0.1, + 0.1, + 0.1, + 0.1, + 0.1, + 0.1, + 0.1, + 0.1 + ] + ] + } + ] +} \ No newline at end of file diff --git a/Resources/Textures/Buildings/autolathe.rsi/opening.png b/Resources/Textures/Buildings/autolathe.rsi/opening.png deleted file mode 100644 index f29bd92306..0000000000 Binary files a/Resources/Textures/Buildings/autolathe.rsi/opening.png and /dev/null differ diff --git a/Resources/Textures/Buildings/autolathe.rsi/panel.png b/Resources/Textures/Buildings/autolathe.rsi/panel.png deleted file mode 100644 index 5607cee9bc..0000000000 Binary files a/Resources/Textures/Buildings/autolathe.rsi/panel.png and /dev/null differ diff --git a/Resources/Textures/Buildings/autolathe.rsi/stanok.png b/Resources/Textures/Buildings/autolathe.rsi/stanok.png deleted file mode 100644 index 1766a7baca..0000000000 Binary files a/Resources/Textures/Buildings/autolathe.rsi/stanok.png and /dev/null differ diff --git a/Resources/Textures/Buildings/autolathe.rsi/workdone.png b/Resources/Textures/Buildings/autolathe.rsi/workdone.png deleted file mode 100644 index 161f1a4f35..0000000000 Binary files a/Resources/Textures/Buildings/autolathe.rsi/workdone.png and /dev/null differ diff --git a/Resources/Textures/Buildings/autolathe.rsi/working.png b/Resources/Textures/Buildings/autolathe.rsi/working.png deleted file mode 100644 index 4a6cc55256..0000000000 Binary files a/Resources/Textures/Buildings/autolathe.rsi/working.png and /dev/null differ diff --git a/Resources/Textures/Buildings/research.rsi/meta.json b/Resources/Textures/Buildings/research.rsi/meta.json index d30c7ab0e8..6eacf5723e 100644 --- a/Resources/Textures/Buildings/research.rsi/meta.json +++ b/Resources/Textures/Buildings/research.rsi/meta.json @@ -1 +1,430 @@ -{"version": 1, "size": {"x": 32, "y": 32}, "license": "CC-BY-SA-3.0", "copyright": "Taken from https://github.com/discordia-space/CEV-Eris/blob/master/icons/obj/machines/excelsior/autolathe.dmi at 40b254106b46981b8ad95ccd5589deb8fa56e765", "states": [{"name": "circuit_imprinter", "directions": 1, "delays": [[1.0]]}, {"name": "circuit_imprinter_ani", "directions": 1, "delays": [[0.08, 0.08, 0.08, 0.08, 0.08, 0.08, 0.08, 0.08, 0.08, 0.08, 0.08, 0.08, 0.08, 0.08, 0.08, 0.08, 0.08, 0.08, 0.08, 0.08, 0.08, 0.08, 0.08, 0.08, 0.08]]}, {"name": "circuit_imprinter_t", "directions": 1, "delays": [[1.0]]}, {"name": "d_analyzer", "directions": 1, "delays": [[1.0]]}, {"name": "d_analyzer_l", "directions": 1, "delays": [[1.0]]}, {"name": "d_analyzer_la", "directions": 1, "delays": [[0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1]]}, {"name": "d_analyzer_process", "directions": 1, "delays": [[0.09, 0.09, 0.09, 0.09, 0.09, 0.09, 0.09, 0.09, 0.09, 0.09, 0.09, 0.09, 0.09, 0.09, 0.09, 0.09, 0.09, 0.09, 0.09, 0.09, 0.09, 0.09, 0.09, 0.09, 0.09, 0.09, 0.09]]}, {"name": "d_analyzer_t", "directions": 1, "delays": [[1.0]]}, {"name": "protolathe", "directions": 1, "delays": [[1.0]]}, {"name": "protolathe_adamantine", "directions": 1, "delays": [[0.088, 0.088, 0.088, 0.088, 0.088, 0.088, 0.088, 0.088, 0.088]]}, {"name": "protolathe_bananium", "directions": 1, "delays": [[0.088, 0.088, 0.088, 0.088, 0.088, 0.088, 0.088, 0.088, 0.088]]}, {"name": "protolathe_diamond", "directions": 1, "delays": [[0.088, 0.088, 0.088, 0.088, 0.088, 0.088, 0.088, 0.088, 0.088]]}, {"name": "protolathe_glass", "directions": 1, "delays": [[0.088, 0.088, 0.088, 0.088, 0.088, 0.088, 0.088, 0.088, 0.088]]}, {"name": "protolathe_gold", "directions": 1, "delays": [[0.088, 0.088, 0.088, 0.088, 0.088, 0.088, 0.088, 0.088, 0.088]]}, {"name": "protolathe_metal", "directions": 1, "delays": [[0.088, 0.088, 0.088, 0.088, 0.088, 0.088, 0.088, 0.088, 0.088]]}, {"name": "protolathe_n", "directions": 1, "delays": [[0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05]]}, {"name": "protolathe_silver", "directions": 1, "delays": [[0.088, 0.088, 0.088, 0.088, 0.088, 0.088, 0.088, 0.088, 0.088]]}, {"name": "protolathe_solid plasma", "directions": 1, "delays": [[0.088, 0.088, 0.088, 0.088, 0.088, 0.088, 0.088, 0.088, 0.088]]}, {"name": "protolathe_t", "directions": 1, "delays": [[1.0]]}, {"name": "protolathe_uranium", "directions": 1, "delays": [[0.088, 0.088, 0.088, 0.088, 0.088, 0.088, 0.088, 0.088, 0.088]]}, {"name": "server", "directions": 1, "delays": [[1.0]]}, {"name": "server-nopower", "directions": 1, "delays": [[1.0]]}, {"name": "server-off", "directions": 1, "delays": [[1.0]]}, {"name": "server-on", "directions": 1, "delays": [[1.0]]}, {"name": "server_o", "directions": 1, "delays": [[1.0]]}, {"name": "tdoppler", "directions": 4, "delays": [[0.8, 0.2], [0.8, 0.2], [0.8, 0.2], [0.8, 0.2]]}, {"name": "tdoppler-broken", "directions": 1, "delays": [[0.1, 0.1, 0.1]]}, {"name": "tdoppler-off", "directions": 1, "delays": [[1.0]]}]} \ No newline at end of file +{ + "version": 1, + "size": { + "x": 32, + "y": 32 + }, + "license": "CC-BY-SA-3.0", + "copyright": "Taken from https://github.com/discordia-space/CEV-Eris/blob/master/icons/obj/machines/excelsior/autolathe.dmi at 40b254106b46981b8ad95ccd5589deb8fa56e765", + "states": [ + { + "name": "circuit_imprinter", + "directions": 1, + "delays": [ + [ + 1.0 + ] + ] + }, + { + "name": "circuit_imprinter_ani", + "directions": 1, + "delays": [ + [ + 0.08, + 0.08, + 0.08, + 0.08, + 0.08, + 0.08, + 0.08, + 0.08, + 0.08, + 0.08, + 0.08, + 0.08, + 0.08, + 0.08, + 0.08, + 0.08, + 0.08, + 0.08, + 0.08, + 0.08, + 0.08, + 0.08, + 0.08, + 0.08, + 0.08 + ] + ] + }, + { + "name": "circuit_imprinter_t", + "directions": 1, + "delays": [ + [ + 1.0 + ] + ] + }, + { + "name": "d_analyzer", + "directions": 1, + "delays": [ + [ + 1.0 + ] + ] + }, + { + "name": "d_analyzer_l", + "directions": 1, + "delays": [ + [ + 1.0 + ] + ] + }, + { + "name": "d_analyzer_la", + "directions": 1, + "delays": [ + [ + 0.1, + 0.1, + 0.1, + 0.1, + 0.1, + 0.1, + 0.1, + 0.1, + 0.1, + 0.1 + ] + ] + }, + { + "name": "d_analyzer_process", + "directions": 1, + "delays": [ + [ + 0.09, + 0.09, + 0.09, + 0.09, + 0.09, + 0.09, + 0.09, + 0.09, + 0.09, + 0.09, + 0.09, + 0.09, + 0.09, + 0.09, + 0.09, + 0.09, + 0.09, + 0.09, + 0.09, + 0.09, + 0.09, + 0.09, + 0.09, + 0.09, + 0.09, + 0.09, + 0.09 + ] + ] + }, + { + "name": "d_analyzer_t", + "directions": 1, + "delays": [ + [ + 1.0 + ] + ] + }, + { + "name": "protolathe", + "directions": 1, + "delays": [ + [ + 1.0 + ] + ] + }, + { + "name": "protolathe_unlit", + "directions": 1, + "delays": [ + [ + 1.0 + ] + ] + }, + { + "name": "protolathe_adamantine", + "directions": 1, + "delays": [ + [ + 0.088, + 0.088, + 0.088, + 0.088, + 0.088, + 0.088, + 0.088, + 0.088, + 0.088 + ] + ] + }, + { + "name": "protolathe_bananium", + "directions": 1, + "delays": [ + [ + 0.088, + 0.088, + 0.088, + 0.088, + 0.088, + 0.088, + 0.088, + 0.088, + 0.088 + ] + ] + }, + { + "name": "protolathe_diamond", + "directions": 1, + "delays": [ + [ + 0.088, + 0.088, + 0.088, + 0.088, + 0.088, + 0.088, + 0.088, + 0.088, + 0.088 + ] + ] + }, + { + "name": "protolathe_glass", + "directions": 1, + "delays": [ + [ + 0.088, + 0.088, + 0.088, + 0.088, + 0.088, + 0.088, + 0.088, + 0.088, + 0.088 + ] + ] + }, + { + "name": "protolathe_gold", + "directions": 1, + "delays": [ + [ + 0.088, + 0.088, + 0.088, + 0.088, + 0.088, + 0.088, + 0.088, + 0.088, + 0.088 + ] + ] + }, + { + "name": "protolathe_metal", + "directions": 1, + "delays": [ + [ + 0.088, + 0.088, + 0.088, + 0.088, + 0.088, + 0.088, + 0.088, + 0.088, + 0.088 + ] + ] + }, + { + "name": "protolathe_n", + "directions": 1, + "delays": [ + [ + 0.05, + 0.05, + 0.05, + 0.05, + 0.05, + 0.05, + 0.05, + 0.05, + 0.05, + 0.05, + 0.05, + 0.05, + 0.05 + ] + ] + }, + { + "name": "protolathe_silver", + "directions": 1, + "delays": [ + [ + 0.088, + 0.088, + 0.088, + 0.088, + 0.088, + 0.088, + 0.088, + 0.088, + 0.088 + ] + ] + }, + { + "name": "protolathe_solid plasma", + "directions": 1, + "delays": [ + [ + 0.088, + 0.088, + 0.088, + 0.088, + 0.088, + 0.088, + 0.088, + 0.088, + 0.088 + ] + ] + }, + { + "name": "protolathe_t", + "directions": 1, + "delays": [ + [ + 1.0 + ] + ] + }, + { + "name": "protolathe_uranium", + "directions": 1, + "delays": [ + [ + 0.088, + 0.088, + 0.088, + 0.088, + 0.088, + 0.088, + 0.088, + 0.088, + 0.088 + ] + ] + }, + { + "name": "server", + "directions": 1, + "delays": [ + [ + 1.0 + ] + ] + }, + { + "name": "server-nopower", + "directions": 1, + "delays": [ + [ + 1.0 + ] + ] + }, + { + "name": "server-off", + "directions": 1, + "delays": [ + [ + 1.0 + ] + ] + }, + { + "name": "server-on", + "directions": 1, + "delays": [ + [ + 1.0 + ] + ] + }, + { + "name": "server_o", + "directions": 1, + "delays": [ + [ + 1.0 + ] + ] + }, + { + "name": "tdoppler", + "directions": 4, + "delays": [ + [ + 0.8, + 0.2 + ], + [ + 0.8, + 0.2 + ], + [ + 0.8, + 0.2 + ], + [ + 0.8, + 0.2 + ] + ] + }, + { + "name": "tdoppler-broken", + "directions": 1, + "delays": [ + [ + 0.1, + 0.1, + 0.1 + ] + ] + }, + { + "name": "tdoppler-off", + "directions": 1, + "delays": [ + [ + 1.0 + ] + ] + } + ] +} diff --git a/Resources/Textures/Buildings/research.rsi/protolathe.png b/Resources/Textures/Buildings/research.rsi/protolathe.png index 0eb2d2ce37..c97052dad9 100644 Binary files a/Resources/Textures/Buildings/research.rsi/protolathe.png and b/Resources/Textures/Buildings/research.rsi/protolathe.png differ diff --git a/Resources/Textures/Buildings/research.rsi/protolathe_unlit.png b/Resources/Textures/Buildings/research.rsi/protolathe_unlit.png new file mode 100644 index 0000000000..13c4be2631 Binary files /dev/null and b/Resources/Textures/Buildings/research.rsi/protolathe_unlit.png differ