Implemented Fortress unit / Made artillery ignore air

This commit is contained in:
Anuken 2018-10-01 09:51:12 -04:00
parent d5d90bde9a
commit d2ce051c4a
28 changed files with 680 additions and 618 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 315 B

After

Width:  |  Height:  |  Size: 600 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 96 B

After

Width:  |  Height:  |  Size: 157 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 92 B

After

Width:  |  Height:  |  Size: 147 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 102 B

After

Width:  |  Height:  |  Size: 166 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 104 B

After

Width:  |  Height:  |  Size: 222 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 184 B

After

Width:  |  Height:  |  Size: 404 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 102 B

After

Width:  |  Height:  |  Size: 166 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 104 B

After

Width:  |  Height:  |  Size: 173 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 211 B

After

Width:  |  Height:  |  Size: 391 B

View File

@ -607,6 +607,7 @@ block.wraith-factory.name=Wraith Fighter Factory
block.ghoul-factory.name=Ghoul Bomber Factory
block.dagger-factory.name=Dagger Mech Factory
block.titan-factory.name=Titan Mech Factory
block.fortress-factory.name=Fortress Mech Factory
block.revenant-factory.name=Revenant Fighter Factory
block.repair-point.name=Repair Point
block.pulse-conduit.name=Pulse Conduit

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 100 KiB

After

Width:  |  Height:  |  Size: 102 KiB

View File

