diff --git a/core/src/mindustry/core/Platform.java b/core/src/mindustry/core/Platform.java index bbceee8a64..cf115e3b40 100644 --- a/core/src/mindustry/core/Platform.java +++ b/core/src/mindustry/core/Platform.java @@ -120,7 +120,7 @@ public interface Platform{ }else{ ui.loadAnd(() -> { try{ - Fi result = Core.files.local(name+ "." + extension); + Fi result = Core.files.local(name + "." + extension); writer.write(result); platform.shareFile(result); }catch(Throwable e){ diff --git a/core/src/mindustry/entities/Effect.java b/core/src/mindustry/entities/Effect.java index 4d298eb40f..4a8961d8f4 100644 --- a/core/src/mindustry/entities/Effect.java +++ b/core/src/mindustry/entities/Effect.java @@ -30,6 +30,8 @@ public class Effect{ public float lifetime = 50f; /** Clip size. */ public float clip; + /** Time delay before the effect starts */ + public float startDelay; /** Amount added to rotation */ public float baseRotation; /** If true, parent unit is data are followed. */ @@ -58,6 +60,11 @@ public class Effect{ all.add(this); } + public Effect startDelay(float d){ + startDelay = d; + return this; + } + public void init(){} public Effect followParent(boolean follow){ @@ -168,21 +175,29 @@ public class Effect{ effect.init(); } - EffectState entity = EffectState.create(); - entity.effect = effect; - entity.rotation = effect.baseRotation + rotation; - entity.data = data; - entity.lifetime = effect.lifetime; - entity.set(x, y); - entity.color.set(color); - if(effect.followParent && data instanceof Posc p){ - entity.parent = p; - entity.rotWithParent = effect.rotWithParent; + if(effect.startDelay <= 0f){ + inst(effect, x, y, rotation, color, data); + }else{ + Time.runTask(effect.startDelay, () -> inst(effect, x, y, rotation, color, data)); } - entity.add(); } } + private static void inst(Effect effect, float x, float y, float rotation, Color color, Object data){ + EffectState entity = EffectState.create(); + entity.effect = effect; + entity.rotation = effect.baseRotation + rotation; + entity.data = data; + entity.lifetime = effect.lifetime; + entity.set(x, y); + entity.color.set(color); + if(effect.followParent && data instanceof Posc p){ + entity.parent = p; + entity.rotWithParent = effect.rotWithParent; + } + entity.add(); + } + public static void decal(TextureRegion region, float x, float y, float rotation){ decal(region, x, y, rotation, 3600f, Pal.rubble); } diff --git a/core/src/mindustry/entities/bullet/BulletType.java b/core/src/mindustry/entities/bullet/BulletType.java index 062c8cc965..7e515281bb 100644 --- a/core/src/mindustry/entities/bullet/BulletType.java +++ b/core/src/mindustry/entities/bullet/BulletType.java @@ -49,6 +49,8 @@ public class BulletType extends Content implements Cloneable{ public Effect despawnEffect = Fx.hitBulletSmall; /** Effect created when shooting. */ public Effect shootEffect = Fx.shootSmall; + /** Effect created when charging completes; only usable in single-shot weapons with a firstShotDelay / shotDelay. */ + public Effect chargeShootEffect = Fx.none; /** Extra smoke effect created when shooting. */ public Effect smokeEffect = Fx.shootSmallSmoke; /** Sound made when hitting something or getting removed.*/ diff --git a/core/src/mindustry/maps/generators/PlanetGenerator.java b/core/src/mindustry/maps/generators/PlanetGenerator.java index a8f0e00e26..3533943b19 100644 --- a/core/src/mindustry/maps/generators/PlanetGenerator.java +++ b/core/src/mindustry/maps/generators/PlanetGenerator.java @@ -76,7 +76,7 @@ public abstract class PlanetGenerator extends BasicGenerator implements HexMeshe //sort counts in descending order Seq> entries = floorc.entries().toArray(); entries.sort(e -> -e.value); - //remove all blocks occuring < 30 times - unimportant + //remove all blocks occurring < 30 times - unimportant entries.removeAll(e -> e.value < 30); Block[] floors = new Block[entries.size]; @@ -84,7 +84,7 @@ public abstract class PlanetGenerator extends BasicGenerator implements HexMeshe floors[i] = entries.get(i).key; } - //TODO bad code + //bad contains() code, but will likely never be fixed boolean hasSnow = floors.length > 0 && (floors[0].name.contains("ice") || floors[0].name.contains("snow")); boolean hasRain = floors.length > 0 && !hasSnow && content.contains(Liquids.water) && !floors[0].name.contains("sand"); boolean hasDesert = floors.length > 0 && !hasSnow && !hasRain && floors[0] == Blocks.sand; diff --git a/core/src/mindustry/type/Weapon.java b/core/src/mindustry/type/Weapon.java index f472f7a03a..fe3bbda604 100644 --- a/core/src/mindustry/type/Weapon.java +++ b/core/src/mindustry/type/Weapon.java @@ -350,6 +350,7 @@ public class Weapon implements Cloneable{ if(!continuous){ shootSound.at(shootX, shootY, Mathf.random(soundPitchMin, soundPitchMax)); } + ammo.chargeShootEffect.at(shootX + unit.x - baseX, shootY + unit.y - baseY, rotation, parentize ? unit : null); }); }else{ unit.vel.add(Tmp.v1.trns(rotation + 180f, ammo.recoil)); diff --git a/gradle.properties b/gradle.properties index 310fedd629..d9b8a9312d 100644 --- a/gradle.properties +++ b/gradle.properties @@ -24,4 +24,4 @@ android.useAndroidX=true #used for slow jitpack builds; TODO see if this actually works org.gradle.internal.http.socketTimeout=100000 org.gradle.internal.http.connectionTimeout=100000 -archash=57b15a1b73cf0d6f19a50d2111f43d993e57c7f1 +archash=6a2c848995763acaaf4e5ee2d589f53f49c7c4c1