Files
dota_factory/src/lib/sim/EntityHitTest.h

30 lines
1.3 KiB
C++

#pragma once
#include <vector>
#include <QPoint>
#include <QRectF>
#include <QVector2D>
#include "entt/entity/entity.hpp"
class EntityAdmin;
entt::entity entityAtWorldPos(EntityAdmin& admin, QVector2D worldPos);
// Returns the nearest piece of debris whose center is within the debris pick radius of
// worldPos, or entt::null if none (REQ-UI-DEBRIS-CLICK-SELECT). Debris is picked only
// after actors: entityAtWorldPos never returns debris (debris has no HealthComponent).
entt::entity debrisAtWorldPos(EntityAdmin& admin, QVector2D worldPos);
// Returns every piece of debris the selection box covers — that is, whose position it
// contains, per boxCoversPoint (REQ-UI-DEBRIS-MULTI-SELECT). `worldBox` is in world
// coordinates and normalized; it is not snapped to tiles.
std::vector<entt::entity> debrisInBox(EntityAdmin& admin, const QRectF& worldBox);
// Returns every living actor (ship or defence station, player or enemy) the selection
// box covers (REQ-UI-MULTI-SELECT, REQ-UI-ENTITY-CLICK-SELECT): a ship when the box
// contains its position, a station when the box overlaps any of its body cells — the
// two rules of SelectionBox.h. Dead actors (hp <= 0) and the HQ proxy are excluded.
std::vector<entt::entity> actorsInBox(EntityAdmin& admin, const QRectF& worldBox);