diff options
| author | Magnus Auvinen <magnus.auvinen@gmail.com> | 2008-10-08 18:36:30 +0000 |
|---|---|---|
| committer | Magnus Auvinen <magnus.auvinen@gmail.com> | 2008-10-08 18:36:30 +0000 |
| commit | b0a88d81aaba70bd16ba3502753cae8afc3f1b38 (patch) | |
| tree | 843717bca11486db34c5b83a57928c9b6686e865 /src/game/server/entities | |
| parent | b39e58ce265971b7f3aa21204e62b45b0319ac76 (diff) | |
| download | zcatch-b0a88d81aaba70bd16ba3502753cae8afc3f1b38.tar.gz zcatch-b0a88d81aaba70bd16ba3502753cae8afc3f1b38.zip | |
fixed so the ninja works again. made it less specialized aswell
Diffstat (limited to 'src/game/server/entities')
| -rw-r--r-- | src/game/server/entities/character.cpp | 46 | ||||
| -rw-r--r-- | src/game/server/entities/character.hpp | 1 | ||||
| -rw-r--r-- | src/game/server/entities/pickup.cpp | 3 |
3 files changed, 28 insertions, 22 deletions
diff --git a/src/game/server/entities/character.cpp b/src/game/server/entities/character.cpp index 0516ddc5..07f4ebbf 100644 --- a/src/game/server/entities/character.cpp +++ b/src/game/server/entities/character.cpp @@ -115,6 +115,9 @@ bool CHARACTER::is_grounded() int CHARACTER::handle_ninja() { + if(active_weapon != WEAPON_NINJA) + return 0; + vec2 direction = normalize(vec2(latest_input.target_x, latest_input.target_y)); if ((server_tick() - ninja.activationtick) > (data->weapons.ninja.duration * server_tickspeed() / 1000)) @@ -131,25 +134,6 @@ int CHARACTER::handle_ninja() // 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)) - { - // ok then, activate ninja - attack_tick = server_tick(); - ninja.activationdir = direction; - ninja.currentmovetime = data->weapons.ninja.movetime * server_tickspeed() / 1000; - ninja.currentcooldown = data->weapons.ninja.base->firedelay * server_tickspeed() / 1000 + server_tick(); - - // reset hit objects - numobjectshit = 0; - - game.create_sound(pos, SOUND_NINJA_FIRE); - - // release all hooks when ninja is activated - //release_hooked(); - //release_hooks(); - } - ninja.currentmovetime--; if (ninja.currentmovetime == 0) @@ -273,7 +257,7 @@ void CHARACTER::handle_weaponswitch() void CHARACTER::fire_weapon() { - if(reload_timer != 0 || active_weapon == WEAPON_NINJA) + if(reload_timer != 0) return; do_weaponswitch(); @@ -425,6 +409,21 @@ void CHARACTER::fire_weapon() game.create_sound(pos, SOUND_RIFLE_FIRE); } break; + case WEAPON_NINJA: + { + attack_tick = server_tick(); + ninja.activationdir = direction; + ninja.currentmovetime = data->weapons.ninja.movetime * server_tickspeed() / 1000; + + //reload_timer = data->weapons.ninja.base->firedelay * server_tickspeed() / 1000 + server_tick(); + + // reset hit objects + numobjectshit = 0; + + game.create_sound(pos, SOUND_NINJA_FIRE); + + } break; + } if(weapons[active_weapon].ammo > 0) // -1 == unlimited @@ -450,6 +449,10 @@ int CHARACTER::handle_weapons() reload_timer--; } */ + //if(active_weapon == WEAPON_NINJA) + handle_ninja(); + + // check reload timer if(reload_timer) { @@ -457,11 +460,12 @@ int CHARACTER::handle_weapons() return 0; } + /* if (active_weapon == WEAPON_NINJA) { // don't update other weapons while ninja is active return handle_ninja(); - } + }*/ // fire weapon, if wanted fire_weapon(); diff --git a/src/game/server/entities/character.hpp b/src/game/server/entities/character.hpp index c25b4b5f..818cebdf 100644 --- a/src/game/server/entities/character.hpp +++ b/src/game/server/entities/character.hpp @@ -69,7 +69,6 @@ public: { vec2 activationdir; int activationtick; - int currentcooldown; int currentmovetime; } ninja; diff --git a/src/game/server/entities/pickup.cpp b/src/game/server/entities/pickup.cpp index e9997733..b6258446 100644 --- a/src/game/server/entities/pickup.cpp +++ b/src/game/server/entities/pickup.cpp @@ -25,6 +25,8 @@ void PICKUP::reset() spawntick = server_tick() + server_tickspeed() * data->pickups[type].spawndelay; else spawntick = -1; + + spawntick = -1; } void PICKUP::tick() @@ -93,6 +95,7 @@ void PICKUP::tick() // activate ninja on target player chr->ninja.activationtick = server_tick(); chr->weapons[WEAPON_NINJA].got = true; + chr->weapons[WEAPON_NINJA].ammo = -1; chr->last_weapon = chr->active_weapon; chr->active_weapon = WEAPON_NINJA; respawntime = data->pickups[type].respawntime; |