/// <summary>
/// Try to get a single component from the source entity/prototype.
/// </summary>
- private bool GetSrcComp<T>(ChameleonDisguiseComponent comp, [NotNullWhen(true)] out T? src) where T: Component
+ private bool GetSrcComp<T>(ChameleonDisguiseComponent comp, [NotNullWhen(true)] out T? src) where T : Component, new()
{
- src = null;
if (TryComp(comp.SourceEntity, out src))
return true;
- if (comp.SourceProto is not {} protoId)
+ if (comp.SourceProto is not { } protoId)
return false;
if (!_proto.TryIndex<EntityPrototype>(protoId, out var proto))
return false;
- return proto.TryGetComponent(out src);
+ return proto.TryGetComponent(out src, EntityManager.ComponentFactory);
}
}