Skip to content

Commit

Permalink
fix vampire polymorph
Browse files Browse the repository at this point in the history
  • Loading branch information
Rinary1 committed Nov 2, 2024
1 parent b4e54d2 commit c5d28e2
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 2 deletions.
24 changes: 22 additions & 2 deletions Content.Server/Vampire/VampireSystem.Abilities.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
using Content.Shared.Mobs;
using Content.Shared.Mobs.Components;
using Content.Shared.Popups;
using Content.Shared.Polymorph;
using Content.Shared.Prying.Components;
using Content.Shared.Stealth.Components;
using Content.Shared.Store.Events;
Expand Down Expand Up @@ -324,10 +325,29 @@ private void Glare(Entity<VampireComponent> vampire, EntityUid? target, TimeSpan
}
private void PolymorphSelf(Entity<VampireComponent> vampire, string? polymorphTarget)
{
if (polymorphTarget == null)
if (string.IsNullOrEmpty(polymorphTarget))
return;

var prototypeId = polymorphTarget switch
{
"MobMouse" => "VampireMouse",
"mobBatVampire" => "VampireBat",
_ => null
};

if (prototypeId == null)
{
Logger.Warning($"Unknown polymorph target: {polymorphTarget}. Polymorph operation aborted.");
return;
}

if (!_prototypeManager.TryIndex<PolymorphPrototype>(prototypeId, out var prototype))
{
Logger.Warning($"Unknown prototype: {prototypeId}. Polymorph operation aborted.");
return;
}

_polymorph.PolymorphEntity(vampire, polymorphTarget);
_polymorph.PolymorphEntity(vampire, prototype);
}
private void BloodSteal(Entity<VampireComponent> vampire)
{
Expand Down
7 changes: 7 additions & 0 deletions Resources/Prototypes/Polymorphs/polymorph.yml
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,13 @@
revertOnDeath: false

#Vampire
- type: polymorph
id: VampireMouse
configuration:
entity: MobMouse
revertOnDeath: true
revertOnCrit: true

- type: polymorph
id: VampireBat
configuration:
Expand Down

0 comments on commit c5d28e2

Please sign in to comment.