Fixed bugs with team assignment
This commit is contained in:
@@ -5,7 +5,6 @@ import com.badlogic.gdx.audio.Sound;
|
||||
import com.badlogic.gdx.graphics.Color;
|
||||
import com.badlogic.gdx.utils.ObjectMap;
|
||||
import com.badlogic.gdx.utils.TimeUtils;
|
||||
import io.anuke.mindustry.Vars;
|
||||
import io.anuke.mindustry.content.Mechs;
|
||||
import io.anuke.mindustry.core.GameState.State;
|
||||
import io.anuke.mindustry.entities.Player;
|
||||
@@ -172,7 +171,7 @@ public class Control extends Module{
|
||||
players[0].isAdmin = true;
|
||||
}catch(IOException e){
|
||||
ui.showError(Bundles.format("text.server.error", Strings.parseException(e, false)));
|
||||
state.set(State.menu);
|
||||
threads.runDelay(() -> state.set(State.menu));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -202,6 +202,7 @@ public class NetServer extends Module{
|
||||
return Integer.MAX_VALUE;
|
||||
});
|
||||
player.setTeam(min);
|
||||
Log.info("Auto-assigned player {0} to team {1}.", player.name, player.getTeam());
|
||||
}
|
||||
|
||||
connections.put(id, player);
|
||||
|
||||
@@ -336,11 +336,13 @@ public class Renderer extends RendererModule{
|
||||
|
||||
@Override
|
||||
public void resize(int width, int height){
|
||||
float lastX = camera.position.x, lastY = camera.position.y;
|
||||
super.resize(width, height);
|
||||
for(Player player : players){
|
||||
control.input(player.playerIndex).resetCursor();
|
||||
}
|
||||
camera.position.set(players[0].x, players[0].y, 0);
|
||||
camera.update();
|
||||
camera.position.set(lastX, lastY, 0f);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -8,7 +8,6 @@ import com.badlogic.gdx.math.Vector2;
|
||||
import com.badlogic.gdx.utils.Queue;
|
||||
import io.anuke.annotations.Annotations.Loc;
|
||||
import io.anuke.annotations.Annotations.Remote;
|
||||
import io.anuke.mindustry.Vars;
|
||||
import io.anuke.mindustry.content.Mechs;
|
||||
import io.anuke.mindustry.content.fx.UnitFx;
|
||||
import io.anuke.mindustry.entities.effect.ScorchDecal;
|
||||
@@ -727,12 +726,14 @@ public class Player extends Unit implements BuilderTrait, CarryTrait, ShooterTra
|
||||
|
||||
//region utility methods
|
||||
|
||||
public void toggleTeam(){
|
||||
team = (team == Team.blue ? Team.red : Team.blue);
|
||||
}
|
||||
|
||||
/** Resets all values of the player.*/
|
||||
public void reset(){
|
||||
resetNoAdd();
|
||||
|
||||
add();
|
||||
}
|
||||
|
||||
public void resetNoAdd(){
|
||||
status.clear();
|
||||
team = Team.blue;
|
||||
inventory.clear();
|
||||
@@ -744,8 +745,6 @@ public class Player extends Unit implements BuilderTrait, CarryTrait, ShooterTra
|
||||
boostHeat = drownTime = hitTime = 0f;
|
||||
mech = (isMobile ? Mechs.starterMobile : Mechs.starterDesktop);
|
||||
placeQueue.clear();
|
||||
|
||||
add();
|
||||
}
|
||||
|
||||
public boolean isShooting(){
|
||||
|
||||
@@ -183,6 +183,7 @@ public class NetworkIO{
|
||||
|
||||
Entities.clear();
|
||||
int id = stream.readInt();
|
||||
player.resetNoAdd();
|
||||
player.read(stream, TimeUtils.millis());
|
||||
player.resetID(id);
|
||||
player.add();
|
||||
@@ -258,7 +259,6 @@ public class NetworkIO{
|
||||
i += consecutives;
|
||||
}
|
||||
|
||||
player.reset();
|
||||
state.teams = new Teams();
|
||||
|
||||
byte teams = stream.readByte();
|
||||
|
||||
Reference in New Issue
Block a user