diff --git a/Content.Server/GameObjects/Components/AtmosPlaqueComponent.cs b/Content.Server/GameObjects/Components/AtmosPlaqueComponent.cs new file mode 100644 index 0000000000..e372c4c5f4 --- /dev/null +++ b/Content.Server/GameObjects/Components/AtmosPlaqueComponent.cs @@ -0,0 +1,109 @@ +using Robust.Server.GameObjects; +using Robust.Server.Interfaces.GameObjects; +using Robust.Shared.GameObjects; +using Robust.Shared.Interfaces.Random; +using Robust.Shared.IoC; +using Robust.Shared.Serialization; +using Robust.Shared.ViewVariables; + +namespace Content.Server.GameObjects.Components +{ + [RegisterComponent] + public sealed class AtmosPlaqueComponent : Component, IMapInit + { + private PlaqueType _type; + public override string Name => "AtmosPlaque"; + + [ViewVariables(VVAccess.ReadWrite)] + public PlaqueType Type + { + get => _type; + set + { + _type = value; + UpdateSign(); + } + } + + public void MapInit() + { + var random = IoCManager.Resolve(); + var rand = random.Next(100); + // Let's not pad ourselves on the back too hard. + // 1% chance of zumos + if (rand == 0) Type = PlaqueType.Zumos; + // 9% FEA + else if (rand <= 10) Type = PlaqueType.Fea; + // 45% ZAS + else if (rand <= 55) Type = PlaqueType.Zas; + // 45% LINDA + else Type = PlaqueType.Linda; + } + + protected override void Startup() + { + base.Startup(); + + UpdateSign(); + } + + private void UpdateSign() + { + if (!Running) + { + return; + } + + Owner.Description = _type switch + { + PlaqueType.Zumos => + "This plaque commemorates the rise of the Atmos ZUM division. May they carry the torch that the Atmos ZAS, LINDA and FEA divisions left behind.", + PlaqueType.Fea => + "This plaque commemorates the fall of the Atmos FEA division. For all the charred, dizzy, and brittle men who have died in its hands.", + PlaqueType.Linda => + "This plaque commemorates the fall of the Atmos LINDA division. For all the charred, dizzy, and brittle men who have died in its hands.", + PlaqueType.Zas => + "This plaque commemorates the fall of the Atmos ZAS division. For all the charred, dizzy, and brittle men who have died in its hands.", + PlaqueType.Unset => "Uhm" + }; + + Owner.Name = _type switch + { + PlaqueType.Zumos => + "ZUM Atmospherics Division plaque", + PlaqueType.Fea => + "FEA Atmospherics Division plaque", + PlaqueType.Linda => + "LINDA Atmospherics Division plaque", + PlaqueType.Zas => + "ZAS Atmospherics Division plaque", + PlaqueType.Unset => "Uhm" + }; + + if (Owner.TryGetComponent(out SpriteComponent sprite)) + { + var state = _type == PlaqueType.Zumos ? "zumosplaque" : "atmosplaque"; + + sprite.LayerSetState(0, state); + } + } + + public override void ExposeData(ObjectSerializer serializer) + { + base.ExposeData(serializer); + + serializer.DataField(ref _type, "plaqueType", PlaqueType.Unset); + } + + public enum PlaqueType + { + Unset = 0, + Zumos, + Fea, + Linda, + Zas + } + } +} + +// If you get the ZUM plaque it means your round will be blessed with good engineering luck. diff --git a/Resources/Maps/saltern.yml b/Resources/Maps/saltern.yml index 2b0fa6bbe4..eaaf44c683 100644 --- a/Resources/Maps/saltern.yml +++ b/Resources/Maps/saltern.yml @@ -1263,7 +1263,7 @@ entities: type: Content.Server.GameObjects.ContainerSlot type: ContainerContainer - uid: 137 - type: PlaqueZum + type: PlaqueAtmos components: - parent: 857 pos: 33.498077,11.399912 diff --git a/Resources/Prototypes/Entities/Constructible/Walls/atmos_plaque.yml b/Resources/Prototypes/Entities/Constructible/Walls/atmos_plaque.yml new file mode 100644 index 0000000000..499f0ca0b0 --- /dev/null +++ b/Resources/Prototypes/Entities/Constructible/Walls/atmos_plaque.yml @@ -0,0 +1,22 @@ +- type: entity + parent: BaseSign + id: PlaqueAtmos + name: Atmos Plaque + components: + - type: Collidable + shapes: + - !type:PhysShapeAabb + bounds: "-0.3,-0.3,0.3,0.3" + layer: + - Opaque + - Impassable + - MobImpassable + - VaultImpassable + - SmallImpassable + - Clickable + + - type: Icon + state: atmosplaque + - type: Sprite + state: atmosplaque + - type: AtmosPlaque diff --git a/Resources/Prototypes/Entities/Constructible/Walls/signs.yml b/Resources/Prototypes/Entities/Constructible/Walls/signs.yml index 222ff68297..36d2b59214 100644 --- a/Resources/Prototypes/Entities/Constructible/Walls/signs.yml +++ b/Resources/Prototypes/Entities/Constructible/Walls/signs.yml @@ -974,50 +974,6 @@ - type: Icon state: atmos_waste -- type: entity - parent: BaseSign - id: PlaqueZum - name: zumos plaque - description: "This plaque commemorates the rise of the Atmos ZUM division. May they carry the torch that the Atmos ZAS, LINDA and FEA divisions left behind." - components: - - type: Collidable - shapes: - - !type:PhysShapeAabb - bounds: "-0.3,-0.3,0.3,0.3" - layer: - - Opaque - - Impassable - - MobImpassable - - VaultImpassable - - SmallImpassable - - Clickable - - type: Sprite - state: zumosplaque - - type: Icon - state: zumosplaque - -- type: entity - parent: BaseSign - id: PlaqueAtmos - name: atmos plaque - description: "This plaque commemorates the fall of the Atmos FEA division. For all the charred, dizzy, and brittle men who have died in its hands." - components: - - type: Collidable - shapes: - - !type:PhysShapeAabb - bounds: "-0.3,-0.3,0.3,0.3" - layer: - - Opaque - - Impassable - - MobImpassable - - VaultImpassable - - SmallImpassable - - Clickable - - type: Sprite - state: atmosplaque - - type: Icon - state: atmosplaque - - type: entity parent: BaseSign id: SignSmoking