91 lines
2.8 KiB
C#
91 lines
2.8 KiB
C#
using System.Numerics;
|
|
|
|
namespace AcDream.Plugin.Abstractions;
|
|
|
|
/// <summary>The trajectory family VTank asks the client to validate.</summary>
|
|
public enum PluginProjectilePathKind
|
|
{
|
|
Straight = 0,
|
|
Arc,
|
|
Missile,
|
|
}
|
|
|
|
/// <summary>Why a projectile-path query did or did not admit the shot.</summary>
|
|
public enum PluginProjectilePathStatus
|
|
{
|
|
Unavailable = 0,
|
|
Clear,
|
|
Blocked,
|
|
InvalidTarget,
|
|
BudgetExceeded,
|
|
Error,
|
|
}
|
|
|
|
/// <summary>One VTank collision-debug marker in client world coordinates.</summary>
|
|
public readonly record struct PluginProjectileDebugSample(
|
|
Vector3 WorldPosition,
|
|
bool IsClear,
|
|
float Radius);
|
|
|
|
/// <summary>
|
|
/// Detached result of one bounded collision probe. The host reports geometry;
|
|
/// the plugin still decides whether to cast, fire, or choose a fallback.
|
|
/// </summary>
|
|
public readonly record struct PluginProjectilePathResult(
|
|
PluginProjectilePathStatus Status,
|
|
int CollisionChecks = 0,
|
|
uint BlockingObjectId = 0u,
|
|
string? Notice = null)
|
|
{
|
|
public bool IsClear => Status == PluginProjectilePathStatus.Clear;
|
|
public IReadOnlyList<PluginProjectileDebugSample> DebugSamples
|
|
{ get; init; } = Array.Empty<PluginProjectileDebugSample>();
|
|
}
|
|
|
|
/// <summary>
|
|
/// Canonical client-world projectile collision projection. Implementations
|
|
/// must use the same resident collision world as ordinary client physics and
|
|
/// must never fabricate a successful path when that world is unavailable.
|
|
/// </summary>
|
|
public interface IProjectileAutomation
|
|
{
|
|
bool IsAvailable => false;
|
|
|
|
PluginProjectilePathResult EvaluatePath(
|
|
uint targetObjectId,
|
|
PluginProjectilePathKind kind,
|
|
PluginAttackHeight targetHeight,
|
|
float projectileRadius,
|
|
float stepDistance,
|
|
int maximumCollisionChecks) =>
|
|
new(PluginProjectilePathStatus.Unavailable);
|
|
|
|
/// <summary>
|
|
/// Same bounded query with VTank's optional per-quantum debug markers.
|
|
/// Older hosts safely fall back to the ordinary result.
|
|
/// </summary>
|
|
PluginProjectilePathResult EvaluatePathWithDiagnostics(
|
|
uint targetObjectId,
|
|
PluginProjectilePathKind kind,
|
|
PluginAttackHeight targetHeight,
|
|
float projectileRadius,
|
|
float stepDistance,
|
|
int maximumCollisionChecks) =>
|
|
EvaluatePath(
|
|
targetObjectId,
|
|
kind,
|
|
targetHeight,
|
|
projectileRadius,
|
|
stepDistance,
|
|
maximumCollisionChecks);
|
|
|
|
/// <summary>
|
|
/// Presents a transient copy of diagnostic samples in the game view.
|
|
/// Graphical hosts draw VTank's green clear/red blocked markers; headless
|
|
/// and older hosts deliberately ignore the request.
|
|
/// </summary>
|
|
void ShowDebugSamples(
|
|
IReadOnlyList<PluginProjectileDebugSample> samples)
|
|
{
|
|
}
|
|
}
|