Rename ship/station scrap drop entities to "debris"
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
|
||||
#include "EntityAdmin.h"
|
||||
#include "PositionComponent.h"
|
||||
#include "ScrapDataComponent.h"
|
||||
#include "DebrisComponent.h"
|
||||
#include "ShipIdentityComponent.h"
|
||||
#include "StationBodyComponent.h"
|
||||
#include "HealthComponent.h"
|
||||
@@ -58,16 +58,16 @@ entt::entity entityAtWorldPos(EntityAdmin& admin, QVector2D worldPos)
|
||||
return bestShip;
|
||||
}
|
||||
|
||||
entt::entity scrapAtWorldPos(EntityAdmin& admin, QVector2D worldPos)
|
||||
entt::entity debrisAtWorldPos(EntityAdmin& admin, QVector2D worldPos)
|
||||
{
|
||||
// Slightly larger than the scrap's rendered radius (0.2 tiles) so small piles
|
||||
// Slightly larger than the debris's rendered radius (0.2 tiles) so small pieces
|
||||
// remain easy to click; tunable.
|
||||
constexpr float kScrapHitRadiusSquared = 0.35f * 0.35f;
|
||||
entt::entity bestScrap = entt::null;
|
||||
float bestDistSquared = kScrapHitRadiusSquared;
|
||||
constexpr float kDebrisHitRadiusSquared = 0.35f * 0.35f;
|
||||
entt::entity bestDebris = entt::null;
|
||||
float bestDistSquared = kDebrisHitRadiusSquared;
|
||||
|
||||
admin.forEach<ScrapDataComponent, PositionComponent>(
|
||||
[&](entt::entity entity, const ScrapDataComponent& /*sd*/, const PositionComponent& pos)
|
||||
admin.forEach<DebrisComponent, PositionComponent>(
|
||||
[&](entt::entity entity, const DebrisComponent& /*sd*/, const PositionComponent& pos)
|
||||
{
|
||||
const float dx = pos.value.x() - worldPos.x();
|
||||
const float dy = pos.value.y() - worldPos.y();
|
||||
@@ -75,14 +75,14 @@ entt::entity scrapAtWorldPos(EntityAdmin& admin, QVector2D worldPos)
|
||||
if (distSquared < bestDistSquared)
|
||||
{
|
||||
bestDistSquared = distSquared;
|
||||
bestScrap = entity;
|
||||
bestDebris = entity;
|
||||
}
|
||||
});
|
||||
|
||||
return bestScrap;
|
||||
return bestDebris;
|
||||
}
|
||||
|
||||
std::vector<entt::entity> scrapInBox(EntityAdmin& admin, QPoint tileA, QPoint tileB)
|
||||
std::vector<entt::entity> debrisInBox(EntityAdmin& admin, QPoint tileA, QPoint tileB)
|
||||
{
|
||||
const int minX = std::min(tileA.x(), tileB.x());
|
||||
const int maxX = std::max(tileA.x(), tileB.x());
|
||||
@@ -90,8 +90,8 @@ std::vector<entt::entity> scrapInBox(EntityAdmin& admin, QPoint tileA, QPoint ti
|
||||
const int maxY = std::max(tileA.y(), tileB.y());
|
||||
|
||||
std::vector<entt::entity> result;
|
||||
admin.forEach<ScrapDataComponent, PositionComponent>(
|
||||
[&](entt::entity entity, const ScrapDataComponent& /*sd*/, const PositionComponent& pos)
|
||||
admin.forEach<DebrisComponent, PositionComponent>(
|
||||
[&](entt::entity entity, const DebrisComponent& /*sd*/, const PositionComponent& pos)
|
||||
{
|
||||
const int tileX = static_cast<int>(std::floor(pos.value.x()));
|
||||
const int tileY = static_cast<int>(std::floor(pos.value.y()));
|
||||
|
||||
Reference in New Issue
Block a user