From a84a99aed6480d3c6d7893560e9268c91a579071 Mon Sep 17 00:00:00 2001 From: Anuken Date: Tue, 7 Jan 2025 20:35:35 -0500 Subject: [PATCH] Large cliff crusher block / Erekir ammo tweaks / Android file chooser fixes --- .../mindustry/android/AndroidLauncher.java | 1 + .../blocks/drills/cliff-crusher-top.png | Bin 352 -> 360 bytes .../large-cliff-crusher-rotator-bottom.png | Bin 0 -> 230 bytes .../drills/large-cliff-crusher-rotator.png | Bin 0 -> 338 bytes .../blocks/drills/large-cliff-crusher-top.png | Bin 0 -> 435 bytes .../blocks/drills/large-cliff-crusher.png | Bin 0 -> 2004 bytes core/assets/bundles/bundle.properties | 4 +- core/assets/icons/icons.properties | 1 + core/assets/logicids.dat | Bin 4673 -> 4694 bytes core/src/mindustry/content/Blocks.java | 71 +++++++++++++++--- core/src/mindustry/content/Fx.java | 40 +++++++++- .../entities/bullet/ArtilleryBulletType.java | 1 - .../world/blocks/defense/turrets/Turret.java | 15 ++++ .../world/blocks/production/WallCrafter.java | 49 +++++++++++- .../world/consumers/ConsumeLiquid.java | 5 ++ .../world/consumers/ConsumeLiquidBase.java | 3 + .../world/consumers/ConsumeLiquidFilter.java | 7 +- 17 files changed, 178 insertions(+), 19 deletions(-) create mode 100644 core/assets-raw/sprites/blocks/drills/large-cliff-crusher-rotator-bottom.png create mode 100644 core/assets-raw/sprites/blocks/drills/large-cliff-crusher-rotator.png create mode 100644 core/assets-raw/sprites/blocks/drills/large-cliff-crusher-top.png create mode 100644 core/assets-raw/sprites/blocks/drills/large-cliff-crusher.png diff --git a/android/src/mindustry/android/AndroidLauncher.java b/android/src/mindustry/android/AndroidLauncher.java index 1a3126234f..548f1b6078 100644 --- a/android/src/mindustry/android/AndroidLauncher.java +++ b/android/src/mindustry/android/AndroidLauncher.java @@ -110,6 +110,7 @@ public class AndroidLauncher extends AndroidApplication{ Intent intent = new Intent(open ? Intent.ACTION_OPEN_DOCUMENT : Intent.ACTION_CREATE_DOCUMENT); intent.addCategory(Intent.CATEGORY_OPENABLE); intent.setType(extension.equals("zip") && !open && extensions.length == 1 ? "application/zip" : "*/*"); + intent.putExtra(Intent.EXTRA_TITLE, "export." + extension); addResultListener(i -> startActivityForResult(intent, i), (code, in) -> { if(code == Activity.RESULT_OK && in != null && in.getData() != null){ diff --git a/core/assets-raw/sprites/blocks/drills/cliff-crusher-top.png b/core/assets-raw/sprites/blocks/drills/cliff-crusher-top.png index 3541f6e3966d9b5186e7433b1e6bbad8b4ec09ef..11b6823dcd4d866ae3db5a97302749cecc9eed22 100644 GIT binary patch delta 320 zcmV-G0l)s>0_XyeF@GXSL_t(|obB1W4Z<)Kh2a}S%R;Qc3aO)1h!HXZqC(WHzzQtH z0MH@?j)Q%C{5W5UK*{}a90kloL_|bHL`15#KTOZh*H)ZUN$=b6)=Ge1!&?ghT*F)K z0p^Cc+5`Ad0QL#6t`0=mCrzA&US8-soJi3BZy~0OU^Zl0|?e z!^gf<=mD6+8#@4dcw-0fg}g&Ve-;>rzVm$^VBPxOK~_NMj}$4vE`d@aK=*(Y5kijv z|4lIWl~BZ8069qk*eAeNb%4`xn%#e@4qzS;st;hEE1?NKf0v7hh=_=YNDE%Q$xKF; SC@9?k000021o-~S!vR1%=3WdP$^7~fSeyF)@F7JloG-88c;$6^WOx$N1*Qm z*c5=h0Jf?FTrtj5@cL7A03aNp`T#)OkWdo1@S5`d-MS?opY8e=`W=$`hJ-zgI_}$p` zXFk+2-#=gVvhw1tjx7%sZ!f>*vqeu!^~;;fwpnUX-(9{QSY5n3AIQ40J1wHW$KmaP zq!-Q`UObfYx&BLuWx}ej&ILcRFDOkBwECj;CVzvm+k&zL!!L>vUkZ4aW!DNaf$Tf> ZiMgd>>f=@4KYs;rJzf1=);T3K0RZQeVAKEr literal 0 HcmV?d00001 diff --git a/core/assets-raw/sprites/blocks/drills/large-cliff-crusher-rotator.png b/core/assets-raw/sprites/blocks/drills/large-cliff-crusher-rotator.png new file mode 100644 index 0000000000000000000000000000000000000000..a63c5c351a237250a2331f777749b80b811cdf55 GIT binary patch literal 338 zcmeAS@N?(olHy`uVBq!ia0vp^4j|0I1|(Ny7TyC=jKx9jP7LeL$-D%zc|2VlLn`LH zyIEH0peRdN)6c(5gKE*fmYTWf7 zY~NNt(0t$Z>8{75XL_fF*1vY{Z&_fTZ=Qck@x}@XZq*cygL!wZ@A16!=W)au0hQtd zBKwMu#5`gAvbR=Pxn;j3L%!mQlhY5H&F0scu<(70t6p=O zPRqJHj_!W~M*G_q+~7Z9=DbhwPJZ~w&7Rv22RjFtzK>~5l>e?mvv4FO#p0~hhG2y literal 0 HcmV?d00001 diff --git a/core/assets-raw/sprites/blocks/drills/large-cliff-crusher-top.png b/core/assets-raw/sprites/blocks/drills/large-cliff-crusher-top.png new file mode 100644 index 0000000000000000000000000000000000000000..1a9526ac5d649d4ac277f4ffa99ec7718ed4c076 GIT binary patch literal 435 zcmeAS@N?(olHy`uVBq!ia0vp^2_VeD1|%QND7OGojKx9jP7LeL$-D%zb3I)gLn`LH zy<_Ni#6Z9y@UX3g_@d=bk4!v5zH}593hZErdUNDl#hdT1M0Wq2onqV>12UVzAxwUK zzx~$R_xk^8{9e_oaKOP-kVWFneh#LX2VpFXO`HNg4GByv!U{7O4zfr*`1$try0U0S zwv`~2y6#NOTYcO!OUj;Gv6dF7H8ISU=~ZxWcUR)L5Sb0vJg4MaUU&oFITwKi!o~AF zXZ&{PHhI4G{rTyuoPR%jX?wO@OFOP5+xe`LZ^N|sZ&L-gRmp8gY6)RH)g*X{RYN#F z!{XoKhUr$zv6CG9^f~KG_^LZh@Hoe}h>FtMoAg-sYpUXO@ GgeCy`&!!Fl literal 0 HcmV?d00001 diff --git a/core/assets-raw/sprites/blocks/drills/large-cliff-crusher.png b/core/assets-raw/sprites/blocks/drills/large-cliff-crusher.png new file mode 100644 index 0000000000000000000000000000000000000000..508f4e7f22c9a40705cdd26c75029c11d5456364 GIT binary patch literal 2004 zcmV;_2P^oAP)A_-0)uaGX}0aE0NV(j1|FQ77o1?xg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B&V{Qrlkmm(K zr&`^b6lCm4ln|_$krjY@M{Ip{xxF}LXBLr+EF+tfCTmpMQn;q=j+hlf8T3&Qrj|A) zltH&b*zO7AKWGrN?x#0|lSi}Am7$iIvKBMC&%BcbaS$SdZxliX#9lU7YC0FYa+7~A z4W$sQ121%dfS-$Og5zhSHbg}2=T2CpJiMDKW8sY}!#gwQz(sAKWq4Cmsl|vBvDO+L zZ3)uvd0K+>yHOjcZ_<7OC#|~*{Q(C}R%gAcwS-8QrAez;+#@+rwXwqdcf>eN1!1&W z{j?0!)wLkafZGz_h$6uUzz2>Xf#AH2s>JP>XZn4bQ*9$AL!5!_loo2{NcNGU3( zCIEO7NoA%|%S=WGA60|k@uT#?3ZWSQ-lUY2CQ8On6?~Kg!Q)3QMb#7nfHy&TbM&c$ zk18Q}{IH~`p^2D9^V6kysQ`^Xl;EQfg2xZ54;q9N0N~vGu Math.max(Mathf.slope(v), 0.8f); + shrinkX = 0.2f; + shrinkY = 0.1f; + buildingDamageMultiplier = 0.25f; }} ); @@ -4633,7 +4687,6 @@ public class Blocks{ range = 250f; scaledHealth = 210; - //TODO is this a good idea to begin with? unitSort = UnitSorts.strongest; consumeLiquid(Liquids.nitrogen, 6f / 60f); diff --git a/core/src/mindustry/content/Fx.java b/core/src/mindustry/content/Fx.java index 1e8579f4b7..9fdbe7ac4d 100644 --- a/core/src/mindustry/content/Fx.java +++ b/core/src/mindustry/content/Fx.java @@ -28,7 +28,7 @@ public class Fx{ public static final Effect none = new Effect(0, 0f, e -> {}), - + blockCrash = new Effect(90f, e -> { if(!(e.data instanceof Block block)) return; @@ -445,6 +445,20 @@ public class Fx{ } }), + titanExplosionLarge = new Effect(45f, 220f, e -> { + color(e.color); + stroke(e.fout() * 3f); + float circleRad = 6f + e.finpow() * 110f; + Lines.circle(e.x, e.y, circleRad); + + rand.setSeed(e.id); + for(int i = 0; i < 21; i++){ + float angle = rand.random(360f); + float lenRand = rand.random(0.5f, 1f); + Lines.lineAngle(e.x, e.y, angle, e.foutpow() * 50f * rand.random(1f, 0.6f) + 2f, e.finpow() * 100f * lenRand + 6f); + } + }), + titanSmoke = new Effect(300f, 300f, b -> { float intensity = 3f; @@ -465,6 +479,26 @@ public class Fx{ } }), + titanSmokeLarge = new Effect(400f, 400f, b -> { + float intensity = 4f; + + color(b.color, 0.65f); + for(int i = 0; i < 4; i++){ + rand.setSeed(b.id*2 + i); + float lenScl = rand.random(0.5f, 1f); + int fi = i; + b.scaled(b.lifetime * lenScl, e -> { + randLenVectors(e.id + fi - 1, e.fin(Interp.pow10Out), (int)(2.9f * intensity), 26f * intensity, (x, y, in, out) -> { + float fout = e.fout(Interp.pow5Out) * rand.random(0.5f, 1f); + float rad = fout * ((2f + intensity) * 2.35f); + + Fill.circle(e.x + x, e.y + y, rad); + Drawf.light(e.x + x, e.y + y, rad * 2.5f, b.color, 0.5f); + }); + }); + } + }), + missileTrailSmoke = new Effect(180f, 300f, b -> { float intensity = 2f; @@ -761,7 +795,7 @@ public class Fx{ Fill.circle(e.x + x, e.y + y, e.fout() * 2f); }); }), - + hitLaserBlast = new Effect(12, e -> { color(e.color); stroke(e.fout() * 1.5f); @@ -1114,7 +1148,7 @@ public class Fx{ stroke(2f * e.fout()); Lines.circle(e.x, e.y, 5f * e.fout()); }), - + forceShrink = new Effect(20, e -> { color(e.color, e.fout()); if(renderer.animateShields){ diff --git a/core/src/mindustry/entities/bullet/ArtilleryBulletType.java b/core/src/mindustry/entities/bullet/ArtilleryBulletType.java index d232d016c3..69e6afbd97 100644 --- a/core/src/mindustry/entities/bullet/ArtilleryBulletType.java +++ b/core/src/mindustry/entities/bullet/ArtilleryBulletType.java @@ -13,7 +13,6 @@ public class ArtilleryBulletType extends BasicBulletType{ collides = false; collidesAir = false; scaleLife = true; - trailRotation = false; hitShake = 1f; hitSound = Sounds.explosion; hitEffect = Fx.flakExplosion; diff --git a/core/src/mindustry/world/blocks/defense/turrets/Turret.java b/core/src/mindustry/world/blocks/defense/turrets/Turret.java index 4636fee9fe..426d038912 100644 --- a/core/src/mindustry/world/blocks/defense/turrets/Turret.java +++ b/core/src/mindustry/world/blocks/defense/turrets/Turret.java @@ -239,6 +239,8 @@ public class Turret extends ReloadTurret{ public float heatReq; public float[] sideHeat = new float[4]; + float lastRangeChange; + @Override public float estimateDps(){ if(!hasAmmo()) return 0f; @@ -316,6 +318,11 @@ public class Turret extends ReloadTurret{ }; } + @Override + public float fogRadius(){ + return (range + (hasAmmo() ? peekAmmo().rangeChange : 0f)) / tilesize * fogRadiusMultiplier; + } + @Override public float progress(){ return Mathf.clamp(reloadCounter / reload); @@ -415,6 +422,14 @@ public class Turret extends ReloadTurret{ //turret always reloads regardless of whether it's targeting something updateReload(); + if(state.rules.fog){ + float newRange = hasAmmo() ? peekAmmo().rangeChange : 0f; + if(newRange != lastRangeChange){ + lastRangeChange = newRange; + fogControl.forceUpdate(team, this); + } + } + if(hasAmmo()){ if(Float.isNaN(reloadCounter)) reloadCounter = 0; diff --git a/core/src/mindustry/world/blocks/production/WallCrafter.java b/core/src/mindustry/world/blocks/production/WallCrafter.java index d499f2cfe3..22f621c613 100644 --- a/core/src/mindustry/world/blocks/production/WallCrafter.java +++ b/core/src/mindustry/world/blocks/production/WallCrafter.java @@ -17,6 +17,7 @@ import mindustry.graphics.*; import mindustry.type.*; import mindustry.ui.*; import mindustry.world.*; +import mindustry.world.consumers.*; import mindustry.world.meta.*; import static mindustry.Vars.*; @@ -30,6 +31,8 @@ public class WallCrafter extends Block{ /** Time to produce one item at 100% efficiency. */ public float drillTime = 150f; + /** How many times faster the drill will progress when boosted by liquid. */ + public float liquidBoostIntensity = 1.6f; /** Effect randomly played while drilling. */ public Effect updateEffect = Fx.mineWallSmall; public float updateEffectChance = 0.02f; @@ -39,6 +42,14 @@ public class WallCrafter extends Block{ public Item output = Items.sand; + public float boostItemUseTime = 120f; + /** How many times faster the drill will progress when boosted by items. Note: Using item and liquid boosters at once is not supported. */ + public float itemBoostIntensity = 1.6f; + public @Nullable Consume itemConsumer; + public boolean hasLiquidBooster; + + public final int timerUse = timers ++; + public WallCrafter(String name){ super(name); @@ -67,6 +78,31 @@ public class WallCrafter extends Block{ stats.add(Stat.output, output); stats.add(Stat.tiles, StatValues.blocks(attribute, floating, 1f, true, false)); stats.add(Stat.drillSpeed, 60f / drillTime * size, StatUnit.itemsSecond); + + boolean consItems = itemConsumer != null; + + if(consItems) stats.timePeriod = boostItemUseTime; + + if(consItems && itemConsumer instanceof ConsumeItems coni){ + stats.remove(Stat.booster); + stats.add(Stat.booster, StatValues.itemBoosters("{0}" + StatUnit.timesSpeed.localized(), stats.timePeriod, itemBoostIntensity, 0f, coni.items, i -> Structs.contains(coni.items, s -> s.item == i))); + } + + if(liquidBoostIntensity != 1 && findConsumer(f -> f instanceof ConsumeLiquidBase && f.booster) instanceof ConsumeLiquidBase consBase){ + stats.remove(Stat.booster); + stats.add(Stat.booster, + StatValues.speedBoosters("{0}" + StatUnit.timesSpeed.localized(), + consBase.amount, + liquidBoostIntensity, false, consBase::consumes) + ); + } + } + + @Override + public void init(){ + super.init(); + + hasLiquidBooster = findConsumer(f -> f instanceof ConsumeLiquidBase && f.booster) != null; } @Override @@ -151,6 +187,7 @@ public class WallCrafter extends Block{ super.updateTile(); boolean cons = shouldConsume(); + boolean itemValid = itemConsumer != null && itemConsumer.efficiency(this) > 0; warmup = Mathf.approachDelta(warmup, Mathf.num(efficiency > 0), 1f / 40f); float dx = Geometry.d4x(rotation) * 0.5f, dy = Geometry.d4y(rotation) * 0.5f; @@ -164,7 +201,11 @@ public class WallCrafter extends Block{ dest.block().mapColor ); } - }, null); + }, null) * Mathf.lerp(1f, liquidBoostIntensity, hasLiquidBooster ? optionalEfficiency : 0f) * (itemValid ? itemBoostIntensity : 1f); + + if(itemValid && eff * efficiency > 0 && timer(timerUse, boostItemUseTime)){ + consume(); + } lastEfficiency = eff * timeScale * efficiency; @@ -173,16 +214,16 @@ public class WallCrafter extends Block{ time %= drillTime; } - totalTime += edelta() * warmup; + totalTime += edelta() * warmup * (eff <= 0f ? 0f : 1f); if(timer(timerDump, dumpTime)){ - dump(); + dump(output); } } @Override public boolean shouldConsume(){ - return items.total() < itemCapacity; + return items.get(output) < itemCapacity; } @Override diff --git a/core/src/mindustry/world/consumers/ConsumeLiquid.java b/core/src/mindustry/world/consumers/ConsumeLiquid.java index 3581a4f3fa..a4a3ebc460 100644 --- a/core/src/mindustry/world/consumers/ConsumeLiquid.java +++ b/core/src/mindustry/world/consumers/ConsumeLiquid.java @@ -50,4 +50,9 @@ public class ConsumeLiquid extends ConsumeLiquidBase{ public void display(Stats stats){ stats.add(booster ? Stat.booster : Stat.input, liquid, amount * 60f, true); } + + @Override + public boolean consumes(Liquid liquid){ + return liquid == this.liquid; + } } diff --git a/core/src/mindustry/world/consumers/ConsumeLiquidBase.java b/core/src/mindustry/world/consumers/ConsumeLiquidBase.java index 1a55711416..9a74338434 100644 --- a/core/src/mindustry/world/consumers/ConsumeLiquidBase.java +++ b/core/src/mindustry/world/consumers/ConsumeLiquidBase.java @@ -1,5 +1,6 @@ package mindustry.world.consumers; +import mindustry.type.*; import mindustry.world.*; public abstract class ConsumeLiquidBase extends Consume{ @@ -16,4 +17,6 @@ public abstract class ConsumeLiquidBase extends Consume{ public void apply(Block block){ block.hasLiquids = true; } + + public abstract boolean consumes(Liquid liquid); } diff --git a/core/src/mindustry/world/consumers/ConsumeLiquidFilter.java b/core/src/mindustry/world/consumers/ConsumeLiquidFilter.java index 7dbaab7043..94e049c260 100644 --- a/core/src/mindustry/world/consumers/ConsumeLiquidFilter.java +++ b/core/src/mindustry/world/consumers/ConsumeLiquidFilter.java @@ -53,7 +53,7 @@ public class ConsumeLiquidFilter extends ConsumeLiquidBase{ if(ed <= 0.00000001f) return 0f; return liq != null ? Math.min(build.liquids.get(liq) / (amount * ed * multiplier.get(build)), 1f) : 0f; } - + public @Nullable Liquid getConsumed(Building build){ if(filter.get(build.liquids.current()) && build.liquids.currentAmount() > 0){ return build.liquids.current(); @@ -74,4 +74,9 @@ public class ConsumeLiquidFilter extends ConsumeLiquidBase{ public void display(Stats stats){ stats.add(booster ? Stat.booster : Stat.input, StatValues.liquids(filter, amount * 60f, true)); } + + @Override + public boolean consumes(Liquid liquid){ + return filter.get(liquid); + } }