Don't add trait comps if present (#16424)

This commit is contained in:
metalgearsloth 2023-05-14 21:18:18 +10:00 committed by GitHub
parent 630ac19309
commit d254a7d2cb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 0 deletions

View File

@ -40,6 +40,9 @@ public sealed class TraitSystem : EntitySystem
// Add all components required by the prototype
foreach (var entry in traitPrototype.Components.Values)
{
if (HasComp(args.Mob, entry.Component.GetType()))
continue;
var comp = (Component) _serializationManager.CreateCopy(entry.Component, notNullableOverride: true);
comp.Owner = args.Mob;
EntityManager.AddComponent(args.Mob, comp);