Fixed discarded shells appearing in water
This commit is contained in:
@@ -74,15 +74,14 @@ public class Renderer extends RendererModule{
|
|||||||
Rectangle pos = rect2.setSize(effect.size).setCenter(x, y);
|
Rectangle pos = rect2.setSize(effect.size).setCenter(x, y);
|
||||||
|
|
||||||
if(view.overlaps(pos)){
|
if(view.overlaps(pos)){
|
||||||
int id = 0;
|
|
||||||
|
|
||||||
if(!(effect instanceof GroundEffect) || ((GroundEffect)effect).isStatic) {
|
if(!(effect instanceof GroundEffect)) {
|
||||||
EffectEntity entity = Pools.obtain(EffectEntity.class);
|
EffectEntity entity = Pools.obtain(EffectEntity.class);
|
||||||
entity.effect = effect;
|
entity.effect = effect;
|
||||||
entity.color = color;
|
entity.color = color;
|
||||||
entity.rotation = rotation;
|
entity.rotation = rotation;
|
||||||
entity.lifetime = effect.lifetime;
|
entity.lifetime = effect.lifetime;
|
||||||
id = entity.set(x, y).add(effectGroup).id;
|
entity.set(x, y).add(effectGroup);
|
||||||
|
|
||||||
if(data instanceof Entity){
|
if(data instanceof Entity){
|
||||||
entity.setParent((Entity)data);
|
entity.setParent((Entity)data);
|
||||||
@@ -96,10 +95,6 @@ public class Renderer extends RendererModule{
|
|||||||
entity.rotation = rotation;
|
entity.rotation = rotation;
|
||||||
entity.lifetime = effect.lifetime;
|
entity.lifetime = effect.lifetime;
|
||||||
entity.set(x, y).add(groundEffectGroup);
|
entity.set(x, y).add(groundEffectGroup);
|
||||||
|
|
||||||
if(((GroundEffect)effect).isStatic){
|
|
||||||
entity.id = id;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -241,7 +236,7 @@ public class Renderer extends RendererModule{
|
|||||||
if(pixelate)
|
if(pixelate)
|
||||||
Graphics.flushSurface();
|
Graphics.flushSurface();
|
||||||
|
|
||||||
drawDebug();
|
if(showPaths) drawDebug();
|
||||||
drawPlayerNames();
|
drawPlayerNames();
|
||||||
|
|
||||||
batch.end();
|
batch.end();
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
package io.anuke.mindustry.entities.effect;
|
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;
|
||||||
import io.anuke.ucore.core.Effects.Effect;
|
import io.anuke.ucore.core.Effects.Effect;
|
||||||
import io.anuke.ucore.core.Timers;
|
import io.anuke.ucore.core.Timers;
|
||||||
@@ -22,6 +24,10 @@ public class GroundEffectEntity extends EffectEntity {
|
|||||||
if (!once && time >= lifetime) {
|
if (!once && time >= lifetime) {
|
||||||
once = true;
|
once = true;
|
||||||
time = 0f;
|
time = 0f;
|
||||||
|
Tile tile = Vars.world.tileWorld(x, y);
|
||||||
|
if(tile != null && tile.floor().liquid){
|
||||||
|
remove();
|
||||||
|
}
|
||||||
} else if (once && time >= effect.staticLife) {
|
} else if (once && time >= effect.staticLife) {
|
||||||
remove();
|
remove();
|
||||||
}
|
}
|
||||||
@@ -36,10 +42,16 @@ public class GroundEffectEntity extends EffectEntity {
|
|||||||
|
|
||||||
if(once && effect.isStatic)
|
if(once && effect.isStatic)
|
||||||
Effects.renderEffect(id, effect, color, lifetime, rotation, x, y, data);
|
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);
|
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 static class GroundEffect extends Effect{
|
||||||
public final float staticLife;
|
public final float staticLife;
|
||||||
public final boolean isStatic;
|
public final boolean isStatic;
|
||||||
|
|||||||
Reference in New Issue
Block a user