Files
tbd-station-14/Content.Server/GameObjects/Components/AtmosPlaqueComponent.cs
ShadowCommander 7a842f7c22 Fix tests (#3707)
* First pass

* Fix access and rename banananium to bananium

* Fix captialization of CookTimeInfoLabel

* Fix InteractUsing calls

* Remove unused [Dependency]

* Replace obsolete references to Anchored with BodyType

* Assign default value to shoving someone in disposals

* Fix naming

* Replace Initialize TryGetComponents with EnsureComponent

* Rework AnchorableComponent

* Fix singularity component

* Replace obsolete usages of Angle.South

* Fix efcore warning

* Fix container tests

* Fix DebugPressurePump invalid PressurePump yaml

* Fix getting pathfinding region of grid 0

* Fix atmos plaque missing layer and add info message when it happens

* Fix AiSteeringSystem steering in an invalid grid in entity test

* Make content able to choose which log level leads to test failures

* Revert container test fix for Acruid

* Fix sprite, pipe and saving errors
Make EntityTest print all errors instead of stopping on the first

* Reorder singularity visualizer

* Disable pvs for container occlusion adn simple predict reconcile, they use entities other than map ones

Co-authored-by: Metal Gear Sloth <metalgearsloth@gmail.com>
Co-authored-by: DrSmugleaf <DrSmugleaf@users.noreply.github.com>
Co-authored-by: metalgearsloth <comedian_vs_clown@hotmail.com>
2021-03-31 21:41:23 +02:00

107 lines
3.4 KiB
C#

using Content.Shared.GameObjects.Components.Atmos;
using Robust.Server.GameObjects;
using Robust.Shared.GameObjects;
using Robust.Shared.IoC;
using Robust.Shared.Random;
using Robust.Shared.Serialization.Manager.Attributes;
using Robust.Shared.ViewVariables;
namespace Content.Server.GameObjects.Components
{
[RegisterComponent]
public sealed class AtmosPlaqueComponent : Component, IMapInit
{
public override string Name => "AtmosPlaque";
[DataField("plaqueType")]
private PlaqueType _type = PlaqueType.Unset;
[ViewVariables(VVAccess.ReadWrite)]
public PlaqueType Type
{
get => _type;
set
{
_type = value;
UpdateSign();
}
}
public void MapInit()
{
var random = IoCManager.Resolve<IRobustRandom>();
var rand = random.Next(100);
// Let's not pat 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",
_ => "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",
_ => "Uhm",
};
if (Owner.TryGetComponent(out AppearanceComponent? appearance))
{
var state = _type == PlaqueType.Zumos ? "zumosplaque" : "atmosplaque";
appearance.SetData(AtmosPlaqueVisuals.State, state);
}
}
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.