Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
path: root/src/game
diff options
context:
space:
mode:
Diffstat (limited to 'src/game')
-rw-r--r--src/game/base/cargo.cc1
-rw-r--r--src/game/base/cargopod.cc5
-rw-r--r--src/game/base/game.cc5
-rw-r--r--src/game/base/ship.cc15
-rw-r--r--src/game/base/ship.h3
5 files changed, 25 insertions, 4 deletions
diff --git a/src/game/base/cargo.cc b/src/game/base/cargo.cc
index 1a933e8..daf4ac2 100644
--- a/src/game/base/cargo.cc
+++ b/src/game/base/cargo.cc
@@ -374,6 +374,7 @@ void Cargo::eject(core::EntityControlable *ejector, const int amount)
ejector->owner()->send(msgstr.str());
ejector->owner()->sound("game/eject");
}
+ pod->reset();
}
void Cargo::list()
diff --git a/src/game/base/cargopod.cc b/src/game/base/cargopod.cc
index a3b44bf..b6d2123 100644
--- a/src/game/base/cargopod.cc
+++ b/src/game/base/cargopod.cc
@@ -18,6 +18,11 @@ CargoPod::CargoPod() : EntityDynamic()
// FIXME hardcoded modelname
set_modelname("maps/cargo/pod");
+
+ set_mass(radius());
+
+ // activate physics
+ reset();
}
CargoPod::~CargoPod()
diff --git a/src/game/base/game.cc b/src/game/base/game.cc
index 3c84d58..c0ef4ce 100644
--- a/src/game/base/game.cc
+++ b/src/game/base/game.cc
@@ -604,7 +604,7 @@ void Game::func_launch(core::Player *player, std::string const &args)
ship->get_axis().assign(dock->axis());
ship->set_state(core::Entity::Normal);
- ship->set_state(core::Entity::Jump);
+ ship->reset();
player->set_view(0);
player->send("^BLaunching from " + dock->name());
@@ -671,8 +671,7 @@ void Game::func_goto(core::Player *player, const std::string &args)
ship->get_axis().assign(dock->axis());
ship->get_axis().change_direction(180.0f);
ship->set_state(core::Entity::Normal);
-
- ship->set_state(core::Entity::Jump);
+ ship->reset();
player->set_view(0);
player->send("Going to " + dock->name());
diff --git a/src/game/base/ship.cc b/src/game/base/ship.cc
index a588122..d7d6b59 100644
--- a/src/game/base/ship.cc
+++ b/src/game/base/ship.cc
@@ -76,6 +76,8 @@ Ship::Ship(core::Player *owner, ShipModel *shipmodel) : core::EntityControlable(
set_flag(core::Entity::Dockable);
}
+
+ set_mass(radius());
reset();
}
@@ -89,7 +91,10 @@ void Ship::reset()
current_target_pitch = 0.0f;;
current_target_roll = 0.0f;
current_target_strafe = 0.0f;
+ current_target_vstrafe = 0.0f;
current_target_afterburner = 0.0f;
+
+ EntityControlable::reset();
}
// this is called if another shuo wants to dock this ship
@@ -617,6 +622,16 @@ void Ship::frame(float seconds)
if ((entity_movement > 0) || (entity_speed > 0)) {
set_dirty();
}
+
+ // transfer entity location to motion state
+ btTransform t;
+ t.setIdentity();
+ t.setOrigin(math::to_btVector3(location()));
+ t.setBasis(math::to_btMatrix3x3(axis()));
+ entity_body->setWorldTransform(t);
+
+ if (zone())
+ zone()->physics()->synchronizeSingleMotionState(entity_body);
}
} // namespace game
diff --git a/src/game/base/ship.h b/src/game/base/ship.h
index 1114df2..1f4f743 100644
--- a/src/game/base/ship.h
+++ b/src/game/base/ship.h
@@ -40,7 +40,7 @@ public:
void initiate_jump(JumpPoint *depart);
/// void reset drive controls
- void reset();
+ virtual void reset();
/// explode the ship
void explode();
@@ -62,6 +62,7 @@ private:
float current_target_pitch;
float current_target_roll;
float current_target_strafe;
+ float current_target_vstrafe;
float current_target_afterburner;
bool ship_jumpdrive;