Add AMIV disease stages (#9637)
* Add AMIV disease stages * remove unused import * move stages to top for readability * monkey immunity to amiv * Update to use time instead of index * Revert "Update to use time instead of index" This reverts commit 6bc83b0d48c167fe30437fa94272a00ed1633c5d. * add comments * rerun test
This commit is contained in:
41
Content.Server/Disease/Effects/DiseasePolymorph.cs
Normal file
41
Content.Server/Disease/Effects/DiseasePolymorph.cs
Normal file
@@ -0,0 +1,41 @@
|
||||
using Content.Server.Polymorph.Systems;
|
||||
using Content.Shared.Audio;
|
||||
using Content.Shared.Disease;
|
||||
using Content.Shared.Disease.Components;
|
||||
using Content.Shared.Polymorph;
|
||||
using Content.Shared.Popups;
|
||||
using Content.Shared.Sound;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Shared.Audio;
|
||||
using Robust.Shared.Player;
|
||||
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
|
||||
|
||||
namespace Content.Server.Disease.Effects
|
||||
{
|
||||
[UsedImplicitly]
|
||||
public sealed class DiseasePolymorph : DiseaseEffect
|
||||
{
|
||||
[DataField("polymorphId", required: true, customTypeSerializer: typeof(PrototypeIdSerializer<PolymorphPrototype>))]
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
public readonly string PolymorphId = default!;
|
||||
|
||||
[DataField("polymorphSound")]
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
public SoundSpecifier? PolymorphSound;
|
||||
|
||||
[DataField("polymorphMessage")]
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
public string? PolymorphMessage;
|
||||
|
||||
public override void Effect(DiseaseEffectArgs args)
|
||||
{
|
||||
EntityUid? polyUid = EntitySystem.Get<PolymorphableSystem>().PolymorphEntity(args.DiseasedEntity, PolymorphId);
|
||||
|
||||
if (PolymorphSound != null && polyUid != null)
|
||||
SoundSystem.Play(PolymorphSound.GetSound(), Filter.Pvs(polyUid.Value), polyUid.Value, AudioHelpers.WithVariation(0.2f));
|
||||
|
||||
if (PolymorphMessage != null && polyUid != null)
|
||||
EntitySystem.Get<SharedPopupSystem>().PopupEntity(Loc.GetString(PolymorphMessage), polyUid.Value, Filter.Entities(polyUid.Value), Shared.Popups.PopupType.Large);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user