Don't add trait comps if present (#16424)
This commit is contained in:
@@ -40,6 +40,9 @@ public sealed class TraitSystem : EntitySystem
|
|||||||
// Add all components required by the prototype
|
// Add all components required by the prototype
|
||||||
foreach (var entry in traitPrototype.Components.Values)
|
foreach (var entry in traitPrototype.Components.Values)
|
||||||
{
|
{
|
||||||
|
if (HasComp(args.Mob, entry.Component.GetType()))
|
||||||
|
continue;
|
||||||
|
|
||||||
var comp = (Component) _serializationManager.CreateCopy(entry.Component, notNullableOverride: true);
|
var comp = (Component) _serializationManager.CreateCopy(entry.Component, notNullableOverride: true);
|
||||||
comp.Owner = args.Mob;
|
comp.Owner = args.Mob;
|
||||||
EntityManager.AddComponent(args.Mob, comp);
|
EntityManager.AddComponent(args.Mob, comp);
|
||||||
|
|||||||
Reference in New Issue
Block a user