Fixed #155
This commit is contained in:
parent
c6cbd5ed1c
commit
49944fab9a
@ -1041,13 +1041,17 @@ namespace spades {
|
||||
if(down){
|
||||
if(world->GetLocalPlayer()->GetTeamId() >= 2 ||
|
||||
time > lastAliveTime + 1.3f)
|
||||
FollowNextPlayer();
|
||||
FollowNextPlayer(false);
|
||||
}
|
||||
return;
|
||||
}else if(CheckKey(cg_keyAltAttack, name)){
|
||||
if(down){
|
||||
if(world->GetLocalPlayer()){
|
||||
if(world->GetLocalPlayer()->GetTeamId() >= 2) {
|
||||
// spectating
|
||||
followingPlayerId = world->GetLocalPlayerIndex();
|
||||
}else if(time > lastAliveTime + 1.3f){
|
||||
// dead
|
||||
FollowNextPlayer(true);
|
||||
}
|
||||
}
|
||||
return;
|
||||
@ -1571,7 +1575,7 @@ namespace spades {
|
||||
// choose next player.
|
||||
while(!world->GetPlayer(followingPlayerId) ||
|
||||
world->GetPlayer(followingPlayerId)->GetFront().GetPoweredLength() < .01f){
|
||||
FollowNextPlayer();
|
||||
FollowNextPlayer(false);
|
||||
if((limit--) <= 0){
|
||||
break;
|
||||
}
|
||||
@ -2731,7 +2735,7 @@ namespace spades {
|
||||
|
||||
#pragma mark - Follow / Spectate
|
||||
|
||||
void Client::FollowNextPlayer() {
|
||||
void Client::FollowNextPlayer(bool reverse) {
|
||||
int myTeam = 2;
|
||||
if(world->GetLocalPlayer()){
|
||||
myTeam = world->GetLocalPlayer()->GetTeamId();
|
||||
@ -2739,9 +2743,11 @@ namespace spades {
|
||||
|
||||
int nextId = followingPlayerId;
|
||||
do{
|
||||
nextId++;
|
||||
reverse ? --nextId : ++nextId;
|
||||
if(nextId >= world->GetNumPlayerSlots())
|
||||
nextId = 0;
|
||||
if(nextId < 0)
|
||||
nextId = world->GetNumPlayerSlots() - 1;
|
||||
|
||||
Player *p = world->GetPlayer(nextId);
|
||||
if(p == NULL)
|
||||
|
@ -161,7 +161,7 @@ namespace spades {
|
||||
Vector3 followPos;
|
||||
/** only for when spectating */
|
||||
Vector3 followVel;
|
||||
void FollowNextPlayer();
|
||||
void FollowNextPlayer(bool reverse);
|
||||
/** @return true following is activated (and followingPlayerId should be used) */
|
||||
bool IsFollowing();
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user