feat: add player-aware world interaction system

This commit is contained in:
2026-08-23 21:37:12 +02:00
parent 1445fc014f
commit 25e32f20d9
28 changed files with 255 additions and 0 deletions
@@ -0,0 +1,6 @@
namespace Game.Features.Interactions.Contracts;
public interface IInteractionService
{
InteractionResult TryInteract(InteractionRequest request);
}
@@ -0,0 +1 @@
uid://a3n8v5r1q7m9c
@@ -0,0 +1,8 @@
namespace Game.Features.Interactions.Contracts;
public interface IInteractionTarget
{
InteractionTargetId Id { get; }
bool CanInteract { get; }
InteractionPrompt Prompt { get; }
}
@@ -0,0 +1 @@
uid://c7p2y5n8f1v6m
@@ -0,0 +1,6 @@
namespace Game.Features.Interactions.Contracts;
public interface IInteractionWorld
{
InteractionResult TryInteract(InteractionRequest request);
}
@@ -0,0 +1 @@
uid://d7k1x6m4v9q2b
@@ -0,0 +1,3 @@
namespace Game.Features.Interactions.Contracts;
public readonly record struct InteractionPrompt(string Text);
@@ -0,0 +1 @@
uid://b3m8r1x6d9w4k
@@ -0,0 +1,5 @@
using Game.Features.Players.Contracts;
namespace Game.Features.Interactions.Contracts;
public readonly record struct InteractionRequest(PlayerId PlayerId, InteractionTargetId TargetId);
@@ -0,0 +1 @@
uid://e2q7k5n1w8m4d
@@ -0,0 +1,10 @@
namespace Game.Features.Interactions.Contracts;
public readonly record struct InteractionResult(InteractionStatus Status, string Message = "")
{
public bool Success => Status == InteractionStatus.Success;
public static InteractionResult Ok() => new(InteractionStatus.Success);
public static InteractionResult Fail(InteractionStatus status, string message) => new(status, message);
}
@@ -0,0 +1 @@
uid://f9w2d7k4m6q1x
@@ -0,0 +1,9 @@
namespace Game.Features.Interactions.Contracts;
public enum InteractionStatus
{
Success,
TargetNotFound,
Unavailable,
Rejected
}
@@ -0,0 +1 @@
uid://b4y9m3r6v1c8p
@@ -0,0 +1,8 @@
using System;
namespace Game.Features.Interactions.Contracts;
public readonly record struct InteractionTargetId(Guid Value)
{
public override string ToString() => Value.ToString();
}
@@ -0,0 +1 @@
uid://c6m1v8q4r9x2k