From 1bf728359d7e7f062be3d73828e778d67b230c12 Mon Sep 17 00:00:00 2001 From: Anuken Date: Tue, 1 May 2018 16:02:42 -0400 Subject: [PATCH] Fixed build errors --- build.gradle | 2 +- .../io/anuke/mindustry/resource/AmmoType.java | 2 ++ .../io/anuke/mindustry/resource/Weapon.java | 7 ++++- .../blocks/types/units/ResupplyPoint.java | 29 +++++++++++++++---- gradle/wrapper/gradle-wrapper.properties | 3 +- 5 files changed, 34 insertions(+), 9 deletions(-) diff --git a/build.gradle b/build.gradle index 4a7535ec55..d40d887191 100644 --- a/build.gradle +++ b/build.gradle @@ -27,7 +27,7 @@ allprojects { gdxVersion = '1.9.8' roboVMVersion = '2.3.0' aiVersion = '1.8.1' - uCoreVersion = 'dd5eb72' + uCoreVersion = '88326fc' getVersionString = { String buildVersion = getBuildVersion() diff --git a/core/src/io/anuke/mindustry/resource/AmmoType.java b/core/src/io/anuke/mindustry/resource/AmmoType.java index eeb2aeec92..a6ee9d2d6d 100644 --- a/core/src/io/anuke/mindustry/resource/AmmoType.java +++ b/core/src/io/anuke/mindustry/resource/AmmoType.java @@ -21,6 +21,8 @@ public class AmmoType { public final float quantityMultiplier; /**Reload speed multiplier.*/ public float speedMultiplier = 1f; + /**Bullet recoil strength.*/ + public float recoil = 0f; /**Effect created when shooting.*/ public Effect shootEffect = Fx.none; /**Extra smoke effect created when shooting.*/ diff --git a/core/src/io/anuke/mindustry/resource/Weapon.java b/core/src/io/anuke/mindustry/resource/Weapon.java index a8cb46c5f6..0bdbdbf1d4 100644 --- a/core/src/io/anuke/mindustry/resource/Weapon.java +++ b/core/src/io/anuke/mindustry/resource/Weapon.java @@ -94,10 +94,15 @@ public class Weapon extends Upgrade{ void shootInternal(Player p, float x, float y, float rotation, boolean left){ Angles.shotgun(shots, spacing, rotation, f -> bullet(p, x, y, f + Mathf.range(inaccuracy))); - tr.trns(rotation, 3f); AmmoType type = p.inventory.getAmmo(); + tr.trns(rotation + 180f, type.recoil); + + p.velocity.add(tr); + + tr.trns(rotation, 3f); + Effects.shake(shake, shake, x, y); Effects.effect(ejectEffect, x, y, rotation * -Mathf.sign(left)); Effects.effect(type.shootEffect, x + tr.x, y + tr.y, rotation, p); diff --git a/core/src/io/anuke/mindustry/world/blocks/types/units/ResupplyPoint.java b/core/src/io/anuke/mindustry/world/blocks/types/units/ResupplyPoint.java index 39a3cf78fc..fb75c45d6f 100644 --- a/core/src/io/anuke/mindustry/world/blocks/types/units/ResupplyPoint.java +++ b/core/src/io/anuke/mindustry/world/blocks/types/units/ResupplyPoint.java @@ -1,6 +1,7 @@ package io.anuke.mindustry.world.blocks.types.units; import com.badlogic.gdx.math.Rectangle; +import com.badlogic.gdx.math.Vector2; import io.anuke.mindustry.entities.TileEntity; import io.anuke.mindustry.entities.Unit; import io.anuke.mindustry.entities.Units; @@ -10,6 +11,7 @@ import io.anuke.mindustry.world.Block; import io.anuke.mindustry.world.Tile; import io.anuke.mindustry.world.flags.BlockFlag; import io.anuke.ucore.core.Timers; +import io.anuke.ucore.graphics.Draw; import io.anuke.ucore.graphics.Shapes; import io.anuke.ucore.util.Angles; import io.anuke.ucore.util.EnumSet; @@ -40,13 +42,28 @@ public class ResupplyPoint extends Block{ public void drawLayer(Tile tile) { ResupplyPointEntity entity = tile.entity(); - if(entity.target != null){ - float ang = entity.angleTo(entity.target); + if(entity.strength > 0f){ + float ang = entity.angleTo(entity.lastx, entity.lasty); float len = 5f; + float x1 = tile.drawx() + Angles.trnsx(ang, len), y1 = tile.drawy() + Angles.trnsy(ang, len); + float dstTo = Vector2.dst(x1, y1, entity.lastx, entity.lasty); + float space = 4f; + + float xf = entity.lastx - x1, yf = entity.lasty - y1; Shapes.laser("transfer", "transfer-end", - tile.drawx() + Angles.trnsx(ang, len), tile.drawy() + Angles.trnsy(ang, len), - entity.target.x, entity.target.y, entity.strength); + x1, y1, entity.lastx, entity.lasty, entity.strength); + + Draw.color("accent"); + for(int i = 0; i < dstTo/space - 1; i ++){ + float fract = (i * space) / dstTo + (Timers.time()/4f) % (1f/(dstTo/space)); + Draw.alpha(fract); + Draw.rect("transfer-arrow", x1 + fract*xf, y1 + fract*yf, + 8, 8*entity.strength, ang); + } + + Draw.color(); + } } @@ -76,6 +93,8 @@ public class ResupplyPoint extends Block{ if(entity.target != null && entity.power.amount >= powerUse){ entity.power.amount -= powerUse; + entity.lastx = entity.x; + entity.lasty = entity.y; entity.strength = Mathf.lerpDelta(entity.strength, 1f, 0.07f * Timers.delta()); }else{ entity.strength = Mathf.lerpDelta(entity.strength, 0f, 0.05f * Timers.delta()); @@ -113,6 +132,6 @@ public class ResupplyPoint extends Block{ public class ResupplyPointEntity extends TileEntity{ public Unit target; - public float strength, rotation = 90; + public float strength, rotation = 90, lastx, lasty; } } diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index dcf30dc421..be280bec02 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,5 @@ -#Sat Apr 28 09:57:33 EDT 2018 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-4.5-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-4.5-bin.zip