diff options
Diffstat (limited to 'src/game/base')
-rw-r--r-- | src/game/base/game.h | 1 | ||||
-rw-r--r-- | src/game/base/ship.cc | 33 |
2 files changed, 23 insertions, 11 deletions
diff --git a/src/game/base/game.h b/src/game/base/game.h index 908aeb6..27ba31b 100644 --- a/src/game/base/game.h +++ b/src/game/base/game.h @@ -41,6 +41,7 @@ const float planet_safe_distance = 50.0f; // ship engine delay times const float jump_timer_delay = 5.0f; +const float jump_cooldown_delay = 2.0f; const float impulse_timer_delay = 3.0f; diff --git a/src/game/base/ship.cc b/src/game/base/ship.cc index 7a499c3..2b8411a 100644 --- a/src/game/base/ship.cc +++ b/src/game/base/ship.cc @@ -422,8 +422,9 @@ void Ship::frame(const unsigned long elapsed) } else { set_state(core::Entity::Normal); } - ship_jumpdrive_timer = 0; - entity_timer = 0; + + ship_jumpdrive_timer = core::server()->time(); + entity_timer = jump_cooldown_delay; set_dirty(); return; @@ -455,16 +456,26 @@ void Ship::frame(const unsigned long elapsed) target_afterburner = 0.0f; target_thrust = 0.0f; - // FIXME 5 second cooldown - entity_state = core::Entity::Normal; - - set_dirty(); - - if (owner() && owner()->view() && owner()->control() == (EntityControlable*) this) - owner()->set_view(0); - + // apply jump drive cooldown + if (ship_jumpdrive_timer + 1.0f <= core::server()->time()) { + entity_timer -= 1.0f; + + if (entity_timer <= 0) { + ship_jumpdrive_timer = 0; + set_state(core::Entity::Normal); + set_dirty(); + + if (owner() && owner()->view() && owner()->control() == (EntityControlable*) this) + owner()->set_view(0); + + } else { + ship_jumpdrive_timer = core::server()->time(); + set_dirty(); + } + } + return; - + } else if (entity_state == core::Entity::ImpulseInitiate) { // cancel impulse drive if afterburner goes reverse |