More IPC work

Additional checks to make sure profile update event is not getting sent when editor and default profile is involved
Selected default profile can no longer be changed if profile set as default is enabled
Fixed "Limit to my creatures" not ignoring objects with IdentifierType != Owned
IPC test tab no longer initializes IPC if debug mode is disabled
Fixed incorrect warning priority in plugin state control
Some slight text changes
This commit is contained in:
RisaDev
2024-03-26 00:14:29 +03:00
parent da252a57cf
commit abb92e741e
7 changed files with 65 additions and 44 deletions

View File

@@ -152,12 +152,6 @@ public partial class CustomizePlusIpc
if (!actor.Valid)
return ((int)ErrorCode.InvalidCharacter, null);
/*if (character == _objectTable[0])
{
_logger.Error($"Received request to set profile on local character, this is not allowed");
return;
}*/
try
{
IPCCharacterProfile? profile;
@@ -204,12 +198,6 @@ public partial class CustomizePlusIpc
if (!actor.Valid)
return (int)ErrorCode.InvalidCharacter;
/*if (character == _objectTable[0])
{
_logger.Error($"Received request to revert profile on local character, this is not allowed");
return;
}*/
try
{
_profileManager.RemoveTemporaryProfile(actor);
@@ -269,7 +257,7 @@ public partial class CustomizePlusIpc
}
}
//warn: limitation - ignores default profiles but why you would use default profile on your own character
//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)
{
string currentPlayerName = _gameObjectService.GetCurrentPlayerName();
@@ -295,25 +283,34 @@ public partial class CustomizePlusIpc
if (activeProfile != null)
{
if (activeProfile == _profileManager.DefaultProfile)
return; //default profiles are not allowed to be sent
if (activeProfile.ProfileType == ProfileType.Editor)
if (activeProfile == _profileManager.DefaultProfile || activeProfile.ProfileType == ProfileType.Editor)
{
if (activeProfile == oldProfile) //ignore any changes while player is in editor
//ignore any changes while player is in editor or if player changes between default profiles
//also do not send event if there were no active profile before
if (activeProfile == oldProfile || oldProfile == null)
return;
OnProfileUpdateInternal(localPlayerCharacter, null); //send empty profile when player enters editor
OnProfileUpdateInternal(localPlayerCharacter, null); //send empty profile when player enters editor or turns on default profile
return;
}
}
//do not send event if we are exiting editor or disabling default profile and don't have any active profile
if (oldProfile != null &&
(oldProfile == _profileManager.DefaultProfile || oldProfile.ProfileType == ProfileType.Editor) &&
activeProfile == null)
return;
OnProfileUpdateInternal(localPlayerCharacter, activeProfile);
return;
}
if (type == ArmatureChanged.Type.Deleted)
{
//Do not send event if default or editor profile was used
if (armature.Profile == _profileManager.DefaultProfile || armature.Profile.ProfileType == ProfileType.Editor)
return;
OnProfileUpdateInternal(localPlayerCharacter, null);
return;
}