Great cleanup

This commit is contained in:
Skat
2020-11-07 11:37:46 +03:00
parent 29b8db0a85
commit ed36390f3c
45 changed files with 134 additions and 189 deletions

View File

@@ -408,8 +408,7 @@ public class Damage{
}
@Struct
static
class PropCellStruct{
static class PropCellStruct{
byte x;
byte y;
short damage;

View File

@@ -115,7 +115,6 @@ public class EntityCollisions{
@SuppressWarnings("unchecked")
public <T extends Hitboxc> void updatePhysics(EntityGroup<T> group){
QuadTree tree = group.tree();
tree.clear();
@@ -141,7 +140,6 @@ public class EntityCollisions{
}
private void checkCollide(Hitboxc a, Hitboxc b){
a.hitbox(this.r1);
b.hitbox(this.r2);
@@ -218,7 +216,6 @@ public class EntityCollisions{
@SuppressWarnings("unchecked")
public <T extends Hitboxc> void collide(EntityGroup<T> groupa){
groupa.each(solid -> {
solid.hitbox(r1);
r1.x += (solid.lastX() - solid.getX());

View File

@@ -183,8 +183,7 @@ public class EntityGroup<T extends Entityc> implements Iterable<T>{
array.each(Entityc::remove);
array.clear();
if(map != null)
map.clear();
if(map != null) map.clear();
clearing = false;
}

View File

@@ -28,7 +28,6 @@ public class StatusFieldAbility extends Ability{
timer += Time.delta;
if(timer >= reload){
Units.nearby(unit.team, unit.x, unit.y, range, other -> {
other.apply(effect, duration);
});

View File

@@ -34,7 +34,6 @@ public class UnitSpawnAbility extends Ability{
timer += Time.delta;
if(timer >= spawnTime && Units.canCreate(unit.team, type)){
float x = unit.x + Angles.trnsx(unit.rotation, spawnY, spawnX), y = unit.y + Angles.trnsy(unit.rotation, spawnY, spawnX);
spawnEffect.at(x, y);
Unit u = type.create(unit.team);

View File

@@ -165,7 +165,7 @@ public abstract class BulletType extends Content{
if(makeFire && tile.team != b.team){
Fires.create(tile.tile);
}
if(healPercent > 0f && tile.team == b.team && !(tile.block instanceof ConstructBlock)){
Fx.healBlockFull.at(tile.x, tile.y, tile.block.size, Pal.heal);
tile.heal(healPercent / 100f * tile.maxHealth());
@@ -213,9 +213,9 @@ public abstract class BulletType extends Content{
if(status != StatusEffects.none){
Damage.status(b.team, x, y, splashDamageRadius, status, statusDuration, collidesAir, collidesGround);
}
if(healPercent > 0f){
indexer.eachBlock(b.team, x, y, splashDamageRadius, other -> other.damaged(), other -> {
indexer.eachBlock(b.team, x, y, splashDamageRadius, Building::damaged, other -> {
Fx.healBlockFull.at(other.x, other.y, other.block.size, Pal.heal);
other.heal(healPercent / 100f * other.maxHealth());
});
@@ -253,8 +253,8 @@ public abstract class BulletType extends Content{
public void init(Bullet b){
if(killShooter && b.owner() instanceof Healthc){
((Healthc)b.owner()).kill();
if(killShooter && b.owner() instanceof Healthc h){
h.kill();
}
if(instantDisappear){

View File

@@ -62,17 +62,15 @@ public class SapBulletType extends BulletType{
if(target != null){
float result = Math.min(target.health(), damage);
if(b.owner instanceof Healthc){
((Healthc)b.owner).heal(result * sapStrength);
if(b.owner instanceof Healthc h){
h.heal(result * sapStrength);
}
}
if(target instanceof Hitboxc hit){
hit.collision(b, hit.x(), hit.y());
b.collision(hit, hit.x(), hit.y());
}else if(target instanceof Building tile){
if(tile.collide(b)){
tile.collision(b);
hit(b, tile.x, tile.y);

View File

@@ -61,7 +61,6 @@ public class AIController implements UnitController{
}
protected void updateVisuals(){
if(unit.isFlying()){
unit.wobble();