From 4ba5be8d319863a71c583a5aa6d5815316886114 Mon Sep 17 00:00:00 2001 From: Anuken Date: Thu, 23 Jun 2022 13:16:25 -0400 Subject: [PATCH] Misc improvements / Latum death unit spawning --- .../src/main/resources/classids.properties | 1 + .../units/neoplasm/renale-segment0.png | Bin 0 -> 326 bytes .../units/neoplasm/renale-segment1.png | Bin 0 -> 750 bytes .../units/neoplasm/renale-segment2.png | Bin 0 -> 505 bytes core/assets/icons/icons.properties | 1 + core/src/mindustry/ai/types/RepairAI.java | 12 +++--- core/src/mindustry/content/Blocks.java | 34 ++++++++------- core/src/mindustry/content/UnitTypes.java | 25 ++++++++++- core/src/mindustry/core/NetServer.java | 1 + .../entities/abilities/SpawnDeathAbility.java | 39 ++++++++++++++++++ .../mindustry/entities/comp/CrawlComp.java | 2 +- core/src/mindustry/graphics/CacheLayer.java | 14 +++++++ 12 files changed, 108 insertions(+), 21 deletions(-) create mode 100644 core/assets-raw/sprites/units/neoplasm/renale-segment0.png create mode 100644 core/assets-raw/sprites/units/neoplasm/renale-segment1.png create mode 100644 core/assets-raw/sprites/units/neoplasm/renale-segment2.png create mode 100644 core/src/mindustry/entities/abilities/SpawnDeathAbility.java diff --git a/annotations/src/main/resources/classids.properties b/annotations/src/main/resources/classids.properties index 110096dd1d..0c04c4de0b 100644 --- a/annotations/src/main/resources/classids.properties +++ b/annotations/src/main/resources/classids.properties @@ -39,6 +39,7 @@ poly=18 pulsar=19 quad=23 quasar=32 +renale=47 risso=20 spiroct=21 stell=43 diff --git a/core/assets-raw/sprites/units/neoplasm/renale-segment0.png b/core/assets-raw/sprites/units/neoplasm/renale-segment0.png new file mode 100644 index 0000000000000000000000000000000000000000..98230644183ff219fded1936f97b2ce11bdaf037 GIT binary patch literal 326 zcmeAS@N?(olHy`uVBq!ia0y~yU~pkzV6fw0V_;yIv}&&?0|NtNage(c!@6@aFBupZ z89ZGaLn`LHy}nnFNl~CJvE+@TaBjBRNnr2@5;K(vHSPf%{#X$JM6Balz(XT@)>fg{x>)Xu}li!cKPf+ z_1O)r#unD?_cTlo&4^mq5udoTwQY5Ap2N~#r!Bg^DOlam|5t6HF5Pv*VLzAh1g_R- zwT+u*sMJ-hwSGDKmgSZ66Yhkq%U!c=+i7E!4)K_%7s~^(vUl%GjoQoYy33P+;lfh( Xuiw+w)i_oB0{O?&)z4*}Q$iB};Pi>E literal 0 HcmV?d00001 diff --git a/core/assets-raw/sprites/units/neoplasm/renale-segment1.png b/core/assets-raw/sprites/units/neoplasm/renale-segment1.png new file mode 100644 index 0000000000000000000000000000000000000000..36729c3e93939114f8c890f73188f3fd71a063e5 GIT binary patch literal 750 zcmeAS@N?(olHy`uVBq!ia0y~yU~pkzV6fw0V_;yIv}&&?0|NtNage(c!@6@aFBuq^ zR(QHNhE&XXJJU8p#8Kq<|L5+h$`Kk}z0W*c)_DteZ?+P6d*zhVhK&L_N!f`LtvYUS zYaUVB=*=M~qtZTI?e4@K5A~J_uAL&HE~d1xYWB>VGjHCVc{7sfefZmR$E)+}PM>*K z$Z*(z2L)MN>X`fC+L<$fGe0(~bVem#Nl8r=FkI^5{Y0y|LsivFC|=TqM{}w=hidbR zs8cJon&-PjbR3##HQ9b%{mR_+F|b$F_36 zERB?G(Rh0L`uvw)AO7nz(QBFVpna8w^ON^4Pv82czW=`W_xI;)FP*df{eHLEbgiS) z7p%W)Be{Eb^2*q$3$qtnsx4eLXB~^6(e=#qb6ifb9J&GO%?s>87kGB*)<^DX-Ba;z z%a`Rp=lbV2_izSwcTE=vW^Dg$eQdAo|6Eyy505|VC&#>6yfO9BZ?8hJq{$0+vo(Co z(75}0$%@=pGSPqb-0FIuvZRA2sroN-!{b)l-^H%4#93DuW$2t;8c}JPYx?Y=$`gf~ zr?gynn@`5%g~_XKI<2=i{Pz8qu#ai<(xfia9j6#< z_^&pnocCl~I9X}iPLGch8Cfdc#_g)Qc+1{n(y?2wyqGWO2Z$^Xb}7CV7A{pe|5@c$ z5ycbjGgk@}GHzRb_qG3;XpcGBlZ2eu9%wvCE>{k|qTsp4|HIkW;hFaTyo&-z@j z>z}T!Ysn5x=VY&$r!UM1@{yGC)J$s5H8Sb<=XW&Tr+5EJaZu1Zm9||ecdCx3 zr#pLj)$3^!T~b;Dj@-!%dhZw0#p(GoL3L@$ZiAz8yNV{h{xB`oBUf^kOwc5D5830{ zvY#j4(}~^HHswXPR_HXV+ANFI+Vx8}1#K&sGGY7E)xm6`CeLOszW4a_BCB5s;#V9$ z%O~!eS}4)ydHeEr#+7z=Vy*mY3ewQxR%H?QJa&F5G^I+#&vuWGXa*4jTX?tg#QLliMX9Dnpew$2|U?&<31vd$@?2>?CA)sg@J literal 0 HcmV?d00001 diff --git a/core/assets/icons/icons.properties b/core/assets/icons/icons.properties index cccf27c0d5..745fad30aa 100755 --- a/core/assets/icons/icons.properties +++ b/core/assets/icons/icons.properties @@ -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 diff --git a/core/src/mindustry/ai/types/RepairAI.java b/core/src/mindustry/ai/types/RepairAI.java index 4879f673c8..14905a9ad7 100644 --- a/core/src/mindustry/ai/types/RepairAI.java +++ b/core/src/mindustry/ai/types/RepairAI.java @@ -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; } } } diff --git a/core/src/mindustry/content/Blocks.java b/core/src/mindustry/content/Blocks.java index cd9c8a97cd..14983498af 100644 --- a/core/src/mindustry/content/Blocks.java +++ b/core/src/mindustry/content/Blocks.java @@ -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; diff --git a/core/src/mindustry/content/UnitTypes.java b/core/src/mindustry/content/UnitTypes.java index 899926fe9a..8a07e98f4c 100644 --- a/core/src/mindustry/content/UnitTypes.java +++ b/core/src/mindustry/content/UnitTypes.java @@ -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 diff --git a/core/src/mindustry/core/NetServer.java b/core/src/mindustry/core/NetServer.java index a8fd7cc37a..6a83d5a82d 100644 --- a/core/src/mindustry/core/NetServer.java +++ b/core/src/mindustry/core/NetServer.java @@ -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()); diff --git a/core/src/mindustry/entities/abilities/SpawnDeathAbility.java b/core/src/mindustry/entities/abilities/SpawnDeathAbility.java new file mode 100644 index 0000000000..2cf5f5ea47 --- /dev/null +++ b/core/src/mindustry/entities/abilities/SpawnDeathAbility.java @@ -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); + } + } + } +} diff --git a/core/src/mindustry/entities/comp/CrawlComp.java b/core/src/mindustry/entities/comp/CrawlComp.java index 3ee98450c8..d1d8fcb7ce 100644 --- a/core/src/mindustry/entities/comp/CrawlComp.java +++ b/core/src/mindustry/entities/comp/CrawlComp.java @@ -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 diff --git a/core/src/mindustry/graphics/CacheLayer.java b/core/src/mindustry/graphics/CacheLayer.java index c68fd0db3d..ed9019cf64 100644 --- a/core/src/mindustry/graphics/CacheLayer.java +++ b/core/src/mindustry/graphics/CacheLayer.java @@ -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(