polymorph popup fixes (#35796)

polymorph fixes
This commit is contained in:
slarticodefast
2025-03-12 19:48:45 +01:00
committed by GitHub
parent 45e5fbfcdf
commit d8ac1524ef
4 changed files with 24 additions and 5 deletions

View File

@@ -204,6 +204,12 @@ public sealed partial class PolymorphSystem : EntitySystem
var child = Spawn(configuration.Entity, _transform.GetMapCoordinates(uid, targetTransformComp), rotation: _transform.GetWorldRotation(uid));
if (configuration.PolymorphPopup != null)
_popup.PopupEntity(Loc.GetString(configuration.PolymorphPopup,
("parent", Identity.Entity(uid, EntityManager)),
("child", Identity.Entity(child, EntityManager))),
child);
MakeSentientCommand.MakeSentient(child, EntityManager);
var polymorphedComp = _compFact.GetComponent<PolymorphedEntityComponent>();
@@ -347,7 +353,8 @@ public sealed partial class PolymorphSystem : EntitySystem
var ev = new PolymorphedEvent(uid, parent, true);
RaiseLocalEvent(uid, ref ev);
_popup.PopupEntity(Loc.GetString("polymorph-revert-popup-generic",
if (component.Configuration.ExitPolymorphPopup != null)
_popup.PopupEntity(Loc.GetString(component.Configuration.ExitPolymorphPopup,
("parent", Identity.Entity(uid, EntityManager)),
("child", Identity.Entity(parent, EntityManager))),
parent);

View File

@@ -416,7 +416,7 @@ public abstract partial class SharedBuckleSystem
public bool TryUnbuckle(Entity<BuckleComponent?> buckle, EntityUid? user, bool popup)
{
if (!Resolve(buckle.Owner, ref buckle.Comp))
if (!Resolve(buckle.Owner, ref buckle.Comp, false))
return false;
if (!CanUnbuckle(buckle, user, popup, out var strap))

View File

@@ -128,6 +128,18 @@ public sealed partial record PolymorphConfiguration
/// </summary>
[DataField]
public SoundSpecifier? ExitPolymorphSound;
/// <summary>
/// If not null, this popup will be displayed when being polymorphed into something.
/// </summary>
[DataField]
public LocId? PolymorphPopup = "polymorph-popup-generic";
/// <summary>
/// If not null, this popup will be displayed when when being reverted from a polymorph.
/// </summary>
[DataField]
public LocId? ExitPolymorphPopup = "polymorph-revert-popup-generic";
}
public enum PolymorphInventoryChange : byte

View File

@@ -1,5 +1,5 @@
polymorph-self-action-name = Polymorph ({CAPITALIZE($target)})
polymorph-self-action-description = Instantly polymorph yourself into {$target}.
polymorph-popup-generic = {CAPITALIZE($parent)} turned into {$child}.
polymorph-revert-popup-generic = {CAPITALIZE($parent)} reverted back into {$child}.
polymorph-popup-generic = {CAPITALIZE(THE($parent))} turned into {$child}.
polymorph-revert-popup-generic = {CAPITALIZE(THE($parent))} reverted back into {$child}.