From fa6ddd5f5050cc8fe9acd0aa08f48a5507b93bbd Mon Sep 17 00:00:00 2001 From: Anuken Date: Thu, 3 Feb 2022 15:13:08 -0500 Subject: [PATCH] Conquer tank progress --- .../units/weapons/conquer-weapon-fold.png | Bin 609 -> 0 bytes core/assets/scripts/global.js | 2 - core/src/mindustry/content/Blocks.java | 4 +- core/src/mindustry/content/UnitTypes.java | 74 ++++++++++++++++-- .../mindustry/entities/bullet/BulletType.java | 14 +++- core/src/mindustry/type/Weapon.java | 3 + .../blocks/distribution/DirectionBridge.java | 15 +--- 7 files changed, 87 insertions(+), 25 deletions(-) delete mode 100644 core/assets-raw/sprites/units/weapons/conquer-weapon-fold.png diff --git a/core/assets-raw/sprites/units/weapons/conquer-weapon-fold.png b/core/assets-raw/sprites/units/weapons/conquer-weapon-fold.png deleted file mode 100644 index 9ef6827464883edd587b9fcb0d4f34dc3add10f0..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 609 zcmV-n0-pVeP)Px%8%ab#RA_sd|*KMB*YKwW?T|5fkDF90M`4A_Nj#1St!VI&p)l z9qAII#Q53Ij-8~HzX{>^&-Y@#I1UhrL?V$$B(ly}~B08I(e@A0rF%gF7m z>uyUHFh!rLCzB3_+NrPOc-Sj~ZEdxM`1I%o18lXvBAP2y8jWYwF6$hT>$&(#wpj>f*2tbqM##sACaX_8$5)j*5 zISJZ|Q}t}>GGK`V#GNjWmH+@h-(R@hKE3VvRa3SLae#S%IT}v@4=+7^5(k(GuWZ!& zNpF|pfc@USQ2 spawnBullets = new Seq<>(); public Color trailColor = Pal.missileYellowBack; @@ -178,7 +179,8 @@ public class BulletType extends Content implements Cloneable{ public @Nullable BulletType lightningType = null; public float weaveScale = 1f; - public float weaveMag = -1f; + public float weaveMag = 0f; + public boolean weaveRandom = true; public float hitShake = 0f, despawnShake = 0f; public int puddles; @@ -375,6 +377,12 @@ public class BulletType extends Content implements Cloneable{ if(instantDisappear){ b.time = lifetime; } + + if(spawnBullets.size > 0){ + for(var bullet : spawnBullets){ + bullet.create(b, b.x, b.y, b.rotation()); + } + } } public void update(Bullet b){ @@ -397,8 +405,8 @@ public class BulletType extends Content implements Cloneable{ } } - if(weaveMag > 0){ - b.vel.rotate(Mathf.sin(b.time + Mathf.PI * weaveScale/2f, weaveScale, weaveMag * (Mathf.randomSeed(b.id, 0, 1) == 1 ? -1 : 1)) * Time.delta); + if(weaveMag != 0){ + b.vel.rotateRadExact((float)Math.sin((b.time + Math.PI * weaveScale/2f) / weaveScale) * weaveMag * (weaveRandom ? (Mathf.randomSeed(b.id, 0, 1) == 1 ? -1 : 1) : 1f) * Time.delta * Mathf.degRad); } if(trailChance > 0){ diff --git a/core/src/mindustry/type/Weapon.java b/core/src/mindustry/type/Weapon.java index 553234c3d0..7f47e61784 100644 --- a/core/src/mindustry/type/Weapon.java +++ b/core/src/mindustry/type/Weapon.java @@ -92,6 +92,8 @@ public class Weapon implements Cloneable{ public float rotationLimit = 361f; /** ticks to cool down the heat region */ public float cooldownTime = 20f; + /** minimum weapon warmup before firing (this is not linear, do NOT use 1!) */ + public float minWarmup = 0f; /** lerp speed for shoot warmup, only used for parts */ public float shootWarmupSpeed = 0.1f, smoothReloadSpeed = 0.15f; /** random sound pitch range */ @@ -342,6 +344,7 @@ public class Weapon implements Cloneable{ can && //must be able to shoot (!useAmmo || unit.ammo > 0 || !state.rules.unitAmmo || unit.team.rules().infiniteAmmo) && //check ammo (!alternate || wasFlipped == flipSprite) && + mount.warmup >= minWarmup && //must be warmed up unit.vel.len() >= minShootVelocity && //check velocity requirements mount.reload <= 0.0001f && //reload has to be 0 Angles.within(rotate ? mount.rotation : unit.rotation, mount.targetRotation, shootCone) //has to be within the cone diff --git a/core/src/mindustry/world/blocks/distribution/DirectionBridge.java b/core/src/mindustry/world/blocks/distribution/DirectionBridge.java index f7c9b6bc7a..d8ca0b81c2 100644 --- a/core/src/mindustry/world/blocks/distribution/DirectionBridge.java +++ b/core/src/mindustry/world/blocks/distribution/DirectionBridge.java @@ -183,21 +183,10 @@ public class DirectionBridge extends Block{ for(int dir = 0; dir < 4; dir++){ if(dir != rotation){ int dx = Geometry.d4x(dir), dy = Geometry.d4y(dir); - int length = range; - Building found = null; - - //find the link - for(int i = 1; i <= range; i++){ - Tile other = world.tile(tile.x + dx * i, tile.y + dy * i); - - if(other != null && other.build instanceof DirectionBridgeBuild build && build.block == DirectionBridge.this && build.team == player.team() && (build.rotation + 2) % 4 == dir){ - length = i; - found = other.build; - break; - } - } + Building found = occupied[(dir + 2) % 4]; if(found != null){ + int length = Math.max(Math.abs(found.tileX() - tileX()), Math.abs(found.tileY() - tileY())); Drawf.dashLine(Pal.place, found.x - dx * (tilesize / 2f + 2), found.y - dy * (tilesize / 2f + 2),