Experimenting with abilities
This commit is contained in:
@@ -3295,7 +3295,7 @@ public class Blocks{
|
||||
tankAssembler = new UnitAssembler("tank-assembler"){{
|
||||
requirements(Category.units, with(Items.graphite, 10));
|
||||
size = 5;
|
||||
plans.add(new AssemblerUnitPlan(UnitTypes.vanquish, 60f * 10f, BlockStack.list(Blocks.thoriumWallLarge, 4, Blocks.duct, 2)));
|
||||
plans.add(new AssemblerUnitPlan(UnitTypes.vanquish, 60f * 10f, BlockStack.list(Blocks.tungstenWallLarge, 5, Blocks.duct, 2)));
|
||||
consumes.power(2f);
|
||||
areaSize = 13;
|
||||
|
||||
@@ -3307,7 +3307,7 @@ public class Blocks{
|
||||
shipAssembler = new UnitAssembler("ship-assembler"){{
|
||||
requirements(Category.units, with(Items.graphite, 10));
|
||||
size = 5;
|
||||
plans.add(new AssemblerUnitPlan(UnitTypes.quell, 60f * 4f, BlockStack.list(Blocks.thoriumWallLarge, 4, Blocks.duct, 2)));
|
||||
plans.add(new AssemblerUnitPlan(UnitTypes.quell, 60f * 4f, BlockStack.list(Blocks.tungstenWallLarge, 5, Blocks.plasmaBore, 2)));
|
||||
consumes.power(2f);
|
||||
areaSize = 13;
|
||||
|
||||
@@ -3316,7 +3316,18 @@ public class Blocks{
|
||||
|
||||
}};
|
||||
|
||||
//TODO mech assembler
|
||||
//TODO requirements
|
||||
mechAssembler = new UnitAssembler("mech-assembler"){{
|
||||
requirements(Category.units, with(Items.graphite, 10));
|
||||
size = 5;
|
||||
plans.add(new AssemblerUnitPlan(UnitTypes.bulwark, 60f * 4f, BlockStack.list(Blocks.tungstenWallLarge, 5, Blocks.duct, 2)));
|
||||
consumes.power(2f);
|
||||
areaSize = 13;
|
||||
|
||||
//TODO unit production is rarely continuous, can be double
|
||||
consumes.liquid(Liquids.gallium, 1f / 60f);
|
||||
|
||||
}};
|
||||
|
||||
basicAssemblerModule = new UnitAssemblerModule("basic-assembler-module"){{
|
||||
requirements(Category.units, with(Items.graphite, 10));
|
||||
|
||||
@@ -2455,7 +2455,7 @@ public class UnitTypes{
|
||||
sprite = "missile-large";
|
||||
width = 9.5f;
|
||||
height = 15f;
|
||||
lifetime = 32f;
|
||||
lifetime = 30f;
|
||||
hitSize = 6f;
|
||||
shootEffect = Fx.shootTitan;
|
||||
smokeEffect = Fx.shootSmokeTitan;
|
||||
@@ -2509,7 +2509,8 @@ public class UnitTypes{
|
||||
outlineColor = Pal.darkOutline;
|
||||
envDisabled = Env.space;
|
||||
|
||||
//TODO shield ability
|
||||
//TODO shield ability looks bad
|
||||
//abilities.add(new ArmorPlateAbility());
|
||||
|
||||
rotateSpeed = 2.7f;
|
||||
|
||||
@@ -2549,7 +2550,7 @@ public class UnitTypes{
|
||||
velocityRnd = 0.33f;
|
||||
heatColor = Color.red;
|
||||
|
||||
bullet = new MissileBulletType(4.2f, 30){{
|
||||
bullet = new MissileBulletType(4.2f, 34){{
|
||||
homingPower = 0.2f;
|
||||
weaveMag = 4;
|
||||
weaveScale = 4;
|
||||
@@ -2557,7 +2558,7 @@ public class UnitTypes{
|
||||
//TODO better
|
||||
shootEffect = Fx.shootBig2;
|
||||
smokeEffect = Fx.shootSmokeTitan;
|
||||
splashDamage = 50f;
|
||||
splashDamage = 40f;
|
||||
splashDamageRadius = 30f;
|
||||
frontColor = Color.white;
|
||||
hitSound = Sounds.none;
|
||||
|
||||
49
core/src/mindustry/entities/abilities/ArmorPlateAbility.java
Normal file
49
core/src/mindustry/entities/abilities/ArmorPlateAbility.java
Normal file
@@ -0,0 +1,49 @@
|
||||
package mindustry.entities.abilities;
|
||||
|
||||
import arc.*;
|
||||
import arc.graphics.*;
|
||||
import arc.graphics.g2d.*;
|
||||
import arc.math.*;
|
||||
import arc.util.*;
|
||||
import mindustry.gen.*;
|
||||
import mindustry.graphics.*;
|
||||
|
||||
public class ArmorPlateAbility extends Ability{
|
||||
public TextureRegion plateRegion;
|
||||
public Color color = Color.valueOf("d1efff");
|
||||
|
||||
public float healthMultiplier = 0.2f;
|
||||
public float z = Layer.effect;
|
||||
|
||||
protected float warmup;
|
||||
|
||||
@Override
|
||||
public void update(Unit unit){
|
||||
super.update(unit);
|
||||
|
||||
warmup = Mathf.lerpDelta(warmup, unit.isShooting() ? 1f : 0f, 0.1f);
|
||||
unit.healthMultiplier += warmup * healthMultiplier;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw(Unit unit){
|
||||
if(warmup > 0.001f){
|
||||
if(plateRegion == null){
|
||||
plateRegion = Core.atlas.find(unit.type.name + "-armor", unit.type.region);
|
||||
}
|
||||
|
||||
Draw.draw(z <= 0 ? Draw.z() : z, () -> {
|
||||
Shaders.armor.region = plateRegion;
|
||||
Shaders.armor.progress = warmup;
|
||||
Shaders.armor.time = -Time.time / 20f;
|
||||
|
||||
Draw.color(color);
|
||||
Draw.shader(Shaders.armor);
|
||||
Draw.rect(Shaders.armor.region, unit.x, unit.y, unit.rotation - 90f);
|
||||
Draw.shader();
|
||||
|
||||
Draw.reset();
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -19,6 +19,7 @@ public class Shaders{
|
||||
public static @Nullable ShieldShader shield;
|
||||
public static BuildBeamShader buildBeam;
|
||||
public static UnitBuildShader build;
|
||||
public static UnitArmorShader armor;
|
||||
public static DarknessShader darkness;
|
||||
public static LightShader light;
|
||||
public static SurfaceShader water, mud, tar, slag, cryofluid, space, caustics, arkycite;
|
||||
@@ -42,6 +43,7 @@ public class Shaders{
|
||||
}
|
||||
buildBeam = new BuildBeamShader();
|
||||
build = new UnitBuildShader();
|
||||
armor = new UnitArmorShader();
|
||||
darkness = new DarknessShader();
|
||||
light = new LightShader();
|
||||
water = new SurfaceShader("water");
|
||||
@@ -200,6 +202,24 @@ public class Shaders{
|
||||
}
|
||||
}
|
||||
|
||||
public static class UnitArmorShader extends LoadShader{
|
||||
public float progress, time;
|
||||
public TextureRegion region;
|
||||
|
||||
public UnitArmorShader(){
|
||||
super("unitarmor", "default");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply(){
|
||||
setUniformf("u_time", time);
|
||||
setUniformf("u_progress", progress);
|
||||
setUniformf("u_uv", region.u, region.v);
|
||||
setUniformf("u_uv2", region.u2, region.v2);
|
||||
setUniformf("u_texsize", region.texture.width, region.texture.height);
|
||||
}
|
||||
}
|
||||
|
||||
public static class BlockBuildShader extends LoadShader{
|
||||
public float progress;
|
||||
public TextureRegion region = new TextureRegion();
|
||||
|
||||
Reference in New Issue
Block a user