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!ia0vp^EE>0Dv!@mce*NOU45%x@4E9!qT=!3|_mB zX-#SU#*(SL{q^3Jb(>@N@3EVAZdG>JT}3JX(CXzg8(NJm ztlRHtm>!xDwXh>Tac67W>f$_yrN2&FbbV8>x}pEC+Cp8r>xRRAF69Yat5H_cF~ zt6FRQa`r9DE9WQN30s%DX4|&Y#ws1+F;Op;2V`aM-j^D+m)muhCj-NUrR-n7r>(1T Rs`v%+ji;-h%Q~loCIH~{iLL+u 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 zcmVPx%s7XXYRCt{2nLTI}K@`XT=SO8DSSX5(=14@YOB0K;IuPyD%0jTQ5Nu*=VUaqB z*b6DdBC$&d9vmcxmnPkjxZy6Q5v`OICl(^HdYhTqnc3Z$*;xYbSMAQndvAWr%ia z3@Mc-2qlB4TFR*^gP%lLh{BmVlRut+scm0cT!>uBF~Rqv>CBkxw6WFQOz%xH2vLeU zS0wbA5;T}i2C>!M%#}ebEiPo{>If+%SfC;@0HE1w>xLN_4P^;cO9>K0m2v+1&Gh=l zwF~KWSs8>V<;&Nf>Gk3Mjx;WWl;DS|C`07$>C4*oC%@lI_wUX<(#}2m@4GgaD#e$e zuiZQuySrnlU6rA0qd6v_rkt(>5i-|lXU+;jT?j2uCxf6qRiH_VEq__Og}iwFwDhO> zolkFrj0sVTikA>m0f+lL#=SlNZ5;sc!he{ z>Kt4AyxNN3B&3K8Vtf4qfa8Td`*TI=7X_#?Xe`a8Sa~^ZHRjBG4}WR6HGN*rDBRTxXJ)L57mQY&q)TMlOndc zNb!*Y1bFRUx_Z&tKS+|s+UiOJ&@WIFpc6!M)>c;#PaO4G5+%Gv~-AybBpHH)mQ|tUx)WQ zw~xvuzkBb2^g4XFE$?|%6m7Sv>QRaQ&mCZv;v*vzwFm*SQdH`Y0n{i2FiWXR2E#B6 g!!QiPFw9BiKmCMB6A-GwF8}}l07*qoM6N<$f(J2RoB#j- literal 0 HcmV?d00001 diff --git a/core/assets-raw/sprites/units/neoplasm/renale-segment2.png b/core/assets-raw/sprites/units/neoplasm/renale-segment2.png new file mode 100644 index 0000000000000000000000000000000000000000..067b85151934e65cc70a98eba0e3b13d3e44263d GIT binary patch literal 505 zcmeAS@N?(olHy`uVBq!ia0vp^E!E-Krdz#QzT7%idAEfsq-qE-0#9~JwP z{vYO)YYYB(U+9_UbQx$W14F~?1#3n3M6Or6{`vOZeO}wO7TQV9k_zf#Z##8i%CsPp z9&P8~Ag_rFT7xcs{-m0DtkS~t{bP-L;Wh~iuat(~SW?p`zhAC=)&I}4J{Rozr>pB) zvP083*=y$M3p0XzB&9qxlbUmlO#1!#9gX+t-G5RX6!cD|ZCA>js$+YP1c=Y+&R$;i zdfG&nl-7VFcQS+C`^9u|dj3pMU7E7n;HccLqKU6ROiT61m7FCLG>P3q_IS4J=gIeU zVt2JodC{#EI?bv!%ObUQ{nAZA+X|*k*#2~NFk7g}v)PO9JwCn2>Q{pJ701u=iTkD& zO7wZ&zWkkWrQMyFYg~m>H~sa}ZPlK=JE*C(g=d|js>)<#)nAKV-BwatdArrR`Est` zrHi$4Iogw)+p@zv*!k9M+P1V@qVH|m-dSgqELB^+y$rdZQ~rC}D+w#(UwX#;m;URk s9-iu5s^j&h_W%BLW^l+N5e|%X43|ufKYAfs=MNJ0boFyt=akR{06oLik^lez 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(