Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
path: root/src/game
diff options
context:
space:
mode:
authorStijn Buys <ingar@osirion.org>2011-07-07 23:23:12 +0000
committerStijn Buys <ingar@osirion.org>2011-07-07 23:23:12 +0000
commitbd421e2b53326657f2746ef0f55c08ea53d7a761 (patch)
tree3d02893a3d4de835fc0ee678afbab52747605abb /src/game
parent035c602e0afc659b344d685614ec7a2e334636b6 (diff)
Added a 2 second jump drive cooldown, added jump completed sound effect, reset keyboard modifiers when resetting the video subsystem.
Diffstat (limited to 'src/game')
-rw-r--r--src/game/base/game.h1
-rw-r--r--src/game/base/ship.cc33
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