1
0
mirror of https://github.com/Anuken/Mindustry.git synced 2024-09-11 08:15:35 +03:00

WIP breach turret

This commit is contained in:
Anuken 2021-10-23 14:25:32 -04:00
parent 553333b656
commit 693e420074
10 changed files with 89 additions and 7 deletions

View File

@ -23,8 +23,8 @@ buildscript{
}
plugins{
id 'org.jetbrains.kotlin.jvm' version '1.5.31'
id "org.jetbrains.kotlin.kapt" version "1.5.31"
id 'org.jetbrains.kotlin.jvm' version '1.6.0-RC'
id "org.jetbrains.kotlin.kapt" version "1.6.0-RC"
}
allprojects{

Binary file not shown.

After

Width:  |  Height:  |  Size: 889 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 827 B

View File

@ -406,3 +406,4 @@
63302=dormant-cyst|item-dormant-cyst-ui
63301=neoplasm|liquid-neoplasm-ui
63300=scuttler|unit-scuttler-ui
63299=breach|block-breach-ui

Binary file not shown.

View File

@ -89,6 +89,9 @@ public class Blocks implements ContentList{
//turrets
duo, scatter, scorch, hail, arc, wave, lancer, swarmer, salvo, fuse, ripple, cyclone, foreshadow, spectre, meltdown, segment, parallax, tsunami,
//turrets - erekir
breach,
//units
commandCenter,
groundFactory, airFactory, navalFactory,
@ -2120,6 +2123,41 @@ public class Blocks implements ContentList{
consumes.add(new ConsumeCoolant(0.5f)).update(false);
}};
breach = new ItemTurret("breach"){{
requirements(Category.turret, with(Items.beryllium, 35), true);
ammo(
Items.beryllium, new BasicBulletType(7f, 20){{
width = 8f;
height = 14f;
shootEffect = Fx.berylSpark;
smokeEffect = Fx.shootBigSmoke;
ammoMultiplier = 2;
pierce = true;
pierceBuilding = true;
hitColor = backColor = trailColor = Pal.berylShot;
frontColor = Color.white;
trailWidth = 1.5f;
trailLength = 10;
//TODO different effect?
hitEffect = despawnEffect = Fx.hitBulletColor;
}}
);
shootLength = 0.5f;
outlineColor = Color.valueOf("2d2f39");
size = 2;
envEnabled |= Env.space;
basePrefix = "reinforced";
reloadTime = 40f;
restitution = 0.03f;
range = 180;
shootCone = 3f;
health = 300 * size * size;
rotateSpeed = 2f;
limitRange();
}};
//endregion
//region units

View File

@ -437,6 +437,24 @@ public class Fx{
Drawf.light(e.x, e.y, 20f, Pal.lightOrange, 0.6f * e.fout());
}),
hitBulletColor = new Effect(14, e -> {
color(Color.white, e.color, e.fin());
e.scaled(7f, s -> {
stroke(0.5f + s.fout());
Lines.circle(e.x, e.y, s.fin() * 5f);
});
stroke(0.5f + e.fout());
randLenVectors(e.id, 5, e.fin() * 15f, (x, y) -> {
float ang = Mathf.angle(x, y);
lineAngle(e.x + x, e.y + y, ang, e.fout() * 3 + 1f);
});
Drawf.light(e.x, e.y, 20f, e.color, 0.6f * e.fout());
}),
hitFuse = new Effect(14, e -> {
color(Color.white, Pal.surge, e.fin());
@ -981,7 +999,7 @@ public class Fx{
}),
muddy = new Effect(80f, e -> {
color(Color.valueOf("432722"));
color(Pal.muddy);
alpha(Mathf.clamp(e.fin() * 2f));
Fill.circle(e.x, e.y, e.fout());
@ -1300,6 +1318,15 @@ public class Fx{
});
}),
berylSpark = new Effect(21f, e -> {
color(Color.white, Pal.berylShot, e.fin());
stroke(e.fout() * 1.1f + 0.5f);
randLenVectors(e.id, 5, 27f * e.fin(), e.rotation, 9f, (x, y) -> {
lineAngle(e.x + x, e.y + y, Mathf.angle(x, y), e.fslope() * 5f + 0.5f);
});
}),
shootPayloadDriver = new Effect(30f, e -> {
color(Pal.accent);
Lines.stroke(0.5f + 0.5f*e.fout());
@ -1620,7 +1647,7 @@ public class Fx{
plasticburn = new Effect(40, e -> {
randLenVectors(e.id, 5, 3f + e.fin() * 5f, (x, y) -> {
color(Color.valueOf("e9ead3"), Color.gray, e.fin());
color(Pal.plasticBurn, Color.gray, e.fin());
Fill.circle(e.x + x, e.y + y, e.fout());
});
}),

View File

@ -112,5 +112,11 @@ public class Pal{
logicControl = Color.valueOf("6bb2b2"),
logicOperations = Color.valueOf("877bad"),
logicIo = Color.valueOf("a08a8a"),
logicUnits = Color.valueOf("c7b59d");
logicUnits = Color.valueOf("c7b59d"),
berylShot = Color.valueOf("b1dd7e"),
plasticBurn = Color.valueOf("e9ead3"),
muddy = Color.valueOf("432722");
}

View File

@ -81,6 +81,7 @@ public class Turret extends ReloadTurret{
protected Vec2 tr = new Vec2();
protected Vec2 tr2 = new Vec2();
public @Nullable String basePrefix;
public @Load(value = "@-base", fallback = "block-@size") TextureRegion baseRegion;
public @Load("@-heat") TextureRegion heatRegion;
public float elevation = -1f;
@ -130,6 +131,15 @@ public class Turret extends ReloadTurret{
super.init();
}
@Override
public void load(){
super.load();
if(basePrefix != null){
baseRegion = Core.atlas.find(basePrefix + "-block-" + size);
}
}
@Override
public TextureRegion[] icons(){
return new TextureRegion[]{baseRegion, region};

View File

@ -65,7 +65,7 @@ public class Duct extends Block implements Autotiler{
@Override
public boolean blends(Tile tile, int rotation, int otherx, int othery, int otherrot, Block otherblock){
return otherblock.outputsItems() && blendsArmored(tile, rotation, otherx, othery, otherrot, otherblock);
return (otherblock.outputsItems() && blendsArmored(tile, rotation, otherx, othery, otherrot, otherblock)) || (lookingAt(tile, rotation, otherx, othery, otherblock) && otherblock.hasItems);
}
@Override
@ -93,7 +93,7 @@ public class Duct extends Block implements Autotiler{
//draw extra ducts facing this one for tiling purposes
for(int i = 0; i < 4; i++){
if((blending & (1 << i)) != 0 && !(i == 0 && nextc != null)){
if((blending & (1 << i)) != 0){
int dir = r - i;
float rot = i == 0 ? rotation : (dir)*90;
drawAt(x + Geometry.d4x(dir) * tilesize*0.75f, y + Geometry.d4y(dir) * tilesize*0.75f, 0, rot, i != 0 ? SliceMode.bottom : SliceMode.top);