diff --git a/Content.Server/Xenoarchaeology/XenoArtifacts/Effects/Components/PolyArtifactComponent.cs b/Content.Server/Xenoarchaeology/XenoArtifacts/Effects/Components/PolyArtifactComponent.cs new file mode 100644 index 00000000000000..8edeb77a67b79f --- /dev/null +++ b/Content.Server/Xenoarchaeology/XenoArtifacts/Effects/Components/PolyArtifactComponent.cs @@ -0,0 +1,30 @@ +using Robust.Shared.Audio; +using Content.Shared.Polymorph; +using Robust.Shared.Prototypes; + +namespace Content.Server.Xenoarchaeology.XenoArtifacts.Effects.Components; + +/// +/// Artifact polymorphs surrounding entities when triggered. +/// +[RegisterComponent] +public sealed partial class PolyArtifactComponent : Component +{ + /// + /// The polymorph effect to trigger. + /// + [DataField] + public ProtoId PolymorphPrototypeName = "ArtifactMonkey"; + + /// + /// range of the effect. + /// + [DataField] + public float Range = 2f; + + /// + /// Sound to play on polymorph. + /// + [DataField] + public SoundSpecifier PolySound = new SoundPathSpecifier("/Audio/Weapons/Guns/Gunshots/Magic/staff_animation.ogg"); +} diff --git a/Content.Server/Xenoarchaeology/XenoArtifacts/Effects/Systems/PolyArtifactSystem.cs b/Content.Server/Xenoarchaeology/XenoArtifacts/Effects/Systems/PolyArtifactSystem.cs new file mode 100644 index 00000000000000..d192e928d8f1f8 --- /dev/null +++ b/Content.Server/Xenoarchaeology/XenoArtifacts/Effects/Systems/PolyArtifactSystem.cs @@ -0,0 +1,41 @@ +using Content.Server.Xenoarchaeology.XenoArtifacts.Effects.Components; +using Content.Server.Xenoarchaeology.XenoArtifacts.Events; +using Content.Shared.Humanoid; +using Content.Server.Polymorph.Systems; +using Content.Shared.Mobs.Systems; +using Content.Shared.Polymorph; + +namespace Content.Server.Xenoarchaeology.XenoArtifacts.Effects.Systems; + +public sealed class PolyArtifactSystem : EntitySystem +{ + [Dependency] private readonly EntityLookupSystem _lookup = default!; + [Dependency] private readonly MobStateSystem _mob = default!; + [Dependency] private readonly PolymorphSystem _poly = default!; + [Dependency] private readonly SharedAudioSystem _audio = default!; + + /// + /// On effect trigger polymorphs targets in range. + /// + public override void Initialize() + { + SubscribeLocalEvent(OnActivate); + } + + /// + /// Provided target is alive and is not a zombie, polymorphs the target. + /// + private void OnActivate(EntityUid uid, PolyArtifactComponent component, ArtifactActivatedEvent args) + { + var xform = Transform(uid); + foreach (var comp in _lookup.GetComponentsInRange(xform.Coordinates, component.Range)) + { + var target = comp.Owner; + if (_mob.IsAlive(target)) + { + _poly.PolymorphEntity(target, component.PolymorphPrototypeName); + _audio.PlayPvs(component.PolySound, uid); + } + } + } +} diff --git a/Resources/Locale/en-US/xenoarchaeology/artifact-hints.ftl b/Resources/Locale/en-US/xenoarchaeology/artifact-hints.ftl index 1da33c3232b6ad..48a6f49408c347 100644 --- a/Resources/Locale/en-US/xenoarchaeology/artifact-hints.ftl +++ b/Resources/Locale/en-US/xenoarchaeology/artifact-hints.ftl @@ -18,6 +18,7 @@ artifact-effect-hint-soap = Lubricated surface artifact-effect-hint-communication = Long-distance communication artifact-effect-hint-phasing = Structural phasing artifact-effect-hint-sentience = Neurological activity +artifact-effect-hint-polymorph = Transmogrificational activity # the triggers should be more obvious than the effects # gives people an idea of what to do: don't be too specific (i.e. no "welders") diff --git a/Resources/Prototypes/Polymorphs/polymorph.yml b/Resources/Prototypes/Polymorphs/polymorph.yml index fe4f80811f80d6..c710d83ceccb50 100644 --- a/Resources/Prototypes/Polymorphs/polymorph.yml +++ b/Resources/Prototypes/Polymorphs/polymorph.yml @@ -102,3 +102,37 @@ transferName: true revertOnDeath: true + +# this is the monkey polymorph for artifact. +- type: polymorph + id: ArtifactMonkey + entity: MobMonkey + forced: true + transferName: true + allowRepeatedMorphs: true + inventory: Transfer + revertOnCrit: true + revertOnDeath: true + duration: 20 + +- type: polymorph + id: ArtifactCluwne + entity: MobCluwne + forced: true + transferName: true + transferHumanoidAppearance: true + inventory: None + revertOnDeath: true + revertOnCrit: true + duration: 30 + +- type: polymorph + id: ArtifactLizard + entity: MobLizard + forced: true + transferName: true + transferHumanoidAppearance: true + inventory: None + revertOnDeath: true + revertOnCrit: true + duration: 20 diff --git a/Resources/Prototypes/XenoArch/Effects/normal_effects.yml b/Resources/Prototypes/XenoArch/Effects/normal_effects.yml index 8deeebcc55c473..040f688403c51d 100644 --- a/Resources/Prototypes/XenoArch/Effects/normal_effects.yml +++ b/Resources/Prototypes/XenoArch/Effects/normal_effects.yml @@ -1,4 +1,4 @@ -- type: artifactEffect +- type: artifactEffect id: EffectBadFeeling targetDepth: 0 effectHint: artifact-effect-hint-mental @@ -405,6 +405,21 @@ components: - type: EmpArtifact +- type: artifactEffect + id: EffectPolyMonkey + targetDepth: 2 + effectHint: artifact-effect-hint-polymorph + components: + - type: PolyArtifact + +- type: artifactEffect + id: EffectPolyLizard + targetDepth: 2 + effectHint: artifact-effect-hint-polymorph + components: + - type: PolyArtifact + polymorphPrototypeName: ArtifactLizard + - type: artifactEffect id: EffectHealAll targetDepth: 3