Fix Boat Trails Being Drawn on Land (#5340)
* update * Revert "update" This reverts commit6ff3523276. * Hacky Implementation * Revert "Hacky Implementation" This reverts commit632121312d. * Not so Hacky Implementation Co-authored-by: Leonwang4234 <62972692+Leonwang4234@users.noreply.github.com> Co-authored-by: Leonwang4234 <leonwang4234@gmail.com> Co-authored-by: Anuken <arnukren@gmail.com>
This commit is contained in:
@@ -15,6 +15,8 @@ import mindustry.type.*;
|
||||
import mindustry.world.*;
|
||||
import mindustry.world.blocks.environment.*;
|
||||
|
||||
import static mindustry.Vars.*;
|
||||
|
||||
@Component
|
||||
abstract class WaterMoveComp implements Posc, Velc, Hitboxc, Flyingc, Unitc{
|
||||
@Import float x, y, rotation;
|
||||
@@ -31,7 +33,7 @@ abstract class WaterMoveComp implements Posc, Velc, Hitboxc, Flyingc, Unitc{
|
||||
|
||||
int sign = i == 0 ? -1 : 1;
|
||||
float cx = Angles.trnsx(rotation - 90, type.trailX * sign, type.trailY) + x, cy = Angles.trnsy(rotation - 90, type.trailX * sign, type.trailY) + y;
|
||||
t.update(cx, cy);
|
||||
t.update(cx, cy, world.floorWorld(cx, cy).isLiquid ? 1 : 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -40,6 +40,7 @@ public class Trail{
|
||||
float[] items = points.items;
|
||||
int i = points.size - 3;
|
||||
float x1 = items[i], y1 = items[i + 1], w1 = items[i + 2], w = w1 * width / (points.size/3) * i/3f * 2f;
|
||||
if(w1 <= 0.001f) return;
|
||||
Draw.rect("hcircle", x1, y1, w, w, -Mathf.radDeg * lastAngle + 180f);
|
||||
Draw.reset();
|
||||
}
|
||||
@@ -56,6 +57,7 @@ public class Trail{
|
||||
float size = width / (points.size/3);
|
||||
float z1 = lastAngle;
|
||||
float z2 = -Angles.angleRad(x2, y2, lx, ly);
|
||||
if(w1 <= 0.001f || w2 <= 0.001f) continue;
|
||||
|
||||
float cx = Mathf.sin(z1) * i/3f * size * w1, cy = Mathf.cos(z1) * i/3f * size * w1,
|
||||
nx = Mathf.sin(z2) * (i/3f + 1) * size * w2, ny = Mathf.cos(z2) * (i/3f + 1) * size * w2;
|
||||
|
||||
Reference in New Issue
Block a user