Merge remote-tracking branch 'origin/master'

This commit is contained in:
Anuken
2021-10-31 13:28:05 -04:00
7 changed files with 29 additions and 11 deletions

View File

@@ -54,9 +54,9 @@ public class Pathfinder implements Runnable{
(PathTile.solid(tile) ? 5 : 0),
//water
(team, tile) -> PathTile.solid(tile) || !PathTile.liquid(tile) ? 200 : 2 +
(team, tile) -> (PathTile.solid(tile) || !PathTile.liquid(tile) ? 6000 : 1) +
(PathTile.nearGround(tile) || PathTile.nearSolid(tile) ? 14 : 0) +
(PathTile.deep(tile) ? -1 : 0) +
(PathTile.deep(tile) ? 0 : 1) +
(PathTile.damages(tile) ? 35 : 0)
);

View File

@@ -757,6 +757,8 @@ public class NetServer implements ApplicationListener{
player.add();
Events.fire(new PlayerConnectionConfirmed(player));
if(player.con == null || player.con.hasConnected) return;
player.con.hasConnected = true;

View File

@@ -359,8 +359,9 @@ public class BulletType extends Content implements Cloneable{
//home in on allies if possible
if(healPercent > 0){
target = Units.closestTarget(null, b.x, b.y, homingRange,
e -> e.checkTarget(collidesAir, collidesGround) && e.team != b.team,
t -> collidesGround && (t.team != b.team || t.damaged()));
e -> e.checkTarget(collidesAir, collidesGround) && e.team != b.team && !b.hasCollided(e.id),
t -> collidesGround && (t.team != b.team || t.damaged()) && !b.hasCollided(t.id)
);
}else{
target = Units.closestTarget(b.team, b.x, b.y, homingRange, e -> e.checkTarget(collidesAir, collidesGround) && !b.hasCollided(e.id), t -> collidesGround && !b.hasCollided(t.id));
}

View File

@@ -480,7 +480,19 @@ public class EventType{
}
}
/** Called after connecting; when a player receives world data and is ready to play.*/
/**
* Called after player confirmed it has received world data and is ready to play.
* Note that if this is the first world receival, then player.con.hasConnected is false.
*/
public static class PlayerConnectionConfirmed{
public final Player player;
public PlayerConnectionConfirmed(Player player){
this.player = player;
}
}
/** Called after connecting; when a player receives world data and is ready to play. Fired only once, after initial connection. */
public static class PlayerJoin{
public final Player player;

View File

@@ -696,9 +696,7 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
});
//flip rotation
if(x == (req.rotation % 2 == 0)){
req.rotation = Mathf.mod(req.rotation + 2, 4);
}
req.block.flipRotation(req, x);
});
}

View File

@@ -468,7 +468,7 @@ public class Block extends UnlockableContent{
if(hasItems && configurable){
bars.add("items", entity -> new Bar(() -> Core.bundle.format("bar.items", entity.items.total()), () -> Pal.items, () -> (float)entity.items.total() / itemCapacity));
}
if(unitCapModifier != 0){
stats.add(Stat.maxUnits, (unitCapModifier < 0 ? "-" : "+") + Math.abs(unitCapModifier));
}
@@ -824,7 +824,7 @@ public class Block extends UnlockableContent{
}
clipSize = Math.max(clipSize, size * tilesize);
//only kept to ensure compatibility with v6 mods.
if(expanded){
clipSize += tilesize * 10f;
@@ -989,4 +989,9 @@ public class Block extends UnlockableContent{
packer.add(PageType.editor, name + "-icon-editor", editorBase);
}
public void flipRotation(BuildPlan req, boolean x){
if(x == (req.rotation % 2 == 0)){
req.rotation = Mathf.mod(req.rotation + 2, 4);
}
}
}