Weapon system refactoring
This commit is contained in:
@@ -1592,6 +1592,7 @@ public class Blocks implements ContentList{
|
||||
inaccuracy = 10f;
|
||||
shootCone = 30f;
|
||||
shootSound = Sounds.shootSnap;
|
||||
targetGround = false;
|
||||
|
||||
health = 145 * size * size;
|
||||
}};
|
||||
@@ -1660,7 +1661,8 @@ public class Blocks implements ContentList{
|
||||
|
||||
hasPower = true;
|
||||
size = 2;
|
||||
force = 3f;
|
||||
force = 2.5f;
|
||||
scaledForce = 5f;
|
||||
range = 170f;
|
||||
damage = 0.08f;
|
||||
health = 160 * size * size;
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package mindustry.content;
|
||||
|
||||
import arc.graphics.*;
|
||||
import arc.math.*;
|
||||
import arc.struct.*;
|
||||
import mindustry.ai.types.*;
|
||||
import mindustry.annotations.Annotations.*;
|
||||
@@ -70,7 +69,7 @@ public class UnitTypes implements ContentList{
|
||||
weapons.add(new Weapon("large-weapon"){{
|
||||
reload = 14f;
|
||||
x = 4f;
|
||||
alternate = true;
|
||||
y = 2f;
|
||||
ejectEffect = Fx.shellEjectSmall;
|
||||
bullet = Bullets.standardCopper;
|
||||
}});
|
||||
@@ -88,7 +87,6 @@ public class UnitTypes implements ContentList{
|
||||
shootSound = Sounds.flame;
|
||||
shootY = 2f;
|
||||
reload = 14f;
|
||||
alternate = true;
|
||||
recoil = 1f;
|
||||
ejectEffect = Fx.none;
|
||||
bullet = Bullets.basicFlame;
|
||||
@@ -107,8 +105,7 @@ public class UnitTypes implements ContentList{
|
||||
weapons.add(new Weapon("heal-weapon"){{
|
||||
shootY = 1.5f;
|
||||
reload = 24f;
|
||||
x = 1f;
|
||||
shootX = 3.5f;
|
||||
x = 3.5f;
|
||||
alternate = false;
|
||||
ejectEffect = Fx.none;
|
||||
recoil = 2f;
|
||||
@@ -160,10 +157,8 @@ public class UnitTypes implements ContentList{
|
||||
weapons.add(new Weapon("beam-weapon"){{
|
||||
shake = 2f;
|
||||
shootY = 4f;
|
||||
shootX = 6f;
|
||||
x = 0.25f;
|
||||
x = 6.5f;
|
||||
reload = 50f;
|
||||
alternate = true;
|
||||
recoil = 4f;
|
||||
shootSound = Sounds.laser;
|
||||
|
||||
@@ -188,7 +183,6 @@ public class UnitTypes implements ContentList{
|
||||
y = 1f;
|
||||
x = 9f;
|
||||
reload = 60f;
|
||||
alternate = true;
|
||||
recoil = 4f;
|
||||
shake = 2f;
|
||||
ejectEffect = Fx.shellEjectMedium;
|
||||
@@ -251,7 +245,6 @@ public class UnitTypes implements ContentList{
|
||||
weapons.add(new Weapon("eruption"){{
|
||||
shootY = 3f;
|
||||
reload = 10f;
|
||||
alternate = true;
|
||||
ejectEffect = Fx.none;
|
||||
recoil = 1f;
|
||||
x = 7f;
|
||||
@@ -288,18 +281,14 @@ public class UnitTypes implements ContentList{
|
||||
legSplashDamage = 32;
|
||||
legSplashRange = 30;
|
||||
|
||||
for(boolean b : Mathf.booleans){
|
||||
weapons.add(
|
||||
new Weapon("missiles-mount"){{
|
||||
reload = 20f;
|
||||
x = 4f * Mathf.sign(b);
|
||||
rotate = true;
|
||||
mirror = false;
|
||||
flipSprite = !b;
|
||||
shake = 1f;
|
||||
bullet = Bullets.missileSwarm;
|
||||
}});
|
||||
}
|
||||
weapons.add(
|
||||
new Weapon("missiles-mount"){{
|
||||
reload = 20f;
|
||||
x = 4f;
|
||||
rotate = true;
|
||||
shake = 1f;
|
||||
bullet = Bullets.missileSwarm;
|
||||
}});
|
||||
}};
|
||||
|
||||
wraith = new UnitType("wraith"){{
|
||||
@@ -315,7 +304,6 @@ public class UnitTypes implements ContentList{
|
||||
y = 0f;
|
||||
x = 2f;
|
||||
reload = 15f;
|
||||
alternate = true;
|
||||
ejectEffect = Fx.shellEjectSmall;
|
||||
bullet = Bullets.standardCopper;
|
||||
shootSound = Sounds.shoot;
|
||||
@@ -338,7 +326,6 @@ public class UnitTypes implements ContentList{
|
||||
shootY = 0f;
|
||||
reload = 12f;
|
||||
shootCone = 180f;
|
||||
alternate = true;
|
||||
ejectEffect = Fx.none;
|
||||
inaccuracy = 15f;
|
||||
ignoreRotation = true;
|
||||
@@ -360,36 +347,31 @@ public class UnitTypes implements ContentList{
|
||||
engineOffset = 12f;
|
||||
engineSize = 3f;
|
||||
|
||||
for(boolean b : Mathf.booleans){
|
||||
weapons.add(
|
||||
new Weapon("revenant-missiles"){{
|
||||
reload = 70f;
|
||||
x = 7f * Mathf.sign(b);
|
||||
rotate = true;
|
||||
mirror = false;
|
||||
flipSprite = !b;
|
||||
shake = 1f;
|
||||
weapons.add(new Weapon("revenant-missiles"){{
|
||||
reload = 70f;
|
||||
x = 7f;
|
||||
rotate = true;
|
||||
shake = 1f;
|
||||
|
||||
bullet = new MissileBulletType(2.7f, 12, "missile"){{
|
||||
width = 8f;
|
||||
height = 8f;
|
||||
shrinkY = 0f;
|
||||
drag = -0.003f;
|
||||
homingRange = 60f;
|
||||
keepVelocity = false;
|
||||
splashDamageRadius = 25f;
|
||||
splashDamage = 10f;
|
||||
lifetime = 60f;
|
||||
trailColor = Pal.unitBack;
|
||||
backColor = Pal.unitBack;
|
||||
frontColor = Pal.unitFront;
|
||||
hitEffect = Fx.blastExplosion;
|
||||
despawnEffect = Fx.blastExplosion;
|
||||
weaveScale = 6f;
|
||||
weaveMag = 1f;
|
||||
}};
|
||||
}});
|
||||
}
|
||||
bullet = new MissileBulletType(2.7f, 12, "missile"){{
|
||||
width = 8f;
|
||||
height = 8f;
|
||||
shrinkY = 0f;
|
||||
drag = -0.003f;
|
||||
homingRange = 60f;
|
||||
keepVelocity = false;
|
||||
splashDamageRadius = 25f;
|
||||
splashDamage = 10f;
|
||||
lifetime = 60f;
|
||||
trailColor = Pal.unitBack;
|
||||
backColor = Pal.unitBack;
|
||||
frontColor = Pal.unitFront;
|
||||
hitEffect = Fx.blastExplosion;
|
||||
despawnEffect = Fx.blastExplosion;
|
||||
weaveScale = 6f;
|
||||
weaveMag = 1f;
|
||||
}};
|
||||
}});
|
||||
}};
|
||||
|
||||
reaper = new UnitType("reaper"){{
|
||||
@@ -407,7 +389,6 @@ public class UnitTypes implements ContentList{
|
||||
weapons.add(new Weapon(){{
|
||||
y = 1.5f;
|
||||
reload = 28f;
|
||||
alternate = true;
|
||||
ejectEffect = Fx.shellEjectSmall;
|
||||
bullet = Bullets.standardCopper;
|
||||
shootSound = Sounds.shoot;
|
||||
@@ -429,7 +410,6 @@ public class UnitTypes implements ContentList{
|
||||
weapons.add(new Weapon(){{
|
||||
y = 1.5f;
|
||||
reload = 28f;
|
||||
alternate = true;
|
||||
ejectEffect = Fx.shellEjectSmall;
|
||||
bullet = Bullets.standardCopper;
|
||||
shootSound = Sounds.shoot;
|
||||
@@ -445,7 +425,6 @@ public class UnitTypes implements ContentList{
|
||||
weapons.add(new Weapon("mount-weapon"){{
|
||||
reload = 10f;
|
||||
x = 1.25f;
|
||||
alternate = true;
|
||||
rotate = true;
|
||||
ejectEffect = Fx.shellEjectSmall;
|
||||
bullet = Bullets.standardCopper;
|
||||
@@ -478,7 +457,6 @@ public class UnitTypes implements ContentList{
|
||||
y = 1.5f;
|
||||
reload = 40f;
|
||||
x = 0.5f;
|
||||
alternate = true;
|
||||
ejectEffect = Fx.none;
|
||||
recoil = 2f;
|
||||
bullet = Bullets.healBulletBig;
|
||||
@@ -506,10 +484,8 @@ public class UnitTypes implements ContentList{
|
||||
|
||||
weapons.add(new Weapon("small-basic-weapon"){{
|
||||
reload = 15f;
|
||||
x = -1f;
|
||||
y = -1f;
|
||||
shootX = 3.5f;
|
||||
alternate = true;
|
||||
x = 2.75f;
|
||||
y = 1f;
|
||||
|
||||
bullet = new BasicBulletType(2.5f, 9){{
|
||||
width = 7f;
|
||||
@@ -551,28 +527,21 @@ public class UnitTypes implements ContentList{
|
||||
hitsize = 14f;
|
||||
engineSize = 3f;
|
||||
|
||||
for(boolean b : Mathf.booleans){
|
||||
weapons.add(
|
||||
new Weapon("heal-weapon-mount"){{
|
||||
reload = 25f;
|
||||
x = 8f * Mathf.sign(b);
|
||||
y = -6f;
|
||||
rotate = true;
|
||||
mirror = false;
|
||||
flipSprite = !b;
|
||||
bullet = Bullets.healBulletBig;
|
||||
}},
|
||||
new Weapon("heal-weapon-mount"){{
|
||||
reload = 15f;
|
||||
x = 4f * Mathf.sign(b);
|
||||
y = 5f;
|
||||
rotate = true;
|
||||
mirror = false;
|
||||
flipSprite = !b;
|
||||
bullet = Bullets.healBullet;
|
||||
}}
|
||||
);
|
||||
}
|
||||
weapons.add(
|
||||
new Weapon("heal-weapon-mount"){{
|
||||
reload = 25f;
|
||||
x = 8f;
|
||||
y = -6f;
|
||||
rotate = true;
|
||||
bullet = Bullets.healBulletBig;
|
||||
}},
|
||||
new Weapon("heal-weapon-mount"){{
|
||||
reload = 15f;
|
||||
x = 4f;
|
||||
y = 5f;
|
||||
rotate = true;
|
||||
bullet = Bullets.healBullet;
|
||||
}});
|
||||
}};
|
||||
|
||||
/*
|
||||
|
||||
@@ -84,11 +84,17 @@ abstract class WeaponsComp implements Teamc, Posc, Rotc{
|
||||
Weapon weapon = mount.weapon;
|
||||
mount.reload = Math.max(mount.reload - Time.delta(), 0);
|
||||
|
||||
if(weapon.otherSide != -1 && weapon.alternate && mount.side == weapon.flipSprite &&
|
||||
mount.reload + Time.delta() > weapon.reload/2f && mount.reload <= weapon.reload/2f){
|
||||
mounts[weapon.otherSide].side = !mounts[weapon.otherSide].side;
|
||||
mount.side = !mount.side;
|
||||
}
|
||||
|
||||
//rotate if applicable
|
||||
if(weapon.rotate && (mount.rotate || mount.shoot)){
|
||||
float axisXOffset = weapon.mirror ? 0f : weapon.x;
|
||||
float axisXOffset = weapon.x;
|
||||
float axisX = this.x + Angles.trnsx(rotation, axisXOffset, weapon.y),
|
||||
axisY = this.y + Angles.trnsy(rotation, axisXOffset, weapon.y);
|
||||
axisY = this.y + Angles.trnsy(rotation, axisXOffset, weapon.y);
|
||||
|
||||
mount.targetRotation = Angles.angle(axisX, axisY, mount.aimX, mount.aimY) - rotation();
|
||||
mount.rotation = Angles.moveToward(mount.rotation, mount.targetRotation, weapon.rotateSpeed * Time.delta());
|
||||
@@ -97,31 +103,31 @@ abstract class WeaponsComp implements Teamc, Posc, Rotc{
|
||||
mount.targetRotation = angleTo(mount.aimX, mount.aimY);
|
||||
}
|
||||
|
||||
if(mount.shoot && (ammo > 0 || !state.rules.unitAmmo || team().rules().infiniteAmmo)){
|
||||
//shoot if applicable
|
||||
if(mount.shoot && //must be shooting
|
||||
(ammo > 0 || !state.rules.unitAmmo || team().rules().infiniteAmmo) && //check ammo
|
||||
(!weapon.alternate || mount.side == weapon.flipSprite) &&
|
||||
mount.reload <= 0.0001f && //reload has to be 0
|
||||
Angles.within(weapon.rotate ? mount.rotation : this.rotation, mount.targetRotation, mount.weapon.shootCone) //has to be within the cone
|
||||
){
|
||||
|
||||
float rotation = this.rotation - 90;
|
||||
float weaponRotation = rotation + (weapon.rotate ? mount.rotation : 0);
|
||||
|
||||
//shoot if applicable
|
||||
if(mount.reload <= 0.0001f && Angles.within(weapon.rotate ? mount.rotation : this.rotation, mount.targetRotation, mount.weapon.shootCone)){
|
||||
for(int i : (weapon.mirror && !weapon.alternate ? Mathf.signs : Mathf.one)){
|
||||
i *= Mathf.sign(weapon.flipped) * (mount.weapon.mirror ? Mathf.sign(mount.side) : 1);
|
||||
//m a t h
|
||||
|
||||
//m a t h
|
||||
float weaponRotation = rotation + (weapon.rotate ? mount.rotation : 0);
|
||||
float mountX = this.x + Angles.trnsx(rotation, weapon.x * i, weapon.y),
|
||||
mountY = this.y + Angles.trnsy(rotation, weapon.x * i, weapon.y);
|
||||
float shootX = mountX + Angles.trnsx(weaponRotation, weapon.shootX * i, weapon.shootY),
|
||||
shootY = mountY + Angles.trnsy(weaponRotation, weapon.shootX * i, weapon.shootY);
|
||||
float shootAngle = weapon.rotate ? weaponRotation + 90 : Angles.angle(shootX, shootY, mount.aimX, mount.aimY) + (this.rotation - angleTo(mount.aimX, mount.aimY));
|
||||
float mountX = this.x + Angles.trnsx(rotation, weapon.x, weapon.y),
|
||||
mountY = this.y + Angles.trnsy(rotation, weapon.x, weapon.y);
|
||||
float shootX = mountX + Angles.trnsx(weaponRotation, weapon.shootX, weapon.shootY),
|
||||
shootY = mountY + Angles.trnsy(weaponRotation, weapon.shootX, weapon.shootY);
|
||||
float shootAngle = weapon.rotate ? weaponRotation + 90 : Angles.angle(shootX, shootY, mount.aimX, mount.aimY) + (this.rotation - angleTo(mount.aimX, mount.aimY));
|
||||
|
||||
shoot(weapon, shootX, shootY, mount.aimX, mount.aimY, shootAngle, -i);
|
||||
}
|
||||
shoot(weapon, shootX, shootY, mount.aimX, mount.aimY, shootAngle, Mathf.sign(weapon.x));
|
||||
|
||||
if(mount.weapon.mirror) mount.side = !mount.side;
|
||||
mount.reload = weapon.reload;
|
||||
mount.reload = weapon.reload;
|
||||
|
||||
ammo --;
|
||||
if(ammo < 0) ammo = 0;
|
||||
}
|
||||
ammo--;
|
||||
if(ammo < 0) ammo = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -145,24 +151,18 @@ abstract class WeaponsComp implements Teamc, Posc, Rotc{
|
||||
Angles.shotgun(weapon.shots, weapon.spacing, rotation, f -> bullet(weapon, x, y, f + Mathf.range(weapon.inaccuracy), lifeScl));
|
||||
}
|
||||
|
||||
Tmp.v1.trns(rotation + 180f, ammo.recoil);
|
||||
|
||||
if(this instanceof Velc){
|
||||
//TODO apply force?
|
||||
((Velc)this).vel().add(Tmp.v1);
|
||||
((Velc)this).vel().add(Tmp.v1.trns(rotation + 180f, ammo.recoil));
|
||||
}
|
||||
|
||||
Tmp.v1.trns(rotation, 3f);
|
||||
boolean parentize = ammo.keepVelocity;
|
||||
|
||||
Effects.shake(weapon.shake, weapon.shake, x, y);
|
||||
weapon.ejectEffect.at(x, y, rotation * side);
|
||||
ammo.shootEffect.at(x + Tmp.v1.x, y + Tmp.v1.y, rotation, parentize ? this : null);
|
||||
ammo.smokeEffect.at(x + Tmp.v1.x, y + Tmp.v1.y, rotation, parentize ? this : null);
|
||||
ammo.shootEffect.at(x, y, rotation, parentize ? this : null);
|
||||
ammo.smokeEffect.at(x, y, rotation, parentize ? this : null);
|
||||
}
|
||||
|
||||
private void bullet(Weapon weapon, float x, float y, float angle, float lifescl){
|
||||
Tmp.v1.trns(angle, 3f);
|
||||
weapon.bullet.create(this, team(), x + Tmp.v1.x, y + Tmp.v1.y, angle, (1f - weapon.velocityRnd) + Mathf.random(weapon.velocityRnd), lifescl);
|
||||
weapon.bullet.create(this, team(), x, y, angle, (1f - weapon.velocityRnd) + Mathf.random(weapon.velocityRnd), lifescl);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,12 +13,12 @@ public class WeaponMount{
|
||||
public float targetRotation;
|
||||
/** aiming position in world coordinates */
|
||||
public float aimX, aimY;
|
||||
/** side that's being shot - only valid for mirrors */
|
||||
public boolean side;
|
||||
/** whether to shoot right now */
|
||||
public boolean shoot = false;
|
||||
/** whether to rotate to face the target right now */
|
||||
public boolean rotate = false;
|
||||
/** extra state for alternating weapons */
|
||||
public boolean side;
|
||||
|
||||
public WeaponMount(Weapon weapon){
|
||||
this.weapon = weapon;
|
||||
|
||||
@@ -137,6 +137,29 @@ public class UnitType extends UnlockableContent{
|
||||
range = Math.max(range, weapon.bullet.range());
|
||||
}
|
||||
}
|
||||
|
||||
//add mirrored weapon variants
|
||||
Seq<Weapon> mapped = new Seq<>();
|
||||
for(Weapon w : weapons){
|
||||
mapped.add(w);
|
||||
|
||||
//mirrors are copies with X values negated
|
||||
if(w.mirror){
|
||||
Weapon copy = w.copy();
|
||||
copy.x *= -1;
|
||||
copy.shootX *= -1;
|
||||
copy.flipSprite = !copy.flipSprite;
|
||||
mapped.add(copy);
|
||||
|
||||
//since there are now two weapons, the reload time must be doubled
|
||||
w.reload *= 2f;
|
||||
copy.reload *= 2f;
|
||||
|
||||
w.otherSide = mapped.size - 1;
|
||||
copy.otherSide = mapped.size - 2;
|
||||
}
|
||||
}
|
||||
this.weapons = mapped;
|
||||
}
|
||||
|
||||
@CallSuper
|
||||
@@ -324,23 +347,17 @@ public class UnitType extends UnlockableContent{
|
||||
for(WeaponMount mount : unit.mounts){
|
||||
Weapon weapon = mount.weapon;
|
||||
|
||||
for(int i : (weapon.mirror ? Mathf.signs : Mathf.one)){
|
||||
i *= Mathf.sign(weapon.flipped);
|
||||
float rotation = unit.rotation - 90;
|
||||
float weaponRotation = rotation + (weapon.rotate ? mount.rotation : 0);
|
||||
float width = weapon.region.getWidth();
|
||||
float recoil = -((mount.reload) / weapon.reload * weapon.recoil);
|
||||
|
||||
float rotation = unit.rotation - 90;
|
||||
float weaponRotation = rotation + (weapon.rotate ? mount.rotation : 0);
|
||||
float width = i > 0 ? -weapon.region.getWidth() : weapon.region.getWidth();
|
||||
float recoil = -(mount.reload / weapon.reload * weapon.recoil) * (weapon.alternate ? Mathf.num(i == Mathf.sign(mount.side)) : 1);
|
||||
|
||||
if(weapon.mirror) rotation = weaponRotation;
|
||||
|
||||
Draw.rect(weapon.region,
|
||||
unit.x + Angles.trnsx(rotation, weapon.x * i, weapon.y) + Angles.trnsx(weaponRotation, 0, recoil),
|
||||
unit.y + Angles.trnsy(rotation, weapon.x * i, weapon.y) + Angles.trnsy(weaponRotation, 0, recoil),
|
||||
width * Draw.scl * -Mathf.sign(weapon.flipSprite),
|
||||
weapon.region.getHeight() * Draw.scl,
|
||||
weaponRotation);
|
||||
}
|
||||
Draw.rect(weapon.region,
|
||||
unit.x + Angles.trnsx(rotation, weapon.x, weapon.y) + Angles.trnsx(weaponRotation, 0, recoil),
|
||||
unit.y + Angles.trnsy(rotation, weapon.x, weapon.y) + Angles.trnsy(weaponRotation, 0, recoil),
|
||||
width * Draw.scl * -Mathf.sign(weapon.flipSprite),
|
||||
weapon.region.getHeight() * Draw.scl,
|
||||
weaponRotation);
|
||||
}
|
||||
|
||||
Draw.reset();
|
||||
|
||||
@@ -8,6 +8,7 @@ import mindustry.content.*;
|
||||
import mindustry.entities.*;
|
||||
import mindustry.entities.bullet.*;
|
||||
import mindustry.gen.*;
|
||||
import mindustry.io.*;
|
||||
|
||||
public class Weapon{
|
||||
/** displayed weapon region */
|
||||
@@ -16,12 +17,12 @@ public class Weapon{
|
||||
public @NonNull BulletType bullet;
|
||||
/** shell ejection effect */
|
||||
public Effect ejectEffect = Fx.none;
|
||||
/** whether to mirror the weapon (draw two of them, which is the default) */
|
||||
/** whether to create a flipped copy of this weapon upon initialization. default: true */
|
||||
public boolean mirror = true;
|
||||
/** whether to flip the weapon's position/side on the ship (only valid when mirror is false) */
|
||||
public boolean flipped = false, flipSprite = false;
|
||||
/** whether to flip the weapon's sprite when rendering */
|
||||
public boolean flipSprite = false;
|
||||
/** whether to shoot the weapons in different arms one after another, rather than all at once; only valid when mirror = true */
|
||||
public boolean alternate = false;
|
||||
public boolean alternate = true;
|
||||
/** whether to rotate toward the target independently of unit */
|
||||
public boolean rotate = false;
|
||||
/** rotation speed of weapon when rotation is enabled, in degrees/t*/
|
||||
@@ -50,6 +51,8 @@ public class Weapon{
|
||||
public float shootCone = 5f;
|
||||
/** whether shooter rotation is ignored when shooting. */
|
||||
public boolean ignoreRotation = false;
|
||||
/** internal value used for alternation - do not change! */
|
||||
public int otherSide = -1;
|
||||
/** sound used for shooting */
|
||||
public Sound shootSound = Sounds.pew;
|
||||
/** displayed region (autoloaded) */
|
||||
@@ -63,6 +66,12 @@ public class Weapon{
|
||||
this("");
|
||||
}
|
||||
|
||||
public Weapon copy(){
|
||||
Weapon out = new Weapon();
|
||||
JsonIO.json().copyFields(this, out);
|
||||
return out;
|
||||
}
|
||||
|
||||
public void load(){
|
||||
region = Core.atlas.find(name, Core.atlas.find("clear"));
|
||||
}
|
||||
|
||||
@@ -28,6 +28,7 @@ public class TractorBeamTurret extends Block{
|
||||
public float shootCone = 6f;
|
||||
public float laserWidth = 0.6f;
|
||||
public float force = 0.3f;
|
||||
public float scaledForce = 0f;
|
||||
public float damage = 0f;
|
||||
public boolean targetAir = true, targetGround = false;
|
||||
|
||||
@@ -88,7 +89,7 @@ public class TractorBeamTurret extends Block{
|
||||
|
||||
//shoot when possible
|
||||
if(Angles.within(rotation, dest, shootCone)){
|
||||
target.impulse(Tmp.v1.set(this).sub(target).limit(force * efficiency() * timeScale));
|
||||
target.impulse(Tmp.v1.set(this).sub(target).limit((force + (1f - target.dst(this) / range) * scaledForce) * efficiency() * timeScale));
|
||||
}
|
||||
}else{
|
||||
target = null;
|
||||
|
||||
Reference in New Issue
Block a user