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
+1 -1
View File
@@ -41,7 +41,7 @@ public class NetServer implements ApplicationListener{
private static final Vec2 vector = new Vec2(); private static final Vec2 vector = new Vec2();
private static final Rect viewport = new Rect(); private static final Rect viewport = new Rect();
/** If a player goes away of their server-side coordinates by this distance, they get teleported back. */ /** 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 Administration admins = new Administration();
public final CommandHandler clientCommands = new CommandHandler("/"); public final CommandHandler clientCommands = new CommandHandler("/");
+8 -5
View File
@@ -248,7 +248,7 @@ public class Damage{
tmpUnit = null; 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; if((tmpUnit != null && e.dst2(x, y) > tmpUnit.dst2(x, y)) || !e.checkTarget(hitter.type.collidesAir, hitter.type.collidesGround)) return;
e.hitbox(hitrect); e.hitbox(hitrect);
@@ -263,9 +263,7 @@ public class Damage{
if(vec != null){ if(vec != null){
tmpUnit = e; tmpUnit = e;
} }
}; });
Units.nearbyEnemies(hitter.team, rect, cons);
if(tmpBuilding != null && tmpUnit != null){ if(tmpBuilding != null && tmpUnit != null){
if(Mathf.dst2(x, y, tmpUnit.getX(), tmpUnit.getY()) <= Mathf.dst2(x, y, tmpBuilding.getX(), tmpBuilding.getY())){ 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. */ /** 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){ 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)){ if(entity.team == team || !entity.within(x, y, radius) || (entity.isFlying() && !air) || (entity.isGrounded() && !ground)){
return; return;
} }
+3 -1
View File
@@ -55,7 +55,9 @@ public class EntityGroup<T extends Entityc> implements Iterable<T>{
} }
public void update(){ public void update(){
each(Entityc::update); for(index = 0; index < array.size; index++){
array.items[index].update();
}
} }
public Seq<T> copy(Seq<T> arr){ public Seq<T> copy(Seq<T> arr){
@@ -283,7 +283,7 @@ public class StackConveyor extends Block implements Autotiler{
@Override @Override
public void handleItem(Building source, Item item){ public void handleItem(Building source, Item item){
if(items.empty()) poofIn(); if(items.empty() && tile != null) poofIn();
super.handleItem(source, item); super.handleItem(source, item);
lastItem = item; lastItem = item;
} }
@@ -291,7 +291,7 @@ public class StackConveyor extends Block implements Autotiler{
@Override @Override
public void handleStack(Item item, int amount, Teamc source){ public void handleStack(Item item, int amount, Teamc source){
if(amount <= 0) return; if(amount <= 0) return;
if(items.empty()) poofIn(); if(items.empty() && tile != null) poofIn();
super.handleStack(item, amount, source); super.handleStack(item, amount, source);
lastItem = item; lastItem = item;
} }
@@ -47,7 +47,7 @@ public class LogicBlock extends Block{
config(Integer.class, (LogicBuild entity, Integer pos) -> { config(Integer.class, (LogicBuild entity, Integer pos) -> {
//if there is no valid link in the first place, nobody cares //if there is no valid link in the first place, nobody cares
if(!entity.validLink(world.build(pos))) return; if(!entity.validLink(world.build(pos))) return;
Building lbuild = world.build(pos); var lbuild = world.build(pos);
int x = lbuild.tileX(), y = lbuild.tileY(); int x = lbuild.tileX(), y = lbuild.tileY();
LogicLink link = entity.links.find(l -> l.x == x && l.y == y); LogicLink link = entity.links.find(l -> l.x == x && l.y == y);
@@ -62,8 +62,7 @@ public class LogicBlock extends Block{
} }
}else{ }else{
entity.links.remove(l -> world.build(l.x, l.y) == lbuild); 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(new LogicLink(x, y, entity.findLinkName(lbuild.block), true));
entity.links.add(out);
} }
entity.updateCode(entity.code, true, null); entity.updateCode(entity.code, true, null);
+1 -1
View File
@@ -1,3 +1,3 @@
org.gradle.daemon=true org.gradle.daemon=true
org.gradle.jvmargs=-Xms256m -Xmx1024m org.gradle.jvmargs=-Xms256m -Xmx1024m
archash=dc282cd5ac5e6017992767f1c3827945c3be40fa archash=20f1b39b3238d56cff9956db35e808e72d6797b6