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

WIP 'bulwark' unit

This commit is contained in:
Anuken 2022-01-16 16:26:21 -05:00
parent 93cfa243bc
commit b23ea8b965
18 changed files with 117 additions and 17 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 770 B

After

Width:  |  Height:  |  Size: 764 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 765 B

After

Width:  |  Height:  |  Size: 767 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 647 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 775 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 691 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

View File

@ -494,3 +494,4 @@
63210=eruption-drill|block-eruption-drill-ui
63209=ship-assembler|block-ship-assembler-ui
63208=quell-missile|unit-quell-missile-ui
63207=bulwark|unit-bulwark-ui

Binary file not shown.

View File

@ -34,7 +34,7 @@ public class UnitTypes{
public static @EntityDef(value = {Unitc.class, Mechc.class}, legacy = true) UnitType nova, pulsar, quasar;
//legs
public static @EntityDef({Unitc.class, Legsc.class}) UnitType corvus, atrax;
public static @EntityDef({Unitc.class, Legsc.class}) UnitType corvus, atrax, bulwark;
//legs, legacy
public static @EntityDef(value = {Unitc.class, Legsc.class}, legacy = true) UnitType spiroct, arkyid, toxopid;
@ -2440,7 +2440,7 @@ public class UnitTypes{
layerOffset = 0.0001f;
reload = 120f;
shootY = 71f / 4f;
shake = 4f;
shake = 5f;
recoil = 4f;
rotate = true;
rotateSpeed = 1f;
@ -2448,12 +2448,14 @@ public class UnitTypes{
x = 0f;
y = 0;
shadow = 28f;
heatColor = Color.valueOf("f9350f");
cooldownTime = 80f;
bullet = new BasicBulletType(7f, 90){{
bullet = new BasicBulletType(8f, 100){{
sprite = "missile-large";
width = 9f;
width = 9.5f;
height = 15f;
lifetime = 33f;
lifetime = 32f;
hitSize = 6f;
shootEffect = Fx.shootTitan;
smokeEffect = Fx.shootSmokeTitan;
@ -2462,7 +2464,7 @@ public class UnitTypes{
pierceBuilding = true;
hitColor = backColor = trailColor = Color.valueOf("feb380");
frontColor = Color.white;
trailWidth = 3f;
trailWidth = 3.1f;
trailLength = 8;
hitEffect = despawnEffect = Fx.blastExplosion;
}};
@ -2498,7 +2500,93 @@ public class UnitTypes{
//endregion
//region erekir - mech
//TODO
bulwark = new UnitType("bulwark"){{
drag = 0.1f;
speed = 0.62f;
hitSize = 23f;
health = 8000;
armor = 6f;
outlineColor = Pal.darkOutline;
envDisabled = Env.space;
//TODO shield ability
rotateSpeed = 2.7f;
legCount = 4;
legLength = 15f;
legTrns = 0.45f;
legMoveSpace = 1.4f;
rippleScale = 2f;
landShake = 0.5f;
legExtension = -5f;
legBaseOffset = 5f;
ammoType = new PowerAmmoType(2000);
legSplashDamage = 32;
legSplashRange = 30;
drownTimeMultiplier = 2f;
hovering = true;
visualElevation = 0.65f;
groundLayer = Layer.legUnit;
weapons.add(new Weapon("bulwark-weapon"){{
mirror = true;
top = false;
x = 62/4f;
y = 1f;
shootY = 47 / 4f;
recoil = 3f;
reload = 40f;
shake = 3f;
cooldownTime = 40f;
shots = 3;
inaccuracy = 3f;
velocityRnd = 0.33f;
heatColor = Color.red;
bullet = new MissileBulletType(4.2f, 30){{
homingPower = 0.2f;
weaveMag = 4;
weaveScale = 4;
lifetime = 60f;
//TODO better
shootEffect = Fx.shootBig2;
smokeEffect = Fx.shootSmokeTitan;
splashDamage = 50f;
splashDamageRadius = 30f;
frontColor = Color.white;
hitSound = Sounds.none;
width = height = 10f;
lightColor = trailColor = backColor = Color.valueOf("8ca9e8");
lightRadius = 40f;
lightOpacity = 0.7f;
trailWidth = 2.8f;
trailLength = 20;
trailChance = -1f;
despawnEffect = Fx.none;
hitEffect = new ExplosionEffect(){{
lifetime = 20f;
waveStroke = 2f;
waveColor = sparkColor = trailColor;
waveRad = 12f;
smokeSize = 0f;
smokeSizeBase = 0f;
sparks = 10;
sparkRad = 35f;
sparkLen = 4f;
sparkStroke = 1.5f;
}};
}};
}});
}};
//endregion
//region erekir - flying

View File

@ -151,6 +151,8 @@ public class Weapon implements Cloneable{
//TODO copy-pasted code
public void drawOutline(Unit unit, WeaponMount mount){
if(!outlineRegion.found()) return;
//apply layer offset, roll it back at the end
float z = Draw.z();
Draw.z(z + layerOffset);
@ -173,6 +175,8 @@ public class Weapon implements Cloneable{
}
public void draw(Unit unit, WeaponMount mount){
if(!region.found()) return;
//apply layer offset, roll it back at the end
float z = Draw.z();
Draw.z(z + layerOffset);
@ -434,7 +438,7 @@ public class Weapon implements Cloneable{
}
public void load(){
region = Core.atlas.find(name, Core.atlas.find("clear"));
region = Core.atlas.find(name);
heatRegion = Core.atlas.find(name + "-heat");
outlineRegion = Core.atlas.find(name + "-outline");
}

View File

@ -463,8 +463,9 @@ public class Turret extends ReloadTurret{
return ammo.peek().type();
}
/** @return whether the turret has ammo. */
/** @return whether the turret has ammo. */
public boolean hasAmmo(){
//used for "side-ammo" like gas in some turrets
if(!cons.canConsume()) return false;
//skip first entry if it has less than the required amount of ammo

View File

@ -503,9 +503,19 @@ public class Generators{
}
};
for(Weapon weapon : type.weapons){
Seq<Weapon> weapons = type.weapons;
weapons.each(Weapon::load);
weapons.removeAll(w -> !w.region.found());
for(Weapon weapon : weapons){
if(outlined.add(weapon.name) && has(weapon.name)){
save(outline.get(get(weapon.name)), weapon.name + "-outline");
//only non-top weapons need separate outline sprites (this is mostly just mechs)
if(!weapon.top){
save(outline.get(get(weapon.name)), weapon.name + "-outline");
}else{
//replace weapon with outlined version, no use keeping standard around
outliner.get(weapon.region);
}
}
}
@ -575,9 +585,7 @@ public class Generators{
//TODO draw under for layerOffset < 0
//draw weapon outlines on base
for(Weapon weapon : type.weapons){
weapon.load();
for(Weapon weapon : weapons){
image.draw(weapon.flipSprite ? outline.get(get(weapon.region)).flipX() : outline.get(get(weapon.region)),
(int)(weapon.x / Draw.scl + image.width / 2f - weapon.region.width / 2f),
(int)(-weapon.y / Draw.scl + image.height / 2f - weapon.region.height / 2f),
@ -598,9 +606,7 @@ public class Generators{
image.draw(cell, image.width / 2 - cell.width / 2, image.height / 2 - cell.height / 2, true);
}
for(Weapon weapon : type.weapons){
weapon.load();
for(Weapon weapon : weapons){
Pixmap wepReg = weapon.top ? outline.get(get(weapon.region)) : get(weapon.region);
if(weapon.flipSprite){
wepReg = wepReg.flipX();