Plastanium laser blocking
This commit is contained in:
@@ -795,6 +795,7 @@ public class Blocks implements ContentList{
|
||||
requirements(Category.defense, ItemStack.with(Items.plastanium, 5, Items.metaglass, 2));
|
||||
health = 190 * wallHealthMultiplier;
|
||||
insulated = true;
|
||||
absorbLasers = true;
|
||||
}};
|
||||
|
||||
plastaniumWallLarge = new Wall("plastanium-wall-large"){{
|
||||
@@ -802,6 +803,7 @@ public class Blocks implements ContentList{
|
||||
health = 190 * wallHealthMultiplier * 4;
|
||||
size = 2;
|
||||
insulated = true;
|
||||
absorbLasers = true;
|
||||
}};
|
||||
|
||||
thoriumWall = new Wall("thorium-wall"){{
|
||||
@@ -1484,7 +1486,7 @@ public class Blocks implements ContentList{
|
||||
powerUse = 2.5f;
|
||||
shootShake = 2f;
|
||||
shootEffect = Fx.lancerLaserShoot;
|
||||
smokeEffect = Fx.lancerLaserShootSmoke;
|
||||
smokeEffect = Fx.none;
|
||||
chargeEffect = Fx.lancerLaserCharge;
|
||||
chargeBeginEffect = Fx.lancerLaserChargeBegin;
|
||||
heatColor = Color.red;
|
||||
|
||||
@@ -884,8 +884,9 @@ public class Fx{
|
||||
|
||||
lancerLaserShootSmoke = new Effect(26f, e -> {
|
||||
color(Color.white);
|
||||
float length = e.data == null ? 70f : (Float)e.data;
|
||||
|
||||
randLenVectors(e.id, 7, 70f, e.rotation, 0f, (x, y) -> {
|
||||
randLenVectors(e.id, 7, length, e.rotation, 0f, (x, y) -> {
|
||||
lineAngle(e.x + x, e.y + y, Mathf.angle(x, y), e.fout() * 9f);
|
||||
});
|
||||
|
||||
|
||||
@@ -8,9 +8,15 @@ import mindustry.content.*;
|
||||
import mindustry.entities.*;
|
||||
import mindustry.gen.*;
|
||||
import mindustry.graphics.*;
|
||||
import mindustry.world.*;
|
||||
|
||||
import static mindustry.Vars.world;
|
||||
|
||||
public class LaserBulletType extends BulletType{
|
||||
protected static Tile furthest;
|
||||
|
||||
protected Color[] colors = {Pal.lancerLaser.cpy().mul(1f, 1f, 1f, 0.4f), Pal.lancerLaser, Color.white};
|
||||
protected Effect laserEffect = Fx.lancerLaserShootSmoke;
|
||||
protected float length = 160f;
|
||||
protected float width = 15f;
|
||||
protected float lengthFalloff = 0.5f;
|
||||
@@ -24,7 +30,7 @@ public class LaserBulletType extends BulletType{
|
||||
hitEffect = Fx.hitLancer;
|
||||
despawnEffect = Fx.none;
|
||||
shootEffect = Fx.hitLancer;
|
||||
smokeEffect = Fx.lancerLaserShootSmoke;
|
||||
smokeEffect = Fx.none;
|
||||
hitSize = 4;
|
||||
lifetime = 16f;
|
||||
pierce = true;
|
||||
@@ -42,13 +48,27 @@ public class LaserBulletType extends BulletType{
|
||||
|
||||
@Override
|
||||
public void init(Bulletc b){
|
||||
Damage.collideLine(b, b.team(), hitEffect, b.x(), b.y(), b.rotation(), length);
|
||||
Tmp.v1.trns(b.rotation(), length);
|
||||
|
||||
furthest = null;
|
||||
|
||||
world.raycast(b.tileX(), b.tileY(), world.toTile(b.x() + Tmp.v1.x), world.toTile(b.y() + Tmp.v1.y),
|
||||
(x, y) -> (furthest = world.tile(x, y)) != null && furthest.block().absorbLasers);
|
||||
|
||||
float resultLength = furthest != null ? Math.max(6f, b.dst(furthest.worldx(), furthest.worldy())) : length;
|
||||
|
||||
Damage.collideLine(b, b.team(), hitEffect, b.x(), b.y(), b.rotation(), resultLength);
|
||||
if(furthest != null) b.data(resultLength);
|
||||
|
||||
laserEffect.at(b.x(), b.y(), b.rotation(), resultLength * 0.75f);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw(Bulletc b){
|
||||
float realLength = b.data() == null ? length : (Float)b.data();
|
||||
|
||||
float f = Mathf.curve(b.fin(), 0f, 0.2f);
|
||||
float baseLen = length * f;
|
||||
float baseLen = realLength * f;
|
||||
float cwidth = width;
|
||||
float compound = 1f;
|
||||
|
||||
|
||||
@@ -86,6 +86,8 @@ public class Block extends UnlockableContent{
|
||||
public boolean insulated = false;
|
||||
/** whether the sprite is a full square. */
|
||||
public boolean squareSprite = true;
|
||||
/** whether this block absorbs laser attacks. */
|
||||
public boolean absorbLasers = false;
|
||||
/** tile entity health */
|
||||
public int health = -1;
|
||||
/** base block explosiveness */
|
||||
|
||||
Reference in New Issue
Block a user