new core unit
This commit is contained in:
@@ -1687,7 +1687,7 @@ public class Blocks implements ContentList{
|
||||
coreBastion = new CoreBlock("core-bastion"){{
|
||||
requirements(Category.effect, BuildVisibility.editorOnly, with(Items.beryllium, 1000, Items.graphite, 1000));
|
||||
|
||||
unitType = UnitTypes.alpha;
|
||||
unitType = UnitTypes.spark;
|
||||
health = 3000;
|
||||
itemCapacity = 3000; //TODO more or less?
|
||||
size = 3;
|
||||
|
||||
@@ -39,7 +39,8 @@ public class UnitTypes implements ContentList{
|
||||
public static @EntityDef(value = {Unitc.class, Legsc.class}, legacy = true) UnitType spiroct, arkyid, toxopid;
|
||||
|
||||
//air
|
||||
public static @EntityDef({Unitc.class}) UnitType flare, eclipse, horizon, zenith, antumbra;
|
||||
public static @EntityDef({Unitc.class}) UnitType flare, eclipse, horizon, zenith, antumbra,
|
||||
spark;
|
||||
|
||||
//air, legacy
|
||||
public static @EntityDef(value = {Unitc.class}, legacy = true) UnitType mono;
|
||||
@@ -2410,6 +2411,68 @@ public class UnitTypes implements ContentList{
|
||||
}});
|
||||
}};
|
||||
|
||||
//TODO bad name
|
||||
spark = new UnitType("spark"){{
|
||||
defaultController = BuilderAI::new;
|
||||
isCounted = false;
|
||||
|
||||
lowAltitude = false;
|
||||
flying = true;
|
||||
targetAir = false;
|
||||
mineSpeed = 6.5f;
|
||||
mineTier = 1;
|
||||
buildSpeed = 0.8f;
|
||||
drag = 0.06f;
|
||||
speed = 2.5f;
|
||||
rotateSpeed = 9f;
|
||||
accel = 0.1f;
|
||||
itemCapacity = 40;
|
||||
health = 300f;
|
||||
armor = 1f;
|
||||
hitSize = 9f;
|
||||
commandLimit = 5;
|
||||
engineSize = 0;
|
||||
|
||||
//TODO ugly definition...
|
||||
engines = new UnitEngine[]{
|
||||
new UnitEngine(21 / 4f, 19 / 4f, 2.2f, 45f),
|
||||
new UnitEngine(-21 / 4f, 19 / 4f, 2.2f, 135f),
|
||||
|
||||
new UnitEngine(23 / 4f, -22 / 4f, 2.2f, 315f),
|
||||
new UnitEngine(-23 / 4f, -22 / 4f, 2.2f, 225f)
|
||||
};
|
||||
|
||||
weapons.add(new Weapon(""){{
|
||||
reload = 55f;
|
||||
x = 0f;
|
||||
y = 1f;
|
||||
top = false;
|
||||
mirror = false;
|
||||
|
||||
bullet = new ArtilleryBulletType(3f, 11){{
|
||||
trailLength = 8;
|
||||
trailWidth = 2.4f;
|
||||
collidesTiles = true;
|
||||
collides = true;
|
||||
trailEffect = Fx.none;
|
||||
trailColor = Pal.bulletYellowBack;
|
||||
homingPower = 0.01f;
|
||||
splashDamage = 10;
|
||||
splashDamageRadius = 20f;
|
||||
weaveMag = 2f;
|
||||
weaveScale = 4f;
|
||||
width = 10f;
|
||||
height = 13f;
|
||||
|
||||
lifetime = 50f;
|
||||
hitEffect = Fx.blastExplosion;
|
||||
shootEffect = Fx.shootBig;
|
||||
smokeEffect = Fx.shootBigSmoke;
|
||||
buildingDamageMultiplier = 0.4f;
|
||||
}};
|
||||
}});
|
||||
}};
|
||||
|
||||
//endregion
|
||||
//region internal
|
||||
|
||||
|
||||
@@ -118,6 +118,7 @@ public class UnitType extends UnlockableContent{
|
||||
public boolean canDrown = true, naval = false;
|
||||
public float drownTimeMultiplier = 1f;
|
||||
public float engineOffset = 5f, engineSize = 2.5f;
|
||||
public UnitEngine[] engines = {};
|
||||
public float strafePenalty = 0.5f;
|
||||
public float hitSize = 6f;
|
||||
public float itemOffsetY = 3f;
|
||||
@@ -641,6 +642,7 @@ public class UnitType extends UnlockableContent{
|
||||
if(drawBody) drawOutline(unit);
|
||||
drawWeaponOutlines(unit);
|
||||
if(engineSize > 0) drawEngine(unit);
|
||||
if(engines.length > 0) drawEngines(unit);
|
||||
if(drawBody) drawBody(unit);
|
||||
if(drawCell) drawCell(unit);
|
||||
drawWeapons(unit);
|
||||
@@ -788,6 +790,33 @@ public class UnitType extends UnlockableContent{
|
||||
Draw.color();
|
||||
}
|
||||
|
||||
public void drawEngines(Unit unit){
|
||||
if(!unit.isFlying()) return;
|
||||
|
||||
float scale = unit.elevation;
|
||||
float rot = unit.rotation - 90;
|
||||
|
||||
for(var engine : engines){
|
||||
Tmp.v1.set(engine.x, engine.y).rotate(rot);
|
||||
float ex = Tmp.v1.x, ey = Tmp.v1.y;
|
||||
|
||||
Draw.color(unit.team.color);
|
||||
Fill.circle(
|
||||
unit.x + ex,
|
||||
unit.y + ey,
|
||||
(engine.radius + Mathf.absin(Time.time, 2f, engine.radius / 4f)) * scale
|
||||
);
|
||||
Draw.color(Color.white);
|
||||
Fill.circle(
|
||||
unit.x + ex - Angles.trnsx(rot + engine.rotation, 1f),
|
||||
unit.y + ey - Angles.trnsy(rot + engine.rotation, 1f),
|
||||
(engine.radius + Mathf.absin(Time.time, 2f, engine.radius / 4f)) / 2f * scale
|
||||
);
|
||||
}
|
||||
|
||||
Draw.color();
|
||||
}
|
||||
|
||||
public void drawWeapons(Unit unit){
|
||||
applyColor(unit);
|
||||
|
||||
@@ -1003,4 +1032,18 @@ public class UnitType extends UnlockableContent{
|
||||
|
||||
//endregion
|
||||
|
||||
public static class UnitEngine{
|
||||
public float x, y, radius, rotation;
|
||||
|
||||
public UnitEngine(float x, float y, float radius, float rotation){
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.radius = radius;
|
||||
this.rotation = rotation;
|
||||
}
|
||||
|
||||
public UnitEngine(){
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user