- UZeusAOIComponent (Game/Network): componente de gameplay do player local com plus de debug. Overlays via DrawDebug* (esfera AOI real; spawn/cell/handoff placeholders) dirigidos pela UI via IZeusAOIDebugTarget + console vars. Estado persiste no componente entre aberturas do menu (IsOverlayEnabled). - AZeusCharacter: anexa o componente + abre/fecha o painel no F8 (UIOnly trava o jogo; Esc/F8 fecham); LoadClass lazy do painel no content do PLUGIN (/ZeusAdminTools/UI/WBP_AdminToolsAIO). - ZMMO.Build.cs: depende de ZeusAdminToolsRuntime. - UIProgressBar_Base: rename EaseOutCubic -> EaseOutCubicPB (fix unity-build). - ZMMO.uproject: remove entrada NwiroIntegrationKit. A UI e o C++ do plugin ZeusAdminTools vivem no repo Server (plugin autocontido). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
135 lines
5.2 KiB
C++
135 lines
5.2 KiB
C++
// Copyright Zeus Server Engine. All rights reserved.
|
|
|
|
#include "ZeusAOIComponent.h"
|
|
|
|
#include "DrawDebugHelpers.h"
|
|
#include "GameFramework/Actor.h"
|
|
|
|
// Console vars — espelham as flags do painel (overlay liga se flag OU CVar).
|
|
static TAutoConsoleVariable<int32> CVarShowAOI(
|
|
TEXT("zeus.debug.aoi"), 0, TEXT("Desenha a esfera de AOI do player local."), ECVF_Default);
|
|
static TAutoConsoleVariable<int32> CVarShowSpawn(
|
|
TEXT("zeus.debug.spawn"), 0, TEXT("Desenha a zona de spawn (placeholder)."), ECVF_Default);
|
|
static TAutoConsoleVariable<int32> CVarShowCell(
|
|
TEXT("zeus.debug.cell"), 0, TEXT("Desenha os bounds da celula (placeholder)."), ECVF_Default);
|
|
static TAutoConsoleVariable<int32> CVarShowProxy(
|
|
TEXT("zeus.debug.proxy"), 0, TEXT("Desenha labels de proxy (TODO)."), ECVF_Default);
|
|
static TAutoConsoleVariable<int32> CVarShowHandoff(
|
|
TEXT("zeus.debug.handoff"), 0, TEXT("Desenha a linha de handoff (placeholder)."), ECVF_Default);
|
|
static TAutoConsoleVariable<int32> CVarShowDrift(
|
|
TEXT("zeus.debug.drift"), 0, TEXT("Desenha o drift autoritativo (TODO)."), ECVF_Default);
|
|
|
|
namespace
|
|
{
|
|
const FColor kColorAOI(93, 213, 255);
|
|
const FColor kColorSpawn(122, 219, 138);
|
|
const FColor kColorCell(232, 192, 96);
|
|
const FColor kColorHandoff(255, 155, 190);
|
|
}
|
|
|
|
UZeusAOIComponent::UZeusAOIComponent()
|
|
{
|
|
PrimaryComponentTick.bCanEverTick = true;
|
|
PrimaryComponentTick.bStartWithTickEnabled = true;
|
|
SetIsReplicatedByDefault(false); // debug/cliente; gameplay AOI real entra depois
|
|
}
|
|
|
|
void UZeusAOIComponent::TickComponent(float DeltaTime, ELevelTick TickType,
|
|
FActorComponentTickFunction* ThisTickFunction)
|
|
{
|
|
Super::TickComponent(DeltaTime, TickType, ThisTickFunction);
|
|
|
|
if (AnyOverlayActive())
|
|
{
|
|
DrawOverlays();
|
|
}
|
|
}
|
|
|
|
bool UZeusAOIComponent::ResolveOverlay(EZeusAOIOverlay Overlay) const
|
|
{
|
|
switch (Overlay)
|
|
{
|
|
case EZeusAOIOverlay::AOIRadius: return bShowAOIRadius || CVarShowAOI.GetValueOnGameThread() > 0;
|
|
case EZeusAOIOverlay::SpawnZone: return bShowSpawnZone || CVarShowSpawn.GetValueOnGameThread() > 0;
|
|
case EZeusAOIOverlay::CellBounds: return bShowCellBounds || CVarShowCell.GetValueOnGameThread() > 0;
|
|
case EZeusAOIOverlay::ProxyLabels: return bShowProxyLabels || CVarShowProxy.GetValueOnGameThread() > 0;
|
|
case EZeusAOIOverlay::HandoffLine: return bShowHandoffLine || CVarShowHandoff.GetValueOnGameThread() > 0;
|
|
case EZeusAOIOverlay::AuthDrift: return bShowAuthDrift || CVarShowDrift.GetValueOnGameThread() > 0;
|
|
default: return false;
|
|
}
|
|
}
|
|
|
|
bool UZeusAOIComponent::AnyOverlayActive() const
|
|
{
|
|
return ResolveOverlay(EZeusAOIOverlay::AOIRadius)
|
|
|| ResolveOverlay(EZeusAOIOverlay::SpawnZone)
|
|
|| ResolveOverlay(EZeusAOIOverlay::CellBounds)
|
|
|| ResolveOverlay(EZeusAOIOverlay::ProxyLabels)
|
|
|| ResolveOverlay(EZeusAOIOverlay::HandoffLine)
|
|
|| ResolveOverlay(EZeusAOIOverlay::AuthDrift);
|
|
}
|
|
|
|
void UZeusAOIComponent::DrawOverlays()
|
|
{
|
|
const AActor* Owner = GetOwner();
|
|
UWorld* World = GetWorld();
|
|
if (!Owner || !World) { return; }
|
|
|
|
const FVector Loc = Owner->GetActorLocation();
|
|
|
|
if (ResolveOverlay(EZeusAOIOverlay::AOIRadius))
|
|
{
|
|
DrawDebugSphere(World, Loc, AOIRadiusCm, 32, kColorAOI, false, -1.0f, 0, LineThickness);
|
|
}
|
|
if (ResolveOverlay(EZeusAOIOverlay::SpawnZone))
|
|
{
|
|
// PLACEHOLDER: box em volta do player. TODO spawn zones reais do servidor.
|
|
DrawDebugBox(World, Loc, FVector(SpawnZoneExtentCm), kColorSpawn, false, -1.0f, 0, LineThickness);
|
|
}
|
|
if (ResolveOverlay(EZeusAOIOverlay::CellBounds))
|
|
{
|
|
// PLACEHOLDER: box grande centrada no player. TODO bounds reais da cell.
|
|
DrawDebugBox(World, Loc, FVector(CellBoundsExtentCm, CellBoundsExtentCm, 2000.0f),
|
|
kColorCell, false, -1.0f, 0, LineThickness);
|
|
}
|
|
if (ResolveOverlay(EZeusAOIOverlay::HandoffLine))
|
|
{
|
|
// PLACEHOLDER: vetor pra frente. TODO apontar pro centro da cell vizinha.
|
|
const FVector End = Loc + Owner->GetActorForwardVector() * AOIRadiusCm;
|
|
DrawDebugDirectionalArrow(World, Loc, End, 200.0f, kColorHandoff, false, -1.0f, 0, LineThickness);
|
|
}
|
|
// ProxyLabels / AuthDrift: TODO (precisam do registry de proxies/snapshots).
|
|
}
|
|
|
|
void UZeusAOIComponent::SetOverlayEnabled_Implementation(EZeusAOIOverlay Overlay, bool bEnabled)
|
|
{
|
|
switch (Overlay)
|
|
{
|
|
case EZeusAOIOverlay::AOIRadius: bShowAOIRadius = bEnabled; break;
|
|
case EZeusAOIOverlay::SpawnZone: bShowSpawnZone = bEnabled; break;
|
|
case EZeusAOIOverlay::CellBounds: bShowCellBounds = bEnabled; break;
|
|
case EZeusAOIOverlay::ProxyLabels: bShowProxyLabels = bEnabled; break;
|
|
case EZeusAOIOverlay::HandoffLine: bShowHandoffLine = bEnabled; break;
|
|
case EZeusAOIOverlay::AuthDrift: bShowAuthDrift = bEnabled; break;
|
|
default: break;
|
|
}
|
|
}
|
|
|
|
void UZeusAOIComponent::SetAllOverlays_Implementation(bool bEnabled)
|
|
{
|
|
bShowAOIRadius = bShowSpawnZone = bShowCellBounds = bEnabled;
|
|
bShowProxyLabels = bShowHandoffLine = bShowAuthDrift = bEnabled;
|
|
}
|
|
|
|
bool UZeusAOIComponent::IsOverlayEnabled_Implementation(EZeusAOIOverlay Overlay) const
|
|
{
|
|
// Reflete o estado real (flag OU CVar) p/ a UI mostrar o que esta' desenhando.
|
|
return ResolveOverlay(Overlay);
|
|
}
|
|
|
|
int32 UZeusAOIComponent::GetEnabledOverlayCount() const
|
|
{
|
|
return (bShowAOIRadius ? 1 : 0) + (bShowSpawnZone ? 1 : 0) + (bShowCellBounds ? 1 : 0)
|
|
+ (bShowProxyLabels ? 1 : 0) + (bShowHandoffLine ? 1 : 0) + (bShowAuthDrift ? 1 : 0);
|
|
}
|