From: TemporalOroboros Date: Mon, 6 Feb 2023 19:53:07 +0000 (-0800) Subject: Resolves FoldableVisualizer is Obsolete (#13913) X-Git-Url: https://git.smokeofanarchy.ru/gitweb.cgi?a=commitdiff_plain;h=eb388a30901e116451a5066ef8ad363176a12e8c;p=space-station-14.git Resolves FoldableVisualizer is Obsolete (#13913) --- diff --git a/Content.Client/Visualizer/FoldableVisualizer.cs b/Content.Client/Visualizer/FoldableVisualizer.cs deleted file mode 100644 index 7a37eda6d2..0000000000 --- a/Content.Client/Visualizer/FoldableVisualizer.cs +++ /dev/null @@ -1,38 +0,0 @@ -using Robust.Client.GameObjects; -using Robust.Shared.GameObjects; -using Robust.Shared.IoC; -using Robust.Shared.Serialization.Manager.Attributes; -using static Content.Shared.Foldable.SharedFoldableSystem; - -namespace Content.Client.Visualizer; - - -public sealed class FoldableVisualizer : AppearanceVisualizer -{ - [DataField("key")] - private string _key = default!; - - [Obsolete("Subscribe to AppearanceChangeEvent instead.")] - public override void OnChangeData(AppearanceComponent appearance) - { - base.OnChangeData(appearance); - - var entManager = IoCManager.Resolve(); - - if (!entManager.TryGetComponent(appearance.Owner, out SpriteComponent? sprite)) return; - - if (appearance.TryGetData(FoldedVisuals.State, out bool folded) && folded) - { - sprite.LayerSetState(FoldableVisualLayers.Base, $"{_key}_folded"); - } - else - { - sprite.LayerSetState(FoldableVisualLayers.Base, $"{_key}"); - } - } - - public enum FoldableVisualLayers : byte - { - Base, - } -} diff --git a/Resources/Prototypes/Entities/Objects/Specific/Medical/morgue.yml b/Resources/Prototypes/Entities/Objects/Specific/Medical/morgue.yml index a96026b9c1..d202b77d50 100644 --- a/Resources/Prototypes/Entities/Objects/Specific/Medical/morgue.yml +++ b/Resources/Prototypes/Entities/Objects/Specific/Medical/morgue.yml @@ -1,5 +1,6 @@ - type: entity id: BodyBag_Container + parent: BaseFoldable name: body bag description: A plastic bag designed for the storage and transportation of cadavers. components: @@ -11,7 +12,10 @@ sprite: Objects/Specific/Medical/Morgue/bodybags.rsi layers: - state: bag - map: ["enum.FoldableVisualLayers.Base"] + map: ["unfoldedLayer"] + - state: bag_folded + map: ["foldedLayer"] + visible: false - state: open_overlay map: ["enum.StorageVisualLayers.Door"] - state: label_overlay @@ -45,7 +49,6 @@ openSound: path: /Audio/Misc/zip.ogg - type: EntityStorageLayingDownOverride - - type: Foldable - type: PaperLabel labelSlot: insertVerbText: Attach Label @@ -57,14 +60,19 @@ visuals: - type: StorageVisualizer state_open: open_overlay - - type: FoldableVisualizer - key: bag - type: GenericVisualizer visuals: enum.PaperLabelVisuals.HasLabel: enum.BodyBagVisualLayers.Label: True: {visible: true} False: {visible: false} + enum.FoldedVisuals.State: + foldedLayer: + True: {visible: true} + False: {visible: false} + unfoldedLayer: + True: {visible: false} + False: {visible: true} - type: Pullable - type: AntiRottingContainer - type: ItemSlots diff --git a/Resources/Prototypes/Entities/Structures/Furniture/chairs.yml b/Resources/Prototypes/Entities/Structures/Furniture/chairs.yml index 140cd8e0cc..3f88600e8f 100644 --- a/Resources/Prototypes/Entities/Structures/Furniture/chairs.yml +++ b/Resources/Prototypes/Entities/Structures/Furniture/chairs.yml @@ -220,7 +220,7 @@ node: chairCursed - type: entity - parent: SeatBase + parent: [SeatBase, BaseFoldable] id: ChairFolding name: folding chair description: If you carry six of these you become the coolest kid at church. @@ -230,14 +230,13 @@ sprite: Structures/Furniture/folding_chair.rsi layers: - state: folding - map: ["enum.FoldableVisualLayers.Base"] + map: ["unfoldedLayer"] + - state: folding_folded + map: ["foldedLayer"] + visible: false - type: Item size: 50 - - type: Foldable - type: Appearance - visuals: - - type: FoldableVisualizer - key: folding - type: MeleeWeapon damage: types: diff --git a/Resources/Prototypes/Entities/Structures/Furniture/rollerbeds.yml b/Resources/Prototypes/Entities/Structures/Furniture/rollerbeds.yml index ea415d31cd..72d745ebca 100644 --- a/Resources/Prototypes/Entities/Structures/Furniture/rollerbeds.yml +++ b/Resources/Prototypes/Entities/Structures/Furniture/rollerbeds.yml @@ -1,6 +1,6 @@ - type: entity id: RollerBed - parent: BaseItem + parent: [BaseItem, BaseFoldable] name: rollerbed description: Used to carry patients around without damaging them. components: @@ -14,7 +14,10 @@ noRot: true layers: - state: rollerbed - map: ["enum.FoldableVisualLayers.Base"] + map: ["unfoldedLayer"] + - state: rollerbed_folded + map: ["foldedLayer"] + visible: false - type: MovedByPressure - type: DamageOnHighSpeedImpact soundHit: /Audio/Effects/bang.ogg @@ -48,11 +51,8 @@ rotation: -90 buckleOffset: "0,0.15" unbuckleOffset: "0,0.15" - - type: Foldable - type: Appearance visuals: - - type: FoldableVisualizer - key: rollerbed - type: RollerbedVisualizer key: rollerbed - type: StaticPrice @@ -75,11 +75,12 @@ - type: Sprite layers: - state: cheap_rollerbed - map: [ "enum.FoldableVisualLayers.Base" ] + map: ["unfoldedLayer"] + - state: cheap_rollerbed_folded + map: ["foldedLayer"] + visible: false - type: Appearance visuals: - - type: FoldableVisualizer - key: cheap_rollerbed - type: RollerbedVisualizer key: cheap_rollerbed @@ -100,11 +101,12 @@ - type: Sprite layers: - state: emergency_rollerbed - map: [ "enum.FoldableVisualLayers.Base" ] + map: ["unfoldedLayer"] + - state: emergency_rollerbed_folded + map: ["foldedLayer"] + visible: false - type: Appearance visuals: - - type: FoldableVisualizer - key: emergency_rollerbed - type: RollerbedVisualizer key: emergency_rollerbed diff --git a/Resources/Prototypes/Entities/foldable.yml b/Resources/Prototypes/Entities/foldable.yml new file mode 100644 index 0000000000..a0843cd125 --- /dev/null +++ b/Resources/Prototypes/Entities/foldable.yml @@ -0,0 +1,15 @@ +- type: entity + id: BaseFoldable + name: "foldable" + abstract: true + components: + - type: Foldable + - type: GenericVisualizer + visuals: + enum.FoldedVisuals.State: + foldedLayer: + True: {visible: true} + False: {visible: false} + unfoldedLayer: + True: {visible: false} + False: {visible: true}