Fix the damn atmos plaque
This is a very important matter.
This commit is contained in:
109
Content.Server/GameObjects/Components/AtmosPlaqueComponent.cs
Normal file
109
Content.Server/GameObjects/Components/AtmosPlaqueComponent.cs
Normal file
@@ -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<IRobustRandom>();
|
||||
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.
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user