/// <summary> /// Register a <see cref="Component"/> that will take part in the extended data system /// </summary> /// <typeparam name="T">Type of the participant to register</typeparam> public static void RegisterDataParticipant <T>() where T : Component, ExtendedData.Participant { GetSaveInfo().onExtendedActorDataLoaded += (model, obj, tag) => { if (tag.HasPiece(ExtendedDataUtils.GetParticipantName(typeof(T)))) { obj.AddComponent <T>(); } }; }
static bool HasValidDataForParticipant(Participant p, CompoundDataPiece piece) { var modid = ExtendedDataUtils.GetModForParticipant(p)?.ModInfo.Id ?? "srml"; return(piece.HasPiece(modid) && piece.GetCompoundPiece(modid).HasPiece(ExtendedDataUtils.GetParticipantName(p))); }