diff --git a/core/assets/bundles/bundle.properties b/core/assets/bundles/bundle.properties index 6d56ab865a..3114282209 100644 --- a/core/assets/bundles/bundle.properties +++ b/core/assets/bundles/bundle.properties @@ -139,7 +139,7 @@ mod.disable = Disable mod.content = Content: mod.delete.error = Unable to delete mod. File may be in use. mod.requiresversion = [scarlet]Requires min game version: [accent]{0} -mod.outdated = [scarlet]Not compatible with V6 (no minGameVersion: 105) +mod.outdatedv7 = [scarlet]Incompatible with V7 (no minGameVersion: 136) mod.missingdependencies = [scarlet]Missing dependencies: {0} mod.erroredcontent = [scarlet]Content Errors mod.errors = Errors have occurred loading content. diff --git a/core/src/mindustry/Vars.java b/core/src/mindustry/Vars.java index 6636d555ce..ab0a498205 100644 --- a/core/src/mindustry/Vars.java +++ b/core/src/mindustry/Vars.java @@ -41,7 +41,7 @@ public class Vars implements Loadable{ public static boolean loadLocales = true; /** Whether the logger is loaded. */ public static boolean loadedLogger = false, loadedFileLogger = false; - /** Whether to enable various experimental features (e.g. spawn positions for spawn groups) */ + /** Whether to enable various experimental features (e.g. spawn positions for spawn groups) TODO change */ public static boolean experimental = true; /** Name of current Steam player. */ public static String steamPlayerName = ""; @@ -165,8 +165,8 @@ public class Vars implements Loadable{ public static boolean headless; /** whether steam is enabled for this game */ public static boolean steam; - /** whether typing into the console is enabled - developers only */ - public static boolean enableConsole = false; + /** whether typing into the console is enabled - developers only TODO change */ + public static boolean enableConsole = true; /** whether to clear sector saves when landing */ public static boolean clearSectors = false; /** whether any light rendering is enabled */ diff --git a/core/src/mindustry/content/Planets.java b/core/src/mindustry/content/Planets.java index 8eec30bb98..a3d2f05914 100644 --- a/core/src/mindustry/content/Planets.java +++ b/core/src/mindustry/content/Planets.java @@ -68,7 +68,7 @@ public class Planets{ r.attributes.set(Attribute.heat, 0.8f); r.showSpawns = true; r.fog = true; - r.staticFog = false; //TODO decide, is this a good idea? + r.staticFog = true; //TODO decide, is this a good idea? }; unlockedOnLand.add(Blocks.coreBastion); diff --git a/core/src/mindustry/content/UnitTypes.java b/core/src/mindustry/content/UnitTypes.java index a43d5a34f5..b1b546b2e6 100644 --- a/core/src/mindustry/content/UnitTypes.java +++ b/core/src/mindustry/content/UnitTypes.java @@ -3142,6 +3142,7 @@ public class UnitTypes{ top = false; layerOffset = -0.01f; rotate = false; + shoot = new ShootHelix(); //TODO cooler + balancing bullet = new BasicBulletType(5f, 15){{ diff --git a/core/src/mindustry/entities/pattern/ShootHelix.java b/core/src/mindustry/entities/pattern/ShootHelix.java new file mode 100644 index 0000000000..2aa10d83ea --- /dev/null +++ b/core/src/mindustry/entities/pattern/ShootHelix.java @@ -0,0 +1,17 @@ +package mindustry.entities.pattern; + +import arc.math.*; + +public class ShootHelix extends ShootPattern{ + //TODO: pattern is broken without a proper offset + public float scl = 2f, mag = 0.5f, offset = Mathf.PI * 1.25f; + + @Override + public void shoot(int totalShots, BulletHandler handler){ + for(int i = 0; i < shots; i++){ + for(int sign : Mathf.signs){ + handler.shoot(0, 0, 0, firstShotDelay + shotDelay * i, b -> Mathf.sin(b.time + offset, scl, mag * sign)); + } + } + } +} diff --git a/core/src/mindustry/entities/pattern/ShootMulti.java b/core/src/mindustry/entities/pattern/ShootMulti.java index 78b620b74a..45a7923a58 100644 --- a/core/src/mindustry/entities/pattern/ShootMulti.java +++ b/core/src/mindustry/entities/pattern/ShootMulti.java @@ -14,10 +14,10 @@ public class ShootMulti extends ShootPattern{ @Override public void shoot(int totalShots, BulletHandler handler){ - source.shoot(totalShots, (x, y, rotation, delay) -> { + source.shoot(totalShots, (x, y, rotation, delay, move) -> { for(var pattern : dest){ - pattern.shoot(totalShots, (x2, y2, rot2, delay2) -> { - handler.shoot(x + x2, y + y2, rotation + rot2, delay + delay2); + pattern.shoot(totalShots, (x2, y2, rot2, delay2, mover) -> { + handler.shoot(x + x2, y + y2, rotation + rot2, delay + delay2, mover); }); } }); diff --git a/core/src/mindustry/entities/pattern/ShootPattern.java b/core/src/mindustry/entities/pattern/ShootPattern.java index c66a5fef9f..e3a6c56efe 100644 --- a/core/src/mindustry/entities/pattern/ShootPattern.java +++ b/core/src/mindustry/entities/pattern/ShootPattern.java @@ -1,5 +1,7 @@ package mindustry.entities.pattern; +import mindustry.entities.*; + /** Handles different types of bullet patterns for shooting. */ public class ShootPattern{ /** amount of shots per "trigger pull" */ @@ -23,6 +25,10 @@ public class ShootPattern{ * @param rotation rotation offset relative to weapon * @param delay bullet delay in ticks * */ - void shoot(float x, float y, float rotation, float delay); + default void shoot(float x, float y, float rotation, float delay){ + shoot(x, y, rotation, delay, null); + } + + void shoot(float x, float y, float rotation, float delay, Mover move); } } diff --git a/core/src/mindustry/mod/Mods.java b/core/src/mindustry/mod/Mods.java index 8c24c4d0ff..a19fc9896f 100644 --- a/core/src/mindustry/mod/Mods.java +++ b/core/src/mindustry/mod/Mods.java @@ -868,7 +868,7 @@ public class Mods implements Loadable{ !skipModLoading() && Core.settings.getBool("mod-" + baseName + "-enabled", true) && Version.isAtLeast(meta.minGameVersion) && - (meta.getMinMajor() >= 105 || headless) + (meta.getMinMajor() >= 136 || headless) ){ if(ios){ throw new ModLoadException("Java class mods are not supported on iOS."); @@ -997,10 +997,10 @@ public class Mods implements Loadable{ return Version.isAtLeast(meta.minGameVersion); } - /** @return whether this mod is outdated, e.g. not compatible with v6. */ + /** @return whether this mod is outdated, e.g. not compatible with v7. */ public boolean isOutdated(){ - //must be at least 105 to indicate v6 compat - return getMinMajor() < 105; + //must be at least 136 to indicate v7 compat + return getMinMajor() < 136; } public int getMinMajor(){ diff --git a/core/src/mindustry/type/Weapon.java b/core/src/mindustry/type/Weapon.java index a955ed73ef..a7ab3fd233 100644 --- a/core/src/mindustry/type/Weapon.java +++ b/core/src/mindustry/type/Weapon.java @@ -372,17 +372,19 @@ public class Weapon implements Cloneable{ bullet.chargeEffect.at(shootX, shootY, rotation, bullet.keepVelocity || parentizeEffects ? unit : null); } - shoot.shoot(mount.totalShots, (xOffset, yOffset, angle, delay) -> { + shoot.shoot(mount.totalShots, (xOffset, yOffset, angle, delay, mover) -> { if(delay > 0f){ - Time.run(delay, () -> setupBullet(unit, mount, xOffset, yOffset, angle)); + Time.run(delay, () -> setupBullet(unit, mount, xOffset, yOffset, angle, mover)); }else{ - setupBullet(unit, mount, xOffset, yOffset, angle); + setupBullet(unit, mount, xOffset, yOffset, angle, mover); } mount.totalShots ++; }); } - protected void setupBullet(Unit unit, WeaponMount mount, float xOffset, float yOffset, float angleOffset){ + protected void setupBullet(Unit unit, WeaponMount mount, float xOffset, float yOffset, float angleOffset, Mover mover){ + if(!unit.isAdded()) return; + float weaponRotation = unit.rotation - 90 + (rotate ? mount.rotation : 0), mountX = unit.x + Angles.trnsx(unit.rotation - 90, x, y), @@ -390,26 +392,21 @@ public class Weapon implements Cloneable{ bulletX = mountX + Angles.trnsx(weaponRotation, this.shootX + xOffset, this.shootY + yOffset), bulletY = mountY + Angles.trnsy(weaponRotation, this.shootX + xOffset, this.shootY + yOffset), shootAngle = bulletRotation(unit, mount, bulletX, bulletY) + angleOffset, - lifeScl = bullet.scaleVelocity ? Mathf.clamp(Mathf.dst(shootX, shootY, mount.aimX, mount.aimY) / bullet.range) : 1f; + lifeScl = bullet.scaleVelocity ? Mathf.clamp(Mathf.dst(shootX, shootY, mount.aimX, mount.aimY) / bullet.range) : 1f, + angle = angleOffset + shootAngle + Mathf.range(inaccuracy); - bullet(mount, unit, bulletX, bulletY, angleOffset + shootAngle + Mathf.range(inaccuracy), lifeScl, shootAngle, mountX, mountY); - } - - protected void bullet(WeaponMount mount, Unit unit, float shootX, float shootY, float angle, float lifescl, float mountRotation, float mountX, float mountY){ - if(!unit.isAdded()) return; - - mount.bullet = bullet.create(unit, unit.team, shootX, shootY, angle, (1f - velocityRnd) + Mathf.random(velocityRnd), lifescl); + mount.bullet = bullet.create(unit, unit.team, bulletX, bulletY, angle, (1f - velocityRnd) + Mathf.random(velocityRnd), lifeScl, mover); if(!continuous){ - shootSound.at(shootX, shootY, Mathf.random(soundPitchMin, soundPitchMax)); + shootSound.at(bulletX, bulletY, Mathf.random(soundPitchMin, soundPitchMax)); } ejectEffect.at(mountX, mountY, angle * Mathf.sign(this.x)); - bullet.shootEffect.at(shootX, shootY, angle, bullet.hitColor, unit); - bullet.smokeEffect.at(shootX, shootY, angle, bullet.hitColor, unit); + bullet.shootEffect.at(bulletX, bulletY, angle, bullet.hitColor, unit); + bullet.smokeEffect.at(bulletX, bulletY, angle, bullet.hitColor, unit); - unit.vel.add(Tmp.v1.trns(mountRotation + 180f, bullet.recoil)); - Effect.shake(shake, shake, shootX, shootY); + unit.vel.add(Tmp.v1.trns(shootAngle + 180f, bullet.recoil)); + Effect.shake(shake, shake, bulletX, bulletY); mount.recoil = recoil; mount.heat = 1f; } diff --git a/core/src/mindustry/ui/dialogs/ModsDialog.java b/core/src/mindustry/ui/dialogs/ModsDialog.java index 233f60004e..ac201d16b5 100644 --- a/core/src/mindustry/ui/dialogs/ModsDialog.java +++ b/core/src/mindustry/ui/dialogs/ModsDialog.java @@ -249,7 +249,7 @@ public class ModsDialog extends BaseDialog{ text.row(); if(item.isOutdated()){ - text.labelWrap("@mod.outdated").growX(); + text.labelWrap("@mod.outdatedv7").growX(); text.row(); }else if(!item.isSupported()){ text.labelWrap(Core.bundle.format("mod.requiresversion", item.meta.minGameVersion)).growX(); diff --git a/core/src/mindustry/world/blocks/defense/turrets/Turret.java b/core/src/mindustry/world/blocks/defense/turrets/Turret.java index ace9ab610a..7f3038277f 100644 --- a/core/src/mindustry/world/blocks/defense/turrets/Turret.java +++ b/core/src/mindustry/world/blocks/defense/turrets/Turret.java @@ -478,18 +478,18 @@ public class Turret extends ReloadTurret{ type.chargeEffect.at(bulletX, bulletY, rotation); } - shoot.shoot(totalShots, (xOffset, yOffset, angle, delay) -> { + shoot.shoot(totalShots, (xOffset, yOffset, angle, delay, mover) -> { queuedBullets ++; if(delay > 0f){ - Time.run(delay, () -> bullet(type, xOffset, yOffset, angle)); + Time.run(delay, () -> bullet(type, xOffset, yOffset, angle, mover)); }else{ - bullet(type, xOffset, yOffset, angle); + bullet(type, xOffset, yOffset, angle, mover); } totalShots ++; }); } - protected void bullet(BulletType type, float xOffset, float yOffset, float angleOffset){ + protected void bullet(BulletType type, float xOffset, float yOffset, float angleOffset, Mover mover){ queuedBullets --; if(dead || !hasAmmo()) return; @@ -501,7 +501,7 @@ public class Turret extends ReloadTurret{ float lifeScl = type.scaleVelocity ? Mathf.clamp(Mathf.dst(bulletX, bulletY, targetPos.x, targetPos.y) / type.range, minRange / type.range, range() / type.range) : 1f; - handleBullet(type.create(this, team, bulletX, bulletY, shootAngle, 1f + Mathf.range(velocityInaccuracy), lifeScl), xOffset, yOffset, angleOffset); + handleBullet(type.create(this, team, bulletX, bulletY, shootAngle, 1f + Mathf.range(velocityInaccuracy), lifeScl, mover), xOffset, yOffset, angleOffset); (shootEffect == Fx.none ? type.shootEffect : shootEffect).at(bulletX, bulletY, rotation, type.hitColor); (smokeEffect == Fx.none ? type.smokeEffect : smokeEffect).at(bulletX, bulletY, rotation, type.hitColor);