diff --git a/core/assets-raw/sprites/units/conquer.aseprite b/core/assets-raw/sprites/units/conquer.aseprite index a867d6e0c0..277e406fa9 100644 Binary files a/core/assets-raw/sprites/units/conquer.aseprite and b/core/assets-raw/sprites/units/conquer.aseprite differ diff --git a/core/src/mindustry/content/Fx.java b/core/src/mindustry/content/Fx.java index 44dd400346..eb82e01bf8 100644 --- a/core/src/mindustry/content/Fx.java +++ b/core/src/mindustry/content/Fx.java @@ -2360,5 +2360,20 @@ public class Fx{ } Lines.endLine(); - }).followParent(false).rotWithParent(false); + }).followParent(false).rotWithParent(false), + + legDestroy = new Effect(90f, 100f, e -> { + if(!(e.data instanceof LegDestroyData data)) return; + rand.setSeed(e.id); + + e.lifetime = rand.random(70f, 130f); + + Tmp.v1.trns(rand.random(360f), rand.random(data.region.width / 8f) * e.finpow()); + float ox = Tmp.v1.x, oy = Tmp.v1.y; + + alpha(e.foutpowdown()); + + stroke(data.region.height * scl); + line(data.region, data.a.x + ox, data.a.y + oy, data.b.x + ox, data.b.y + oy, false); + }).layer(Layer.groundUnit + 5f); } diff --git a/core/src/mindustry/content/Planets.java b/core/src/mindustry/content/Planets.java index 42fe36b87d..ef25688f35 100644 --- a/core/src/mindustry/content/Planets.java +++ b/core/src/mindustry/content/Planets.java @@ -52,7 +52,6 @@ public class Planets{ landCloudColor = Color.valueOf("ed6542"); atmosphereColor = Color.valueOf("f07218"); defaultEnv = Env.scorching | Env.terrestrial; - drillOverlay = Blocks.air; startSector = 10; atmosphereRadIn = 0.02f; atmosphereRadOut = 0.3f; diff --git a/core/src/mindustry/entities/LegDestroyData.java b/core/src/mindustry/entities/LegDestroyData.java new file mode 100644 index 0000000000..32994c0aaa --- /dev/null +++ b/core/src/mindustry/entities/LegDestroyData.java @@ -0,0 +1,15 @@ +package mindustry.entities; + +import arc.graphics.g2d.*; +import arc.math.geom.*; + +public class LegDestroyData{ + public Vec2 a, b; + public TextureRegion region; + + public LegDestroyData(Vec2 a, Vec2 b, TextureRegion region){ + this.a = a; + this.b = b; + this.region = region; + } +} diff --git a/core/src/mindustry/entities/comp/LegsComp.java b/core/src/mindustry/entities/comp/LegsComp.java index 89d88e8710..ccd3be83b2 100644 --- a/core/src/mindustry/entities/comp/LegsComp.java +++ b/core/src/mindustry/entities/comp/LegsComp.java @@ -15,6 +15,8 @@ import mindustry.graphics.*; import mindustry.type.*; import mindustry.world.blocks.environment.*; +import static mindustry.Vars.*; + @Component abstract class LegsComp implements Posc, Rotc, Hitboxc, Flyingc, Unitc{ private static final Vec2 straightVec = new Vec2(); @@ -57,6 +59,31 @@ abstract class LegsComp implements Posc, Rotc, Hitboxc, Flyingc, Unitc{ resetLegs(1f); } + @MethodPriority(-1) + @Override + public void destroy(){ + if(!isAdded() || Vars.headless) return; + + float legExplodeRad = type.legRegion.height / 4f / 1.45f; + + //create effects for legs being destroyed + for(int i = 0; i < legs.length; i++){ + Leg l = legs[i]; + + Vec2 base = legOffset(Tmp.v1, i).add(x, y); + + Tmp.v2.set(l.base).sub(l.joint).inv().setLength(type.legExtension); + + for(Vec2 vec : new Vec2[]{base, l.joint, l.base}){ + Damage.dynamicExplosion(vec.x, vec.y, 0f, 0f, 0f, legExplodeRad, state.rules.damageExplosions, false, team, type.deathExplosionEffect); + } + + Fx.legDestroy.at(base.x, base.y, 0f, new LegDestroyData(base.cpy(), l.joint, type.legRegion)); + Fx.legDestroy.at(l.joint.x, l.joint.y, 0f, new LegDestroyData(l.joint.cpy().add(Tmp.v2), l.base, type.legBaseRegion)); + + } + } + public void resetLegs(){ resetLegs(type.legLength); } @@ -89,7 +116,6 @@ abstract class LegsComp implements Posc, Rotc, Hitboxc, Flyingc, Unitc{ baseRotation = rotation; } - float rot = baseRotation; float legLength = type.legLength; //set up initial leg positions diff --git a/core/src/mindustry/entities/comp/UnitComp.java b/core/src/mindustry/entities/comp/UnitComp.java index adbf8b349f..8c5f626906 100644 --- a/core/src/mindustry/entities/comp/UnitComp.java +++ b/core/src/mindustry/entities/comp/UnitComp.java @@ -506,7 +506,7 @@ abstract class UnitComp implements Healthc, Physicsc, Hitboxc, Statusc, Teamc, I float power = item().charge * Mathf.pow(stack().amount, 1.11f) * 160f; if(!spawnedByCore){ - Damage.dynamicExplosion(x, y, flammability, explosiveness, power, bounds() / 2f, state.rules.damageExplosions, item().flammability > 1, team, type.deathExplosionEffect); + Damage.dynamicExplosion(x, y, flammability, explosiveness, power, (bounds() + type.legLength/1.7f) / 2f, state.rules.damageExplosions, item().flammability > 1, team, type.deathExplosionEffect); }else{ type.deathExplosionEffect.at(x, y, bounds() / 2f / 8f); } diff --git a/core/src/mindustry/game/Schematics.java b/core/src/mindustry/game/Schematics.java index 88d6123233..b390c2deb9 100644 --- a/core/src/mindustry/game/Schematics.java +++ b/core/src/mindustry/game/Schematics.java @@ -30,7 +30,6 @@ import mindustry.world.blocks.ConstructBlock.*; import mindustry.world.blocks.distribution.*; import mindustry.world.blocks.legacy.*; import mindustry.world.blocks.power.*; -import mindustry.world.blocks.production.*; import mindustry.world.blocks.sandbox.*; import mindustry.world.blocks.storage.*; import mindustry.world.blocks.storage.CoreBlock.*; @@ -421,20 +420,20 @@ public class Schematics implements Loadable{ /** Places the last launch loadout at the coordinates and fills it with the launch resources. */ public static void placeLaunchLoadout(int x, int y){ - placeLoadout(universe.getLastLoadout(), x, y, state.rules.defaultTeam, state.rules.sector == null ? Blocks.air : state.rules.sector.planet.drillOverlay); + placeLoadout(universe.getLastLoadout(), x, y, state.rules.defaultTeam); if(world.tile(x, y).build == null) throw new RuntimeException("No core at loadout coordinates!"); world.tile(x, y).build.items.add(universe.getLaunchResources()); } public static void placeLoadout(Schematic schem, int x, int y){ - placeLoadout(schem, x, y, state.rules.defaultTeam, Blocks.oreCopper); + placeLoadout(schem, x, y, state.rules.defaultTeam); } - public static void placeLoadout(Schematic schem, int x, int y, Team team, Block resource){ - placeLoadout(schem, x, y, team, resource, true); + public static void placeLoadout(Schematic schem, int x, int y, Team team){ + placeLoadout(schem, x, y, team, true); } - public static void placeLoadout(Schematic schem, int x, int y, Team team, Block resource, boolean check){ + public static void placeLoadout(Schematic schem, int x, int y, Team team, boolean check){ Stile coreTile = schem.tiles.find(s -> s.block instanceof CoreBlock); Seq seq = new Seq<>(); if(coreTile == null) throw new IllegalArgumentException("Loadout schematic has no core tile!"); @@ -465,10 +464,6 @@ public class Schematics implements Loadable{ tile.build.configureAny(config); } - if(st.block instanceof Drill && resource != Blocks.air){ - tile.getLinkedTiles(t -> t.setOverlay(resource)); - } - if(tile.build instanceof CoreBuild cb){ state.teams.registerCore(cb); } diff --git a/core/src/mindustry/maps/generators/BaseGenerator.java b/core/src/mindustry/maps/generators/BaseGenerator.java index d6e698e886..6bc9f78315 100644 --- a/core/src/mindustry/maps/generators/BaseGenerator.java +++ b/core/src/mindustry/maps/generators/BaseGenerator.java @@ -56,7 +56,7 @@ public class BaseGenerator{ for(Tile tile : cores){ tile.clearOverlay(); - Schematics.placeLoadout(coreschem.schematic, tile.x, tile.y, team, coreschem.required instanceof Item ? bases.ores.get((Item)coreschem.required) : Blocks.oreCopper, false); + Schematics.placeLoadout(coreschem.schematic, tile.x, tile.y, team, false); //fill core with every type of item (even non-material) Building entity = tile.build; diff --git a/core/src/mindustry/type/Planet.java b/core/src/mindustry/type/Planet.java index 7864cca54e..e4f1cd62ad 100644 --- a/core/src/mindustry/type/Planet.java +++ b/core/src/mindustry/type/Planet.java @@ -9,14 +9,12 @@ import arc.math.geom.*; import arc.struct.*; import arc.util.*; import arc.util.noise.*; -import mindustry.content.*; import mindustry.content.TechTree.*; import mindustry.ctype.*; import mindustry.graphics.*; import mindustry.graphics.g3d.*; import mindustry.graphics.g3d.PlanetGrid.*; import mindustry.maps.generators.*; -import mindustry.world.*; import mindustry.world.meta.*; import static mindustry.Vars.*; @@ -68,8 +66,6 @@ public class Planet extends UnlockableContent{ public boolean accessible = true; /** Environment flags for sectors on this planet. */ public int defaultEnv = Env.terrestrial | Env.spores | Env.groundOil | Env.groundWater | Env.oxygen; - /** Default block placed under drills upon launching. */ - public Block drillOverlay = Blocks.oreCopper; /** If true, a day/night cycle is simulated. */ public boolean updateLighting = true; /** Day/night cycle parameters. */