Implemented homing silicon bullets

This commit is contained in:
Anuken
2018-06-24 21:17:48 -04:00
parent 6e5aec080a
commit 6ec28be541
4 changed files with 21 additions and 4 deletions

View File

@@ -42,9 +42,10 @@ public class AmmoTypes implements ContentList {
smokeEffect = ShootFx.shootSmallSmoke; smokeEffect = ShootFx.shootSmallSmoke;
}}; }};
bulletSilicon = new AmmoType(Items.silicon, StandardBullets.homing, 4) {{ bulletSilicon = new AmmoType(Items.silicon, StandardBullets.homing, 5) {{
shootEffect = ShootFx.shootSmall; shootEffect = ShootFx.shootSmall;
smokeEffect = ShootFx.shootSmallSmoke; smokeEffect = ShootFx.shootSmallSmoke;
reloadMultiplier = 1.4f;
}}; }};
bulletThermite = new AmmoType(Items.thermite, StandardBullets.tracer, 3) {{ bulletThermite = new AmmoType(Items.thermite, StandardBullets.tracer, 3) {{

View File

@@ -18,10 +18,11 @@ public class TurretBlocks extends BlockList implements ContentList {
@Override @Override
public void load() { public void load() {
duo = new DoubleTurret("duo") {{ duo = new DoubleTurret("duo") {{
ammoTypes = new AmmoType[]{AmmoTypes.bulletTungsten, AmmoTypes.bulletLead, AmmoTypes.bulletCarbide, AmmoTypes.bulletThermite}; ammoTypes = new AmmoType[]{AmmoTypes.bulletTungsten, AmmoTypes.bulletLead, AmmoTypes.bulletCarbide, AmmoTypes.bulletThermite, AmmoTypes.bulletSilicon};
reload = 25f; reload = 25f;
restitution = 0.03f; restitution = 0.03f;
range = 80f; range = 80f;
shootCone = 15f;
ammoUseEffect = ShootFx.shellEjectSmall; ammoUseEffect = ShootFx.shellEjectSmall;
}}; }};
/* /*

View File

@@ -1,8 +1,13 @@
package io.anuke.mindustry.content.bullets; package io.anuke.mindustry.content.bullets;
import io.anuke.mindustry.entities.Unit;
import io.anuke.mindustry.entities.Units;
import io.anuke.mindustry.entities.bullet.BasicBulletType; import io.anuke.mindustry.entities.bullet.BasicBulletType;
import io.anuke.mindustry.entities.bullet.Bullet;
import io.anuke.mindustry.entities.bullet.BulletType; import io.anuke.mindustry.entities.bullet.BulletType;
import io.anuke.mindustry.type.ContentList; import io.anuke.mindustry.type.ContentList;
import io.anuke.ucore.core.Timers;
import io.anuke.ucore.util.Angles;
public class StandardBullets extends BulletList implements ContentList { public class StandardBullets extends BulletList implements ContentList {
public static BulletType tungsten, lead, carbide, thorium, homing, tracer; public static BulletType tungsten, lead, carbide, thorium, homing, tracer;
@@ -32,7 +37,7 @@ public class StandardBullets extends BulletList implements ContentList {
} }
}; };
thorium = new BasicBulletType(4f, 25, "bullet") { thorium = new BasicBulletType(4f, 29, "bullet") {
{ {
bulletWidth = 10f; bulletWidth = 10f;
bulletHeight = 13f; bulletHeight = 13f;
@@ -40,11 +45,20 @@ public class StandardBullets extends BulletList implements ContentList {
} }
}; };
homing = new BasicBulletType(3f, 5, "bullet") { homing = new BasicBulletType(3f, 9, "bullet") {
float homingPower = 5f;
{ {
bulletWidth = 7f; bulletWidth = 7f;
bulletHeight = 9f; bulletHeight = 9f;
} }
@Override
public void update(Bullet b) {
Unit target = Units.getClosestEnemy(b.getTeam(), b.x, b.y, 40f, unit -> true);
if(target != null){
b.getVelocity().setAngle(Angles.moveToward(b.getVelocity().angle(), b.angleTo(target), homingPower * Timers.delta()));
}
}
}; };
tracer = new BasicBulletType(3f, 5, "bullet") { tracer = new BasicBulletType(3f, 5, "bullet") {

View File

@@ -418,6 +418,7 @@ public class Player extends Unit implements BuilderTrait, CarryTrait {
if(isDead()){ if(isDead()){
isBoosting = false; isBoosting = false;
boostHeat = 0f;
CoreEntity entity = (CoreEntity)getClosestCore(); CoreEntity entity = (CoreEntity)getClosestCore();
if (!respawning && entity != null) { if (!respawning && entity != null) {