From 5169e197b67ae63d4793df0afbdb6f687e979821 Mon Sep 17 00:00:00 2001 From: Anuken Date: Sat, 8 Feb 2020 16:00:54 -0500 Subject: [PATCH] Bugfixes --- .../java/mindustry/annotations/impl/EntityProcess.java | 2 +- core/src/mindustry/content/Blocks.java | 1 + core/src/mindustry/entities/EntityCollisions.java | 3 +-- core/src/mindustry/entities/def/EntityComp.java | 2 -- core/src/mindustry/entities/def/FlyingComp.java | 1 - core/src/mindustry/entities/def/LegsComp.java | 7 +++---- core/src/mindustry/entities/def/VelComp.java | 2 ++ gradle.properties | 2 +- 8 files changed, 9 insertions(+), 11 deletions(-) diff --git a/annotations/src/main/java/mindustry/annotations/impl/EntityProcess.java b/annotations/src/main/java/mindustry/annotations/impl/EntityProcess.java index bb6e1b8257..1df120f5bf 100644 --- a/annotations/src/main/java/mindustry/annotations/impl/EntityProcess.java +++ b/annotations/src/main/java/mindustry/annotations/impl/EntityProcess.java @@ -272,7 +272,7 @@ public class EntityProcess extends BaseProcessor{ err("Type " + type + " has multiple components implementing non-void method " + entry.key + "."); } - entry.value.sort(m -> m.has(MethodPriority.class) ? m.annotation(MethodPriority.class).value() : 0); + entry.value.sort(Structs.comps(Structs.comparingFloat(m -> m.has(MethodPriority.class) ? m.annotation(MethodPriority.class).value() : 0), Structs.comparing(Selement::name))); //representative method Smethod first = entry.value.first(); diff --git a/core/src/mindustry/content/Blocks.java b/core/src/mindustry/content/Blocks.java index bcedc0e4d6..e6428ad0e0 100644 --- a/core/src/mindustry/content/Blocks.java +++ b/core/src/mindustry/content/Blocks.java @@ -269,6 +269,7 @@ public class Blocks implements ContentList{ ice = new Floor("ice"){{ dragMultiplier = 0.35f; + speedMultiplier = 0.9f; attributes.set(Attribute.water, 0.4f); }}; diff --git a/core/src/mindustry/entities/EntityCollisions.java b/core/src/mindustry/entities/EntityCollisions.java index 29be64cd5d..3e0e385afb 100644 --- a/core/src/mindustry/entities/EntityCollisions.java +++ b/core/src/mindustry/entities/EntityCollisions.java @@ -115,8 +115,7 @@ public class EntityCollisions{ tree.clear(); group.each(s -> { - s.lastX(s.getX()); - s.lastY(s.getY()); + s.updateLastPosition(); tree.insert(s); }); } diff --git a/core/src/mindustry/entities/def/EntityComp.java b/core/src/mindustry/entities/def/EntityComp.java index 1ffab2ee7a..80c1412930 100644 --- a/core/src/mindustry/entities/def/EntityComp.java +++ b/core/src/mindustry/entities/def/EntityComp.java @@ -19,8 +19,6 @@ abstract class EntityComp{ return added; } - void init(){} - void update(){} void remove(){ diff --git a/core/src/mindustry/entities/def/FlyingComp.java b/core/src/mindustry/entities/def/FlyingComp.java index 9e21a61d3e..60b1dda381 100644 --- a/core/src/mindustry/entities/def/FlyingComp.java +++ b/core/src/mindustry/entities/def/FlyingComp.java @@ -32,7 +32,6 @@ abstract class FlyingComp implements Posc, Velc, Healthc, Hitboxc{ } void moveAt(Vec2 vector){ - Floor on = isFlying() ? Blocks.air.asFloor() : floorOn(); Vec2 t = Tmp.v3.set(vector).scl(floorSpeedMultiplier()); //target vector float mag = Tmp.v3.len(); vel.x = Mathf.approach(vel.x, t.x, mag); diff --git a/core/src/mindustry/entities/def/LegsComp.java b/core/src/mindustry/entities/def/LegsComp.java index 7134aa980f..f530a1997f 100644 --- a/core/src/mindustry/entities/def/LegsComp.java +++ b/core/src/mindustry/entities/def/LegsComp.java @@ -13,10 +13,9 @@ abstract class LegsComp implements Posc, Flyingc, Hitboxc, DrawLayerGroundUnderc @Override public void update(){ - if(vel().len() > 0.5f){ - baseRotation = Angles.moveToward(baseRotation, vel().angle(), type().baseRotateSpeed); - walkTime += Time.delta()*vel().len()/1f; - } + float len = vel().len(); + baseRotation = Angles.moveToward(baseRotation, vel().angle(), type().baseRotateSpeed * Mathf.clamp(len / type().speed)); + walkTime += Time.delta()*len/1f; } @Override diff --git a/core/src/mindustry/entities/def/VelComp.java b/core/src/mindustry/entities/def/VelComp.java index 512777a7f6..7155b804c6 100644 --- a/core/src/mindustry/entities/def/VelComp.java +++ b/core/src/mindustry/entities/def/VelComp.java @@ -12,6 +12,8 @@ abstract class VelComp implements Posc{ final Vec2 vel = new Vec2(); float drag = 0f; + //velocity needs to be called first, as it affects delta and lastPosition + @MethodPriority(-1) @Override public void update(){ move(vel.x, vel.y); diff --git a/gradle.properties b/gradle.properties index ae5c619f0d..3fead25b94 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,3 +1,3 @@ org.gradle.daemon=true org.gradle.jvmargs=-Xms256m -Xmx1024m -archash=0328073f1993cd1d72a237781c3cc1f82395234b +archash=68b2451bd0f8c6252ccf2c065a1c4b4896605183