Development Merge 2026.04.03 #8

Merged
Syntriax merged 51 commits from development into main 2026-04-03 14:08:02 +02:00
3 changed files with 7 additions and 4 deletions
Showing only changes of commit e84c6edce1 - Show all commits

View File

@@ -3,7 +3,7 @@ namespace Engine.Core;
/// <summary> /// <summary>
/// Represents any instance in the engine with an id. /// Represents any instance in the engine with an id.
/// </summary> /// </summary>
public interface IIdentifiable : System.IComparable<IIdentifiable> public interface IIdentifiable
{ {
/// <summary> /// <summary>
/// Event triggered when the <see cref="Id"/> of the <see cref="IIdentifiable"/> changes. /// Event triggered when the <see cref="Id"/> of the <see cref="IIdentifiable"/> changes.

View File

@@ -101,6 +101,4 @@ public abstract class BaseEntity : IEntity
protected BaseEntity() => Id = Guid.NewGuid().ToString("D"); protected BaseEntity() => Id = Guid.NewGuid().ToString("D");
protected BaseEntity(string id) => Id = id; protected BaseEntity(string id) => Id = id;
public int CompareTo(IIdentifiable? other) => Id.CompareTo(other?.Id);
} }

View File

@@ -3,5 +3,10 @@ namespace Engine.Core;
public static class IdentifiableExtensions public static class IdentifiableExtensions
{ {
public static bool IsIdentical(this IIdentifiable? left, IIdentifiable? right) public static bool IsIdentical(this IIdentifiable? left, IIdentifiable? right)
=> left?.CompareTo(right) == 0; {
if (left == null || right == null)
return false;
return left?.Id?.CompareTo(right?.Id) == 0;
}
} }