Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/core/entityprojectile.cc27
-rw-r--r--src/game/base/npc.cc2
-rw-r--r--src/game/base/platform.cc8
-rw-r--r--src/game/base/ship.cc4
4 files changed, 25 insertions, 16 deletions
diff --git a/src/core/entityprojectile.cc b/src/core/entityprojectile.cc
index 440c46b..ac016e0 100644
--- a/src/core/entityprojectile.cc
+++ b/src/core/entityprojectile.cc
@@ -60,13 +60,28 @@ void EntityProjectile::upkeep(const unsigned long timestamp)
void EntityProjectile::collision(Entity *other)
{
- if (state() == Entity::Destroyed) {
+ if (state() == Entity::Destroyed)
+ {
return;
- } else {
- if ((other->type() == Dynamic) || (other->type() == Controlable)) {
- static_cast<EntityDynamic *>(other)->hit(this);
+ } else
+ {
+ if (other->id() == projectile_spawn_id)
+ {
+ // don't shoot yourself
+ return;
+ }
+ switch(other->type())
+ {
+ case Projectile:
+ return;
+ break;
+ case Dynamic:
+ case Controlable:
+ static_cast<EntityDynamic *>(other)->hit(this);
+ default:
+ set_state(Entity::Destroyed);
+ break;
}
- set_state(Entity::Destroyed);
}
}
@@ -171,7 +186,7 @@ void EntityProjectile::reset()
// point the bullet user pointer to the entity
entity_body->setUserPointer((void *) this);
// enable custom collision callback
- entity_body->setCollisionFlags(entity_body->getCollisionFlags() | btCollisionObject::CF_CUSTOM_MATERIAL_CALLBACK);
+ entity_body->setCollisionFlags(entity_body->getCollisionFlags() | btCollisionObject::CF_CUSTOM_MATERIAL_CALLBACK | btCollisionObject::CF_NO_CONTACT_RESPONSE);
//entity_body->setCollisionFlags(entity_body->getCollisionFlags() | btCollisionObject::CF_NO_CONTACT_RESPONSE);
if (entity_mass) {
diff --git a/src/game/base/npc.cc b/src/game/base/npc.cc
index f9a600e..d52c612 100644
--- a/src/game/base/npc.cc
+++ b/src/game/base/npc.cc
@@ -307,7 +307,7 @@ void NPC::frame(const unsigned long elapsed)
if (zone() != carrier->zone())
{
set_zone(carrier->zone());
- }
+ }
if (carrier->state() == core::Entity::Destroyed)
{
explode();
diff --git a/src/game/base/platform.cc b/src/game/base/platform.cc
index 1f81591..de7f987 100644
--- a/src/game/base/platform.cc
+++ b/src/game/base/platform.cc
@@ -109,18 +109,14 @@ void Platform::frame(const unsigned long elapsed)
continue;
}
- // location of the slot in world coordinates
- const math::Vector3f slot_location(location() + (axis() * slot->location()));
-
// find a target for this slot
Ship *current_enemy = 0;
float current_distance = 0.0f;
- const float projectile_radius = core::PROJECTILE_RADIUS;
+ math::Vector3f projectile_location(location() + (axis() * slot->location()));
+ math::Vector3f projectile_direction;
math::Axis projectile_axis(axis() * slot->axis());
- const math::Vector3f projectile_location(slot_location + projectile_axis.forward() * projectile_radius);
- math::Vector3f projectile_direction;
math::Vector3f aim_location;
// we only need half the cone angle for the cosine calculation
diff --git a/src/game/base/ship.cc b/src/game/base/ship.cc
index dbf8b19..9b78dfa 100644
--- a/src/game/base/ship.cc
+++ b/src/game/base/ship.cc
@@ -1205,10 +1205,8 @@ void Ship::frame(const unsigned long elapsed)
} else if ((weapon->projectile_interval() > 0) && (slot->last_fired() + weapon->projectile_interval() <= core::server()->timestamp())) {
// aim
- const float projectile_radius = core::PROJECTILE_RADIUS; // FIXME this should be defined somewhere
-
math::Axis projectile_axis(axis() * slot->axis());
- math::Vector3f projectile_location(location() + axis() * slot->location() + projectile_axis.forward() * projectile_radius);
+ math::Vector3f projectile_location(location() + axis() * slot->location());
math::Vector3f projectile_direction(target_aim - projectile_location);
projectile_direction.normalize();
float cosa = math::dotproduct(projectile_direction, projectile_axis.forward());