diff --git a/core/assets-raw/sprites/units/emanate-cell.png b/core/assets-raw/sprites/units/emanate-cell.png new file mode 100644 index 0000000000..77e5a9aaf3 Binary files /dev/null and b/core/assets-raw/sprites/units/emanate-cell.png differ diff --git a/core/assets-raw/sprites/units/emanate.png b/core/assets-raw/sprites/units/emanate.png new file mode 100644 index 0000000000..95fa1a83d8 Binary files /dev/null and b/core/assets-raw/sprites/units/emanate.png differ diff --git a/core/assets/icons/icons.properties b/core/assets/icons/icons.properties index 7e4f889eed..0f7352074c 100755 --- a/core/assets/icons/icons.properties +++ b/core/assets/icons/icons.properties @@ -446,3 +446,4 @@ 63260=reinforced-liquid-junction|block-reinforced-liquid-junction-ui 63259=oxidation-chamber|block-oxidation-chamber-ui 63258=surge-crucible|block-surge-crucible-ui +63257=emanate|unit-emanate-ui diff --git a/core/assets/logicids.dat b/core/assets/logicids.dat index f595f82542..e06c76e3d9 100644 Binary files a/core/assets/logicids.dat and b/core/assets/logicids.dat differ diff --git a/core/src/mindustry/content/Blocks.java b/core/src/mindustry/content/Blocks.java index ba04795c5b..a271ef0b55 100644 --- a/core/src/mindustry/content/Blocks.java +++ b/core/src/mindustry/content/Blocks.java @@ -1988,7 +1988,7 @@ public class Blocks implements ContentList{ //TODO cost requirements(Category.effect, with(Items.beryllium, 11000, Items.graphite, 11000, Items.tungsten, 9000, Items.carbide, 10000)); - unitType = UnitTypes.evoke; + unitType = UnitTypes.emanate; health = 22000; itemCapacity = 16000; size = 6; diff --git a/core/src/mindustry/content/UnitTypes.java b/core/src/mindustry/content/UnitTypes.java index c5c7a4e14f..b109816d9b 100644 --- a/core/src/mindustry/content/UnitTypes.java +++ b/core/src/mindustry/content/UnitTypes.java @@ -3,6 +3,7 @@ package mindustry.content; import arc.graphics.*; import arc.graphics.g2d.*; import arc.math.*; +import arc.math.geom.*; import arc.struct.*; import mindustry.ai.types.*; import mindustry.annotations.Annotations.*; @@ -2417,6 +2418,7 @@ public class UnitTypes implements ContentList{ isCounted = false; envDisabled = 0; + outlineColor = Pal.darkOutline; lowAltitude = false; flying = true; targetAir = false; @@ -2475,6 +2477,7 @@ public class UnitTypes implements ContentList{ isCounted = false; envDisabled = 0; + outlineColor = Pal.darkOutline; lowAltitude = false; flying = true; targetAir = false; @@ -2483,7 +2486,7 @@ public class UnitTypes implements ContentList{ buildSpeed = 1.4f; drag = 0.06f; speed = 2.6f; - rotateSpeed = 6f; + rotateSpeed = 5f; accel = 0.11f; itemCapacity = 70; health = 600f; @@ -2526,6 +2529,77 @@ public class UnitTypes implements ContentList{ }}); }}; + emanate = new UnitType("emanate"){{ + defaultController = BuilderAI::new; + isCounted = false; + envDisabled = 0; + + outlineColor = Pal.darkOutline; + lowAltitude = false; + flying = true; + targetAir = false; + mineSpeed = 8f; + mineTier = 3; + buildSpeed = 1.4f; + drag = 0.06f; + speed = 2.6f; + rotateSpeed = 3f; + accel = 0.11f; + itemCapacity = 140; + health = 1500f; + armor = 3f; + hitSize = 36f; + commandLimit = 9; + buildBeamOffset = 72f / 4f; + engineSize = 0; + payloadCapacity = Mathf.sqr(3f) * tilePayload; + + float es = 3.8f; + + setEnginesMirror( + new UnitEngine(49 / 4f, 51 / 4f, es, 45f), + new UnitEngine(67 / 4f, -30 / 4f, es, 315f), + new UnitEngine(49 / 4f, -62 / 4f, es, 315f) + ); + + Vec2[] positions = {new Vec2(30f, 50f), new Vec2(60f, -15f)}; + int i = 0; + + for(var pos : positions){ + int fi = i; + weapons.add(new Weapon("incite-weapon"){{ + rotate = true; + reload = fi == 0 ? 25f : 35f; + rotateSpeed = 4f; + x = pos.x/4f; + y = pos.y/4f; + shootY = 5.75f; + recoil = 2f; + rotationLimit = 90f; + layerOffset = -0.01f; + + bullet = new BasicBulletType(5f, 17){{ + width = 7f; + height = 12f; + shootEffect = Fx.sparkShoot; + smokeEffect = Fx.shootBigSmoke; + pierceCap = 2; + pierce = true; + pierceBuilding = true; + hitColor = backColor = trailColor = Pal.bulletYellowBack; + frontColor = Color.white; + trailWidth = 1.5f; + trailLength = 7; + hitEffect = despawnEffect = Fx.hitBulletColor; + }}; + }}); + i ++; + } + + + }}; + + //TODO emanate (+ better names) //endregion diff --git a/core/src/mindustry/type/Weapon.java b/core/src/mindustry/type/Weapon.java index 5d7ca4fcc4..72766cd983 100644 --- a/core/src/mindustry/type/Weapon.java +++ b/core/src/mindustry/type/Weapon.java @@ -85,6 +85,8 @@ public class Weapon implements Cloneable{ public float shotDelay = 0; /** The half-radius of the cone in which shooting will start. */ public float shootCone = 5f; + /** Cone in which the weapon can rotate relative to its mount. */ + public float rotationLimit = 361f; /** ticks to cool down the heat region */ public float cooldownTime = 20f; /** random sound pitch range */ @@ -147,6 +149,10 @@ public class Weapon implements Cloneable{ //TODO copy-pasted code public void drawOutline(Unit unit, WeaponMount mount){ + //apply layer offset, roll it back at the end + float z = Draw.z(); + Draw.z(z + layerOffset); + float rotation = unit.rotation - 90, weaponRotation = rotation + (rotate ? mount.rotation : 0), @@ -160,6 +166,8 @@ public class Weapon implements Cloneable{ outlineRegion.height * Draw.scl, weaponRotation); } + + Draw.z(z); } public void draw(Unit unit, WeaponMount mount){ @@ -215,6 +223,12 @@ public class Weapon implements Cloneable{ mount.targetRotation = Angles.angle(axisX, axisY, mount.aimX, mount.aimY) - unit.rotation; mount.rotation = Angles.moveToward(mount.rotation, mount.targetRotation, rotateSpeed * Time.delta); + if(rotationLimit < 360){ + float dst = Angles.angleDist(mount.rotation, 0f); + if(dst > rotationLimit/2f){ + mount.rotation = Angles.moveToward(mount.rotation, 0, dst - rotationLimit/2f); + } + } }else if(!rotate){ mount.rotation = 0; mount.targetRotation = unit.angleTo(mount.aimX, mount.aimY);