More unit progress

This commit is contained in:
Anuken 2020-07-10 20:04:45 -04:00
parent d7e432f730
commit 9cb4645b11
30 changed files with 106 additions and 221 deletions

View file

@ -0,0 +1 @@
{fields:[{name:ammo,type:int,size:4},{name:armor,type:float,size:4},{name:controller,type:mindustry.entities.units.UnitController,size:-1},{name:elevation,type:float,size:4},{name:health,type:float,size:4},{name:isShooting,type:boolean,size:1},{name:mineTile,type:mindustry.world.Tile,size:-1},{name:mounts,type:"mindustry.entities.units.WeaponMount[]",size:-1},{name:rotation,type:float,size:4},{name:shield,type:float,size:4},{name:spawnedByCore,type:boolean,size:1},{name:stack,type:mindustry.type.ItemStack,size:-1},{name:statuses,type:arc.struct.Seq<mindustry.entities.units.StatusEntry>,size:-1},{name:team,type:mindustry.game.Team,size:-1},{name:type,type:mindustry.type.UnitType,size:-1},{name:x,type:float,size:4},{name:y,type:float,size:4}]}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 336 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 950 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 639 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 465 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 467 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 697 B

View file

@ -1054,16 +1054,6 @@ team.derelict.name = derelict
team.green.name = green
team.purple.name = purple
#TODO - don't translate yet
#unit.crawler.name = Crawler
#unit.dagger.name = Dagger
#unit.fortress.name = Fortress
#unit.wraith.name = Wraith Fighter
#unit.ghoul.name = Ghoul Bomber
#unit.revenant.name = Revenant
#unit.lich.name = Lich
#unit.reaper.name = Reaper
tutorial.next = [lightgray]<Tap to continue>
tutorial.intro = You have entered the[scarlet] Mindustry Tutorial.[]\nUse[accent] [[WASD][] to move.\n[accent]Scroll[] to zoom in and out.\nBegin by[accent] mining copper[]. Move close to it, then tap a copper ore vein near your core to do this.\n\n[accent]{0}/{1} copper
tutorial.intro.mobile = You have entered the[scarlet] Mindustry Tutorial.[]\nSwipe the screen to move.\n[accent]Pinch with 2 fingers[] to zoom in and out.\nBegin by[accent] mining copper[]. Move close to it, then tap a copper ore vein near your core to do this.\n\n[accent]{0}/{1} copper

View file

@ -1535,7 +1535,7 @@ public class Blocks implements ContentList{
@Override
public void init(Bullet b){
for(int i = 0; i < rays; i++){
Damage.collideLine(b, b.team(), hitEffect, b.x, b.y, b.rotation(), rayLength - Math.abs(i - (rays / 2)) * 20f);
Damage.collideLine(b, b.team, hitEffect, b.x, b.y, b.rotation(), rayLength - Math.abs(i - (rays / 2)) * 20f);
}
}
@ -1689,7 +1689,7 @@ public class Blocks implements ContentList{
plans = new UnitPlan[]{
new UnitPlan(UnitTypes.dagger, 200f, with(Items.silicon, 10, Items.lead, 10)),
new UnitPlan(UnitTypes.crawler, 200f, with(Items.silicon, 10, Items.blastCompound, 5)),
new UnitPlan(UnitTypes.nova, 200f, with(Items.silicon, 20, Items.lead, 10)),
new UnitPlan(UnitTypes.nova, 200f, with(Items.silicon, 20, Items.lead, 20, Items.titanium, 20)),
};
size = 3;
consumes.power(1.2f);
@ -1699,7 +1699,7 @@ public class Blocks implements ContentList{
requirements(Category.units, with(Items.copper, 30, Items.lead, 70));
plans = new UnitPlan[]{
new UnitPlan(UnitTypes.flare, 200f, with(Items.silicon, 10)),
new UnitPlan(UnitTypes.mono, 200f, with(Items.silicon, 10)),
new UnitPlan(UnitTypes.mono, 200f, with(Items.silicon, 15, Items.lead, 15)),
//new UnitPlan(UnitTypes.phantom, 200f, with(Items.silicon, 10)),
};
size = 3;

View file

@ -289,24 +289,6 @@ public class Bullets implements ContentList{
lightningLength = 14;
}};
missileJavelin = new MissileBulletType(5f, 10.5f, "missile"){{
width = 8f;
height = 8f;
shrinkY = 0f;
drag = -0.003f;
keepVelocity = false;
splashDamageRadius = 20f;
splashDamage = 1f;
lifetime = 90f;
trailColor = Color.valueOf("b6c6fd");
hitEffect = Fx.blastExplosion;
despawnEffect = Fx.blastExplosion;
backColor = Pal.bulletYellowBack;
frontColor = Pal.bulletYellow;
weaveScale = 8f;
weaveMag = 2f;
}};
missileSwarm = new MissileBulletType(2.7f, 12, "missile"){{
width = 8f;
height = 8f;

View file

@ -29,8 +29,8 @@ public class UnitTypes implements ContentList{
//air (no special traits)
public static @EntityDef({Unitc.class}) UnitType flare, eclipse, horizon, zenith, antumbra;
//air + building
public static @EntityDef({Unitc.class, Builderc.class}) UnitType mono;
//air + mining
public static @EntityDef({Unitc.class, Minerc.class}) UnitType mono;
//air + building + mining
public static @EntityDef({Unitc.class, Builderc.class, Minerc.class}) UnitType poly;
@ -363,7 +363,7 @@ public class UnitTypes implements ContentList{
}};
zenith = new UnitType("zenith"){{
health = 220;
health = 450;
speed = 1.9f;
accel = 0.04f;
drag = 0.016f;
@ -376,12 +376,15 @@ public class UnitTypes implements ContentList{
engineSize = 3f;
weapons.add(new Weapon("zenith-missiles"){{
reload = 70f;
reload = 32f;
x = 7f;
rotate = true;
shake = 1f;
shots = 2;
inaccuracy = 5f;
velocityRnd = 0.2f;
bullet = new MissileBulletType(2.7f, 12, "missile"){{
bullet = new MissileBulletType(3f, 12){{
width = 8f;
height = 8f;
shrinkY = 0f;
@ -451,20 +454,28 @@ public class UnitTypes implements ContentList{
mono = new UnitType("mono"){{
flying = true;
drag = 0.05f;
accel = 0.2f;
accel = 0.15f;
speed = 2f;
range = 50f;
health = 100;
engineSize = 1.8f;
engineOffset = 5.7f;
mineTier = 1;
mineSpeed = 2.5f;
weapons.add(new Weapon(){{
y = 1.5f;
x = 0f;
reload = 40f;
x = 0.5f;
ejectEffect = Fx.none;
recoil = 2f;
bullet = Bullets.healBulletBig;
shootSound = Sounds.pew;
mirror = false;
bullet = new HealBulletType(5.2f, 10){{
healPercent = 4f;
}};
}});
}};
@ -473,29 +484,63 @@ public class UnitTypes implements ContentList{
flying = true;
drag = 0.05f;
speed = 3f;
speed = 2f;
rotateSpeed = 15f;
accel = 0.3f;
accel = 0.1f;
range = 70f;
itemCapacity = 70;
health = 400;
buildSpeed = 0.5f;
engineOffset = 6.5f;
hitsize = 8f;
lowAltitude = true;
mineTier = 2;
mineSpeed = 3.5f;
abilities.add(new HealFieldAbility(5f, 60f * 5, 50f));
weapons.add(new Weapon("heal-weapon-mount"){{
y = -2.5f;
x = 3.5f;
reload = 34f;
ejectEffect = Fx.none;
recoil = 2f;
shootSound = Sounds.pew;
shots = 1;
velocityRnd = 0.5f;
inaccuracy = 15f;
alternate = true;
bullet = new MissileBulletType(4f, 10){{
homingPower = 0.08f;
weaveMag = 4;
weaveScale = 4;
lifetime = 50f;
keepVelocity = false;
shootEffect = Fx.shootHeal;
smokeEffect = Fx.hitLaser;
frontColor = Color.white;
backColor = Pal.heal;
trailColor = Pal.heal;
}};
}});
}};
mega = new UnitType("mega"){{
health = 500;
speed = 2f;
accel = 0.05f;
drag = 0.016f;
speed = 1.8f;
accel = 0.06f;
drag = 0.017f;
lowAltitude = true;
flying = true;
engineOffset = 10.5f;
rotateShooting = false;
hitsize = 15f;
engineSize = 3f;
payloadCapacity = 3;
weapons.add(
new Weapon("heal-weapon-mount"){{

View file

@ -2,12 +2,10 @@ package mindustry.entities.bullet;
import arc.graphics.g2d.*;
import mindustry.content.*;
import mindustry.entities.*;
import mindustry.gen.*;
//TODO scale velocity depending on fslope()
public class ArtilleryBulletType extends BasicBulletType{
protected Effect trailEffect = Fx.artilleryTrail;
public ArtilleryBulletType(float speed, float damage, String bulletSprite){
super(speed, damage, bulletSprite);
@ -17,6 +15,7 @@ public class ArtilleryBulletType extends BasicBulletType{
scaleVelocity = true;
hitShake = 1f;
hitSound = Sounds.explosion;
trailEffect = Fx.artilleryTrail;
}
public ArtilleryBulletType(){

View file

@ -75,6 +75,11 @@ public abstract class BulletType extends Content{
public BulletType fragBullet = null;
public Color hitColor = Color.white;
public Color trailColor = Pal.missileYellowBack;
public float trailChance = -0.0001f;
public Effect trailEffect = Fx.missileTrail;
public float trailParam = 2f;
/** Use a negative value to disable splash damage. */
public float splashDamageRadius = -1f;
@ -118,7 +123,7 @@ public abstract class BulletType extends Content{
}
public void hit(Bullet b){
hit(b, b.getX(), b.getY());
hit(b, b.x, b.y);
}
public void hit(Bullet b, float x, float y){
@ -140,20 +145,20 @@ public abstract class BulletType extends Content{
}
if(splashDamageRadius > 0){
Damage.damage(b.team(), x, y, splashDamageRadius, splashDamage * b.damageMultiplier(), collidesAir, collidesGround);
Damage.damage(b.team, x, y, splashDamageRadius, splashDamage * b.damageMultiplier(), collidesAir, collidesGround);
if(status != StatusEffects.none){
Damage.status(b.team(), x, y, splashDamageRadius, status, statusDuration, collidesAir, collidesGround);
Damage.status(b.team, x, y, splashDamageRadius, status, statusDuration, collidesAir, collidesGround);
}
}
for(int i = 0; i < lightning; i++){
Lightning.create(b.team(), Pal.surge, lightningDamage < 0 ? damage : lightningDamage, b.getX(), b.getY(), Mathf.random(360f), lightningLength);
Lightning.create(b.team, Pal.surge, lightningDamage < 0 ? damage : lightningDamage, b.x, b.y, Mathf.random(360f), lightningLength);
}
}
public void despawned(Bullet b){
despawnEffect.at(b.getX(), b.getY(), b.rotation());
despawnEffect.at(b.x, b.y, b.rotation());
hitSound.at(b);
if(fragBullet != null || splashDamageRadius > 0 || lightning > 0){
@ -165,7 +170,7 @@ public abstract class BulletType extends Content{
}
public void drawLight(Bullet b){
Drawf.light(b.team(), b, lightRadius, lightColor, lightOpacity);
Drawf.light(b.team, b, lightRadius, lightColor, lightOpacity);
}
public void init(Bullet b){
@ -180,14 +185,20 @@ public abstract class BulletType extends Content{
public void update(Bullet b){
if(homingPower > 0.0001f){
Teamc target = Units.closestTarget(b.team(), b.getX(), b.getY(), homingRange, e -> (e.isGrounded() && collidesGround) || (e.isFlying() && collidesAir), t -> collidesGround);
Teamc target = Units.closestTarget(b.team, b.x, b.y, homingRange, e -> (e.isGrounded() && collidesGround) || (e.isFlying() && collidesAir), t -> collidesGround);
if(target != null){
b.vel.setAngle(Mathf.slerpDelta(b.rotation(), b.angleTo(target), homingPower));
}
}
if(weaveMag > 0){
b.vel.rotate(Mathf.sin(Time.time() + b.id() * 3, weaveScale, weaveMag) * Time.delta());
b.vel.rotate(Mathf.sin(Mathf.randomSeed(b.id, 10f) + b.time, weaveScale, weaveMag) * Time.delta());
}
if(trailChance > 0){
if(Mathf.chanceDelta(trailChance)){
trailEffect.at(b.x, b.y, trailParam, trailColor);
}
}
}
@ -213,11 +224,11 @@ public abstract class BulletType extends Content{
}
public Bullet create(Bullet parent, float x, float y, float angle){
return create(parent.owner(), parent.team(), x, y, angle);
return create(parent.owner(), parent.team, x, y, angle);
}
public Bullet create(Bullet parent, float x, float y, float angle, float velocityScl){
return create(parent.owner(), parent.team(), x, y, angle, velocityScl);
return create(parent.owner(), parent.team, x, y, angle, velocityScl);
}
public Bullet create(@Nullable Entityc owner, Team team, float x, float y, float angle, float damage, float velocityScl, float lifetimeScl, Object data){

View file

@ -48,7 +48,7 @@ public class ContinuousLaserBulletType extends BulletType{
//damage every 5 ticks
if(b.timer(1, 5f)){
Damage.collideLine(b, b.team(), hitEffect, b.x, b.y, b.rotation(), length, true);
Damage.collideLine(b, b.team, hitEffect, b.x, b.y, b.rotation(), length, true);
}
if(shake > 0){
@ -72,7 +72,7 @@ public class ContinuousLaserBulletType extends BulletType{
Tmp.v1.trns(b.rotation(), baseLen * 1.1f);
Drawf.light(b.team(), b.x, b.y, b.x + Tmp.v1.x, b.y + Tmp.v1.y, 40, Color.orange, 0.7f);
Drawf.light(b.team, b.x, b.y, b.x + Tmp.v1.x, b.y + Tmp.v1.y, 40, Color.orange, 0.7f);
Draw.reset();
}

View file

@ -28,7 +28,7 @@ public class FlakBulletType extends BasicBulletType{
if(b.data() instanceof Integer) return;
if(b.timer(2, 6)){
Units.nearbyEnemies(b.team(), Tmp.r1.setSize(explodeRange * 2f).setCenter(b.x, b.y), unit -> {
Units.nearbyEnemies(b.team, Tmp.r1.setSize(explodeRange * 2f).setCenter(b.x, b.y), unit -> {
if(b.data() instanceof Float || !unit.checkTarget(collidesAir, collidesGround)) return;
if(unit.dst(b) < explodeRange){

View file

@ -29,7 +29,7 @@ public class HealBulletType extends BulletType{
@Override
public boolean collides(Bullet b, Building tile){
return tile.team() != b.team() || tile.healthf() < 1f;
return tile.team() != b.team || tile.healthf() < 1f;
}
@Override
@ -46,7 +46,7 @@ public class HealBulletType extends BulletType{
public void hitTile(Bullet b, Building tile){
super.hit(b);
if(tile.team() == b.team() && !(tile.block() instanceof BuildBlock)){
if(tile.team() == b.team && !(tile.block() instanceof BuildBlock)){
Fx.healBlockFull.at(tile.x, tile.y, tile.block().size, Pal.heal);
tile.heal(healPercent / 100f * tile.maxHealth());
}

View file

@ -54,11 +54,11 @@ public class LaserBulletType extends BulletType{
furthest = null;
world.raycast(b.tileX(), b.tileY(), world.toTile(b.x + Tmp.v1.x), world.toTile(b.y + Tmp.v1.y),
(x, y) -> (furthest = world.tile(x, y)) != null && furthest.team() != b.team() && furthest.block().absorbLasers);
(x, y) -> (furthest = world.tile(x, y)) != null && furthest.team() != b.team && furthest.block().absorbLasers);
float resultLength = furthest != null ? Math.max(6f, b.dst(furthest.worldx(), furthest.worldy())) : length;
Damage.collideLine(b, b.team(), hitEffect, b.x, b.y, b.rotation(), resultLength);
Damage.collideLine(b, b.team, hitEffect, b.x, b.y, b.rotation(), resultLength);
if(furthest != null) b.data(resultLength);
laserEffect.at(b.x, b.y, b.rotation(), resultLength * 0.75f);
@ -93,7 +93,7 @@ public class LaserBulletType extends BulletType{
Draw.reset();
Tmp.v1.trns(b.rotation(), baseLen * 1.1f);
Drawf.light(b.team(), b.x, b.y, b.x + Tmp.v1.x, b.y + Tmp.v1.y, width * 1.4f * b.fout(), colors[0], 0.6f);
Drawf.light(b.team, b.x, b.y, b.x + Tmp.v1.x, b.y + Tmp.v1.y, width * 1.4f * b.fout(), colors[0], 0.6f);
}
@Override

View file

@ -32,6 +32,6 @@ public class LightningBulletType extends BulletType{
@Override
public void init(Bullet b){
Lightning.create(b.team(), lightningColor, damage, b.x, b.y, b.rotation(), lightningLength + Mathf.random(lightningLengthRand));
Lightning.create(b.team, lightningColor, damage, b.x, b.y, b.rotation(), lightningLength + Mathf.random(lightningLengthRand));
}
}

View file

@ -1,32 +1,27 @@
package mindustry.entities.bullet;
import arc.graphics.*;
import arc.math.*;
import mindustry.content.*;
import mindustry.gen.*;
import mindustry.graphics.*;
public class MissileBulletType extends BasicBulletType{
protected Color trailColor = Pal.missileYellowBack;
public MissileBulletType(float speed, float damage, String bulletSprite){
super(speed, damage, bulletSprite);
backColor = Pal.missileYellowBack;
frontColor = Pal.missileYellow;
homingPower = 0.08f;
shrinkY = 0f;
width = 8f;
height = 8f;
hitSound = Sounds.explosion;
trailChance = 0.2f;
}
public MissileBulletType(float speed, float damage){
this(speed, damage, "missile");
}
public MissileBulletType(){
this(1f, 1f, "missile");
}
@Override
public void update(Bullet b){
super.update(b);
if(Mathf.chanceDelta(0.2)){
Fx.missileTrail.at(b.x, b.y, 2f, trailColor);
}
}
}

View file

@ -603,7 +603,7 @@ public class DesktopInput extends InputHandler{
Payloadc pay = (Payloadc)unit;
if(Core.input.keyTap(Binding.pickupCargo) && pay.payloads().size < unit.type().payloadCapacity){
Unit target = Units.closest(player.team(), pay.x(), pay.y(), unit.type().hitsize * 1.1f, u -> u.isAI() && u.isGrounded());
Unit target = Units.closest(player.team(), pay.x(), pay.y(), unit.type().hitsize * 1.1f, u -> u.isAI() && u.isGrounded() && u.mass() < unit.mass());
if(target != null){
Call.pickupUnitPayload(player, target);
}else if(!pay.hasPayload()){

View file

@ -112,6 +112,7 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
Payloadc pay = (Payloadc)unit;
if(target.isAI() && target.isGrounded() && pay.payloads().size < unit.type().payloadCapacity
&& target.mass() < unit.mass()
&& target.within(unit, unit.type().hitsize * 1.5f)){
pay.pickup(target);
}

View file

@ -1,139 +0,0 @@
package mindustry.io.legacy;
/*
Latest data: [build 81]
0 = Player
1 = Fire
2 = Puddle
3 = MinerDrone
4 = RepairDrone
5 = BuilderDrone
6 = GroundUnit
7 = GroundUnit
8 = GroundUnit
9 = GroundUnit
10 = GroundUnit
11 = FlyingUnit
12 = FlyingUnit
13 = Revenant
Before removal of lightining/bullet: [build 80]
0 = Player
1 = Fire
2 = Puddle
3 = Bullet
4 = Lightning
5 = MinerDrone
6 = RepairDrone
7 = BuilderDrone
8 = GroundUnit
9 = GroundUnit
10 = GroundUnit
11 = GroundUnit
12 = GroundUnit
13 = FlyingUnit
14 = FlyingUnit
15 = Revenant
Before addition of new units: [build 79 and below]
0 = Player
1 = Fire
2 = Puddle
3 = Bullet
4 = Lightning
5 = RepairDrone
6 = GroundUnit
7 = GroundUnit
8 = GroundUnit
9 = GroundUnit
10 = GroundUnit
11 = FlyingUnit
12 = FlyingUnit
13 = BuilderDrone
14 = Revenant
*/
public class LegacyTypeTable{
/*
0 = Player
1 = Fire
2 = Puddle
3 = Draug
4 = Spirit
5 = Phantom
6 = Dagger
7 = Crawler
8 = Titan
9 = Fortress
10 = Eruptor
11 = Wraith
12 = Ghoul
13 = Revenant
private static final Prov[] build81Table = {
Player::new,
Fire::new,
Puddle::new,
MinerDrone::new,
RepairDrone::new,
BuilderDrone::new,
GroundUnit::new,
GroundUnit::new,
GroundUnit::new,
GroundUnit::new,
GroundUnit::new,
FlyingUnit::new,
FlyingUnit::new,
HoverUnit::new
};
private static final Prov[] build80Table = {
Player::new,
Fire::new,
Puddle::new,
Bullet::new,
Lightning::new,
MinerDrone::new,
RepairDrone::new,
BuilderDrone::new,
GroundUnit::new,
GroundUnit::new,
GroundUnit::new,
GroundUnit::new,
GroundUnit::new,
FlyingUnit::new,
FlyingUnit::new,
HoverUnit::new
};
private static final Prov[] build79Table = {
Player::new,
Fire::new,
Puddle::new,
Bullet::new,
Lightning::new,
RepairDrone::new,
GroundUnit::new,
GroundUnit::new,
GroundUnit::new,
GroundUnit::new,
GroundUnit::new,
FlyingUnit::new,
FlyingUnit::new,
BuilderDrone::new,
HoverUnit::new
};
public static Prov[] getTable(int build){
if(build == -1 || build == 81){
//return most recent one since that's probably it; not guaranteed
return build81Table;
}else if(build == 80){
return build80Table;
}else{
return build79Table;
}
}*/
}

View file

@ -69,11 +69,11 @@ public class PointDefenseTurret extends Block{
//retarget
if(timer(timerTarget, retargetTime)){
target = Groups.bullet.intersect(x - range, y - range, range*2, range*2).min(b -> b.team() == team || !b.type().hittable ? Float.MAX_VALUE : b.dst2(this));
target = Groups.bullet.intersect(x - range, y - range, range*2, range*2).min(b -> b.team == team || !b.type().hittable ? Float.MAX_VALUE : b.dst2(this));
}
//look at target
if(target != null && target.within(this, range) && target.team() != team && target.type().hittable){
if(target != null && target.within(this, range) && target.team != team && target.type().hittable){
float dest = angleTo(target);
rotation = Angles.moveToward(rotation, dest, rotateSpeed * edelta());
reload -= edelta();