* Geras bug fixes * oops * its as shrimple as that toggled transferName in the polymorph yml instead of using the system to manually change it * its as shrimple as that (2.0) fixed reviews for zombies having a dummy action, instead - properly implemented removal of action * its as shrimple as that (3.0) fixed tests by removing nameidentifier from slime (its already inherited, anyway)
53 lines
1.9 KiB
C#
53 lines
1.9 KiB
C#
using Content.Server.Polymorph.Systems;
|
|
using Content.Shared.Zombies;
|
|
using Content.Server.Actions;
|
|
using Content.Server.Popups;
|
|
using Content.Shared.Geras;
|
|
using Robust.Shared.Player;
|
|
|
|
namespace Content.Server.Geras;
|
|
|
|
/// <inheritdoc/>
|
|
public sealed class GerasSystem : SharedGerasSystem
|
|
{
|
|
[Dependency] private readonly PolymorphSystem _polymorphSystem = default!;
|
|
[Dependency] private readonly MetaDataSystem _metaDataSystem = default!;
|
|
[Dependency] private readonly ActionsSystem _actionsSystem = default!;
|
|
[Dependency] private readonly PopupSystem _popupSystem = default!;
|
|
|
|
/// <inheritdoc/>
|
|
public override void Initialize()
|
|
{
|
|
SubscribeLocalEvent<GerasComponent, MorphIntoGeras>(OnMorphIntoGeras);
|
|
SubscribeLocalEvent<GerasComponent, MapInitEvent>(OnMapInit);
|
|
SubscribeLocalEvent<GerasComponent, EntityZombifiedEvent>(OnZombification);
|
|
}
|
|
|
|
private void OnZombification(EntityUid uid, GerasComponent component, EntityZombifiedEvent args)
|
|
{
|
|
_actionsSystem.RemoveAction(uid, component.GerasActionEntity);
|
|
}
|
|
|
|
private void OnMapInit(EntityUid uid, GerasComponent component, MapInitEvent args)
|
|
{
|
|
// try to add geras action
|
|
_actionsSystem.AddAction(uid, ref component.GerasActionEntity, component.GerasAction);
|
|
}
|
|
|
|
private void OnMorphIntoGeras(EntityUid uid, GerasComponent component, MorphIntoGeras args)
|
|
{
|
|
if (HasComp<ZombieComponent>(uid))
|
|
return; // i hate zomber.
|
|
|
|
var ent = _polymorphSystem.PolymorphEntity(uid, component.GerasPolymorphId);
|
|
|
|
if (!ent.HasValue)
|
|
return;
|
|
|
|
_popupSystem.PopupEntity(Loc.GetString("geras-popup-morph-message-others", ("entity", ent.Value)), ent.Value, Filter.PvsExcept(ent.Value), true);
|
|
_popupSystem.PopupEntity(Loc.GetString("geras-popup-morph-message-user"), ent.Value, ent.Value);
|
|
|
|
args.Handled = true;
|
|
}
|
|
}
|