1
0
mirror of https://github.com/Anuken/Mindustry.git synced 2024-09-11 08:15:35 +03:00

Misc improvements / Latum death unit spawning

This commit is contained in:
Anuken 2022-06-23 13:16:25 -04:00
parent 226d0a9f32
commit 4ba5be8d31
12 changed files with 108 additions and 21 deletions

View File

@ -39,6 +39,7 @@ poly=18
pulsar=19
quad=23
quasar=32
renale=47
risso=20
spiroct=21
stell=43

Binary file not shown.

After

Width:  |  Height:  |  Size: 326 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 750 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 505 B

View File

@ -567,3 +567,4 @@
63117=afflict|block-afflict-ui
63116=shielded-wall|block-shielded-wall-ui
63115=fracture|block-fracture-ui
63114=renale|unit-renale-ui

View File

@ -11,6 +11,7 @@ public class RepairAI extends AIController{
@Nullable Teamc avoid;
float retreatTimer;
Building damagedTarget;
@Override
public void updateMovement(){
@ -57,14 +58,15 @@ public class RepairAI extends AIController{
@Override
public void updateTargeting(){
Building target = Units.findDamagedTile(unit.team, unit.x, unit.y);
if(timer.get(timerTarget, 15)){
damagedTarget = Units.findDamagedTile(unit.team, unit.x, unit.y);
if(damagedTarget instanceof ConstructBuild) damagedTarget = null;
}
if(target instanceof ConstructBuild) target = null;
if(target == null){
if(damagedTarget == null){
super.updateTargeting();
}else{
this.target = target;
this.target = damagedTarget;
}
}
}

View File

@ -4190,7 +4190,7 @@ public class Blocks{
recoil = 3f;
range = 340;
shootCone = 20f;
scaledHealth = 180;
scaledHealth = 220;
rotateSpeed = 1.5f;
researchCostMultiplier = 0.05f;
@ -4198,7 +4198,7 @@ public class Blocks{
}};
fracture = new ItemTurret("fracture"){{
//requirements(Category.turret, with(Items.beryllium, 150, Items.silicon, 200, Items.graphite, 200, Items.carbide, 50));
requirements(Category.turret, with(Items.beryllium, 150, Items.silicon, 200, Items.graphite, 200, Items.carbide, 50));
ammo(
Items.tungsten, new BasicBulletType(8f, 41){{
@ -4215,19 +4215,28 @@ public class Blocks{
trailLength = 3;
hitEffect = despawnEffect = Fx.hitSquaresColor;
buildingDamageMultiplier = 0.2f;
if(false)
spawnBullets.add(new BulletType(){{
instantDisappear = true;
lightning = 6;
lightningLength = 10;
lightningLengthRand = 10;
lightningColor = Color.valueOf("ff6214");
lightningCone = 20f;
damage = 30;
despawnEffect = hitEffect = Fx.none;
}});
}}
);
shoot = new ShootSpread(15, 2f);
coolantMultiplier = 6f;
inaccuracy = 0.2f;
velocityRnd = 0.17f;
shake = 1f;
ammoPerShot = 3;
maxAmmo = 30;
consumeAmmoOnce = true;
//shoot = new ShootAlternate(){{
// shots = 3;
// barrels = 3;
//}};
drawer = new DrawTurret("reinforced-"){{
parts.add(new RegionPart("-blade"){{
@ -4237,7 +4246,6 @@ public class Blocks{
mirror = true;
under = true;
moveX = 2f;
//moveY = -1f;
moveRot = -7f;
moves.add(new PartMove(PartProgress.recoil, 0f, -2f, 3f));
}},
@ -4254,20 +4262,18 @@ public class Blocks{
heatColor = Color.valueOf("ff6214");
moveY = -8f;
progress = PartProgress.recoil;
//drawRegion = false;
mirror = false;
under = true;
}});
}};
shootY = 5f;
shootY = 11f;
outlineColor = Pal.darkOutline;
size = 4;
envEnabled |= Env.space;
reload = 30f;
recoil = 2f;
range = 125;
shootCone = 40f;
scaledHealth = 210;
rotateSpeed = 3f;

View File

@ -89,7 +89,7 @@ public class UnitTypes{
//region neoplasm
public static @EntityDef({Unitc.class, Crawlc.class}) UnitType latum;
public static @EntityDef({Unitc.class, Crawlc.class}) UnitType latum, renale;
//endregion
@ -3906,6 +3906,27 @@ public class UnitTypes{
//endregion
//region erekir - neoplasm
renale = new NeoplasmUnitType("renale"){{
health = 500;
armor = 2;
hitSize = 9f;
omniMovement = false;
rotateSpeed = 2.5f;
drownTimeMultiplier = 2f;
drawCell = false;
segments = 3;
drawBody = false;
hidden = true;
crushDamage = 0.5f;
aiController = HugAI::new;
targetAir = false;
segmentScl = 3f;
segmentPhase = 5f;
segmentMag = 0.5f;
speed = 1.2f;
}};
latum = new NeoplasmUnitType("latum"){{
health = 20000;
armor = 12;
@ -3924,6 +3945,8 @@ public class UnitTypes{
segmentScl = 4f;
segmentPhase = 5f;
speed = 1f;
abilities.add(new SpawnDeathAbility(renale, 5, 11f));
}};
//endregion

View File

@ -869,6 +869,7 @@ public class NetServer implements ApplicationListener{
}
}
//TODO I don't like where this is, move somewhere else?
/** Queues a building health update. This will be sent in a Call.buildHealthUpdate packet later. */
public void buildHealthUpdate(Building build){
buildHealthChanged.add(build.pos());

View File

@ -0,0 +1,39 @@
package mindustry.entities.abilities;
import arc.math.*;
import arc.util.*;
import mindustry.*;
import mindustry.gen.*;
import mindustry.type.*;
/** Spawns a certain amount of units upon death. */
public class SpawnDeathAbility extends Ability{
public UnitType type;
public int amount = 1, randAmount = 0;
/** Random spread of units away from the spawned. */
public float spread = 8f;
/** If true, units spawned face outwards from the middle. */
public boolean faceOutwards = true;
public SpawnDeathAbility(UnitType type, int amount, float spread){
this.type = type;
this.amount = amount;
this.spread = spread;
}
public SpawnDeathAbility(){
}
@Override
public void death(Unit unit){
if(!Vars.net.client()){
int spawned = amount + Mathf.random(randAmount);
for(int i = 0; i < spawned; i++){
Tmp.v1.rnd(Mathf.random(spread));
var u = type.spawn(unit.team, unit.x + Tmp.v1.x, unit.y + Tmp.v1.y);
u.rotation = faceOutwards ? Tmp.v1.angle() : unit.rotation + Mathf.range(5f);
}
}
}
}

View File

@ -26,7 +26,7 @@ abstract class CrawlComp implements Posc, Rotc, Hitboxc, Unitc{
transient Floor lastDeepFloor;
transient float lastCrawlSlowdown = 1f;
transient float segmentRot, crawlTime;
transient float segmentRot, crawlTime = Mathf.random(100f);
@Replace
@Override

View File

@ -3,6 +3,7 @@ package mindustry.graphics;
import arc.*;
import arc.graphics.*;
import arc.graphics.gl.*;
import arc.math.*;
import arc.util.*;
import static mindustry.Vars.*;
@ -31,6 +32,19 @@ public class CacheLayer{
}
}
/** Adds a cache layer at a certain position. All layers >= this index are shifted upwards.*/
public static void add(int index, CacheLayer layer){
index = Mathf.clamp(index, 0, all.length - 1);
var prev = all;
all = new CacheLayer[all.length + 1];
System.arraycopy(prev, 0, all, 0, index);
System.arraycopy(prev, index, all, index + 1, prev.length - index);
all[index] = layer;
}
/** Loads default cache layers. */
public static void init(){
add(