diff options
| author | Magnus Auvinen <magnus.auvinen@gmail.com> | 2008-04-05 08:02:21 +0000 |
|---|---|---|
| committer | Magnus Auvinen <magnus.auvinen@gmail.com> | 2008-04-05 08:02:21 +0000 |
| commit | 35643645e2a433e950c3b0ad9403eb2ad0ce99c8 (patch) | |
| tree | 90cb66a2fa7ebc35d4f417d966e73477bb7960a2 /src/game/server | |
| parent | 605e7074bab498812d3b397b04692013445d5df6 (diff) | |
| download | zcatch-35643645e2a433e950c3b0ad9403eb2ad0ce99c8.tar.gz zcatch-35643645e2a433e950c3b0ad9403eb2ad0ce99c8.zip | |
fixed the ninja again
Diffstat (limited to 'src/game/server')
| -rw-r--r-- | src/game/server/gs_server.cpp | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/src/game/server/gs_server.cpp b/src/game/server/gs_server.cpp index 1857f42f..e46001ee 100644 --- a/src/game/server/gs_server.cpp +++ b/src/game/server/gs_server.cpp @@ -713,6 +713,9 @@ void player::destroy() { } void player::set_weapon(int w) { + if(w == active_weapon) + return; + last_weapon = active_weapon; queued_weapon = -1; active_weapon = w; @@ -958,9 +961,14 @@ int player::handle_ninja() // time's up, return weapons[WEAPON_NINJA].got = false; active_weapon = last_weapon; + if(active_weapon == WEAPON_NINJA) + active_weapon = WEAPON_GUN; set_weapon(active_weapon); return 0; } + + // force ninja weapon + set_weapon(WEAPON_NINJA); // Check if it should activate if (count_input(latest_previnput.fire, latest_input.fire).presses && (server_tick() > ninja.currentcooldown)) @@ -1048,8 +1056,17 @@ int player::handle_ninja() void player::do_weaponswitch() { - if(reload_timer == 0 && queued_weapon != -1) - set_weapon(queued_weapon); + if(reload_timer != 0) // make sure we have reloaded + return; + + if(queued_weapon == -1) // check for a queued weapon + return; + + if(weapons[WEAPON_NINJA].got) // if we have ninja, no weapon selection is possible + return; + + // switch weapon + set_weapon(queued_weapon); } void player::handle_weaponswitch() |