Mostly finished T2 spider unit
This commit is contained in:
@@ -1463,6 +1463,17 @@ public class Fx{
|
||||
});
|
||||
}),
|
||||
|
||||
shootSmokeTris = new Effect(30f, e -> {
|
||||
color(Color.white, e.color, e.fin());
|
||||
|
||||
rand.setSeed(e.id);
|
||||
for(int i = 0; i < 10; i++){
|
||||
float rot = e.rotation + rand.range(22f);
|
||||
v.trns(rot, rand.random(e.finpow() * 24f));
|
||||
Fill.poly(e.x + v.x, e.y + v.y, 4, e.fout() * 3.8f + 0.2f, rand.random(360f));
|
||||
}
|
||||
}),
|
||||
|
||||
shootSmokeTitan = new Effect(70f, e -> {
|
||||
rand.setSeed(e.id);
|
||||
for(int i = 0; i < 13; i++){
|
||||
|
||||
@@ -2556,7 +2556,7 @@ public class UnitTypes{
|
||||
bulwark = new UnitType("bulwark"){{
|
||||
drag = 0.1f;
|
||||
speed = 0.62f;
|
||||
hitSize = 19f;
|
||||
hitSize = 23f;
|
||||
health = 7300;
|
||||
armor = 5f;
|
||||
outlineColor = Pal.darkOutline;
|
||||
@@ -2625,7 +2625,7 @@ public class UnitTypes{
|
||||
hitSound = Sounds.none;
|
||||
width = height = 10f;
|
||||
|
||||
lightColor = trailColor = backColor = Color.valueOf("8ca9e8");
|
||||
lightColor = trailColor = backColor = Pal.techBlue;
|
||||
lightRadius = 40f;
|
||||
lightOpacity = 0.7f;
|
||||
|
||||
@@ -2653,24 +2653,25 @@ public class UnitTypes{
|
||||
krepost = new UnitType("krepost"){{
|
||||
drag = 0.1f;
|
||||
speed = 1f;
|
||||
hitSize = 19f;
|
||||
health = 7300;
|
||||
armor = 5f;
|
||||
hitSize = 44f;
|
||||
health = 18000;
|
||||
armor = 8f;
|
||||
outlineColor = Pal.darkOutline;
|
||||
envDisabled = Env.space;
|
||||
rotateSpeed = 1.8f;
|
||||
rotateSpeed = 1.6f;
|
||||
lockLegBase = true;
|
||||
legStraightness = 1f;
|
||||
baseLegStraightness = 0.6f;
|
||||
legContinuousMove = true;
|
||||
legStraightness = 0.6f;
|
||||
baseLegStraightness = 0.5f;
|
||||
|
||||
legCount = 8;
|
||||
legLength = 30f;
|
||||
legTrns = 2f;
|
||||
legTrns = 2.1f;
|
||||
legMoveSpace = 1.05f;
|
||||
rippleScale = 1.2f;
|
||||
landShake = 0.5f;
|
||||
legGroupSize = 2;
|
||||
legExtension = -5f;
|
||||
legExtension = -6f;
|
||||
legBaseOffset = 19f;
|
||||
legStraightLength = 0.9f;
|
||||
maxStretch = 1.2f;
|
||||
@@ -2684,6 +2685,65 @@ public class UnitTypes{
|
||||
hovering = true;
|
||||
visualElevation = 0.4f;
|
||||
groundLayer = Layer.legUnit;
|
||||
|
||||
weapons.add(new Weapon("krepost-weapon"){{
|
||||
mirror = true;
|
||||
rotationLimit = 30f;
|
||||
rotateSpeed = 0.4f;
|
||||
rotate = true;
|
||||
|
||||
x = 43/4f;
|
||||
y = -20f / 4f;
|
||||
shootY = 39 / 4f;
|
||||
shootX = -5f / 4f;
|
||||
recoil = 3f;
|
||||
reload = 30f;
|
||||
shake = 3f;
|
||||
cooldownTime = 20f;
|
||||
|
||||
shots = 3;
|
||||
shotDelay = 3f;
|
||||
inaccuracy = 2f;
|
||||
velocityRnd = 0.1f;
|
||||
heatColor = Color.red;
|
||||
|
||||
bullet = new BasicBulletType(9f, 75){{
|
||||
pierceCap = 2;
|
||||
pierceBuilding = true;
|
||||
|
||||
lifetime = 30f;
|
||||
shootEffect = Fx.shootBigColor;
|
||||
smokeEffect = Fx.shootSmokeTris;
|
||||
frontColor = Color.white;
|
||||
hitSound = Sounds.none;
|
||||
width = 12f;
|
||||
height = 20f;
|
||||
|
||||
lightColor = trailColor = hitColor = backColor = Pal.techBlue;
|
||||
lightRadius = 40f;
|
||||
lightOpacity = 0.7f;
|
||||
|
||||
trailWidth = 2.2f;
|
||||
trailLength = 8;
|
||||
trailChance = -1f;
|
||||
|
||||
despawnEffect = Fx.none;
|
||||
|
||||
//TODO diff effect
|
||||
hitEffect = despawnEffect = new ExplosionEffect(){{
|
||||
lifetime = 30f;
|
||||
waveStroke = 2f;
|
||||
waveColor = sparkColor = trailColor;
|
||||
waveRad = 5f;
|
||||
smokeSize = 0f;
|
||||
smokeSizeBase = 0f;
|
||||
sparks = 5;
|
||||
sparkRad = 20f;
|
||||
sparkLen = 6f;
|
||||
sparkStroke = 2f;
|
||||
}};
|
||||
}};
|
||||
}});
|
||||
}};
|
||||
|
||||
//endregion
|
||||
|
||||
@@ -62,18 +62,18 @@ abstract class LegsComp implements Posc, Rotc, Hitboxc, Flyingc, Unitc{
|
||||
}
|
||||
|
||||
public void resetLegs(float legLength){
|
||||
float rot = baseRotation;
|
||||
int count = type.legCount;
|
||||
|
||||
this.legs = new Leg[count];
|
||||
|
||||
float spacing = 360f / count;
|
||||
|
||||
for(int i = 0; i < legs.length; i++){
|
||||
Leg l = new Leg();
|
||||
|
||||
l.joint.trns(i * spacing + rot, legLength/2f + type.legBaseOffset).add(x, y);
|
||||
l.base.trns(i * spacing + rot, legLength + type.legBaseOffset).add(x, y);
|
||||
float dstRot = legAngle(i) + (type.lockLegBase ? rotation - baseRotation : baseRotation);
|
||||
Vec2 baseOffset = legOffset(Tmp.v5, i).add(x, y);
|
||||
|
||||
l.joint.trns(dstRot, legLength/2f).add(baseOffset);
|
||||
l.base.trns(dstRot, legLength).add(baseOffset);
|
||||
|
||||
legs[i] = l;
|
||||
}
|
||||
@@ -100,13 +100,14 @@ abstract class LegsComp implements Posc, Rotc, Hitboxc, Flyingc, Unitc{
|
||||
float moveSpeed = type.legSpeed;
|
||||
int div = Math.max(legs.length / type.legGroupSize, 2);
|
||||
moveSpace = legLength / 1.6f / (div / 2f) * type.legMoveSpace;
|
||||
totalLength += Mathf.dst(deltaX(), deltaY());
|
||||
//TODO should move legs even when still, based on speed. also, to prevent "slipping", make sure legs move when they are too far from their destination
|
||||
totalLength += type.legContinuousMove ? type.speed : Mathf.dst(deltaX(), deltaY());
|
||||
|
||||
float trns = moveSpace * 0.85f * type.legTrns;
|
||||
|
||||
//rotation + offset vector
|
||||
Vec2 moveOffset = Tmp.v4.trns(rot, trns);
|
||||
boolean moving = moving();
|
||||
Vec2 moveOffset = !moving ? Tmp.v4.setZero() : Tmp.v4.trns(Angles.angle(deltaX(), deltaY()), trns);
|
||||
|
||||
lastDeepFloor = null;
|
||||
int deeps = 0;
|
||||
@@ -116,6 +117,7 @@ abstract class LegsComp implements Posc, Rotc, Hitboxc, Flyingc, Unitc{
|
||||
Vec2 baseOffset = legOffset(Tmp.v5, i).add(x, y);
|
||||
Leg l = legs[i];
|
||||
|
||||
//TODO is limiting twice necessary?
|
||||
l.joint.sub(baseOffset).limit(type.maxStretch * legLength/2f).add(baseOffset);
|
||||
l.base.sub(baseOffset).limit(type.maxStretch * legLength).add(baseOffset);
|
||||
|
||||
@@ -141,7 +143,7 @@ abstract class LegsComp implements Posc, Rotc, Hitboxc, Flyingc, Unitc{
|
||||
if(l.group != group){
|
||||
|
||||
//create effect when transitioning to a group it can't move in
|
||||
if(!move && i % div == l.group){
|
||||
if(!move && (moving || !type.legContinuousMove) && i % div == l.group){
|
||||
if(floor.isLiquid){
|
||||
floor.walkEffect.at(l.base.x, l.base.y, type.rippleScale, floor.mapColor);
|
||||
floor.walkSound.at(x, y, 1f, floor.walkSoundVolume);
|
||||
@@ -179,6 +181,10 @@ abstract class LegsComp implements Posc, Rotc, Hitboxc, Flyingc, Unitc{
|
||||
}
|
||||
|
||||
l.joint.lerpDelta(jointDest, moveSpeed / 4f);
|
||||
|
||||
//limit again after updating
|
||||
l.joint.sub(baseOffset).limit(type.maxStretch * legLength/2f).add(baseOffset);
|
||||
l.base.sub(baseOffset).limit(type.maxStretch * legLength).add(baseOffset);
|
||||
}
|
||||
|
||||
//when at least 1 leg is touching land, it can't drown
|
||||
|
||||
@@ -57,6 +57,10 @@ public class OverlayRenderer{
|
||||
}
|
||||
}
|
||||
|
||||
if(pos.isEmpty()){
|
||||
return;
|
||||
}
|
||||
|
||||
//if this is laggy, it could be shoved in another thread.
|
||||
var result = Voronoi.generate(pos.toArray(Vec2.class), 0, world.unitWidth(), 0, world.unitHeight());
|
||||
for(var edge : result){
|
||||
|
||||
@@ -127,6 +127,7 @@ public class Pal{
|
||||
|
||||
redLight = Color.valueOf("feb380"),
|
||||
slagOrange = Color.valueOf("ffa166"),
|
||||
techBlue = Color.valueOf("8ca9e8"),
|
||||
|
||||
vent = Color.valueOf("6b4e4e");
|
||||
}
|
||||
|
||||
@@ -113,7 +113,7 @@ public class UnitType extends UnlockableContent{
|
||||
public float legSplashDamage = 0f, legSplashRange = 5;
|
||||
public float legStraightLength = 1f;
|
||||
/** If true, legs are locked to the base of the unit instead of being on an implicit rotating "mount". */
|
||||
public boolean lockLegBase = false;
|
||||
public boolean lockLegBase = false, legContinuousMove;
|
||||
public float baseLegStraightness, legStraightness;
|
||||
/** TODO neither of these appear to do much */
|
||||
public boolean flipBackLegs = true, flipLegSide = false;
|
||||
@@ -1043,7 +1043,6 @@ public class UnitType extends UnlockableContent{
|
||||
for(int j = legs.length - 1; j >= 0; j--){
|
||||
int i = (j % 2 == 0 ? j/2 : legs.length - 1 - j/2);
|
||||
Leg leg = legs[i];
|
||||
float angle = unit.legAngle(i);
|
||||
boolean flip = i >= legs.length/2f;
|
||||
int flips = Mathf.sign(flip);
|
||||
|
||||
@@ -1074,8 +1073,13 @@ public class UnitType extends UnlockableContent{
|
||||
if(jointRegion.found()){
|
||||
Draw.rect(jointRegion, leg.joint.x, leg.joint.y);
|
||||
}
|
||||
}
|
||||
|
||||
if(baseJointRegion.found()){
|
||||
//base joints are drawn after everything else
|
||||
if(baseJointRegion.found()){
|
||||
for(int j = legs.length - 1; j >= 0; j--){
|
||||
//TODO does the index / draw order really matter?
|
||||
Vec2 position = unit.legOffset(legOffset, (j % 2 == 0 ? j/2 : legs.length - 1 - j/2)).add(unit);
|
||||
Draw.rect(baseJointRegion, position.x, position.y, rotation);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -414,8 +414,8 @@ public class Weapon implements Cloneable{
|
||||
}
|
||||
|
||||
protected @Nullable Bullet bullet(Unit unit, float shootX, float shootY, float angle, float lifescl){
|
||||
float xr = Mathf.range(xRand);
|
||||
float
|
||||
xr = Mathf.range(xRand),
|
||||
x = shootX + Angles.trnsx(angle, 0, xr),
|
||||
y = shootY + Angles.trnsy(angle, 0, xr);
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@ import arc.scene.ui.*;
|
||||
import arc.scene.ui.layout.*;
|
||||
import arc.struct.*;
|
||||
import arc.util.*;
|
||||
import mindustry.content.*;
|
||||
import mindustry.core.*;
|
||||
import mindustry.entities.*;
|
||||
import mindustry.entities.units.*;
|
||||
@@ -484,7 +485,7 @@ public class PlacementFragment extends Fragment{
|
||||
}
|
||||
|
||||
//if the tile has a drop, display the drop
|
||||
if(hoverTile.drop() != null || hoverTile.wallDrop() != null || hoverTile.floor().liquidDrop != null){
|
||||
if((hoverTile.drop() != null && hoverTile.block() == Blocks.air) || hoverTile.wallDrop() != null || hoverTile.floor().liquidDrop != null){
|
||||
return hoverTile;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user