Files
tbd-station-14/Content.Server/Chemistry/ReagentEffects/PopupMessage.cs
mirrorcult 181fd055ce Adds metabolism effects to pretty much every chem already in the game (#5349)
* pass 1

* a little more reagent effect for breakfast

* move lots of stuff around

* implements all medicines

* implement all cleaning & elements

* implement toxins/pyrotechnic

* p

* linter fixies

* fixes + narcotic balancing

* fix and standardize

* reviews

* things
2021-11-20 16:47:53 -07:00

38 lines
1.2 KiB
C#

using Content.Shared.Chemistry.Reagent;
using Content.Shared.Popups;
using Robust.Shared.IoC;
using Robust.Shared.Localization;
using Robust.Shared.Player;
using Robust.Shared.Random;
using Robust.Shared.Serialization.Manager.Attributes;
namespace Content.Server.Chemistry.ReagentEffects
{
public class PopupMessage : ReagentEffect
{
[DataField("messages", required: true)]
public string[] Messages = default!;
[DataField("type")]
public PopupType Type = PopupType.Local;
public override void Metabolize(ReagentEffectArgs args)
{
var popupSys = args.EntityManager.EntitySysManager.GetEntitySystem<SharedPopupSystem>();
var random = IoCManager.Resolve<IRobustRandom>();
var msg = random.Pick(Messages);
if (Type == PopupType.Local)
popupSys.PopupEntity(Loc.GetString(msg), args.SolutionEntity, Filter.Entities(args.SolutionEntity));
else if (Type == PopupType.Pvs)
popupSys.PopupEntity(Loc.GetString(msg), args.SolutionEntity, Filter.Pvs(args.SolutionEntity));
}
}
public enum PopupType
{
Pvs,
Local
}
}