Fix for examine actor being gone deleting temporary profile for original actor
This commit is contained in:
@@ -145,6 +145,7 @@ public partial class CustomizePlusIpc
|
|||||||
[EzIPC("Profile.SetTemporaryProfileOnCharacter")]
|
[EzIPC("Profile.SetTemporaryProfileOnCharacter")]
|
||||||
private (int, Guid?) SetTemporaryProfileOnCharacter(Character character, string profileJson)
|
private (int, Guid?) SetTemporaryProfileOnCharacter(Character character, string profileJson)
|
||||||
{
|
{
|
||||||
|
//todo: do not allow to set temporary profile on reserved actors (examine, etc)
|
||||||
if (character == null)
|
if (character == null)
|
||||||
return ((int)ErrorCode.InvalidCharacter, null);
|
return ((int)ErrorCode.InvalidCharacter, null);
|
||||||
|
|
||||||
|
|||||||
@@ -583,9 +583,18 @@ public class ProfileManager : IDisposable
|
|||||||
|
|
||||||
var profile = armature!.Profile;
|
var profile = armature!.Profile;
|
||||||
|
|
||||||
|
if (!profile.IsTemporary)
|
||||||
|
return;
|
||||||
|
|
||||||
|
//Do not proceed unless there are no armatures left
|
||||||
|
//because this might be the case of examine window actor being gone.
|
||||||
|
//Profiles for those are shared with the original actor.
|
||||||
|
if (profile.Armatures.Count > 0)
|
||||||
|
return;
|
||||||
|
|
||||||
//todo: TemporaryProfileDeleted ends up calling this again, fix this.
|
//todo: TemporaryProfileDeleted ends up calling this again, fix this.
|
||||||
//Profiles.Remove check won't allow for infinite loop but this isn't good anyway
|
//Profiles.Remove check won't allow for infinite loop but this isn't good anyway
|
||||||
if (!profile.IsTemporary || !Profiles.Remove(profile))
|
if (!Profiles.Remove(profile))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
_logger.Debug($"ProfileManager.OnArmatureChange: Removed unused temporary profile for {profile.CharacterName}");
|
_logger.Debug($"ProfileManager.OnArmatureChange: Removed unused temporary profile for {profile.CharacterName}");
|
||||||
|
|||||||
Reference in New Issue
Block a user