mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-02-13 12:16:53 +07:00
WIP shielded wall
This commit is contained in:
parent
2109a25e3e
commit
02f40d1e29
BIN
core/assets-raw/sprites/blocks/walls/shielded-wall-glow.png
Normal file
BIN
core/assets-raw/sprites/blocks/walls/shielded-wall-glow.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 788 B |
BIN
core/assets-raw/sprites/blocks/walls/shielded-wall.png
Normal file
BIN
core/assets-raw/sprites/blocks/walls/shielded-wall.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 893 B |
@ -565,3 +565,4 @@
|
|||||||
63119=ship-refabricator|block-ship-refabricator-ui
|
63119=ship-refabricator|block-ship-refabricator-ui
|
||||||
63118=slag-heater|block-slag-heater-ui
|
63118=slag-heater|block-slag-heater-ui
|
||||||
63117=afflict|block-afflict-ui
|
63117=afflict|block-afflict-ui
|
||||||
|
63116=shielded-wall|block-shielded-wall-ui
|
||||||
|
Binary file not shown.
@ -80,7 +80,11 @@ public class Blocks{
|
|||||||
//defense
|
//defense
|
||||||
copperWall, copperWallLarge, titaniumWall, titaniumWallLarge, plastaniumWall, plastaniumWallLarge, thoriumWall, thoriumWallLarge, door, doorLarge,
|
copperWall, copperWallLarge, titaniumWall, titaniumWallLarge, plastaniumWall, plastaniumWallLarge, thoriumWall, thoriumWallLarge, door, doorLarge,
|
||||||
phaseWall, phaseWallLarge, surgeWall, surgeWallLarge,
|
phaseWall, phaseWallLarge, surgeWall, surgeWallLarge,
|
||||||
|
|
||||||
|
//walls - erekir
|
||||||
berylliumWall, berylliumWallLarge, tungstenWall, tungstenWallLarge, blastDoor, reinforcedSurgeWall, reinforcedSurgeWallLarge, carbideWall, carbideWallLarge,
|
berylliumWall, berylliumWallLarge, tungstenWall, tungstenWallLarge, blastDoor, reinforcedSurgeWall, reinforcedSurgeWallLarge, carbideWall, carbideWallLarge,
|
||||||
|
shieldedWall,
|
||||||
|
|
||||||
mender, mendProjector, overdriveProjector, overdriveDome, forceProjector, shockMine,
|
mender, mendProjector, overdriveProjector, overdriveDome, forceProjector, shockMine,
|
||||||
scrapWall, scrapWallLarge, scrapWallHuge, scrapWallGigantic, thruster, //ok, these names are getting ridiculous, but at least I don't have humongous walls yet
|
scrapWall, scrapWallLarge, scrapWallHuge, scrapWallGigantic, thruster, //ok, these names are getting ridiculous, but at least I don't have humongous walls yet
|
||||||
|
|
||||||
@ -1669,6 +1673,20 @@ public class Blocks{
|
|||||||
size = 2;
|
size = 2;
|
||||||
}};
|
}};
|
||||||
|
|
||||||
|
shieldedWall = new ShieldWall("shielded-wall"){{
|
||||||
|
requirements(Category.defense, ItemStack.with(Items.phaseFabric, 20, Items.surgeAlloy, 12));
|
||||||
|
consumePower(3f / 60f);
|
||||||
|
|
||||||
|
outputsPower = false;
|
||||||
|
hasPower = true;
|
||||||
|
consumesPower = true;
|
||||||
|
conductivePower = true;
|
||||||
|
|
||||||
|
health = 260 * wallHealthMultiplier * 4;
|
||||||
|
armor = 15f;
|
||||||
|
size = 2;
|
||||||
|
}};
|
||||||
|
|
||||||
mender = new MendProjector("mender"){{
|
mender = new MendProjector("mender"){{
|
||||||
requirements(Category.effect, with(Items.lead, 30, Items.copper, 25));
|
requirements(Category.effect, with(Items.lead, 30, Items.copper, 25));
|
||||||
consumePower(0.3f);
|
consumePower(0.3f);
|
||||||
@ -1992,6 +2010,7 @@ public class Blocks{
|
|||||||
hasPower = true;
|
hasPower = true;
|
||||||
consumesPower = true;
|
consumesPower = true;
|
||||||
conductivePower = true;
|
conductivePower = true;
|
||||||
|
|
||||||
underBullets = true;
|
underBullets = true;
|
||||||
baseEfficiency = 1f;
|
baseEfficiency = 1f;
|
||||||
consumePower(1f / 60f);
|
consumePower(1f / 60f);
|
||||||
@ -4124,7 +4143,7 @@ public class Blocks{
|
|||||||
intervalRandomSpread = 20f;
|
intervalRandomSpread = 20f;
|
||||||
intervalBullets = 2;
|
intervalBullets = 2;
|
||||||
intervalAngle = 180f;
|
intervalAngle = 180f;
|
||||||
intervalSpread = 280f;
|
intervalSpread = 300f;
|
||||||
|
|
||||||
fragBullets = 20;
|
fragBullets = 20;
|
||||||
fragVelocityMin = 0.5f;
|
fragVelocityMin = 0.5f;
|
||||||
@ -4140,7 +4159,7 @@ public class Blocks{
|
|||||||
under = true;
|
under = true;
|
||||||
moveX = 2f;
|
moveX = 2f;
|
||||||
moveY = -1f;
|
moveY = -1f;
|
||||||
moveRot = -5f;
|
moveRot = -7f;
|
||||||
}},
|
}},
|
||||||
new RegionPart("-blade-glow"){{
|
new RegionPart("-blade-glow"){{
|
||||||
progress = PartProgress.recoil;
|
progress = PartProgress.recoil;
|
||||||
@ -4151,7 +4170,7 @@ public class Blocks{
|
|||||||
under = true;
|
under = true;
|
||||||
moveX = 2f;
|
moveX = 2f;
|
||||||
moveY = -1f;
|
moveY = -1f;
|
||||||
moveRot = -5f;
|
moveRot = -7f;
|
||||||
}});
|
}});
|
||||||
}};
|
}};
|
||||||
|
|
||||||
|
122
core/src/mindustry/world/blocks/defense/ShieldWall.java
Normal file
122
core/src/mindustry/world/blocks/defense/ShieldWall.java
Normal file
@ -0,0 +1,122 @@
|
|||||||
|
package mindustry.world.blocks.defense;
|
||||||
|
|
||||||
|
import arc.graphics.*;
|
||||||
|
import arc.graphics.g2d.*;
|
||||||
|
import arc.math.*;
|
||||||
|
import arc.util.*;
|
||||||
|
import arc.util.io.*;
|
||||||
|
import mindustry.annotations.Annotations.*;
|
||||||
|
import mindustry.graphics.*;
|
||||||
|
import mindustry.world.meta.*;
|
||||||
|
|
||||||
|
import static mindustry.Vars.*;
|
||||||
|
|
||||||
|
public class ShieldWall extends Wall{
|
||||||
|
public float shieldHealth = 900f;
|
||||||
|
public float breakCooldown = 60f * 10f;
|
||||||
|
public float regenSpeed = 2f;
|
||||||
|
|
||||||
|
public Color glowColor = Color.valueOf("ff7531").a(0.5f);
|
||||||
|
public float glowMag = 0.6f, glowScl = 8f;
|
||||||
|
|
||||||
|
public @Load("@-glow") TextureRegion glowRegion;
|
||||||
|
|
||||||
|
public ShieldWall(String name){
|
||||||
|
super(name);
|
||||||
|
|
||||||
|
update = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setStats(){
|
||||||
|
super.setStats();
|
||||||
|
|
||||||
|
stats.add(Stat.shieldHealth, shieldHealth);
|
||||||
|
}
|
||||||
|
|
||||||
|
public class ShieldWallBuild extends WallBuild{
|
||||||
|
public float shield = shieldHealth, shieldRadius = 0f;
|
||||||
|
public float breakTimer;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void draw(){
|
||||||
|
Draw.rect(block.region, x, y);
|
||||||
|
|
||||||
|
if(shieldRadius > 0){
|
||||||
|
float radius = shieldRadius * tilesize;
|
||||||
|
|
||||||
|
Draw.z(Layer.shields);
|
||||||
|
|
||||||
|
Draw.color(team.color, Color.white, Mathf.clamp(hit));
|
||||||
|
|
||||||
|
if(renderer.animateShields){
|
||||||
|
Fill.square(x, y, radius);
|
||||||
|
}else{
|
||||||
|
Lines.stroke(1.5f);
|
||||||
|
Draw.alpha(0.09f + Mathf.clamp(0.08f * hit));
|
||||||
|
Fill.square(x, y, radius);
|
||||||
|
Draw.alpha(1f);
|
||||||
|
Lines.poly(x, y, 4, radius, 45f);
|
||||||
|
Draw.reset();
|
||||||
|
}
|
||||||
|
|
||||||
|
Draw.reset();
|
||||||
|
|
||||||
|
Drawf.additive(glowRegion, glowColor, (1f - glowMag + Mathf.absin(glowScl, glowMag)) * shieldRadius, x, y, 0f, Layer.blockAdditive);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateTile(){
|
||||||
|
if(breakTimer > 0){
|
||||||
|
breakTimer -= Time.delta;
|
||||||
|
}else{
|
||||||
|
//regen when not broken
|
||||||
|
shield = Mathf.clamp(shield + regenSpeed * edelta(), 0f, shieldHealth);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(hit > 0){
|
||||||
|
hit -= Time.delta / 10f;
|
||||||
|
hit = Math.max(hit, 0f);
|
||||||
|
}
|
||||||
|
|
||||||
|
shieldRadius = Mathf.lerpDelta(shieldRadius, broken() ? 0f : 1f, 0.12f);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean broken(){
|
||||||
|
return breakTimer > 0 || !canConsume();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void damage(float damage){
|
||||||
|
float shieldTaken = broken() ? 0f : Math.min(shield, damage);
|
||||||
|
|
||||||
|
shield -= shieldTaken;
|
||||||
|
if(shieldTaken > 0){
|
||||||
|
hit = 1f;
|
||||||
|
}
|
||||||
|
|
||||||
|
//shield was destroyed, needs to go down
|
||||||
|
if(shield <= 0.00001f && shieldTaken > 0){
|
||||||
|
breakTimer = breakCooldown;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(damage - shieldTaken > 0){
|
||||||
|
super.damage(damage - shieldTaken);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void write(Writes write){
|
||||||
|
super.write(write);
|
||||||
|
write.f(shield);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void read(Reads read, byte revision){
|
||||||
|
super.read(read, revision);
|
||||||
|
shield = read.f();
|
||||||
|
if(shield > 0) shieldRadius = 1f;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user