mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-01-30 17:34:23 +07:00
Fixed discarded shells appearing in water
This commit is contained in:
parent
2af750cfec
commit
3a3c23d2f1
@ -74,15 +74,14 @@ public class Renderer extends RendererModule{
|
||||
Rectangle pos = rect2.setSize(effect.size).setCenter(x, y);
|
||||
|
||||
if(view.overlaps(pos)){
|
||||
int id = 0;
|
||||
|
||||
if(!(effect instanceof GroundEffect) || ((GroundEffect)effect).isStatic) {
|
||||
if(!(effect instanceof GroundEffect)) {
|
||||
EffectEntity entity = Pools.obtain(EffectEntity.class);
|
||||
entity.effect = effect;
|
||||
entity.color = color;
|
||||
entity.rotation = rotation;
|
||||
entity.lifetime = effect.lifetime;
|
||||
id = entity.set(x, y).add(effectGroup).id;
|
||||
entity.set(x, y).add(effectGroup);
|
||||
|
||||
if(data instanceof Entity){
|
||||
entity.setParent((Entity)data);
|
||||
@ -96,10 +95,6 @@ public class Renderer extends RendererModule{
|
||||
entity.rotation = rotation;
|
||||
entity.lifetime = effect.lifetime;
|
||||
entity.set(x, y).add(groundEffectGroup);
|
||||
|
||||
if(((GroundEffect)effect).isStatic){
|
||||
entity.id = id;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -241,7 +236,7 @@ public class Renderer extends RendererModule{
|
||||
if(pixelate)
|
||||
Graphics.flushSurface();
|
||||
|
||||
drawDebug();
|
||||
if(showPaths) drawDebug();
|
||||
drawPlayerNames();
|
||||
|
||||
batch.end();
|
||||
|
@ -1,5 +1,7 @@
|
||||
package io.anuke.mindustry.entities.effect;
|
||||
|
||||
import io.anuke.mindustry.Vars;
|
||||
import io.anuke.mindustry.world.Tile;
|
||||
import io.anuke.ucore.core.Effects;
|
||||
import io.anuke.ucore.core.Effects.Effect;
|
||||
import io.anuke.ucore.core.Timers;
|
||||
@ -22,6 +24,10 @@ public class GroundEffectEntity extends EffectEntity {
|
||||
if (!once && time >= lifetime) {
|
||||
once = true;
|
||||
time = 0f;
|
||||
Tile tile = Vars.world.tileWorld(x, y);
|
||||
if(tile != null && tile.floor().liquid){
|
||||
remove();
|
||||
}
|
||||
} else if (once && time >= effect.staticLife) {
|
||||
remove();
|
||||
}
|
||||
@ -36,10 +42,16 @@ public class GroundEffectEntity extends EffectEntity {
|
||||
|
||||
if(once && effect.isStatic)
|
||||
Effects.renderEffect(id, effect, color, lifetime, rotation, x, y, data);
|
||||
else if(!effect.isStatic)
|
||||
else
|
||||
Effects.renderEffect(id, effect, color, time, rotation, x, y, data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reset() {
|
||||
super.reset();
|
||||
once = false;
|
||||
}
|
||||
|
||||
public static class GroundEffect extends Effect{
|
||||
public final float staticLife;
|
||||
public final boolean isStatic;
|
||||
|
Loading…
Reference in New Issue
Block a user