Rename CompareIgnoringOwnership and FindActorsByIdentifier
This commit is contained in:
@@ -261,7 +261,7 @@ public partial class CustomizePlusIpc
|
||||
//warn: intended limitation - ignores default profiles because why you would use default profile on your own character
|
||||
private void OnArmatureChanged(ArmatureChanged.Type type, Armature armature, object? arg3)
|
||||
{
|
||||
if (!armature.ActorIdentifier.CompareIgnoringOwnership(_gameObjectService.GetCurrentPlayerActorIdentifier()))
|
||||
if (armature.ActorIdentifier != _gameObjectService.GetCurrentPlayerActorIdentifier())
|
||||
return;
|
||||
|
||||
if (armature.ActorIdentifier.HomeWorld == WorldId.AnyWorld) //Only Cutscene/GPose actors have world set to AnyWorld
|
||||
|
||||
@@ -539,7 +539,7 @@ public unsafe sealed class ArmatureManager : IDisposable
|
||||
{
|
||||
(var armatureActorIdentifier, _) = _gameObjectService.GetTrueActorForSpecialTypeActor(kvPair.Key);
|
||||
|
||||
if (actorIdentifier.IsValid && armatureActorIdentifier.CompareIgnoringOwnership(actorIdentifier) &&
|
||||
if (actorIdentifier.IsValid && armatureActorIdentifier.MatchesIgnoringOwnership(actorIdentifier) &&
|
||||
(armatureActorIdentifier.Type != IdentifierType.Owned || armatureActorIdentifier.IsOwnedByLocalPlayer()))
|
||||
yield return kvPair.Value;
|
||||
}
|
||||
|
||||
@@ -32,6 +32,11 @@ public class PluginConfiguration : IPluginConfiguration, ISavable
|
||||
/// </summary>
|
||||
public Guid DefaultProfile { get; set; } = Guid.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// Id of the profile applied to any character user logins with. Can be set to Empty to disable this feature.
|
||||
/// </summary>
|
||||
public Guid DefaultLocalPlayerProfile { get; set; } = Guid.Empty;
|
||||
|
||||
[Serializable]
|
||||
public class ChangelogSettingsEntries
|
||||
{
|
||||
|
||||
@@ -85,9 +85,9 @@ public class GameObjectService
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Searches using CompareIgnoringOwnership
|
||||
/// Searches using MatchesIgnoringOwnership
|
||||
/// </summary>
|
||||
public IEnumerable<(ActorIdentifier, Actor)> FindActorsByIdentifier(ActorIdentifier identifier)
|
||||
public IEnumerable<(ActorIdentifier, Actor)> FindActorsByIdentifierIgnoringOwnership(ActorIdentifier identifier)
|
||||
{
|
||||
if (!identifier.IsValid)
|
||||
yield break;
|
||||
@@ -103,7 +103,7 @@ public class GameObjectService
|
||||
if (!objectIdentifier.IsValid)
|
||||
continue;
|
||||
|
||||
if (identifier.CompareIgnoringOwnership(objectIdentifier))
|
||||
if (identifier.MatchesIgnoringOwnership(objectIdentifier))
|
||||
{
|
||||
if (kvPair.Value.Objects.Count > 1) //in gpose we can have more than a single object for one actor
|
||||
foreach (var obj in kvPair.Value.Objects)
|
||||
|
||||
@@ -172,7 +172,7 @@ public partial class ProfileManager : IDisposable
|
||||
/// </summary>
|
||||
public void ChangeCharacter(Profile profile, ActorIdentifier actorIdentifier)
|
||||
{
|
||||
if (!actorIdentifier.IsValid || actorIdentifier.CompareIgnoringOwnership(profile.Character))
|
||||
if (!actorIdentifier.IsValid || actorIdentifier.MatchesIgnoringOwnership(profile.Character))
|
||||
return;
|
||||
|
||||
var oldCharacter = profile.Character;
|
||||
@@ -227,7 +227,7 @@ public partial class ProfileManager : IDisposable
|
||||
_logger.Debug($"Setting {profile} as enabled...");
|
||||
|
||||
foreach (var otherProfile in Profiles
|
||||
.Where(x => x.Character.CompareIgnoringOwnership(profile.Character) && x != profile && x.Enabled && !x.IsTemporary))
|
||||
.Where(x => x.Character.MatchesIgnoringOwnership(profile.Character) && x != profile && x.Enabled && !x.IsTemporary))
|
||||
{
|
||||
_logger.Debug($"\t-> {otherProfile} disabled");
|
||||
SetEnabled(otherProfile, false);
|
||||
@@ -257,6 +257,7 @@ public partial class ProfileManager : IDisposable
|
||||
|
||||
public void SetApplyToCurrentlyActiveCharacter(Profile profile, bool value)
|
||||
{
|
||||
//todo: only one profile is allowed to be active for that setting
|
||||
if (profile.ApplyToCurrentlyActiveCharacter != value)
|
||||
{
|
||||
profile.ApplyToCurrentlyActiveCharacter = value;
|
||||
@@ -351,7 +352,7 @@ public partial class ProfileManager : IDisposable
|
||||
profile.ProfileType = ProfileType.Temporary;
|
||||
profile.Character = identifier.CreatePermanent(); //warn: identifier must not be AnyWorld or stuff will break!
|
||||
|
||||
var existingProfile = Profiles.FirstOrDefault(x => x.Character.CompareIgnoringOwnership(profile.Character) && x.IsTemporary);
|
||||
var existingProfile = Profiles.FirstOrDefault(x => x.Character.MatchesIgnoringOwnership(profile.Character) && x.IsTemporary);
|
||||
if (existingProfile != null)
|
||||
{
|
||||
_logger.Debug($"Temporary profile for {existingProfile.Character.Incognito(null)} already exists, removing...");
|
||||
@@ -409,7 +410,7 @@ public partial class ProfileManager : IDisposable
|
||||
if (!actorIdentifier.IsValid)
|
||||
return null;
|
||||
|
||||
var query = Profiles.Where(x => x.Character.CompareIgnoringOwnership(actorIdentifier) && !x.IsTemporary);
|
||||
var query = Profiles.Where(x => x.Character.MatchesIgnoringOwnership(actorIdentifier) && !x.IsTemporary);
|
||||
if (enabledOnly)
|
||||
query = query.Where(x => x.Enabled);
|
||||
|
||||
@@ -458,13 +459,13 @@ public partial class ProfileManager : IDisposable
|
||||
return true;
|
||||
|
||||
var currentPlayer = _actorManager.GetCurrentPlayer();
|
||||
return currentPlayer.IsValid && currentPlayer.CompareIgnoringOwnership(actorIdentifier);
|
||||
return currentPlayer.IsValid && currentPlayer.MatchesIgnoringOwnership(actorIdentifier);
|
||||
}
|
||||
|
||||
if (actorIdentifier.Type == IdentifierType.Owned && !actorIdentifier.IsOwnedByLocalPlayer())
|
||||
return false;
|
||||
|
||||
return profile.CharacterName.Text == name || profile.Character.CompareIgnoringOwnership(actorIdentifier);
|
||||
return profile.CharacterName.Text == name || profile.Character.MatchesIgnoringOwnership(actorIdentifier);
|
||||
}
|
||||
|
||||
if (_templateEditorManager.IsEditorActive && _templateEditorManager.EditorProfile.Enabled && IsProfileAppliesToCurrentActor(_templateEditorManager.EditorProfile))
|
||||
|
||||
@@ -76,7 +76,7 @@ public class TemplateEditorManager : IDisposable
|
||||
{
|
||||
//todo: check with mounts/companions
|
||||
var playerName = _gameObjectService.GetCurrentPlayerName();
|
||||
return _gameObjectService.FindActorsByIdentifier(Character)
|
||||
return _gameObjectService.FindActorsByIdentifierIgnoringOwnership(Character)
|
||||
.Where(x => x.Item1.Type != Penumbra.GameData.Enums.IdentifierType.Owned || x.Item1.IsOwnedByLocalPlayer())
|
||||
.Any();
|
||||
}
|
||||
|
||||
@@ -240,9 +240,9 @@ public class ProfileFileSystemSelector : FileSystemSelector<Profile, ProfileStat
|
||||
}
|
||||
|
||||
if (leaf.Value.Enabled)
|
||||
state.Color = leaf.Value.Character.CompareIgnoringOwnership(_gameObjectService.GetCurrentPlayerActorIdentifier()) ? ColorId.LocalCharacterEnabledProfile : ColorId.EnabledProfile;
|
||||
state.Color = leaf.Value.Character.MatchesIgnoringOwnership(_gameObjectService.GetCurrentPlayerActorIdentifier()) ? ColorId.LocalCharacterEnabledProfile : ColorId.EnabledProfile;
|
||||
else
|
||||
state.Color = leaf.Value.Character.CompareIgnoringOwnership(_gameObjectService.GetCurrentPlayerActorIdentifier()) ? ColorId.LocalCharacterDisabledProfile : ColorId.DisabledProfile;
|
||||
state.Color = leaf.Value.Character.MatchesIgnoringOwnership(_gameObjectService.GetCurrentPlayerActorIdentifier()) ? ColorId.LocalCharacterDisabledProfile : ColorId.DisabledProfile;
|
||||
|
||||
return ApplyStringFilters(leaf, leaf.Value);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user