diff options
Diffstat (limited to 'src/game/base/ship.cc')
-rw-r--r-- | src/game/base/ship.cc | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/src/game/base/ship.cc b/src/game/base/ship.cc index 4c3885a..7ce6d36 100644 --- a/src/game/base/ship.cc +++ b/src/game/base/ship.cc @@ -912,16 +912,26 @@ void Ship::frame(const unsigned long elapsed) core::Slot *slot = (*it); // create projectiles - if (slot->has_flag(core::Slot::Mounted) && slot->item() && (slot->item()->info()->type() == Weapon::infotype())) { + if (!slot->has_flag(core::Slot::Mounted)) { + continue; + + } else if ( !(slot->item() && (slot->item()->info()->type() == Weapon::infotype()))) { + continue; + + } else { const Weapon *weapon = static_cast<const Weapon *>(slot->item()->info()); - if ((weapon->subtype() == Weapon::Cannon) && (weapon->projectile_interval() > 0) && (slot->last_fired() + weapon->projectile_interval() <= core::server()->timestamp())) { + + if ((weapon->subtype() != Weapon::Cannon) && (weapon->subtype() != Weapon::Turret) ) { + continue; + + } else if ((weapon->projectile_interval() > 0) && (slot->last_fired() + weapon->projectile_interval() <= core::server()->timestamp())) { // aim const float projectile_radius = 0.01f; // FIXME this should be defined somewhere math::Axis projectile_axis(axis() * slot->axis()); - math::Vector3f projectile_location(location() + (axis() * slot->location() * modelscale) + projectile_axis.forward() * projectile_radius); + math::Vector3f projectile_location(location() + (axis() * slot->location() * modelscale) + projectile_axis.forward() * projectile_radius); math::Vector3f projectile_direction(target_aim - projectile_location); projectile_direction.normalize(); float cosa = math::dotproduct(projectile_direction, projectile_axis.forward()); |