diff --git a/core/src/mindustry/content/Fx.java b/core/src/mindustry/content/Fx.java index 47b9995c77..e1d7ad0d7e 100644 --- a/core/src/mindustry/content/Fx.java +++ b/core/src/mindustry/content/Fx.java @@ -1066,38 +1066,40 @@ public class Fx{ shellEjectSmall = new Effect(30f, e -> { color(Pal.lightOrange, Color.lightGray, Pal.lightishGray, e.fin()); + alpha(e.fout(0.2f)); float rot = Math.abs(e.rotation) + 90f; - int i = Mathf.sign(e.rotation); + int i = -Mathf.sign(e.rotation); float len = (2f + e.finpow() * 6f) * i; float lr = rot + e.fin() * 30f * i; Fill.rect(e.x + trnsx(lr, len) + Mathf.randomSeedRange(e.id + i + 7, 3f * e.fin()), - e.y + trnsy(lr, len) + Mathf.randomSeedRange(e.id + i + 8, 3f * e.fin()), - 1f, 2f, rot + e.fin() * 50f * i); + e.y + trnsy(lr, len) + Mathf.randomSeedRange(e.id + i + 8, 3f * e.fin()), + 1f, 2f, rot + e.fin() * 50f * i); }).layer(Layer.debris, 400f), shellEjectMedium = new Effect(34f, e -> { color(Pal.lightOrange, Color.lightGray, Pal.lightishGray, e.fin()); - float rot = e.rotation + 90f; - for(int i : Mathf.signs){ + float rot = Math.abs(e.rotation) + 90f; + int i = Mathf.sign(e.rotation); + //for(int i : Mathf.signs){ float len = (2f + e.finpow() * 10f) * i; float lr = rot + e.fin() * 20f * i; rect(Core.atlas.find("casing"), e.x + trnsx(lr, len) + Mathf.randomSeedRange(e.id + i + 7, 3f * e.fin()), e.y + trnsy(lr, len) + Mathf.randomSeedRange(e.id + i + 8, 3f * e.fin()), 2f, 3f, rot); - } + //} color(Color.lightGray, Color.gray, e.fin()); - for(int i : Mathf.signs){ + //for(int i : Mathf.signs){ float ex = e.x, ey = e.y, fout = e.fout(); randLenVectors(e.id, 4, 1f + e.finpow() * 11f, e.rotation + 90f * i, 20f, (x, y) -> { Fill.circle(ex + x, ey + y, fout * 1.5f); }); - } + //} }).layer(Layer.debris, 400f), diff --git a/core/src/mindustry/core/Logic.java b/core/src/mindustry/core/Logic.java index ce08b21c0a..55df925737 100644 --- a/core/src/mindustry/core/Logic.java +++ b/core/src/mindustry/core/Logic.java @@ -180,18 +180,8 @@ public class Logic implements ApplicationListener{ //if there's a "win" wave and no enemies are present, win automatically if(state.rules.waves && (state.enemies == 0 && state.rules.winWave > 0 && state.wave >= state.rules.winWave && !spawner.isSpawning()) || (state.rules.attackMode && state.rules.waveTeam.cores().isEmpty())){ - //the sector has been conquered - waves get disabled - state.rules.waves = false; - //disable attack mode - state.rules.attackMode = false; - //fire capture event - Events.fire(new SectorCaptureEvent(state.rules.sector)); - - //save, just in case - if(!headless){ - control.saves.saveSector(state.rules.sector); - } + Call.sectorCapture(); } }else{ if(!state.rules.attackMode && state.teams.playerCores().size == 0 && !state.gameOver){ @@ -227,6 +217,24 @@ public class Logic implements ApplicationListener{ } } + @Remote(called = Loc.server) + public static void sectorCapture(){ + //the sector has been conquered - waves get disabled + state.rules.waves = false; + //disable attack mode + state.rules.attackMode = false; + + if(state.rules.sector == null) return; + + //fire capture event + Events.fire(new SectorCaptureEvent(state.rules.sector)); + + //save, just in case + if(!headless){ + control.saves.saveSector(state.rules.sector); + } + } + @Remote(called = Loc.both) public static void updateGameOver(Team winner){ state.gameOver = true; diff --git a/core/src/mindustry/entities/Lightning.java b/core/src/mindustry/entities/Lightning.java index 21e9d91a9f..fa943d6b88 100644 --- a/core/src/mindustry/entities/Lightning.java +++ b/core/src/mindustry/entities/Lightning.java @@ -4,6 +4,7 @@ import arc.graphics.*; import arc.math.*; import arc.math.geom.*; import arc.struct.*; +import arc.util.*; import mindustry.content.*; import mindustry.core.*; import mindustry.entities.bullet.*; @@ -33,11 +34,11 @@ public class Lightning{ createLightningInternal(bullet, lastSeed++, bullet.team, color, damage, x, y, targetAngle, length); } - private static void createLightningInternal(Bullet hitter, int seed, Team team, Color color, float damage, float x, float y, float rotation, int length){ + private static void createLightningInternal(@Nullable Bullet hitter, int seed, Team team, Color color, float damage, float x, float y, float rotation, int length){ random.setSeed(seed); hit.clear(); - BulletType hitCreate = hitter.type.lightningType; + BulletType hitCreate = hitter == null ? Bullets.damageLightning : hitter.type.lightningType; Seq lines = new Seq<>(); bhit = false; diff --git a/core/src/mindustry/entities/comp/WeaponsComp.java b/core/src/mindustry/entities/comp/WeaponsComp.java index dec0105c14..00fc925a5e 100644 --- a/core/src/mindustry/entities/comp/WeaponsComp.java +++ b/core/src/mindustry/entities/comp/WeaponsComp.java @@ -152,7 +152,7 @@ abstract class WeaponsComp implements Teamc, Posc, Rotc, Velc, Statusc{ mount.reload <= 0.0001f && //reload has to be 0 Angles.within(weapon.rotate ? mount.rotation : this.rotation, mount.targetRotation, mount.weapon.shootCone) //has to be within the cone ){ - shoot(mount, shootX, shootY, mount.aimX, mount.aimY, shootAngle, Mathf.sign(weapon.x)); + shoot(mount, shootX, shootY, mount.aimX, mount.aimY, mountX, mountY, shootAngle, Mathf.sign(weapon.x)); mount.reload = weapon.reload; @@ -162,7 +162,7 @@ abstract class WeaponsComp implements Teamc, Posc, Rotc, Velc, Statusc{ } } - private void shoot(WeaponMount mount, float x, float y, float aimX, float aimY, float rotation, int side){ + private void shoot(WeaponMount mount, float x, float y, float aimX, float aimY, float mountX, float mountY, float rotation, int side){ Weapon weapon = mount.weapon; float baseX = this.x, baseY = this.y; @@ -203,7 +203,7 @@ abstract class WeaponsComp implements Teamc, Posc, Rotc, Velc, Statusc{ mount.heat = 1f; } - weapon.ejectEffect.at(x, y, rotation * side); + weapon.ejectEffect.at(mountX, mountY, rotation * side); ammo.shootEffect.at(x, y, rotation, parentize ? this : null); ammo.smokeEffect.at(x, y, rotation, parentize ? this : null); apply(weapon.shootStatus, weapon.shootStatusDuration); diff --git a/gradle.properties b/gradle.properties index dc961b8e69..17789c206e 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,3 +1,3 @@ org.gradle.daemon=true org.gradle.jvmargs=-Xms256m -Xmx1024m -archash=57726650a54aa55dae98cf4d5f17cd6cd3218a3d +archash=947eb46d0619baf4f029910ca384ed2ad4b59095