fix: properly respect AllowRepeatedMorphs (#39411)
* fix: properly respect AllowRepeatedMorphs * feat: add IgnoreAllowRepeatedMorphs
This commit is contained in:
@@ -170,15 +170,18 @@ public sealed partial class PolymorphSystem : EntitySystem
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Polymorphs the target entity into another
|
||||
/// Polymorphs the target entity into another.
|
||||
/// </summary>
|
||||
/// <param name="uid">The entity that will be transformed</param>
|
||||
/// <param name="configuration">Polymorph data</param>
|
||||
/// <returns></returns>
|
||||
/// <param name="configuration">The new polymorph configuration</param>
|
||||
/// <returns>The new entity, or null if the polymorph failed.</returns>
|
||||
public EntityUid? PolymorphEntity(EntityUid uid, PolymorphConfiguration configuration)
|
||||
{
|
||||
// if it's already morphed, don't allow it again with this condition active.
|
||||
if (!configuration.AllowRepeatedMorphs && HasComp<PolymorphedEntityComponent>(uid))
|
||||
// If they're morphed, check their current config to see if they can be
|
||||
// morphed again
|
||||
if (!configuration.IgnoreAllowRepeatedMorphs
|
||||
&& TryComp<PolymorphedEntityComponent>(uid, out var currentPoly)
|
||||
&& !currentPoly.Configuration.AllowRepeatedMorphs)
|
||||
return null;
|
||||
|
||||
// If this polymorph has a cooldown, check if that amount of time has passed since the
|
||||
|
||||
Reference in New Issue
Block a user