Rename scrap-drop entity to "debris" in code and config
Implements the requirements rename in the codebase. The salvageable object dropped by destroyed ships and defence stations is now the "debris" entity; the scrap resource it yields (cargo, delivery, smelting, threat, scrap_drop_formula, scrap_per_threat) is unchanged. Entity renames: ScrapDataComponent->DebrisComponent, ScrapSystem->DebrisSystem, ScrapInfo->DebrisInfo, ScrapSelectionChangedEvent->DebrisSelectionChangedEvent (member scrap->debris), spawnScrap->spawnDebris, getScraps->getDebrisSystem, getAllScrapInfo->getAllDebrisInfo, scrapAtWorldPos/scrapInBox->debris*, SalvageScrapBehavior::scrapTarget->debrisTarget, PendingCollection::scrap->debris, ScrapTest.cpp->DebrisTest.cpp. Config key scrap_despawn_seconds-> debris_despawn_seconds (WorldConfig.scrapDespawnSeconds->debrisDespawnSeconds). The salvage/deliver behavior classes keep their names (they act on the scrap resource). Also implements the new REQ-UI-DEBRIS-PANEL behavior in SelectedBuildingPanel: a single selected piece of debris shows a "Debris" heading plus a "Scrap" stat row; a multi/mixed field selection appends "Debris x N" and "Scrap x N" lines. Updates the four renamed REQ-ID references in comments/docs, plus architecture.md and derived.md. All 449 test cases pass; app, tests, and balancing targets build. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Y7N59FsLA5e2kuVdqe4Uhc
This commit is contained in:
@@ -11,15 +11,15 @@
|
||||
#include "EntityAdmin.h"
|
||||
#include "PositionComponent.h"
|
||||
#include "SalvageScrapBehavior.h"
|
||||
#include "ScrapSystem.h"
|
||||
#include "DebrisSystem.h"
|
||||
#include "SensorRangeComponent.h"
|
||||
#include "tracing.h"
|
||||
|
||||
void SalvageScrapEvaluator::evaluate(EntityAdmin& admin, const ScrapSystem& scraps)
|
||||
void SalvageScrapEvaluator::evaluate(EntityAdmin& admin, const DebrisSystem& debris)
|
||||
{
|
||||
TRACE();
|
||||
const std::unordered_map<entt::entity, CargoState> cargoByShip = buildCargoByShip(admin);
|
||||
const std::vector<ScrapInfo> allScrap = scraps.getAllScrapInfo();
|
||||
const std::vector<DebrisInfo> allDebris = debris.getAllDebrisInfo();
|
||||
|
||||
admin.forEach<SalvageScrapBehavior, PositionComponent, SensorRangeComponent>(
|
||||
[&](entt::entity e, SalvageScrapBehavior& salvage, const PositionComponent& pos,
|
||||
@@ -31,15 +31,15 @@ void SalvageScrapEvaluator::evaluate(EntityAdmin& admin, const ScrapSystem& scra
|
||||
|
||||
if (cargoFull)
|
||||
{
|
||||
salvage.scrapTarget = std::nullopt;
|
||||
salvage.debrisTarget = std::nullopt;
|
||||
salvage.score = BehaviorScores::kInactive;
|
||||
return;
|
||||
}
|
||||
|
||||
// Find nearest scrap within sensor range.
|
||||
// Find nearest debris within sensor range.
|
||||
float bestDist = sensor.value_tiles;
|
||||
std::optional<QVector2D> bestPos;
|
||||
for (const ScrapInfo& si : allScrap)
|
||||
for (const DebrisInfo& si : allDebris)
|
||||
{
|
||||
const float dist = (si.position - pos.value).length();
|
||||
if (dist < bestDist)
|
||||
@@ -49,7 +49,7 @@ void SalvageScrapEvaluator::evaluate(EntityAdmin& admin, const ScrapSystem& scra
|
||||
}
|
||||
}
|
||||
|
||||
salvage.scrapTarget = bestPos;
|
||||
salvage.debrisTarget = bestPos;
|
||||
salvage.score = bestPos ? BehaviorScores::kSalvage : BehaviorScores::kInactive;
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user