diff options
author | Stijn Buys <ingar@osirion.org> | 2008-08-07 23:27:42 +0000 |
---|---|---|
committer | Stijn Buys <ingar@osirion.org> | 2008-08-07 23:27:42 +0000 |
commit | a743791e624590e0b41229f28f940db5272b60ba (patch) | |
tree | 6a6ec736e4ed34d5254a292889e6e33300919a63 /src/game/ship.cc | |
parent | 1f36b993d603c56251aa15eb6edc6b92ecf599ae (diff) |
rotating planets, navpoints, network protocol updates, entity event state
Diffstat (limited to 'src/game/ship.cc')
-rw-r--r-- | src/game/ship.cc | 35 |
1 files changed, 29 insertions, 6 deletions
diff --git a/src/game/ship.cc b/src/game/ship.cc index 8492b68..f8a1143 100644 --- a/src/game/ship.cc +++ b/src/game/ship.cc @@ -7,6 +7,7 @@ // project headers #include "auxiliary/functions.h" #include "core/gameserver.h" +#include "core/entity.h" #include "game/game.h" #include "game/ship.h" #include "math/mathlib.h" @@ -56,7 +57,7 @@ void Ship::impulse() { if (ship_impulse) { ship_impulse = false; - + entity_eventstate = core::Entity::Normal; } else { if (ship_jumpdrive_activated) { ship_jumpdrive_activated = 0; @@ -64,8 +65,10 @@ void Ship::impulse() ship_countdown = 0; } + entity_eventstate = core::Entity::Impulse; ship_impulse = true; } + entity_dirty = true; } void Ship::jump(std::string const &args) @@ -80,6 +83,7 @@ void Ship::jump(std::string const &args) ship_jumpdrive_activated = 0; ship_jumptargetzone = 0; ship_countdown = 0; + entity_eventstate = core::Entity::Normal; return; } @@ -112,13 +116,16 @@ void Ship::jump(std::string const &args) } ship_jumpdrive_activated = core::server()->time(); - ship_countdown = 5; + ship_countdown = 10; ship_impulse = false; std::stringstream msg(""); - msg << "Hyperspace drive activated. Jumping in " << ship_countdown << "..."; + msg << "Initializing hyperspace jump drive..."; core::server()->send(owner(), msg.str()); + entity_eventstate = core::Entity::JumpInitiate; + entity_timer = ship_countdown; // countdown to jump, in seconds + entity_dirty = true; } void Ship::frame(float seconds) @@ -144,6 +151,8 @@ void Ship::frame(float seconds) if (ship_jumpdrive_activated + 1.0f <= core::server()->time()) { ship_countdown -= 1.0f; + entity_timer = ship_countdown; + if (ship_countdown <= 0) { core::server()->send(owner(), "Jumping to '" + ship_jumptargetzone->name() + '\''); set_zone(ship_jumptargetzone); @@ -151,12 +160,17 @@ void Ship::frame(float seconds) owner()->set_zone(ship_jumptargetzone); ship_jumpdrive_activated = 0; ship_jumptargetzone = 0; + entity_dirty = true; + entity_eventstate = core::Entity::Jump; return; } else { - std::stringstream msg(""); - msg << ship_countdown << "..."; - core::server()->send(owner(), msg.str()); + if (ship_countdown <= 5) { + std::stringstream msg(""); + msg << ship_countdown << "..."; + core::server()->send(owner(), msg.str()); + } ship_jumpdrive_activated = core::server()->time(); + entity_dirty = true; } } @@ -166,6 +180,15 @@ void Ship::frame(float seconds) target_roll = 0; target_direction = 0; + } else if (entity_eventstate == core::Entity::Jump) { + // FIXME jump location and axis + math::Axis default_axis; + entity_axis.assign(default_axis); + entity_dirty = true; + + // FIXME 5 second cooldown + entity_eventstate = core::Entity::Normal; + } else if (ship_impulse) { // clamp input values |