More misc cleanup

This commit is contained in:
Anuken
2021-03-17 17:39:50 -04:00
parent 786d638ad0
commit c7cbe50876
6 changed files with 17 additions and 13 deletions

View File

@@ -41,7 +41,7 @@ public class NetServer implements ApplicationListener{
private static final Vec2 vector = new Vec2();
private static final Rect viewport = new Rect();
/** If a player goes away of their server-side coordinates by this distance, they get teleported back. */
private static final float correctDist = tilesize * 12f;
private static final float correctDist = tilesize * 14f;
public final Administration admins = new Administration();
public final CommandHandler clientCommands = new CommandHandler("/");

View File

@@ -248,7 +248,7 @@ public class Damage{
tmpUnit = null;
Cons<Unit> cons = e -> {
Units.nearbyEnemies(hitter.team, rect, e -> {
if((tmpUnit != null && e.dst2(x, y) > tmpUnit.dst2(x, y)) || !e.checkTarget(hitter.type.collidesAir, hitter.type.collidesGround)) return;
e.hitbox(hitrect);
@@ -263,9 +263,7 @@ public class Damage{
if(vec != null){
tmpUnit = e;
}
};
Units.nearbyEnemies(hitter.team, rect, cons);
});
if(tmpBuilding != null && tmpUnit != null){
if(Mathf.dst2(x, y, tmpUnit.getX(), tmpUnit.getY()) <= Mathf.dst2(x, y, tmpBuilding.getX(), tmpBuilding.getY())){
@@ -339,7 +337,12 @@ public class Damage{
/** Damages all entities and blocks in a radius that are enemies of the team. */
public static void damage(Team team, float x, float y, float radius, float damage, boolean complete, boolean air, boolean ground){
Cons<Unit> cons = entity -> {
Cons<Unit> cons
= entity -> {
if(entity.team == team || !entity.within(x, y, radius) || (entity.isFlying() && !air) || (entity.isGrounded() && !ground)){
return;
}

View File

@@ -55,7 +55,9 @@ public class EntityGroup<T extends Entityc> implements Iterable<T>{
}
public void update(){
each(Entityc::update);
for(index = 0; index < array.size; index++){
array.items[index].update();
}
}
public Seq<T> copy(Seq<T> arr){

View File

@@ -283,7 +283,7 @@ public class StackConveyor extends Block implements Autotiler{
@Override
public void handleItem(Building source, Item item){
if(items.empty()) poofIn();
if(items.empty() && tile != null) poofIn();
super.handleItem(source, item);
lastItem = item;
}
@@ -291,7 +291,7 @@ public class StackConveyor extends Block implements Autotiler{
@Override
public void handleStack(Item item, int amount, Teamc source){
if(amount <= 0) return;
if(items.empty()) poofIn();
if(items.empty() && tile != null) poofIn();
super.handleStack(item, amount, source);
lastItem = item;
}

View File

@@ -47,7 +47,7 @@ public class LogicBlock extends Block{
config(Integer.class, (LogicBuild entity, Integer pos) -> {
//if there is no valid link in the first place, nobody cares
if(!entity.validLink(world.build(pos))) return;
Building lbuild = world.build(pos);
var lbuild = world.build(pos);
int x = lbuild.tileX(), y = lbuild.tileY();
LogicLink link = entity.links.find(l -> l.x == x && l.y == y);
@@ -62,8 +62,7 @@ public class LogicBlock extends Block{
}
}else{
entity.links.remove(l -> world.build(l.x, l.y) == lbuild);
LogicLink out = new LogicLink(x, y, entity.findLinkName(lbuild.block), true);
entity.links.add(out);
entity.links.add(new LogicLink(x, y, entity.findLinkName(lbuild.block), true));
}
entity.updateCode(entity.code, true, null);