Targeting bugfixes

This commit is contained in:
Anuken
2020-05-20 13:56:17 -04:00
parent 611115e55b
commit aa19c80567
13 changed files with 19 additions and 17 deletions

View File

@@ -174,12 +174,14 @@ public class UnitTypes implements ContentList{
reaper = new UnitType("reaper"){{
speed = 1.1f;
accel = 0.08f;
accel = 0.02f;
drag = 0.05f;
mass = 30f;
rotateSpeed = 0.5f;
flying = true;
lowAltitude = true;
health = 75000;
engineOffset = 40;
engineOffset = 38;
engineSize = 7.3f;
hitsize = 58f;

View File

@@ -51,15 +51,15 @@ public class Predict{
return sol;
}
public static Vec2 intercept(Position src, Hitboxc dst, float v){
return intercept(src.getX(), src.getY(), dst.getX(), dst.getY(), dst.deltaX(), dst.deltaY(), v);
}
public static Vec2 intercept(Position src, Position dst, float v){
float ddx = 0, ddy = 0;
if(dst instanceof Hitboxc){
ddx = ((Hitboxc)dst).deltaX();
ddy = ((Hitboxc)dst).deltaY();
ddx += ((Hitboxc)dst).deltaX();
ddy += ((Hitboxc)dst).deltaY();
}
if(src instanceof Hitboxc){
ddx -= ((Hitboxc)src).deltaX()/(Time.delta());
ddy -= ((Hitboxc)src).deltaY()/(Time.delta());
}
return intercept(src.getX(), src.getY(), dst.getX(), dst.getY(), ddx, ddy, v);
}

View File

@@ -39,7 +39,7 @@ public class Units{
* @return whether the target is invalid
*/
public static boolean invalidateTarget(Posc target, Team team, float x, float y, float range){
return target == null || !target.isAdded() || (range != Float.MAX_VALUE && !target.within(x, y, range)) || (target instanceof Teamc && ((Teamc)target).team() == team) || (target instanceof Healthc && !((Healthc)target).isValid());
return target == null || (range != Float.MAX_VALUE && !target.within(x, y, range)) || (target instanceof Teamc && ((Teamc)target).team() == team) || (target instanceof Healthc && !((Healthc)target).isValid());
}
/** See {@link #invalidateTarget(Posc, Team, float, float, float)} */

View File

@@ -219,7 +219,7 @@ public abstract class BulletType extends Content{
bullet.damage(damage < 0 ? this.damage : damage);
bullet.add();
if(keepVelocity && owner instanceof Velc) bullet.vel().add(((Velc)owner).vel());
if(keepVelocity && owner instanceof Hitboxc) bullet.vel().add(((Hitboxc)owner).deltaX(), ((Hitboxc)owner).deltaY());
return bullet;
}

View File

@@ -41,8 +41,8 @@ public class Layer{
//building plans
plans = 85,
//flying units
flyingUnit = 115,
//flying units (low altitude)
flyingUnitLow = 90,
//bullets *bloom begin*
bullet = 100,
@@ -50,6 +50,9 @@ public class Layer{
//effects *bloom end*
effect = 110,
//flying units
flyingUnit = 115,
//overlaied UI, like block config guides
overlayUI = 120,

View File

@@ -53,7 +53,6 @@ public class MultiPacker implements Disposable{
main,
environment,
editor,
zone,
ui;
public static final PageType[] all = values();

View File

@@ -195,7 +195,6 @@ public class Mods implements Loadable{
region.getTexture() == Core.atlas.find("white").getTexture() ? PageType.main :
region.getTexture() == Core.atlas.find("stone1").getTexture() ? PageType.environment :
region.getTexture() == Core.atlas.find("clear-editor").getTexture() ? PageType.editor :
region.getTexture() == Core.atlas.find("zone-groundZero").getTexture() ? PageType.zone :
region.getTexture() == Core.atlas.find("whiteui").getTexture() ? PageType.ui :
PageType.main;
}
@@ -205,7 +204,6 @@ public class Mods implements Loadable{
return
parent.equals("environment") ? PageType.environment :
parent.equals("editor") ? PageType.editor :
parent.equals("zones") ? PageType.zone :
parent.equals("ui") || file.parent().parent().name().equals("ui") ? PageType.ui :
PageType.main;
}

View File

@@ -34,7 +34,7 @@ public class UnitType extends UnlockableContent{
public float drag = 0.3f, mass = 1f, accel = 0.5f;
public float health = 200f, range = -1;
public boolean targetAir = true, targetGround = true;
public boolean faceTarget = true, isCounted = true;
public boolean faceTarget = true, isCounted = true, lowAltitude = false;
public float sway = 1f;
public int itemCapacity = 30;
@@ -129,7 +129,7 @@ public class UnitType extends UnlockableContent{
drawShadow(unit);
}
float z = Mathf.lerp(Layer.groundUnit, Layer.flyingUnit, unit.elevation());
float z = unit.elevation() > 0.5f ? (lowAltitude ? Layer.flyingUnitLow : Layer.flyingUnit) : Layer.groundUnit;
Draw.z(z - 0.02f);