diff options
Diffstat (limited to 'src/game/base/ship.cc')
-rw-r--r-- | src/game/base/ship.cc | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/src/game/base/ship.cc b/src/game/base/ship.cc index 7282fe1..fc01b5c 100644 --- a/src/game/base/ship.cc +++ b/src/game/base/ship.cc @@ -9,13 +9,15 @@ #include <iostream> #include "auxiliary/functions.h" +#include "math/functions.h" + #include "core/gameserver.h" #include "core/entity.h" + #include "base/game.h" #include "base/ship.h" #include "base/projectile.h" #include "base/spacemine.h" -#include "math/functions.h" using math::degrees360f; using math::degrees180f; @@ -85,14 +87,16 @@ Ship::Ship(core::Player *owner, const ShipModel *shipmodel) : core::EntityContro if (model()) { add_slots(); slots()->load(model()); - +/* for (core::Slots::iterator it = slots()->begin(); it != slots()->end(); it++) { // default fire rate: 1 projectile / second (*it)->set_projectile_interval(1000); (*it)->set_projectile_lifespan(5000); (*it)->set_projectile_speed(5.0f); (*it)->set_projectile_damage(10.0f); + (*it)->set_projectile_modelname("laser1"); } +*/ } // menus for docked players @@ -529,7 +533,7 @@ void Ship::collision(core::Entity *other) } else if (other->moduletype() == projectile_enttype) { // hit by projectile - Projectile * projectile = static_cast<Projectile *>(other); + game::EntityProjectile *projectile = static_cast<EntityProjectile *>(other); if (projectile->state() != core::Entity::Destroyed) { ship_armor -= projectile->damage(); } @@ -877,10 +881,10 @@ void Ship::frame(const unsigned long elapsed) for (core::Slots::iterator it = slots()->begin(); it != slots()->end(); it++) { // create projectiles - if ((*it)->projectile_interval() > 0) { + if ( ((*it)->projectile_interval() > 0) && ((*it)->has_flag(core::Slot::Mounted)) && ((*it)->has_flag(core::Slot::Active))) { if ((*it)->last_fired() + (*it)->projectile_interval() <= core::server()->timestamp()) { (*it)->set_last_fired(core::server()->timestamp()); - Projectile * projectile = new Projectile((*it)->projectile_lifespan()); + EntityProjectile * projectile = new EntityProjectile((*it)->projectile_lifespan()); projectile->set_damage((*it)->projectile_damage()); projectile->set_color(color()); if (owner()) { @@ -889,7 +893,8 @@ void Ship::frame(const unsigned long elapsed) projectile->set_zone(zone()); projectile->set_axis(axis() * (*it)->axis()); projectile->set_location(location() + (axis() * (*it)->location() * modelscale) + projectile->axis().forward() * projectile->radius()); - + projectile->set_modelname("maps/projectiles/" + (*it)->projectile_modelname()); + projectile->reset(); projectile->body()->setDamping(0.0f, 0.0f); projectile->body()->setLinearVelocity(math::to_btVector3(projectile->axis().forward() * (*it)->projectile_speed())); |