Too many things to list

This commit is contained in:
Anuken
2022-04-10 21:02:51 -04:00
parent 89af2c8033
commit 2145e31bac
18 changed files with 318 additions and 24 deletions

View File

@@ -171,7 +171,7 @@ public class Damage{
});
Units.nearbyEnemies(b.team, rect, u -> {
if(u.checkTarget(b.type.collidesAir, b.type.collidesGround)){
if(u.checkTarget(b.type.collidesAir, b.type.collidesGround) && u.type.hittable){
distances.add(u.dst(b));
}
});
@@ -272,6 +272,7 @@ public class Damage{
float x2 = vec.x + x, y2 = vec.y + y;
Cons<Unit> cons = e -> {
if(!e.type.hittable) return;
//the peirce cap works for units, but really terribly, I'm just disabling it for now.
//if(pierceCap > 0 && pierceCount > pierceCap) return;
@@ -373,7 +374,7 @@ public class Damage{
/** Damages all entities and blocks in a radius that are enemies of the team. */
public static void damageUnits(Team team, float x, float y, float size, float damage, Boolf<Unit> predicate, Cons<Unit> acceptor){
Cons<Unit> cons = entity -> {
if(!predicate.get(entity)) return;
if(!predicate.get(entity) || !entity.type.hittable) return;
entity.hitbox(hitrect);
if(!hitrect.overlaps(rect)){
@@ -437,7 +438,7 @@ 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, boolean scaled, Bullet source){
Cons<Unit> cons = entity -> {
if(entity.team == team || !entity.within(x, y, radius + (scaled ? entity.hitSize / 2f : 0f)) || (entity.isFlying() && !air) || (entity.isGrounded() && !ground)){
if(entity.team == team || !entity.type.hittable || !entity.within(x, y, radius + (scaled ? entity.hitSize / 2f : 0f)) || (entity.isFlying() && !air) || (entity.isGrounded() && !ground)){
return;
}

View File

@@ -159,7 +159,7 @@ public class EntityCollisions{
float vbx = b.getX() - b.lastX();
float vby = b.getY() - b.lastY();
if(a != b && a.collides(b)){
if(a != b && a.collides(b) && b.collides(a)){
l1.set(a.getX(), a.getY());
boolean collide = r1.overlaps(r2) || collide(r1.x, r1.y, r1.width, r1.height, vax, vay,
r2.x, r2.y, r2.width, r2.height, vbx, vby, l1);

View File

@@ -257,6 +257,12 @@ abstract class UnitComp implements Healthc, Physicsc, Hitboxc, Statusc, Teamc, I
return type.isCounted;
}
@Override
@Replace
public boolean collides(Hitboxc other){
return type.hittable;
}
@Override
public int itemCapacity(){
return type.itemCapacity;