This commit is contained in:
Anuken
2021-07-19 15:20:53 -04:00
parent 0c46d5088c
commit 6b7a63aba5
5 changed files with 20 additions and 23 deletions

View File

@@ -141,12 +141,9 @@ public class Effect{
} }
public static void create(Effect effect, float x, float y, float rotation, Color color, Object data){ public static void create(Effect effect, float x, float y, float rotation, Color color, Object data){
if(headless || effect == Fx.none) return; if(headless || effect == Fx.none || !Core.settings.getBool("effects")) return;
if(Core.settings.getBool("effects")){
Rect view = Core.camera.bounds(Tmp.r1);
Rect pos = Tmp.r2.setSize(effect.clip).setCenter(x, y);
if(view.overlaps(pos)){ if(Core.camera.bounds(Tmp.r1).overlaps(Tmp.r2.setCentered(x, y, effect.clip))){
if(!effect.initialized){ if(!effect.initialized){
effect.initialized = true; effect.initialized = true;
effect.init(); effect.init();
@@ -159,11 +156,10 @@ public class Effect{
entity.lifetime = effect.lifetime; entity.lifetime = effect.lifetime;
entity.set(x, y); entity.set(x, y);
entity.color.set(color); entity.color.set(color);
if(effect.followParent && data instanceof Posc) entity.parent = ((Posc)data); if(effect.followParent && data instanceof Posc p) entity.parent = p;
entity.add(); entity.add();
} }
} }
}
public static void decal(TextureRegion region, float x, float y, float rotation){ public static void decal(TextureRegion region, float x, float y, float rotation){
decal(region, x, y, rotation, 3600f, Pal.rubble); decal(region, x, y, rotation, 3600f, Pal.rubble);

View File

@@ -41,6 +41,7 @@ public class Drawf{
Draw.reset(); Draw.reset();
} }
/** Sets Draw.z to the text layer, and returns the previous layer. */
public static float text(){ public static float text(){
float z = Draw.z(); float z = Draw.z();
if(renderer.pixelator.enabled()){ if(renderer.pixelator.enabled()){
@@ -275,7 +276,7 @@ public class Drawf{
Draw.reset(); Draw.reset();
} }
/** Draws a sprite that should be lightwise correct. Provided sprite must be symmetrical. */ /** Draws a sprite that should be light-wise correct, when rotated. Provided sprite must be symmetrical in shape. */
public static void spinSprite(TextureRegion region, float x, float y, float r){ public static void spinSprite(TextureRegion region, float x, float y, float r){
r = Mathf.mod(r, 90f); r = Mathf.mod(r, 90f);
Draw.rect(region, x, y, r); Draw.rect(region, x, y, r);

View File

@@ -120,7 +120,7 @@ public class GenericCrafter extends Block{
warmup = Mathf.approachDelta(warmup, 1f, warmupSpeed); warmup = Mathf.approachDelta(warmup, 1f, warmupSpeed);
if(Mathf.chanceDelta(updateEffectChance)){ if(Mathf.chanceDelta(updateEffectChance)){
updateEffect.at(getX() + Mathf.range(size * 4f), getY() + Mathf.range(size * 4)); updateEffect.at(x + Mathf.range(size * 4f), y + Mathf.range(size * 4));
} }
}else{ }else{
warmup = Mathf.approachDelta(warmup, 0f, warmupSpeed); warmup = Mathf.approachDelta(warmup, 0f, warmupSpeed);

View File

@@ -49,7 +49,7 @@ public class LiquidConverter extends GenericCrafter{
if(cons.valid()){ if(cons.valid()){
if(Mathf.chanceDelta(updateEffectChance)){ if(Mathf.chanceDelta(updateEffectChance)){
updateEffect.at(getX() + Mathf.range(size * 4f), getY() + Mathf.range(size * 4)); updateEffect.at(x + Mathf.range(size * 4f), y + Mathf.range(size * 4));
} }
warmup = Mathf.lerpDelta(warmup, 1f, 0.02f); warmup = Mathf.lerpDelta(warmup, 1f, 0.02f);

View File

@@ -108,7 +108,7 @@ public class SolidPump extends Pump{
lastPump = maxPump; lastPump = maxPump;
warmup = Mathf.lerpDelta(warmup, 1f, 0.02f); warmup = Mathf.lerpDelta(warmup, 1f, 0.02f);
if(Mathf.chance(delta() * updateEffectChance)) if(Mathf.chance(delta() * updateEffectChance))
updateEffect.at(getX() + Mathf.range(size * 2f), getY() + Mathf.range(size * 2f)); updateEffect.at(x + Mathf.range(size * 2f), y + Mathf.range(size * 2f));
}else{ }else{
warmup = Mathf.lerpDelta(warmup, 0f, 0.02f); warmup = Mathf.lerpDelta(warmup, 0f, 0.02f);
lastPump = 0f; lastPump = 0f;