From c573fd34a1dd25c32cabf0e5f244864b2008c9dd Mon Sep 17 00:00:00 2001 From: Anuken Date: Wed, 25 Aug 2021 09:10:59 -0400 Subject: [PATCH 01/21] Bullet raycast clamp --- core/src/mindustry/entities/comp/BulletComp.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/core/src/mindustry/entities/comp/BulletComp.java b/core/src/mindustry/entities/comp/BulletComp.java index 27a92be992..d36a399150 100644 --- a/core/src/mindustry/entities/comp/BulletComp.java +++ b/core/src/mindustry/entities/comp/BulletComp.java @@ -133,8 +133,9 @@ abstract class BulletComp implements Timedc, Damagec, Hitboxc, Teamc, Posc, Draw int x = x0f, dx = Math.abs(x1 - x), sx = x < x1 ? 1 : -1; int y = y0f, dy = Math.abs(y1 - y), sy = y < y1 ? 1 : -1; int e2, err = dx - dy; + int ww = world.width(), wh = world.height(); - while(true){ + while(x >= 0 && y >= 0 && x < ww && y < wh){ Building build = world.build(x, y); if(build != null && isAdded() && build.collide(self()) && type.testCollision(self(), build) && !build.dead() && (type.collidesTeam || build.team != team) && !(type.pierceBuilding && hasCollided(build.id))){ From 9e16d7385aae1211d8ee24ac2a9f7afbd57d3065 Mon Sep 17 00:00:00 2001 From: Anuken Date: Wed, 25 Aug 2021 10:09:00 -0400 Subject: [PATCH 02/21] Implemented #5853 --- .../sprites/statuses/status-shielded.png | Bin 0 -> 260 bytes core/assets/bundles/bundle.properties | 6 ++ core/src/mindustry/editor/WaveInfoDialog.java | 85 +++++++++++++++++- core/src/mindustry/game/Waves.java | 2 +- 4 files changed, 90 insertions(+), 3 deletions(-) create mode 100644 core/assets-raw/sprites/statuses/status-shielded.png diff --git a/core/assets-raw/sprites/statuses/status-shielded.png b/core/assets-raw/sprites/statuses/status-shielded.png new file mode 100644 index 0000000000000000000000000000000000000000..b079c1bfeff9dcf01c8f3690bdd72e76ac449339 GIT binary patch literal 260 zcmeAS@N?(olHy`uVBq!ia0y~yU{C;I4mJh`hT^KKFANL}jKx9jP7LeL$-HD>VA$vB z;usRq`Zm;BtU-ZC_J*}uMP@-8lWxT1bv(Qv3)?iC<- zo`H9V+70U|j8|KNyrmO5uU?&nu8so+ubGZ*R| { + BaseDialog dialog = new BaseDialog("@waves.sort"); + dialog.setFillParent(false); + dialog.cont.table(Tex.button, t -> { + for(Sort s : Sort.all){ + t.button("@waves.sort." + s, Styles.clearTogglet, () -> { + sort = s; + dialog.hide(); + buildGroups(); + }).size(150f, 60f).checked(s == sort); + } + }).row(); + dialog.cont.check("@waves.sort.reverse", b -> { + reverseSort = b; + buildGroups(); + }).padTop(4).checked(reverseSort).padBottom(8f); + dialog.addCloseButton(); + dialog.show(); + buildGroups(); + }).size(60f, 64f); + addCloseButton(); buttons.button("@waves.edit", () -> { @@ -165,7 +190,8 @@ public class WaveInfoDialog extends BaseDialog{ table.margin(10f); if(groups != null){ - groups.sort(g -> g.begin); + groups.sort(sort.sort); + if(reverseSort) groups.reverse(); for(SpawnGroup group : groups){ table.table(Tex.button, t -> { @@ -179,6 +205,11 @@ public class WaveInfoDialog extends BaseDialog{ b.label(() -> (group.begin + 1) + "").color(Color.lightGray).minWidth(45f).labelAlign(Align.left).left(); + b.button(group.effect != null && group.effect != StatusEffects.none ? + new TextureRegionDrawable(group.effect.uiIcon) : + Icon.logicSmall, + Styles.emptyi, () -> showEffect(group)).pad(-6).size(46f); + b.button(Icon.unitsSmall, Styles.emptyi, () -> showUpdate(group)).pad(-6).size(46f); b.button(Icon.cancel, Styles.emptyi, () -> { groups.remove(group); @@ -269,7 +300,10 @@ public class WaveInfoDialog extends BaseDialog{ a.add("@waves.shields").padLeft(4); }).row(); - t.check("@waves.guardian", b -> group.effect = (b ? StatusEffects.boss : null)).padTop(4).update(b -> b.setChecked(group.effect == StatusEffects.boss)).padBottom(8f); + t.check("@waves.guardian", b -> { + group.effect = (b ? StatusEffects.boss : null); + buildGroups(); + }).padTop(4).update(b -> b.setChecked(group.effect == StatusEffects.boss)).padBottom(8f); } }).width(340f).pad(8); @@ -306,6 +340,53 @@ public class WaveInfoDialog extends BaseDialog{ dialog.show(); } + void showEffect(SpawnGroup group){ + BaseDialog dialog = new BaseDialog(""); + dialog.setFillParent(true); + dialog.cont.pane(p -> { + int i = 0; + for(StatusEffect effect : content.statusEffects()){ + if(effect != StatusEffects.none && (effect.isHidden() || effect.reactive)) continue; + + p.button(t -> { + t.left(); + if(effect.uiIcon != null && effect != StatusEffects.none){ + t.image(effect.uiIcon).size(8 * 4).scaling(Scaling.fit).padRight(2f); + }else{ + t.image(Icon.none).size(8 * 4).scaling(Scaling.fit).padRight(2f); + } + + if(effect != StatusEffects.none){ + t.add(effect.localizedName); + }else{ + t.add("@settings.resetKey"); + } + }, () -> { + group.effect = effect; + dialog.hide(); + buildGroups(); + }).pad(2).margin(12f).fillX(); + if(++i % 3 == 0) p.row(); + } + }); + dialog.addCloseButton(); + dialog.show(); + } + + enum Sort{ + begin(g -> g.begin), + health(g -> g.type.health), + type(g -> g.type.id); + + static final Sort[] all = values(); + + final Floatf sort; + + Sort(Floatf sort){ + this.sort = sort; + } + } + void updateWaves(){ graph.groups = groups; graph.from = start; diff --git a/core/src/mindustry/game/Waves.java b/core/src/mindustry/game/Waves.java index 415ccea8fc..867c1476ce 100644 --- a/core/src/mindustry/game/Waves.java +++ b/core/src/mindustry/game/Waves.java @@ -116,7 +116,7 @@ public class Waves{ spacing = 5; unitAmount = 1; unitScaling = 3; - effect = StatusEffects.shielded; + shields = 640f; max = 25; }}, From 20305b5d366e9e510c650b2598d085ff9e565494 Mon Sep 17 00:00:00 2001 From: Ilya246 <57039557+Ilya246@users.noreply.github.com> Date: Wed, 25 Aug 2021 21:06:19 +0400 Subject: [PATCH 03/21] Fix .pl BE server (#5862) The server is currently up and running BE --- servers_be.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/servers_be.json b/servers_be.json index eff76d37c5..8d93d2bf8f 100644 --- a/servers_be.json +++ b/servers_be.json @@ -3,7 +3,7 @@ "address": "be.mindustry.nydus.app:6567" }, { - "address": "mindustry.pl:7777" + "address": "46.105.36.238:7777" }, { "address": "v7.mindurka.tk:9999" From 2b6856634c3a82fa5d82ff82e7cadbc4579f2c79 Mon Sep 17 00:00:00 2001 From: Anuken Date: Wed, 25 Aug 2021 13:22:19 -0400 Subject: [PATCH 04/21] Fixed #5864 --- core/src/mindustry/world/blocks/payloads/PayloadBlock.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/src/mindustry/world/blocks/payloads/PayloadBlock.java b/core/src/mindustry/world/blocks/payloads/PayloadBlock.java index 86023894e3..ea4de86c26 100644 --- a/core/src/mindustry/world/blocks/payloads/PayloadBlock.java +++ b/core/src/mindustry/world/blocks/payloads/PayloadBlock.java @@ -79,7 +79,7 @@ public class PayloadBlock extends Block{ @Override public boolean canControlSelect(Player player){ - return !player.unit().spawnedByCore && this.payload == null && acceptUnitPayload(player.unit()) && player.tileOn().build == this; + return !player.unit().spawnedByCore && this.payload == null && acceptUnitPayload(player.unit()) && player.tileOn() != null && player.tileOn().build == this; } @Override From c25e6b586b83bcd351efe6ab7ad5f8b9292994e9 Mon Sep 17 00:00:00 2001 From: Anuken Date: Wed, 25 Aug 2021 21:57:18 -0400 Subject: [PATCH 05/21] Allow empty maps in FileMapGenerator --- core/src/mindustry/graphics/g3d/PlanetRenderer.java | 1 - .../mindustry/maps/generators/FileMapGenerator.java | 10 ++++++++++ gradle.properties | 2 +- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/core/src/mindustry/graphics/g3d/PlanetRenderer.java b/core/src/mindustry/graphics/g3d/PlanetRenderer.java index c7938cd11e..4113603a7c 100644 --- a/core/src/mindustry/graphics/g3d/PlanetRenderer.java +++ b/core/src/mindustry/graphics/g3d/PlanetRenderer.java @@ -234,7 +234,6 @@ public class PlanetRenderer implements Disposable{ Tmp.c1.set(from).lerp(to, (f+ Time.globalTime /timeScale)%1f); batch.color(Tmp.c1); batch.vertex(Tmp.bz3.valueAt(Tmp.v32, f)); - } batch.flush(Gl.lineStrip); } diff --git a/core/src/mindustry/maps/generators/FileMapGenerator.java b/core/src/mindustry/maps/generators/FileMapGenerator.java index ebebd03877..f2e38e8d6b 100644 --- a/core/src/mindustry/maps/generators/FileMapGenerator.java +++ b/core/src/mindustry/maps/generators/FileMapGenerator.java @@ -21,6 +21,16 @@ public class FileMapGenerator implements WorldGenerator{ this.preset = preset; } + public FileMapGenerator(Map map, SectorPreset preset){ + this.map = map; + this.preset = preset; + } + + /** If you use this constructor, make sure to override generate()! */ + public FileMapGenerator(SectorPreset preset){ + this(emptyMap, preset); + } + @Override public void generate(Tiles tiles){ if(map == null) throw new RuntimeException("Generator has null map, cannot be used."); diff --git a/gradle.properties b/gradle.properties index b3ec89f9e1..76539672ae 100644 --- a/gradle.properties +++ b/gradle.properties @@ -11,4 +11,4 @@ android.useAndroidX=true #used for slow jitpack builds; TODO see if this actually works http.socketTimeout=80000 http.connectionTimeout=80000 -archash=7e96b986053ce489aae161aa6bcbb5d921c609d4 +archash=6534b0e34bfcb24d02d99cb9534d087ea76b5601 From 309b0adb9e9d70925944c207e11b748e25236aec Mon Sep 17 00:00:00 2001 From: RebornTrack970 <62565267+RebornTrack970@users.noreply.github.com> Date: Thu, 26 Aug 2021 15:33:10 +0300 Subject: [PATCH 06/21] Added Rush and Expansion to Omega Hub (#5868) --- servers_v7.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/servers_v7.json b/servers_v7.json index 217026029a..eccd6ced6d 100644 --- a/servers_v7.json +++ b/servers_v7.json @@ -13,7 +13,7 @@ }, { "name": "Omega", - "address": ["yeet.mindustry.me:6567", "yeet.mindustry.me:2345", "n3.mindustry.me:4444","n2.mindustry.me:4040", "n2.mindustry.me:4002", "n2.mindustry.me:4001"] + "address": ["yeet.mindustry.me", "yeet.mindustry.me:2345", "n3.mindustry.me:4444","n2.mindustry.me:4040", "n2.mindustry.me:4002", "n2.mindustry.me:4001", "n3.mindustry.me", "n2.mindustry.me:4004"] }, { "name": "MeowLand", From 139d6cd5cc6838ed024b149cd80fcd75ea95357b Mon Sep 17 00:00:00 2001 From: Anuken Date: Thu, 26 Aug 2021 15:07:08 -0400 Subject: [PATCH 07/21] Proper #5872 --- core/src/mindustry/ui/dialogs/PlanetDialog.java | 2 -- core/src/mindustry/world/blocks/production/Drill.java | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/core/src/mindustry/ui/dialogs/PlanetDialog.java b/core/src/mindustry/ui/dialogs/PlanetDialog.java index cc105257d3..5db4f285b3 100644 --- a/core/src/mindustry/ui/dialogs/PlanetDialog.java +++ b/core/src/mindustry/ui/dialogs/PlanetDialog.java @@ -372,8 +372,6 @@ public class PlanetDialog extends BaseDialog implements PlanetInterfaceRenderer{ } if(selectAlpha > 0.001f){ - - for(Sector sec : planet.sectors){ if(sec.hasBase()){ for(Sector enemy : sec.near()){ diff --git a/core/src/mindustry/world/blocks/production/Drill.java b/core/src/mindustry/world/blocks/production/Drill.java index b64cc621c8..407b2715d0 100644 --- a/core/src/mindustry/world/blocks/production/Drill.java +++ b/core/src/mindustry/world/blocks/production/Drill.java @@ -195,7 +195,7 @@ public class Drill extends Block{ } public boolean canMine(Tile tile){ - if(tile == null) return false; + if(tile == null || tile.block().isStatic()) return false; Item drops = tile.drop(); return drops != null && drops.hardness <= tier; } From 9b22777dfb08b663e815c9eac4d83ebbfe9d5294 Mon Sep 17 00:00:00 2001 From: Anuken Date: Thu, 26 Aug 2021 15:15:29 -0400 Subject: [PATCH 08/21] AGP 7.0.1 --- android/build.gradle | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/android/build.gradle b/android/build.gradle index d073b66a15..b2a1d49e4d 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -7,8 +7,7 @@ buildscript{ } dependencies{ - //note that later versions, like alpha05, fail to work correctly - classpath 'com.android.tools.build:gradle:7.1.0-alpha02' + classpath 'com.android.tools.build:gradle:7.0.1' } } From 5cc461edb07827ef98ba75b9f31b731239414f7f Mon Sep 17 00:00:00 2001 From: Matthew Peng <54301439+MEEPofFaith@users.noreply.github.com> Date: Thu, 26 Aug 2021 17:47:35 -0700 Subject: [PATCH 09/21] Make hiding details optional (#5871) * Make hiding details optional * Sandbox blocks shouldn't have their details hidden. --- core/src/mindustry/ctype/UnlockableContent.java | 2 ++ core/src/mindustry/ui/dialogs/ContentInfoDialog.java | 2 +- core/src/mindustry/world/Block.java | 4 ++++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/core/src/mindustry/ctype/UnlockableContent.java b/core/src/mindustry/ctype/UnlockableContent.java index c45f076061..0c1c610b9a 100644 --- a/core/src/mindustry/ctype/UnlockableContent.java +++ b/core/src/mindustry/ctype/UnlockableContent.java @@ -27,6 +27,8 @@ public abstract class UnlockableContent extends MappableContent{ public boolean alwaysUnlocked = false; /** Whether to show the description in the research dialog preview. */ public boolean inlineDescription = true; + /** Whether details of blocks are hidden in custom games if they haven't been unlocked in campaign mode. */ + public boolean hideDetails = true; /** Special logic icon ID. */ public int iconId = 0; /** Icon of the content to use in UI. */ diff --git a/core/src/mindustry/ui/dialogs/ContentInfoDialog.java b/core/src/mindustry/ui/dialogs/ContentInfoDialog.java index f62ede3957..9e120155b4 100644 --- a/core/src/mindustry/ui/dialogs/ContentInfoDialog.java +++ b/core/src/mindustry/ui/dialogs/ContentInfoDialog.java @@ -81,7 +81,7 @@ public class ContentInfoDialog extends BaseDialog{ } if(content.details != null){ - table.add("[gray]" + (content.unlocked() ? content.details : Iconc.lock + " " + Core.bundle.get("unlock.incampaign"))).pad(6).padTop(20).width(400f).wrap().fillX(); + table.add("[gray]" + (content.unlocked() || !content.hideDetails ? content.details : Iconc.lock + " " + Core.bundle.get("unlock.incampaign"))).pad(6).padTop(20).width(400f).wrap().fillX(); table.row(); } diff --git a/core/src/mindustry/world/Block.java b/core/src/mindustry/world/Block.java index f0f5e979d8..be8837463a 100644 --- a/core/src/mindustry/world/Block.java +++ b/core/src/mindustry/world/Block.java @@ -847,6 +847,10 @@ public class Block extends UnlockableContent{ if(!outputsPower && consumes.hasPower() && consumes.getPower().buffered){ throw new IllegalArgumentException("Consumer using buffered power: " + name); } + + if(buildVisibility == BuildVisibility.sandboxOnly){ + hideDetails = false; + } } @Override From b2ed066faaf817e2bdac2dfdb40925ef24783682 Mon Sep 17 00:00:00 2001 From: Anuken Date: Fri, 27 Aug 2021 09:17:26 -0400 Subject: [PATCH 10/21] Fixed BE server not updating --- core/src/mindustry/net/BeControl.java | 2 +- core/src/mindustry/ui/dialogs/JoinDialog.java | 6 +++--- gradle.properties | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/core/src/mindustry/net/BeControl.java b/core/src/mindustry/net/BeControl.java index 6fc58c9e06..35c881ea31 100644 --- a/core/src/mindustry/net/BeControl.java +++ b/core/src/mindustry/net/BeControl.java @@ -39,7 +39,7 @@ public class BeControl{ public BeControl(){ if(active()){ Timer.schedule(() -> { - if(Vars.clientLoaded && checkUpdates && !mobile){ + if((Vars.clientLoaded || headless) && checkUpdates && !mobile){ checkUpdate(t -> {}); } }, updateInterval, updateInterval); diff --git a/core/src/mindustry/ui/dialogs/JoinDialog.java b/core/src/mindustry/ui/dialogs/JoinDialog.java index 1633255a26..8a6ddf9543 100644 --- a/core/src/mindustry/ui/dialogs/JoinDialog.java +++ b/core/src/mindustry/ui/dialogs/JoinDialog.java @@ -119,7 +119,7 @@ public class JoinDialog extends BaseDialog{ refreshLocal(); refreshRemote(); - refreshGlobal(); + refreshCommunity(); } void setupRemote(){ @@ -331,7 +331,7 @@ public class JoinDialog extends BaseDialog{ if(eye){ name.button(Icon.eyeSmall, Styles.emptyi, () -> { showHidden = !showHidden; - refreshGlobal(); + refreshCommunity(); }).update(i -> i.getStyle().imageUp = (showHidden ? Icon.eyeSmall : Icon.eyeOffSmall)) .size(40f).right().padRight(3).tooltip("@servers.showhidden"); } @@ -357,7 +357,7 @@ public class JoinDialog extends BaseDialog{ net.discoverServers(this::addLocalHost, this::finishLocalHosts); } - void refreshGlobal(){ + void refreshCommunity(){ int cur = refreshes; global.clear(); diff --git a/gradle.properties b/gradle.properties index 76539672ae..4313f7da42 100644 --- a/gradle.properties +++ b/gradle.properties @@ -11,4 +11,4 @@ android.useAndroidX=true #used for slow jitpack builds; TODO see if this actually works http.socketTimeout=80000 http.connectionTimeout=80000 -archash=6534b0e34bfcb24d02d99cb9534d087ea76b5601 +archash=e1165d2a9ec04dc5220d41bbc104a6ade3f31232 From bfc9b076515ab9dda85ece16fb4a8c23ca6e9fa7 Mon Sep 17 00:00:00 2001 From: Anuken Date: Fri, 27 Aug 2021 09:31:09 -0400 Subject: [PATCH 11/21] Redundant cast cleanup --- core/src/mindustry/ClientLauncher.java | 2 +- core/src/mindustry/ui/Fonts.java | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/core/src/mindustry/ClientLauncher.java b/core/src/mindustry/ClientLauncher.java index 5ea23d3555..a7d1791e20 100644 --- a/core/src/mindustry/ClientLauncher.java +++ b/core/src/mindustry/ClientLauncher.java @@ -83,7 +83,7 @@ public abstract class ClientLauncher extends ApplicationCore implements Platform Fonts.loadDefaultFont(); //load fallback atlas if max texture size is below 4096 - assets.load(new AssetDescriptor<>(maxTextureSize >= 4096 ? "sprites/sprites.aatls" : "sprites/fallback/sprites.aatls", TextureAtlas.class)).loaded = t -> atlas = (TextureAtlas)t; + assets.load(new AssetDescriptor<>(maxTextureSize >= 4096 ? "sprites/sprites.aatls" : "sprites/fallback/sprites.aatls", TextureAtlas.class)).loaded = t -> atlas = t; assets.loadRun("maps", Map.class, () -> maps.loadPreviews()); Musics.load(); diff --git a/core/src/mindustry/ui/Fonts.java b/core/src/mindustry/ui/Fonts.java index 2d5b3c4a4d..2596292bfb 100644 --- a/core/src/mindustry/ui/Fonts.java +++ b/core/src/mindustry/ui/Fonts.java @@ -196,12 +196,12 @@ public class Fonts{ size = 18; }}; - Core.assets.load("outline", Font.class, new FreeTypeFontLoaderParameter(mainFont, param)).loaded = t -> Fonts.outline = (Font)t; + Core.assets.load("outline", Font.class, new FreeTypeFontLoaderParameter(mainFont, param)).loaded = t -> Fonts.outline = t; Core.assets.load("tech", Font.class, new FreeTypeFontLoaderParameter("fonts/tech.ttf", new FreeTypeFontParameter(){{ size = 18; }})).loaded = f -> { - Fonts.tech = (Font)f; + Fonts.tech = f; Fonts.tech.getData().down *= 1.5f; }; } From 8c32acbc30187e42ca0b499fdd577704879f3020 Mon Sep 17 00:00:00 2001 From: Anuken Date: Fri, 27 Aug 2021 09:58:08 -0400 Subject: [PATCH 12/21] Fixed #5878 --- core/src/mindustry/net/ArcNetProvider.java | 4 +++- core/src/mindustry/ui/fragments/LoadingFragment.java | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/core/src/mindustry/net/ArcNetProvider.java b/core/src/mindustry/net/ArcNetProvider.java index 4cc05ecccb..907ec63920 100644 --- a/core/src/mindustry/net/ArcNetProvider.java +++ b/core/src/mindustry/net/ArcNetProvider.java @@ -162,7 +162,9 @@ public class ArcNetProvider implements NetProvider{ client.connect(5000, ip, port, port); success.run(); }catch(Exception e){ - net.handleException(e); + if(netClient.isConnecting()){ + net.handleException(e); + } } }); } diff --git a/core/src/mindustry/ui/fragments/LoadingFragment.java b/core/src/mindustry/ui/fragments/LoadingFragment.java index a8ba631420..41e3ca537d 100644 --- a/core/src/mindustry/ui/fragments/LoadingFragment.java +++ b/core/src/mindustry/ui/fragments/LoadingFragment.java @@ -83,6 +83,7 @@ public class LoadingFragment extends Fragment{ } public void show(String text){ + button.visible = false; nameLabel.setColor(Color.white); bar.visible = false; table.clearActions(); From 9f68fe520b78f0f1e272c4c1d25f62fe4225f2d3 Mon Sep 17 00:00:00 2001 From: Zelaux <58040045+Zelaux@users.noreply.github.com> Date: Fri, 27 Aug 2021 20:08:04 +0500 Subject: [PATCH 13/21] Fixed incorrect work of TextureRegion.found() when creating icons (#5879) * Fixed incorrect work of TextureRegion.found() when creating icons * fixed comment text * fixed comment text --- core/src/mindustry/mod/Mods.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/core/src/mindustry/mod/Mods.java b/core/src/mindustry/mod/Mods.java index e53de0a4ad..8e3f3ad2b1 100644 --- a/core/src/mindustry/mod/Mods.java +++ b/core/src/mindustry/mod/Mods.java @@ -225,6 +225,10 @@ public class Mods implements Loadable{ var shadow = Core.atlas; //dummy texture atlas that returns the 'shadow' regions; used for mod loading Core.atlas = new TextureAtlas(){ + { + //needed for the correct operation of the found() method in the TextureRegion + error = shadow.find("error"); + } @Override public AtlasRegion find(String name){ From ced97888e43d73811802e3893858e39da1454544 Mon Sep 17 00:00:00 2001 From: Anuken Date: Fri, 27 Aug 2021 21:51:37 -0400 Subject: [PATCH 14/21] why --- .../sprites/blocks/extra/block-select.png | Bin 136 -> 158 bytes gradle.properties | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/core/assets-raw/sprites/blocks/extra/block-select.png b/core/assets-raw/sprites/blocks/extra/block-select.png index e9d19b9e7ed08239123fdb759ab77f1f3b84aee2..62f6a9576fb40ef6455d24ed9085d017a626dd82 100644 GIT binary patch delta 129 zcmeBRoX0pprHZjQ$lZxy-8q?;3=9kro-U3d5v^}881fxZ;9+r`{r~^ZAVozMPFD-A zvfYzodSo13TwGkXPoH$<-I*;+UfWIg7%?sS-68+Ljfc_ih{yw{Jxnqk{s;1o2rW=5 lvzW$swNUCq^>If28_6o)U4>ZYGcYhPc)I$ztaD0e0sv{*F(&{3 delta 107 zcmbQo*ugkKCB@&<#WAGf*4r!ATnq{V%olB2zVCk(5gE}Tf2HA> Date: Fri, 27 Aug 2021 22:33:56 -0400 Subject: [PATCH 15/21] Fixed RailBulletType effect length --- .../src/mindustry/entities/bullet/RailBulletType.java | 11 ++++++++++- gradle.properties | 2 +- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/core/src/mindustry/entities/bullet/RailBulletType.java b/core/src/mindustry/entities/bullet/RailBulletType.java index f10b221c8f..07e1e6dddb 100644 --- a/core/src/mindustry/entities/bullet/RailBulletType.java +++ b/core/src/mindustry/entities/bullet/RailBulletType.java @@ -7,6 +7,9 @@ import mindustry.entities.*; import mindustry.gen.*; public class RailBulletType extends BulletType{ + //for calculating the furthest point + static float furthest = 0; + public Effect pierceEffect = Fx.hitBulletSmall, updateEffect = Fx.none; /** Multiplier of damage decreased per health pierced. */ public float pierceDamageFactor = 1f; @@ -47,6 +50,11 @@ public class RailBulletType extends BulletType{ //subtract health from each consecutive pierce b.damage -= Math.min(b.damage, sub); + + //bullet was stopped, decrease furthest distance + if(b.damage <= 0f){ + furthest = Math.min(furthest, b.dst(pos)); + } } @Override @@ -54,8 +62,9 @@ public class RailBulletType extends BulletType{ super.init(b); b.fdata = length; + furthest = length; Damage.collideLine(b, b.team, b.type.hitEffect, b.x, b.y, b.rotation(), length, false, false); - float resultLen = b.fdata; + float resultLen = furthest; Vec2 nor = Tmp.v1.trns(b.rotation(), 1f).nor(); for(float i = 0; i <= resultLen; i += updateEffectSeg){ diff --git a/gradle.properties b/gradle.properties index 98ad075e46..d6205820f2 100644 --- a/gradle.properties +++ b/gradle.properties @@ -11,4 +11,4 @@ android.useAndroidX=true #used for slow jitpack builds; TODO see if this actually works http.socketTimeout=80000 http.connectionTimeout=80000 -archash=2fff3e0fc21546b1a52652c8222faf78847b6991 +archash=83ba08c732333d88d7f46142721cec043d6bbeee From 4d62b0321fb441d0286718ace987eeaab4d131a1 Mon Sep 17 00:00:00 2001 From: Anuken Date: Sat, 28 Aug 2021 08:44:42 -0400 Subject: [PATCH 16/21] Fixed #5885 --- core/src/mindustry/world/blocks/units/UnitFactory.java | 5 ++++- gradle.properties | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/core/src/mindustry/world/blocks/units/UnitFactory.java b/core/src/mindustry/world/blocks/units/UnitFactory.java index ab7fa7024b..948b85f0ff 100644 --- a/core/src/mindustry/world/blocks/units/UnitFactory.java +++ b/core/src/mindustry/world/blocks/units/UnitFactory.java @@ -39,12 +39,15 @@ public class UnitFactory extends UnitBlock{ rotate = true; config(Integer.class, (UnitFactoryBuild tile, Integer i) -> { + if(tile.currentPlan == i) return; tile.currentPlan = i < 0 || i >= plans.size ? -1 : i; tile.progress = 0; }); config(UnitType.class, (UnitFactoryBuild tile, UnitType val) -> { - tile.currentPlan = plans.indexOf(p -> p.unit == val); + int next = plans.indexOf(p -> p.unit == val); + if(tile.currentPlan == next) return; + tile.currentPlan = next; tile.progress = 0; }); diff --git a/gradle.properties b/gradle.properties index d6205820f2..09cc4bfc63 100644 --- a/gradle.properties +++ b/gradle.properties @@ -11,4 +11,4 @@ android.useAndroidX=true #used for slow jitpack builds; TODO see if this actually works http.socketTimeout=80000 http.connectionTimeout=80000 -archash=83ba08c732333d88d7f46142721cec043d6bbeee +archash=dd43cacc5c5a68bd7160234a97b4fd48d9a816d7 From f8c7ff0159c1882302812a41bb60e54e31bc0fd0 Mon Sep 17 00:00:00 2001 From: Matthew Peng <54301439+MEEPofFaith@users.noreply.github.com> Date: Sat, 28 Aug 2021 05:46:08 -0700 Subject: [PATCH 17/21] `Damage.damage` doesn't properly convert cores (#5882) * `Damage.damage` doesn't properly convert cores * Well that was a complete failure --- core/src/mindustry/entities/Damage.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/src/mindustry/entities/Damage.java b/core/src/mindustry/entities/Damage.java index cc11cf29fa..bc5b55a4ef 100644 --- a/core/src/mindustry/entities/Damage.java +++ b/core/src/mindustry/entities/Damage.java @@ -466,7 +466,7 @@ public class Damage{ for(int dy = -trad; dy <= trad; dy++){ Tile tile = world.tile(Math.round(x / tilesize) + dx, Math.round(y / tilesize) + dy); if(tile != null && tile.build != null && (team == null ||team.isEnemy(tile.team())) && Mathf.dst(dx, dy) <= trad){ - tile.build.damage(damage); + tile.build.damage(team, damage); } } } From 60b2842d821ba39d1b32a9408412955cffc681f2 Mon Sep 17 00:00:00 2001 From: Matthew Peng <54301439+MEEPofFaith@users.noreply.github.com> Date: Sat, 28 Aug 2021 05:47:11 -0700 Subject: [PATCH 18/21] Rotator `spinSpeed` (#5881) --- core/src/mindustry/world/draw/DrawRotator.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/core/src/mindustry/world/draw/DrawRotator.java b/core/src/mindustry/world/draw/DrawRotator.java index 3bbf1accc8..a6f2817748 100644 --- a/core/src/mindustry/world/draw/DrawRotator.java +++ b/core/src/mindustry/world/draw/DrawRotator.java @@ -9,14 +9,15 @@ import mindustry.world.blocks.production.GenericCrafter.*; public class DrawRotator extends DrawBlock{ public TextureRegion rotator, top; public boolean drawSpinSprite = false; + public float spinSpeed = 2f; @Override public void draw(GenericCrafterBuild build){ Draw.rect(build.block.region, build.x, build.y); if(drawSpinSprite){ - Drawf.spinSprite(rotator, build.x, build.y, build.totalProgress * 2f); + Drawf.spinSprite(rotator, build.x, build.y, build.totalProgress * spinSpeed); }else{ - Draw.rect(rotator, build.x, build.y, build.totalProgress * 2f); + Draw.rect(rotator, build.x, build.y, build.totalProgress * spinSpeed); } if(top.found()) Draw.rect(top, build.x, build.y); } From 800f0f4511cd0b3348cbd45ff84a96d1ef101153 Mon Sep 17 00:00:00 2001 From: "SMOLKEYS.exe" <75618732+SMOLKEYS@users.noreply.github.com> Date: Sat, 28 Aug 2021 21:13:57 +0800 Subject: [PATCH 19/21] inconspicuous OCD goes to brazil (#5884) --- core/src/mindustry/world/blocks/payloads/UnitPayload.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/src/mindustry/world/blocks/payloads/UnitPayload.java b/core/src/mindustry/world/blocks/payloads/UnitPayload.java index a33bb35dcf..99558971da 100644 --- a/core/src/mindustry/world/blocks/payloads/UnitPayload.java +++ b/core/src/mindustry/world/blocks/payloads/UnitPayload.java @@ -94,7 +94,7 @@ public class UnitPayload implements Payload{ if(solid.solid(tx, ty)) return false; } - //cannnot dump when there's a lot of overlap going on + //cannot dump when there's a lot of overlap going on if(!unit.type.flying && Units.count(unit.x, unit.y, unit.physicSize(), o -> o.isGrounded() && (o.type.allowLegStep == unit.type.allowLegStep)) > 0){ return false; } From d254d971a9a11710663c55c690f68c74b7223d51 Mon Sep 17 00:00:00 2001 From: Darkness6030 <79508138+Darkness6030@users.noreply.github.com> Date: Sat, 28 Aug 2021 17:53:19 +0300 Subject: [PATCH 20/21] Add unitSpawnEvent (#5876) --- core/assets/contributors | 1 + core/src/mindustry/ai/WaveSpawner.java | 1 + core/src/mindustry/game/EventType.java | 9 +++++++++ 3 files changed, 11 insertions(+) diff --git a/core/assets/contributors b/core/assets/contributors index 5099ab7e37..55e0341789 100644 --- a/core/assets/contributors +++ b/core/assets/contributors @@ -127,3 +127,4 @@ WilloIzCitron SAMBUYYA genNAowl TranquillyUnpleasant +Darkness6030 diff --git a/core/src/mindustry/ai/WaveSpawner.java b/core/src/mindustry/ai/WaveSpawner.java index 40be2defad..276b86bb26 100644 --- a/core/src/mindustry/ai/WaveSpawner.java +++ b/core/src/mindustry/ai/WaveSpawner.java @@ -196,6 +196,7 @@ public class WaveSpawner{ unit.apply(StatusEffects.invincible, 60f); unit.add(); + Events.fire(new UnitSpawnEvent(unit)); Call.spawnEffect(unit.x, unit.y, unit.rotation, unit.type); } diff --git a/core/src/mindustry/game/EventType.java b/core/src/mindustry/game/EventType.java index c72ffc403c..66bc472c6f 100644 --- a/core/src/mindustry/game/EventType.java +++ b/core/src/mindustry/game/EventType.java @@ -428,6 +428,15 @@ public class EventType{ } } + /** Called when a unit is spawned by wave. */ + public static class UnitSpawnEvent{ + public final Unit unit; + + public UnitSpawnEvent(Unit unit) { + this.unit = unit; + } + } + /** Called when a unit is dumped from any payload block. */ public static class UnitUnloadEvent{ public final Unit unit; From 9a7324ce547255a2a4f3de484535bac1c682d62b Mon Sep 17 00:00:00 2001 From: Anuken Date: Sat, 28 Aug 2021 14:17:01 -0400 Subject: [PATCH 21/21] Fixed #5887 --- core/src/mindustry/entities/Damage.java | 2 +- core/src/mindustry/world/blocks/power/PowerGraph.java | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/core/src/mindustry/entities/Damage.java b/core/src/mindustry/entities/Damage.java index cc11cf29fa..28ae0fb3a0 100644 --- a/core/src/mindustry/entities/Damage.java +++ b/core/src/mindustry/entities/Damage.java @@ -465,7 +465,7 @@ public class Damage{ for(int dx = -trad; dx <= trad; dx++){ for(int dy = -trad; dy <= trad; dy++){ Tile tile = world.tile(Math.round(x / tilesize) + dx, Math.round(y / tilesize) + dy); - if(tile != null && tile.build != null && (team == null ||team.isEnemy(tile.team())) && Mathf.dst(dx, dy) <= trad){ + if(tile != null && tile.build != null && (team == null ||team.isEnemy(tile.team())) && dx*dx + dy*dy <= trad){ tile.build.damage(damage); } } diff --git a/core/src/mindustry/world/blocks/power/PowerGraph.java b/core/src/mindustry/world/blocks/power/PowerGraph.java index b510ef2285..5e5ff19022 100644 --- a/core/src/mindustry/world/blocks/power/PowerGraph.java +++ b/core/src/mindustry/world/blocks/power/PowerGraph.java @@ -174,9 +174,9 @@ public class PowerGraph{ return Math.min(excess, capacity); } - public void distributePower(float needed, float produced){ + public void distributePower(float needed, float produced, boolean charged){ //distribute even if not needed. this is because some might be requiring power but not using it; it updates consumers - float coverage = Mathf.zero(needed) && Mathf.zero(produced) ? 0f : Mathf.zero(needed) ? 1f : Math.min(1, produced / needed); + float coverage = Mathf.zero(needed) && Mathf.zero(produced) && !charged ? 0f : Mathf.zero(needed) ? 1f : Math.min(1, produced / needed); for(Building consumer : consumers){ Consumers consumes = consumer.block.consumes; if(consumes.hasPower()){ @@ -233,6 +233,7 @@ public class PowerGraph{ energyDelta = 0f; if(!(consumers.size == 0 && producers.size == 0 && batteries.size == 0)){ + boolean charged = false; if(!Mathf.equal(powerNeeded, powerProduced)){ if(powerNeeded > powerProduced){ @@ -240,11 +241,12 @@ public class PowerGraph{ powerProduced += powerBatteryUsed; lastPowerProduced += powerBatteryUsed; }else if(powerProduced > powerNeeded){ + charged = true; powerProduced -= chargeBatteries(powerProduced - powerNeeded); } } - distributePower(powerNeeded, powerProduced); + distributePower(powerNeeded, powerProduced, charged); } }