use meters in config
This commit is contained in:
@@ -69,7 +69,7 @@ void CombatSystem::resolveWeapon(
|
||||
{
|
||||
const float distanceSquared =
|
||||
(ownPos.value - admin.get<PositionComponent>(t).value).lengthSquared();
|
||||
if (distanceSquared > weapon.range * weapon.range)
|
||||
if (distanceSquared > weapon.range_tiles * weapon.range_tiles)
|
||||
{
|
||||
weapon.currentTarget = std::nullopt;
|
||||
}
|
||||
@@ -81,8 +81,8 @@ void CombatSystem::resolveWeapon(
|
||||
if (!weapon.currentTarget)
|
||||
{
|
||||
const float acquisitionRange = admin.hasAll<SensorRangeComponent>(shipEntity)
|
||||
? admin.get<SensorRangeComponent>(shipEntity).value
|
||||
: weapon.range;
|
||||
? admin.get<SensorRangeComponent>(shipEntity).value_tiles
|
||||
: weapon.range_tiles;
|
||||
float bestDistanceSquared = acquisitionRange * acquisitionRange;
|
||||
admin.forEach<ShipIdentityComponent, PositionComponent, FactionComponent>(
|
||||
[&](entt::entity candidate, const ShipIdentityComponent& /*si*/,
|
||||
|
||||
Reference in New Issue
Block a user