Merge remote-tracking branch 'origin/7.0-features' into 7.0-features

This commit is contained in:
Epowerj
2022-05-01 16:57:18 -04:00
19 changed files with 182 additions and 70 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 626 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 249 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 875 B

After

Width:  |  Height:  |  Size: 597 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 419 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

@@ -1004,6 +1004,11 @@ public class Fx{
Fill.circle(e.x, e.y, e.rotation * e.fout()); Fill.circle(e.x, e.y, e.rotation * e.fout());
}).layer(Layer.bullet - 0.001f), //below bullets }).layer(Layer.bullet - 0.001f), //below bullets
missileTrailShort = new Effect(22, e -> {
color(e.color);
Fill.circle(e.x, e.y, e.rotation * e.fout());
}).layer(Layer.bullet - 0.001f),
absorb = new Effect(12, e -> { absorb = new Effect(12, e -> {
color(Pal.accent); color(Pal.accent);
stroke(2f * e.fout()); stroke(2f * e.fout());

View File

@@ -3399,6 +3399,10 @@ public class UnitTypes{
itemCapacity = 0; itemCapacity = 0;
useEngineElevation = false; useEngineElevation = false;
engineColor = Pal.sapBullet;
abilities.add(new MoveEffectAbility(0f, -7f, Pal.sapBulletBack, Fx.missileTrailShort, 4f));
for(float f : new float[]{-3f, 3f}){ for(float f : new float[]{-3f, 3f}){
parts.add(new HoverPart(){{ parts.add(new HoverPart(){{
x = 3.9f; x = 3.9f;
@@ -3413,18 +3417,25 @@ public class UnitTypes{
} }
weapons.add(new Weapon("osc-weapon"){{ weapons.add(new Weapon("osc-weapon"){{
y = 3f; y = -2f;
x = 3f; x = 4f;
top = true;
mirror = true; mirror = true;
layerOffset = -0.0001f;
reload = 40f; reload = 40f;
baseRotation = -35f;
shootCone = 360f;
shoot = new ShootSpread(){{
shots = 2;
spread = 11f;
}};
bullet = new BasicBulletType(5f, 20){{ bullet = new BasicBulletType(5f, 20){{
pierceCap = 2; homingPower = 0.2f;
pierceBuilding = false; homingDelay = 4f;
width = 7f; width = 7f;
height = 12f; height = 12f;
lifetime = 25f; lifetime = 50f;
shootEffect = Fx.sparkShoot; shootEffect = Fx.sparkShoot;
smokeEffect = Fx.shootBigSmoke; smokeEffect = Fx.shootBigSmoke;
hitColor = backColor = trailColor = Pal.suppress; hitColor = backColor = trailColor = Pal.suppress;
@@ -3486,8 +3497,8 @@ public class UnitTypes{
obviate = new ErekirUnitType("obviate"){{ obviate = new ErekirUnitType("obviate"){{
flying = true; flying = true;
drag = 0.08f; drag = 0.08f;
speed = 1.9f; speed = 1.8f;
rotateSpeed = 4f; rotateSpeed = 2.5f;
accel = 0.09f; accel = 0.09f;
health = 2300f; health = 2300f;
armor = 3f; armor = 3f;
@@ -3499,46 +3510,106 @@ public class UnitTypes{
lowAltitude = true; lowAltitude = true;
setEnginesMirror( setEnginesMirror(
new UnitEngine(59 / 4f, -25 / 4f, 3.1f, 315f) new UnitEngine(38 / 4f, -46 / 4f, 3.1f, 315f)
); );
parts.add(new RegionPart("-heat"){{ parts.add(
blending = Blending.additive; new RegionPart("-blade"){{
progress = PartProgress.heat; moveRot = -10f;
outline = false; moveX = -1f;
colorTo = new Color(1f, 0.5f, 0.5f, 0.7f); moves.add(new PartMove(PartProgress.reload, 2f, 1f, -5f));
color = colorTo.cpy().a(0f); progress = PartProgress.warmup;
layerOffset = 0.01f; mirror = true;
children.add(new RegionPart("-side"){{
moveX = 2f;
moveY = -2f;
progress = PartProgress.warmup;
under = true;
mirror = true;
moves.add(new PartMove(PartProgress.reload, -2f, 2f, 0f));
}});
}}); }});
//TODO this is really dumb.
weapons.add(new Weapon(){{ weapons.add(new Weapon(){{
y = 2f;
shootY = 0f;
x = 0f; x = 0f;
y = -2f;
shootY = 0f;
reload = 140f; reload = 140f;
mirror = false; mirror = false;
continuous = true; minWarmup = 0.95f;
// minWarmup = 0.5f; shake = 3f;
cooldownTime = reload - 10f;
bullet = new ContinuousLaserBulletType(140){{ bullet = new BasicBulletType(){{
shake = 0f; shoot = new ShootHelix(){{
lifetime = 120f; mag = 1f;
colors = new Color[]{Color.valueOf("bf92f9").a(0.4f), Color.valueOf("bf92f9"), Color.white}; scl = 5f;
//TODO merge }};
chargeEffect = new MultiEffect(Fx.lancerLaserCharge, Fx.lancerLaserChargeBegin);
width = 4f;
largeHit = false;
buildingDamageMultiplier = 0.25f; shootEffect = new MultiEffect(Fx.shootTitan, new WaveEffect(){{
hitEffect = Fx.hitLancer; colorTo = Pal.sapBulletBack;
hitSize = 4; sizeTo = 26f;
drawSize = 400f; lifetime = 14f;
length = 173f; strokeFrom = 4f;
ammoMultiplier = 1f; }});
pierceCap = 4; smokeEffect = Fx.shootSmokeTitan;
hitColor = colors[1]; hitColor = Pal.sapBullet;
sprite = "large-orb";
trailEffect = Fx.missileTrail;
trailInterval = 3f;
trailParam = 4f;
speed = 3f;
damage = 80f;
lifetime = 70f;
width = height = 15f;
backColor = Pal.sapBulletBack;
frontColor = Pal.sapBullet;
shrinkX = shrinkY = 0f;
trailColor = Pal.sapBulletBack;
trailLength = 12;
trailWidth = 2.2f;
despawnEffect = hitEffect = new ExplosionEffect(){{
waveColor = Pal.sapBullet;
smokeColor = Color.gray;
sparkColor = Pal.sap;
waveStroke = 4f;
waveRad = 20f;
}};
intervalBullet = new LightningBulletType(){{
damage = 15;
collidesAir = false;
ammoMultiplier = 1f;
lightningColor = Pal.sapBullet;
lightningLength = 2;
lightningLengthRand = 6;
//for visual stats only.
buildingDamageMultiplier = 0.25f;
lightningType = new BulletType(0.0001f, 0f){{
lifetime = Fx.lightning.lifetime;
hitEffect = Fx.hitLancer;
despawnEffect = Fx.none;
status = StatusEffects.shocked;
statusDuration = 10f;
hittable = false;
lightColor = Color.white;
buildingDamageMultiplier = 0.25f;
}};
}};
bulletInterval = 4f;
lightningColor = Pal.sapBullet;
lightningDamage = 19;
lightning = 8;
lightningLength = 2;
lightningLengthRand = 8;
}}; }};
}}); }});
}}; }};

View File

@@ -0,0 +1,41 @@
package mindustry.entities.abilities;
import arc.graphics.*;
import arc.util.*;
import mindustry.content.*;
import mindustry.entities.*;
import mindustry.gen.*;
public class MoveEffectAbility extends Ability{
public float minVelocity = 0.08f;
public float interval = 3f;
public float x, y;
public boolean rotateEffect = false;
public float effectParam = 3f;
public boolean teamColor = false;
public Color color = Color.white;
public Effect effect = Fx.missileTrail;
protected float counter;
public MoveEffectAbility(float x, float y, Color color, Effect effect, float interval){
this.x = x;
this.y = y;
this.color = color;
this.effect = effect;
this.interval = interval;
}
public MoveEffectAbility(){
}
@Override
public void update(Unit unit){
counter += Time.delta;
if(unit.vel.len2() >= minVelocity * minVelocity && (counter >= interval)){
Tmp.v1.trns(unit.rotation - 90f, x, y);
counter %= interval;
effect.at(Tmp.v1.x + unit.x, Tmp.v1.y + unit.y, rotateEffect ? unit.rotation : effectParam, teamColor ? unit.team.color : color);
}
}
}

View File

@@ -151,7 +151,7 @@ public class BulletType extends Content implements Cloneable{
public float fragVelocityMin = 0.2f, fragVelocityMax = 1f, fragLifeMin = 1f, fragLifeMax = 1f; public float fragVelocityMin = 0.2f, fragVelocityMax = 1f, fragLifeMin = 1f, fragLifeMax = 1f;
public @Nullable BulletType fragBullet = null; public @Nullable BulletType fragBullet = null;
public float bulletInterval = 20f; public float bulletInterval = 20f;
public int intervalBulletCount = 1; public int intervalBullets = 1;
public @Nullable BulletType intervalBullet; public @Nullable BulletType intervalBullet;
public Color hitColor = Color.white; public Color hitColor = Color.white;
public Color healColor = Pal.heal; public Color healColor = Pal.heal;
@@ -431,7 +431,7 @@ public class BulletType extends Content implements Cloneable{
public void updateBulletInterval(Bullet b){ public void updateBulletInterval(Bullet b){
if(intervalBullet != null && b.timer.get(2, bulletInterval)){ if(intervalBullet != null && b.timer.get(2, bulletInterval)){
for(int i = 0; i < intervalBulletCount; i++){ for(int i = 0; i < intervalBullets; i++){
intervalBullet.create(b, b.x, b.y, Mathf.random(360f)); intervalBullet.create(b, b.x, b.y, Mathf.random(360f));
} }
} }

View File

@@ -11,6 +11,7 @@ public class ShootBarrel extends ShootPattern{
barrels = barrels.clone(); barrels = barrels.clone();
for(int i = 0; i < barrels.length; i += 3){ for(int i = 0; i < barrels.length; i += 3){
barrels[i] *= -1; barrels[i] *= -1;
barrels[i + 2] *= -1;
} }
} }

View File

@@ -10,7 +10,7 @@ public class ShootHelix extends ShootPattern{
for(int i = 0; i < shots; i++){ for(int i = 0; i < shots; i++){
for(int sign : Mathf.signs){ for(int sign : Mathf.signs){
handler.shoot(0, 0, 0, firstShotDelay + shotDelay * i, handler.shoot(0, 0, 0, firstShotDelay + shotDelay * i,
b -> b.moveRelative(0f, Mathf.sin(b.time + offset, 2f, mag * sign))); b -> b.moveRelative(0f, Mathf.sin(b.time + offset, scl, mag * sign)));
} }
} }
} }

View File

@@ -29,9 +29,9 @@ public class ShootMulti extends ShootPattern{
source.shoot(totalShots, (x, y, rotation, delay, move) -> { source.shoot(totalShots, (x, y, rotation, delay, move) -> {
for(var pattern : dest){ for(var pattern : dest){
pattern.shoot(totalShots, (x2, y2, rot2, delay2, mover) -> { pattern.shoot(totalShots, (x2, y2, rot2, delay2, mover) -> {
handler.shoot(x + x2, y + y2, rotation + rot2, delay + delay2, b -> { handler.shoot(x + x2, y + y2, rotation + rot2, delay + delay2, move == null && mover == null ? null : b -> {
move.move(b); if(move != null) move.move(b);
mover.move(b); if(mover != null) mover.move(b);
}); });
}); });
} }

View File

@@ -353,23 +353,13 @@ public class Mods implements Loadable{
Log.debug("Total time to generate & flush textures synchronously: @", Time.elapsed()); Log.debug("Total time to generate & flush textures synchronously: @", Time.elapsed());
} }
private PageType getPage(AtlasRegion region){
return
region.texture == Core.atlas.find("white").texture ? PageType.main :
region.texture == Core.atlas.find("stone1").texture ? PageType.environment :
region.texture == Core.atlas.find("clear-editor").texture ? PageType.editor :
region.texture == Core.atlas.find("whiteui").texture ? PageType.ui :
region.texture == Core.atlas.find("rubble-1-0").texture ? PageType.rubble :
PageType.main;
}
private PageType getPage(Fi file){ private PageType getPage(Fi file){
String path = file.path(); String path = file.path();
return return
path.contains("sprites/blocks/environment") ? PageType.environment : path.contains("sprites/blocks/environment") || path.contains("sprites-override/blocks/environment") ? PageType.environment :
path.contains("sprites/editor") ? PageType.editor : path.contains("sprites/editor") || path.contains("sprites-override/editor") ? PageType.editor :
path.contains("sprites/rubble") ? PageType.editor : path.contains("sprites/rubble") || path.contains("sprites-override/rubble") ? PageType.rubble :
path.contains("sprites/ui") ? PageType.ui : path.contains("sprites/ui") || path.contains("sprites-override/ui") ? PageType.ui :
PageType.main; PageType.main;
} }

View File

@@ -212,7 +212,7 @@ public class UnitType extends UnlockableContent{
public Sound deathSound = Sounds.bang; public Sound deathSound = Sounds.bang;
public Seq<Weapon> weapons = new Seq<>(); public Seq<Weapon> weapons = new Seq<>();
public TextureRegion baseRegion, legRegion, region, shadowRegion, cellRegion, public TextureRegion baseRegion, legRegion, region, previewRegion, shadowRegion, cellRegion,
softShadowRegion, jointRegion, footRegion, legBaseRegion, baseJointRegion, outlineRegion, treadRegion; softShadowRegion, jointRegion, footRegion, legBaseRegion, baseJointRegion, outlineRegion, treadRegion;
public TextureRegion[] wreckRegions, segmentRegions, segmentOutlineRegions; public TextureRegion[] wreckRegions, segmentRegions, segmentOutlineRegions;
public TextureRegion[][] treadRegions; public TextureRegion[][] treadRegions;
@@ -590,6 +590,7 @@ public class UnitType extends UnlockableContent{
} }
weapons.each(Weapon::load); weapons.each(Weapon::load);
region = Core.atlas.find(name); region = Core.atlas.find(name);
previewRegion = Core.atlas.find(name + "-preview", name);
legRegion = Core.atlas.find(name + "-leg"); legRegion = Core.atlas.find(name + "-leg");
jointRegion = Core.atlas.find(name + "-joint"); jointRegion = Core.atlas.find(name + "-joint");
baseJointRegion = Core.atlas.find(name + "-joint-base"); baseJointRegion = Core.atlas.find(name + "-joint-base");

View File

@@ -41,6 +41,8 @@ public class Weapon implements Cloneable{
public boolean alternate = true; public boolean alternate = true;
/** whether to rotate toward the target independently of unit */ /** whether to rotate toward the target independently of unit */
public boolean rotate = false; public boolean rotate = false;
/** rotation at which this weapon is locked to if rotate = false. TODO buggy!*/
public float baseRotation = 0f;
/** whether to draw the outline on top. */ /** whether to draw the outline on top. */
public boolean top = true; public boolean top = true;
/** whether to hold the bullet in place while firing */ /** whether to hold the bullet in place while firing */
@@ -180,7 +182,7 @@ public class Weapon implements Cloneable{
float float
rotation = unit.rotation - 90, rotation = unit.rotation - 90,
weaponRotation = rotation + (rotate ? mount.rotation : 0), weaponRotation = rotation + (rotate ? mount.rotation : baseRotation),
wx = unit.x + Angles.trnsx(rotation, x, y) + Angles.trnsx(weaponRotation, 0, -mount.recoil), wx = unit.x + Angles.trnsx(rotation, x, y) + Angles.trnsx(weaponRotation, 0, -mount.recoil),
wy = unit.y + Angles.trnsy(rotation, x, y) + Angles.trnsy(weaponRotation, 0, -mount.recoil); wy = unit.y + Angles.trnsy(rotation, x, y) + Angles.trnsy(weaponRotation, 0, -mount.recoil);
@@ -263,12 +265,12 @@ public class Weapon implements Cloneable{
} }
} }
}else if(!rotate){ }else if(!rotate){
mount.rotation = 0; mount.rotation = baseRotation;
mount.targetRotation = unit.angleTo(mount.aimX, mount.aimY); mount.targetRotation = unit.angleTo(mount.aimX, mount.aimY);
} }
float float
weaponRotation = unit.rotation - 90 + (rotate ? mount.rotation : 0), weaponRotation = unit.rotation - 90 + (rotate ? mount.rotation : baseRotation),
mountX = unit.x + Angles.trnsx(unit.rotation - 90, x, y), mountX = unit.x + Angles.trnsx(unit.rotation - 90, x, y),
mountY = unit.y + Angles.trnsy(unit.rotation - 90, x, y), mountY = unit.y + Angles.trnsy(unit.rotation - 90, x, y),
bulletX = mountX + Angles.trnsx(weaponRotation, this.shootX, this.shootY), bulletX = mountX + Angles.trnsx(weaponRotation, this.shootX, this.shootY),
@@ -346,7 +348,7 @@ public class Weapon implements Cloneable{
mount.warmup >= minWarmup && //must be warmed up mount.warmup >= minWarmup && //must be warmed up
unit.vel.len() >= minShootVelocity && //check velocity requirements unit.vel.len() >= minShootVelocity && //check velocity requirements
mount.reload <= 0.0001f && //reload has to be 0 mount.reload <= 0.0001f && //reload has to be 0
Angles.within(rotate ? mount.rotation : unit.rotation, mount.targetRotation, shootCone) //has to be within the cone Angles.within(rotate ? mount.rotation : unit.rotation + baseRotation, mount.targetRotation, shootCone) //has to be within the cone
){ ){
shoot(unit, mount, bulletX, bulletY, shootAngle); shoot(unit, mount, bulletX, bulletY, shootAngle);
@@ -368,7 +370,7 @@ public class Weapon implements Cloneable{
} }
protected float bulletRotation(Unit unit, WeaponMount mount, float bulletX, float bulletY){ protected float bulletRotation(Unit unit, WeaponMount mount, float bulletX, float bulletY){
return rotate ? unit.rotation + mount.rotation : Angles.angle(bulletX, bulletY, mount.aimX, mount.aimY) + (unit.rotation - unit.angleTo(mount.aimX, mount.aimY)); return rotate ? unit.rotation + mount.rotation : Angles.angle(bulletX, bulletY, mount.aimX, mount.aimY) + (unit.rotation - unit.angleTo(mount.aimX, mount.aimY)) + baseRotation;
} }
protected void shoot(Unit unit, WeaponMount mount, float shootX, float shootY, float rotation){ protected void shoot(Unit unit, WeaponMount mount, float shootX, float shootY, float rotation){
@@ -393,7 +395,7 @@ public class Weapon implements Cloneable{
if(!unit.isAdded()) return; if(!unit.isAdded()) return;
float float
weaponRotation = unit.rotation - 90 + (rotate ? mount.rotation : 0), weaponRotation = unit.rotation - 90 + (rotate ? mount.rotation : baseRotation),
mountX = unit.x + Angles.trnsx(unit.rotation - 90, x, y), mountX = unit.x + Angles.trnsx(unit.rotation - 90, x, y),
mountY = unit.y + Angles.trnsy(unit.rotation - 90, x, y), mountY = unit.y + Angles.trnsy(unit.rotation - 90, x, y),
bulletX = mountX + Angles.trnsx(weaponRotation, this.shootX + xOffset, this.shootY + yOffset), bulletX = mountX + Angles.trnsx(weaponRotation, this.shootX + xOffset, this.shootY + yOffset),
@@ -421,6 +423,7 @@ public class Weapon implements Cloneable{
public void flip(){ public void flip(){
x *= -1; x *= -1;
shootX *= -1; shootX *= -1;
baseRotation *= -1f;
flipSprite = !flipSprite; flipSprite = !flipSprite;
shoot = shoot.copy(); shoot = shoot.copy();
shoot.flip(); shoot.flip();

View File

@@ -557,7 +557,7 @@ public class Generators{
if(sample instanceof Legsc) outliner.get(type.legRegion); if(sample instanceof Legsc) outliner.get(type.legRegion);
if(sample instanceof Tankc) outliner.get(type.treadRegion); if(sample instanceof Tankc) outliner.get(type.treadRegion);
Pixmap image = type.segments > 0 ? get(type.segmentRegions[0]) : outline.get(get(type.region)); Pixmap image = type.segments > 0 ? get(type.segmentRegions[0]) : outline.get(get(type.previewRegion));
Func<Weapon, Pixmap> weaponRegion = weapon -> Core.atlas.has(weapon.name + "-preview") ? get(weapon.name + "-preview") : get(weapon.region); Func<Weapon, Pixmap> weaponRegion = weapon -> Core.atlas.has(weapon.name + "-preview") ? get(weapon.name + "-preview") : get(weapon.region);
Cons2<Weapon, Pixmap> drawWeapon = (weapon, pixmap) -> Cons2<Weapon, Pixmap> drawWeapon = (weapon, pixmap) ->
@@ -585,7 +585,7 @@ public class Generators{
if(type.needsBodyOutline()){ if(type.needsBodyOutline()){
save(image, type.name + "-outline"); save(image, type.name + "-outline");
}else{ }else{
replace(type.name, image); replace(type.name, type.segments > 0 ? get(type.segmentRegions[0]) : outline.get(get(type.region)));
} }
//draw weapons that are under the base //draw weapons that are under the base
@@ -596,13 +596,13 @@ public class Generators{
//draw over the weapons under the image //draw over the weapons under the image
if(anyUnder){ if(anyUnder){
image.draw(outline.get(get(type.region)), true); image.draw(outline.get(get(type.previewRegion)), true);
} }
//draw treads //draw treads
if(sample instanceof Tankc){ if(sample instanceof Tankc){
image.draw(outline.get(get(type.treadRegion)), true); image.draw(outline.get(get(type.treadRegion)), true);
image.draw(get(type.region), true); image.draw(get(type.previewRegion), true);
} }
//draw mech parts //draw mech parts
@@ -610,7 +610,7 @@ public class Generators{
drawCenter(image, get(type.baseRegion)); drawCenter(image, get(type.baseRegion));
drawCenter(image, get(type.legRegion)); drawCenter(image, get(type.legRegion));
drawCenter(image, get(type.legRegion).flipX()); drawCenter(image, get(type.legRegion).flipX());
image.draw(get(type.region), true); image.draw(get(type.previewRegion), true);
} }
//draw weapon outlines on base //draw weapon outlines on base
@@ -622,7 +622,7 @@ public class Generators{
} }
//draw base region on top to mask weapons //draw base region on top to mask weapons
if(type.drawCell) image.draw(get(type.region), true); if(type.drawCell) image.draw(get(type.previewRegion), true);
if(type.drawCell){ if(type.drawCell){
Pixmap baseCell = get(type.cellRegion); Pixmap baseCell = get(type.cellRegion);