Made turret ranges more related to turret shot speed and duration, rather than to some magic numbers. No change in current behaviour.

This commit is contained in:
AnotherCommander 2016-03-28 14:14:52 +02:00
parent 95ec3f2c9c
commit e98ae999aa
2 changed files with 17 additions and 7 deletions

View File

@ -447,8 +447,13 @@ static ShipEntity *doOctreesCollide(ShipEntity *prime, ShipEntity *other);
}
}
if (isWeaponNone(weapon_type) && hasTurrets)
{ // safety for ships only equipped with turrets
weaponRange = 10000.0;
{ /* safety for ships only equipped with turrets
note: this was hard-coded to 10000.0, although turrets have a notably
shorter range. We are using a multiplier of 1.667 in order to not change
something that already works, but probably it would be best to use
TURRET_SHOT_RANGE * COMBAT_WEAPON_RANGE_FACTOR here
*/
weaponRange = TURRET_SHOT_RANGE * 1.667;
}
else
{
@ -11537,8 +11542,13 @@ Vector positionOffsetForShipInRotationToAlignment(ShipEntity* ship, Quaternion q
}
}
if (isWeaponNone(weapon_type) && hasTurrets)
{ // no forward weapon but has turrets, so set up range calculations accordingly
weaponRange = 10000.0;
{ /* no forward weapon but has turrets, so set up range calculations accordingly
note: this was hard-coded to 10000.0, although turrets have a notably
shorter range. We are using a multiplier of 1.667 in order to not change
something that already works, but probably it would be best to use
TURRET_SHOT_RANGE * COMBAT_WEAPON_RANGE_FACTOR here
*/
weaponRange = TURRET_SHOT_RANGE * 1.667;
}
else
{

View File

@ -1582,10 +1582,10 @@ static NSString * const kVisualEffectDataCacheKey = @"visual effect data";
fireRate = 0.25f;
}
weaponRange = [declaration oo_floatForKey:@"weapon_range" defaultValue:-1.0f];
if (weaponRange > 7500.0f)
if (weaponRange > TURRET_SHOT_RANGE * COMBAT_WEAPON_RANGE_FACTOR)
{
OOLogWARN(@"shipData.load.warning.turret.badWeaponRange", @"ball turret weapon range of %g for subenitity of ship %@ is too high, using 7500.", weaponRange, shipKey);
weaponRange = 7500.0f; // range of primary plasma canon.
OOLogWARN(@"shipData.load.warning.turret.badWeaponRange", @"ball turret weapon range of %g for subenitity of ship %@ is too high, using %.1f.", weaponRange, shipKey, TURRET_SHOT_RANGE * COMBAT_WEAPON_RANGE_FACTOR);
weaponRange = TURRET_SHOT_RANGE * COMBAT_WEAPON_RANGE_FACTOR; // approx. range of primary plasma canon.
}
weaponEnergy = [declaration oo_floatForKey:@"weapon_energy" defaultValue:-1.0f];