@ -9,13 +9,14 @@ import io.anuke.mindustry.type.AmmoType;
import io.anuke.mindustry.type.ContentType;
public class AmmoTypes implements ContentList{
public static AmmoType bulletCopper, bulletDense, bulletThorium, bulletSilicon, bulletPyratite,
public static AmmoType
bulletCopper, bulletDense, bulletThorium, bulletSilicon, bulletPyratite,
bulletDenseBig, bulletPyratiteBig, bulletThoriumBig,
shock, bombExplosive, bombIncendiary, bombOil, shellCarbide, flamerThermite, weaponMissile, weaponMissileSwarm, bulletMech,
healBlaster, bulletGlaive,
flakExplosive, flakPlastic, flakSurge,
missileExplosive, missileIncindiary, missileSurge,
artilleryDense, artilleryPlastic, artilleryHoming, artilleryIncindiary, artilleryExplosive,
artilleryDense, artilleryPlastic, artilleryHoming, artilleryIncindiary, artilleryExplosive, unitArtillery,
basicFlame, lancerLaser, lightning, spectreLaser, meltdownLaser, fuseShotgun, oil, water, lava, cryofluid, arc;
@Override
@ -201,6 +202,13 @@ public class AmmoTypes implements ContentList{
reloadMultiplier = 1.6f;
}};
unitArtillery = new AmmoType(Items.blastCompound, ArtilleryBullets.unit, 1){{
shootEffect = ShootFx.shootBig2;
smokeEffect = ShootFx.shootBigSmoke2;
reloadMultiplier = 1.6f;
}};
//flame
basicFlame = new AmmoType(Liquids.oil, TurretBullets.basicFlame, 0.3f){{

View File

@ -107,7 +107,7 @@ public class Mechs implements ContentList{
float healAmount = 10f;
float healReload = 160f;
Rectangle rect = new Rectangle();
boolean wasHeadled;
boolean wasHealed;
{
drillPower = 4;
@ -128,20 +128,20 @@ public class Mechs implements ContentList{
public void updateAlt(Player player){
if(player.timer.get(Player.timerAbility, healReload)){
wasHeadled = false;
wasHealed = false;
rect.setSize(healRange*2f).setCenter(player.x, player.y);
Units.getNearby(player.getTeam(), rect, unit -> {
if(unit.distanceTo(player) <= healRange){
if(unit.health < unit.maxHealth()){
Effects.effect(UnitFx.heal, unit);
wasHeadled = true;
wasHealed = true;
}
unit.healBy(healAmount);
}
});
if(wasHeadled){
if(wasHealed){
Effects.effect(UnitFx.healWave, player);
}
}

View File

@ -167,6 +167,7 @@ public class Recipes implements ContentList{
new Recipe(units, UnitBlocks.daggerFactory, new ItemStack(Items.lead, 90), new ItemStack(Items.silicon, 70));
new Recipe(units, UnitBlocks.titanFactory, new ItemStack(Items.thorium, 90), new ItemStack(Items.lead, 140), new ItemStack(Items.silicon, 90));
new Recipe(units, UnitBlocks.fortressFactory, new ItemStack(Items.thorium, 200), new ItemStack(Items.lead, 220), new ItemStack(Items.silicon, 150), new ItemStack(Items.surgealloy, 100), new ItemStack(Items.phasematter, 50));
new Recipe(units, UnitBlocks.wraithFactory, new ItemStack(Items.titanium, 60), new ItemStack(Items.lead, 80), new ItemStack(Items.silicon, 90));
new Recipe(units, UnitBlocks.ghoulFactory, new ItemStack(Items.plastanium, 80), new ItemStack(Items.titanium, 100), new ItemStack(Items.lead, 130), new ItemStack(Items.silicon, 220));

View File

@ -58,17 +58,21 @@ public class UnitTypes implements ContentList{
speed = 0.18f;
drag = 0.4f;
range = 10f;
rotatespeed = 0.1f;
weapon = Weapons.flamethrower;
health = 440;
}};
fortress = new UnitType("fortress", Fortress.class, Fortress::new){{
maxVelocity = 0.8f;
speed = 0.18f;
speed = 0.15f;
drag = 0.4f;
range = 10f;
rotatespeed = 0.06f;
weaponOffsetX = 1;
targetAir = false;
weapon = Weapons.artillery;
health = 500;
health = 800;
}};
wraith = new UnitType("wraith", Wraith.class, Wraith::new){{
@ -86,6 +90,7 @@ public class UnitTypes implements ContentList{
maxVelocity = 1.4f;
drag = 0.01f;
isFlying = true;
targetAir = false;
weapon = Weapons.bomber;
}};

View File

@ -124,9 +124,10 @@ public class Weapons implements ContentList{
length = 1f;
reload = 60f;
roundrobin = true;
recoil = 1f;
recoil = 5f;
shake = 2f;
ejectEffect = ShootFx.shellEjectMedium;
ammo = AmmoTypes.artilleryExplosive;
ammo = AmmoTypes.unitArtillery;
}};
sapper = new Weapon("sapper"){{

View File

@ -11,7 +11,7 @@ public class UnitBlocks extends BlockList implements ContentList{
public static Block
spiritFactory, phantomFactory,
wraithFactory, ghoulFactory, revenantFactory,
daggerFactory, titanFactory,
daggerFactory, titanFactory, fortressFactory,
reconstructor, repairPoint, commandCenter;
@Override
@ -75,6 +75,15 @@ public class UnitBlocks extends BlockList implements ContentList{
consumes.items(new ItemStack[]{new ItemStack(Items.silicon, 20), new ItemStack(Items.thorium, 30)});
}};
fortressFactory = new UnitFactory("fortress-factory"){{
type = UnitTypes.fortress;
produceTime = 5000;
size = 3;
consumes.power(0.2f);
shadow = "shadow-round-3";
consumes.items(new ItemStack[]{new ItemStack(Items.silicon, 40), new ItemStack(Items.thorium, 50)});
}};
repairPoint = new RepairPoint("repair-point"){{
shadow = "shadow-round-1";
repairSpeed = 0.1f;

View File

@ -9,7 +9,7 @@ import io.anuke.mindustry.graphics.Palette;
import io.anuke.mindustry.game.ContentList;
public class ArtilleryBullets extends BulletList implements ContentList{
public static BulletType dense, plastic, plasticFrag, homing, incindiary, explosive, surge;
public static BulletType dense, plastic, plasticFrag, homing, incindiary, explosive, surge, unit;
@Override
public void load(){
@ -99,6 +99,20 @@ public class ArtilleryBullets extends BulletList implements ContentList{
}
};
unit = new ArtilleryBulletType(2f, 0, "shell"){
{
hiteffect = BulletFx.blastExplosion;
knockback = 0.8f;
lifetime = 90f;
bulletWidth = bulletHeight = 14f;
collides = true;
splashDamageRadius = 45f;
splashDamage = 50f;
backColor = Palette.bulletYellowBack;
frontColor = Palette.bulletYellow;
}
};
surge = new ArtilleryBulletType(3f, 0, "shell"){
{
//TODO

View File

@ -13,6 +13,7 @@ public class ArtilleryBulletType extends BasicBulletType{
super(speed, damage, bulletSprite);
collidesTiles = false;
collides = false;
collidesAir = false;
hitShake = 1f;
}

View File

@ -12,5 +12,6 @@ public class BombBulletType extends BasicBulletType{
lifetime = 30f;
drag = 0.05f;
keepVelocity = false;
collidesAir = false;
}
}

View File

@ -180,7 +180,7 @@ public class Bullet extends BulletEntity<BulletType> implements TeamTrait, SyncT
@Override
public boolean collides(SolidTrait other){
return type.collides && super.collides(other) && !supressCollision;
return type.collides && super.collides(other) && !supressCollision && !(other instanceof Unit && ((Unit) other).isFlying() && !type.collidesAir);
}
@Override

View File

@ -37,6 +37,8 @@ public abstract class BulletType extends Content implements BaseBulletType<Bulle
public boolean collidesTiles = true;
/**Whether this bullet type collides with tiles that are of the same team.*/
public boolean collidesTeam = false;
/**Whether this bullet type collides with air units.*/
public boolean collidesAir = true;
/**Whether this bullet types collides with anything at all.*/
public boolean collides = true;
/**Whether velocity is inherited from the shooter.*/

View File

@ -190,7 +190,7 @@ public abstract class BaseUnit extends Unit implements ShooterTrait{
}
public void targetClosest(){
target = Units.getClosestTarget(team, x, y, getWeapon().getAmmo().getRange());
target = Units.getClosestTarget(team, x, y, getWeapon().getAmmo().getRange(), u -> type.targetAir || !u.isFlying());
}
public TileEntity getClosestEnemyCore(){

View File

@ -60,13 +60,7 @@ public abstract class GroundUnit extends BaseUnit{
if(distanceTo(target) > 400f){
moveAwayFromCore();
}else{
vec.trns(baseRotation, type.speed);
velocity.add(vec.x, vec.y);
vec.trns(baseRotation, type.hitsizeTile);
Tile tile = world.tileWorld(x + vec.x, y + vec.y);
if((tile == null || tile.solid() || tile.floor().drownTime > 0) || stuckTime > 10f){
baseRotation += Mathf.sign(id % 2 - 0.5f) * Timers.delta() * 3f;
}
patrol();
}
}
}
@ -128,7 +122,11 @@ public abstract class GroundUnit extends BaseUnit{
stuckTime = !vec.set(x, y).sub(lastPosition().x, lastPosition().y).isZero(0.0001f) ? 0f : stuckTime + Timers.delta();
if(!velocity.isZero(0.0001f) && (Units.invalidateTarget(target, this) || (distanceTo(target) > getWeapon().getAmmo().getRange()))){
rotation = Mathf.slerpDelta(rotation, velocity.angle(), 0.2f);
rotation = Mathf.slerpDelta(rotation, velocity.angle(), type.rotatespeed);
}
if(stuckTime < 1f){
walkTime += Timers.delta();
}
}
@ -145,9 +143,7 @@ public abstract class GroundUnit extends BaseUnit{
public void draw(){
Draw.alpha(hitTime / hitDuration);
float walktime = walkTime;
float ft = Mathf.sin(walktime, 6f, 2f);
float ft = Mathf.sin(walkTime * type.speed*5f, 6f, 2f);
Floor floor = getFloorOn();
@ -241,6 +237,16 @@ public abstract class GroundUnit extends BaseUnit{
super.readSave(stream);
}
protected void patrol(){
vec.trns(baseRotation, type.speed);
velocity.add(vec.x, vec.y);
vec.trns(baseRotation, type.hitsizeTile);
Tile tile = world.tileWorld(x + vec.x, y + vec.y);
if((tile == null || tile.solid() || tile.floor().drownTime > 0) || stuckTime > 10f){
baseRotation += Mathf.sign(id % 2 - 0.5f) * Timers.delta() * 3f;
}
}
protected void circle(float circleLength){
if(target == null) return;
@ -265,7 +271,6 @@ public abstract class GroundUnit extends BaseUnit{
vec.trns(baseRotation, type.speed);
baseRotation = Mathf.slerpDelta(baseRotation, angleTo(targetTile), 0.05f);
walkTime += Timers.delta();
velocity.add(vec);
}
@ -290,7 +295,6 @@ public abstract class GroundUnit extends BaseUnit{
vec.trns(baseRotation, type.speed);
baseRotation = Mathf.slerpDelta(baseRotation, angleTo(targetTile), 0.05f);
walkTime += Timers.delta();
velocity.add(vec);
}
}

View File

@ -30,10 +30,11 @@ public class UnitType extends UnlockableContent{
public float hitsizeTile = 4f;
public float speed = 0.4f;
public float range = 160;
public float rotatespeed = 0.1f;
public float rotatespeed = 0.2f;
public float baseRotateSpeed = 0.1f;
public float mass = 1f;
public boolean isFlying;
public boolean targetAir = true;
public float drag = 0.1f;
public float maxVelocity = 5f;
public float retreatPercent = 0.2f;

View File

@ -1,6 +1,21 @@
package io.anuke.mindustry.entities.units.types;
import io.anuke.mindustry.entities.Units;
import io.anuke.mindustry.entities.units.GroundUnit;
public class Fortress extends GroundUnit{
@Override
protected void patrol(){
if(Units.invalidateTarget(target, this)){
super.patrol();
}
}
@Override
protected void moveToCore(){
if(Units.invalidateTarget(target, this)){
super.moveToCore();
}
}
}

View File

@ -63,7 +63,6 @@ public class BundleLauncher {
result.append("\n");
}
Files.write(child, result.toString().getBytes());
//PropertiesUtils.store(other, Files.newBufferedWriter(output), null);
}catch (IOException e){
throw new RuntimeException(e);