Fixed air units spawning on wrong end of map / Fixed kick message spam
This commit is contained in:
@@ -99,7 +99,7 @@ public class WaveSpawner{
|
|||||||
|
|
||||||
private void eachFlyerSpawn(Floatc2 cons){
|
private void eachFlyerSpawn(Floatc2 cons){
|
||||||
for(Tile tile : spawns){
|
for(Tile tile : spawns){
|
||||||
float angle = Angles.angle(tile.x, tile.y, world.width() / 2, world.height() / 2);
|
float angle = Angles.angle(world.width() / 2, world.height() / 2, tile.x, tile.y);
|
||||||
|
|
||||||
float trns = Math.max(world.width(), world.height()) * Mathf.sqrt2 * tilesize;
|
float trns = Math.max(world.width(), world.height()) * Mathf.sqrt2 * tilesize;
|
||||||
float spawnX = Mathf.clamp(world.width() * tilesize / 2f + Angles.trnsx(angle, trns), -margin, world.width() * tilesize + margin);
|
float spawnX = Mathf.clamp(world.width() * tilesize / 2f + Angles.trnsx(angle, trns), -margin, world.width() * tilesize + margin);
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ public abstract class NetConnection{
|
|||||||
public @Nullable Player player;
|
public @Nullable Player player;
|
||||||
public @Nullable Unitc lastUnit;
|
public @Nullable Unitc lastUnit;
|
||||||
public Vec2 lastPosition = new Vec2();
|
public Vec2 lastPosition = new Vec2();
|
||||||
|
public boolean kicked = false;
|
||||||
|
|
||||||
/** ID of last received client snapshot. */
|
/** ID of last received client snapshot. */
|
||||||
public int lastReceivedClientSnapshot = -1;
|
public int lastReceivedClientSnapshot = -1;
|
||||||
@@ -38,6 +39,8 @@ public abstract class NetConnection{
|
|||||||
|
|
||||||
/** Kick with a special, localized reason. Use this if possible. */
|
/** Kick with a special, localized reason. Use this if possible. */
|
||||||
public void kick(KickReason reason){
|
public void kick(KickReason reason){
|
||||||
|
if(kicked) return;
|
||||||
|
|
||||||
Log.info("Kicking connection @; Reason: @", address, reason.name());
|
Log.info("Kicking connection @; Reason: @", address, reason.name());
|
||||||
|
|
||||||
if((reason == KickReason.kick || reason == KickReason.banned || reason == KickReason.vote)){
|
if((reason == KickReason.kick || reason == KickReason.banned || reason == KickReason.vote)){
|
||||||
@@ -51,6 +54,7 @@ public abstract class NetConnection{
|
|||||||
Time.runTask(2f, this::close);
|
Time.runTask(2f, this::close);
|
||||||
|
|
||||||
netServer.admins.save();
|
netServer.admins.save();
|
||||||
|
kicked = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Kick with an arbitrary reason. */
|
/** Kick with an arbitrary reason. */
|
||||||
@@ -60,6 +64,8 @@ public abstract class NetConnection{
|
|||||||
|
|
||||||
/** Kick with an arbitrary reason, and a kick duration in milliseconds. */
|
/** Kick with an arbitrary reason, and a kick duration in milliseconds. */
|
||||||
public void kick(String reason, int kickDuration){
|
public void kick(String reason, int kickDuration){
|
||||||
|
if(kicked) return;
|
||||||
|
|
||||||
Log.info("Kicking connection @; Reason: @", address, reason.replace("\n", " "));
|
Log.info("Kicking connection @; Reason: @", address, reason.replace("\n", " "));
|
||||||
|
|
||||||
PlayerInfo info = netServer.admins.getInfo(uuid);
|
PlayerInfo info = netServer.admins.getInfo(uuid);
|
||||||
@@ -71,6 +77,7 @@ public abstract class NetConnection{
|
|||||||
Time.runTask(2f, this::close);
|
Time.runTask(2f, this::close);
|
||||||
|
|
||||||
netServer.admins.save();
|
netServer.admins.save();
|
||||||
|
kicked = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isConnected(){
|
public boolean isConnected(){
|
||||||
|
|||||||
Reference in New Issue
Block a user