refactor: restructure interaction system into clean layers

This commit is contained in:
2026-08-28 22:35:09 +02:00
parent 3127c1b4af
commit 9fdd565637
33 changed files with 474 additions and 288 deletions
@@ -1,6 +1,6 @@
namespace Game.Features.Interactions.Contracts;
public interface IInteractionService
public interface IInteractionHandler
{
InteractionResult TryInteract(InteractionRequest request);
}
@@ -0,0 +1,8 @@
namespace Game.Features.Interactions.Contracts;
public interface IInteractionRegistry
{
void Register(IInteractionTarget target);
void Unregister(InteractionTargetId targetId);
bool TryGetTarget(InteractionTargetId targetId, out IInteractionTarget target);
}
@@ -0,0 +1 @@
uid://baejppnflmpnn
@@ -1,8 +1,12 @@
using Game.Features.Players.Contracts;
namespace Game.Features.Interactions.Contracts;
public interface IInteractionTarget
{
InteractionTargetId Id { get; }
InteractionTargetId InteractionTargetId { get; }
bool CanInteract { get; }
InteractionPrompt Prompt { get; }
InteractionResult Execute(PlayerId playerId);
}
@@ -1,6 +0,0 @@
namespace Game.Features.Interactions.Contracts;
public interface IInteractionWorld
{
InteractionResult TryInteract(InteractionRequest request);
}
@@ -1 +0,0 @@
uid://d7k1x6m4v9q2b
@@ -1,8 +1,10 @@
using System;
using Game.Shared.Domain;
namespace Game.Features.Interactions.Contracts;
public readonly record struct InteractionTargetId(Guid Value)
public readonly record struct InteractionTargetId(InstanceId Value)
{
public static InteractionTargetId From(InstanceId value) => new(value);
public override string ToString() => Value.ToString();
}