From 131881ac2283d14691ce35f07bde6a88c68a2708 Mon Sep 17 00:00:00 2001 From: Slotterleet <62336673+Slotterleet@users.noreply.github.com> Date: Fri, 1 Nov 2024 16:52:20 +0300 Subject: [PATCH] Mostly bug-related stuff. I don't remember at this point. --- res/bundles/bundle.properties | 7 +- res/bundles/bundle_ru.properties | 7 +- .../blocks/liquid/copper-pipe-bottom-0.png | Bin 189 -> 0 bytes .../blocks/liquid/copper-pipe-bottom-1.png | Bin 222 -> 0 bytes .../blocks/liquid/copper-pipe-bottom-2.png | Bin 216 -> 0 bytes .../blocks/liquid/copper-pipe-bottom-3.png | Bin 222 -> 0 bytes .../blocks/liquid/copper-pipe-bottom-4.png | Bin 220 -> 0 bytes revisions/BugBurrowLegsUnit/1.json | 1 + revisions/BugBurrowLegsUnit/2.json | 1 + src/fos/ai/FOSPathfinder.java | 4 +- src/fos/ai/bugs/BugAI.java | 4 +- src/fos/content/FOSBlocks.java | 2 +- src/fos/content/FOSFx.java | 42 +++++- src/fos/content/FOSStatuses.java | 30 +--- src/fos/content/FOSUnitTypes.java | 21 ++- src/fos/content/LumoniTechTree.java | 2 +- src/fos/controllers/AcidController.java | 142 +++--------------- src/fos/entities/Acid.java | 107 +++++++++++++ .../type/abilities/AcidExplodeAbility.java | 39 +++++ .../type/blocks/production/OreDetector.java | 13 ++ src/fos/type/blocks/units/BugSpawn.java | 2 +- src/fos/type/units/comp/BurrowComp.java | 104 +++++++++++-- src/fos/type/units/types/BugUnitType.java | 8 +- src/fos/type/units/types/BurrowUnitType.java | 5 +- 24 files changed, 353 insertions(+), 188 deletions(-) delete mode 100644 res/sprites/blocks/liquid/copper-pipe-bottom-0.png delete mode 100644 res/sprites/blocks/liquid/copper-pipe-bottom-1.png delete mode 100644 res/sprites/blocks/liquid/copper-pipe-bottom-2.png delete mode 100644 res/sprites/blocks/liquid/copper-pipe-bottom-3.png delete mode 100644 res/sprites/blocks/liquid/copper-pipe-bottom-4.png create mode 100644 revisions/BugBurrowLegsUnit/1.json create mode 100644 revisions/BugBurrowLegsUnit/2.json create mode 100644 src/fos/entities/Acid.java create mode 100644 src/fos/type/abilities/AcidExplodeAbility.java diff --git a/res/bundles/bundle.properties b/res/bundles/bundle.properties index b2e59acd..4b690bf6 100644 --- a/res/bundles/bundle.properties +++ b/res/bundles/bundle.properties @@ -27,6 +27,8 @@ accelerator.confirmtext = This core will be sent towards the nearest planet. Do ability.hackfield = Hack Field ability.unitresistance = Damage Resistance +ability.acidexplode = Corrosive Innards +ability.acidexplode.description = Releases acid on death. bar.units = Units: {0}/{1} bar.detectorreq = Ore Detector Required @@ -159,8 +161,8 @@ block.fos-pumpjack.name = Pumpjack block.fos-pumpjack.description = Pumps and outputs liquids at a faster rate. block.fos-fluid-router.name = Fluid Router block.fos-fluid-router.description = Accepts liquids and outputs them to up to 3 directions equally. Also stores a certain amount of fluid. -block.fos-fluid-barrel.name = Fluid Barrel -block.fos-fluid-barrel.description = Stores a sizeable amount of fluid. Outputs to all sides, similarly to a fluid router. +block.fos-fluid-container.name = Fluid Container +block.fos-fluid-container.description = Stores a sizeable amount of fluid. Outputs to all sides, similarly to a fluid router. block.fos-fluid-tank.name = Fluid Tank block.fos-fluid-tank.description = Stores a large amount of fluid. Outputs to all sides, similarly to a fluid router. block.fos-tin-wire.name = Zinc Wire @@ -352,6 +354,7 @@ status.fos-hacked.name = Hacked status.fos-injected.name = Injected status.fos-injected.description = [#8ae3df]Injectors[] will have increased chance of hacking targets.\n[accent]Non-Injectors[] will be more vulnerable to hack attacks.\nThese multipliers can stack with each other. status.fos-tokicite-slowed.name = Tokicite Slowed +status.fos-dissolving.name = Dissolving status.fos-standard1.name = Basic Rifle Mount status.fos-standard1.description = A basic rifle with balanced stats. diff --git a/res/bundles/bundle_ru.properties b/res/bundles/bundle_ru.properties index 4d4dac7c..f1994922 100644 --- a/res/bundles/bundle_ru.properties +++ b/res/bundles/bundle_ru.properties @@ -27,6 +27,8 @@ accelerator.confirmtext = Это ядро будет отправлено в б ability.hackfield = Поле взлома ability.unitresistance = Устойчивость к урону +ability.acidexplode = Кислотные внутренности +ability.acidexplode.description = Выпускает кислоту при смерти. bar.units = Боевые единицы: {0}/{1} bar.detectorreq = Требуется детектор руды @@ -159,8 +161,8 @@ block.fos-pumpjack.name = Штанговый насос block.fos-pumpjack.description = Перекачивает и выводит жидкости с большей скоростью. block.fos-fluid-router.name = Жидкостный маршрутизатор block.fos-fluid-router.description = Принимает жидкости и газы равномерно распределяет их до 3 сторон. Также может хранить определенное количество жидкости. -block.fos-fluid-barrel.name = Жидкостная бочка -block.fos-fluid-barrel.description = Хранит небольшое количество жидкости. Выводит во все стороны, подобно жидкостному маршрутизатору. +block.fos-fluid-container.name = Жидкостный контейнер +block.fos-fluid-container.description = Хранит небольшое количество жидкости. Выводит во все стороны, подобно жидкостному маршрутизатору. block.fos-fluid-tank.name = Жидкостный бак block.fos-fluid-tank.description = Хранит большое количество жидкости. Выводит во все стороны, подобно жидкостному маршрутизатору. block.fos-tin-wire.name = Цинковый провод @@ -352,6 +354,7 @@ status.fos-hacked.name = Взлом status.fos-injected.name = Инъекция status.fos-injected.description = [#8ae3df]Инжекторы[] получат увеличенный шанс взлома вражеских целей.\n[accent]Не-инжекторы[] станут более уязвимыми ко взлому.\nЭти множители могут складываться между собой. status.fos-tokicite-slowed.name = Замедление токицитом +status.fos-dissolving.name = Растворение status.fos-standard1.name = Базовая винтовка status.fos-standard1.description = Базовая винтовка со сбалансированными характеристиками. diff --git a/res/sprites/blocks/liquid/copper-pipe-bottom-0.png b/res/sprites/blocks/liquid/copper-pipe-bottom-0.png deleted file mode 100644 index 9f5d8d395210a77ee3f036036b49a6218479e1e3..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 189 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE1|*BCs=ffJ7Ec$)kcv5Pr+RZ8P~c(Je)2DT zT^`dyyV>W}TKB!_nQ4&_uydBPh65wl7VbORC5B-x3a4+Z`0(k@2H!0LPyKo~|0!d= zbwq5@9Cg8`4|x_GI`L3+Upc!2HwOyP4s4b9hXAOAw_5+VThuvD+PA>h6 n_II*lp6<775m|6xJ&W28)0)QrUMo)m-NWGN>gTe~DWM4fmpw_Q diff --git a/res/sprites/blocks/liquid/copper-pipe-bottom-1.png b/res/sprites/blocks/liquid/copper-pipe-bottom-1.png deleted file mode 100644 index 61064bdeae500116555e49dbdfae00763d878994..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 222 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE1|*BCs=ffJrJgR1Ar*7pPP@o;K!L;6{KfzJ z%GK?T9Z#?B5;**ON9Mdaey3AktlX57wrh3T`_rc$T9?>4cqe`_j(FM5ut>n8K;i&* zBU?FRh0%qa?P&@@%o;3Px!nZ*wr03mG);IO&{e>)@Mmz>g~$HdP9bUx#uh9G!kAPT zO66}b9cWwdmibcI&+s0nn&#!(ug+^_(BZJG+8U_y*E#k<c`U`z{RWcql1?g#I?nGF+i?WLx< Q0iDX=>FVdQ&MBb@0Ea?UYybcN diff --git a/res/sprites/blocks/liquid/copper-pipe-bottom-3.png b/res/sprites/blocks/liquid/copper-pipe-bottom-3.png deleted file mode 100644 index d8015032723c92641150e90b8646a00db97054ad..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 222 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE1|*BCs=ffJrJgR1Ar*7pPP@o;K!L;6{KNnH z%GK=-E52kMYpRr=9mg-`w@bv=OlW~i@yGqLw&&3YCw}NY)dEUCTAzAb3^PN+k1+8Lw6XE5{u=}g!0q*j3 WQ);I^*&hOQFoUP7pUXO@geCw|hF4zz diff --git a/res/sprites/blocks/liquid/copper-pipe-bottom-4.png b/res/sprites/blocks/liquid/copper-pipe-bottom-4.png deleted file mode 100644 index ee53eb701ac03a5922eb2ff8bc209af9f4e52a9e..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 220 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE1|*BCs=ffJ#hxyXAr*7pPIKftpuoX$`^f+L zomZWOoms?QOYy%6bX_LWSY%nXYLD@>cUsx||Lm-3J;$D*IOi{K+z-WuNRA_xJOZr_ zbK4n|1T)g7yCtZx2XMU7zM$}nf061!HpTY~RTi=tZd$IAcx2wRmK8A!%ZfP~*0Ojo zyt3KA(!jfMsYvv%|&p7f!L_R}gsqooQR#YUK&J UD!*lVfzD;{boFyt=akR{0MBGo3jhEB diff --git a/revisions/BugBurrowLegsUnit/1.json b/revisions/BugBurrowLegsUnit/1.json new file mode 100644 index 00000000..0b447620 --- /dev/null +++ b/revisions/BugBurrowLegsUnit/1.json @@ -0,0 +1 @@ +{version:1,fields:[{name:abilities,type:"mindustry.entities.abilities.Ability[]"},{name:ammo,type:float},{name:controller,type:mindustry.entities.units.UnitController},{name:elevation,type:float},{name:flag,type:double},{name:health,type:float},{name:isShooting,type:boolean},{name:mineTile,type:mindustry.world.Tile},{name:plans,type:arc.struct.Queue},{name:rotation,type:float},{name:shield,type:float},{name:spawnedByCore,type:boolean},{name:stack,type:mindustry.type.ItemStack},{name:statuses,type:arc.struct.Seq},{name:team,type:mindustry.game.Team},{name:type,type:mindustry.type.UnitType},{name:updateBuilding,type:boolean},{name:vel,type:arc.math.geom.Vec2},{name:x,type:float},{name:y,type:float}]} \ No newline at end of file diff --git a/revisions/BugBurrowLegsUnit/2.json b/revisions/BugBurrowLegsUnit/2.json new file mode 100644 index 00000000..fd03c8ff --- /dev/null +++ b/revisions/BugBurrowLegsUnit/2.json @@ -0,0 +1 @@ +{version:2,fields:[{name:abilities,type:"mindustry.entities.abilities.Ability[]"},{name:ammo,type:float},{name:controller,type:mindustry.entities.units.UnitController},{name:elevation,type:float},{name:flag,type:double},{name:health,type:float},{name:isShooting,type:boolean},{name:mineTile,type:mindustry.world.Tile},{name:mounts,type:"mindustry.entities.units.WeaponMount[]"},{name:plans,type:arc.struct.Queue},{name:rotation,type:float},{name:shield,type:float},{name:spawnedByCore,type:boolean},{name:stack,type:mindustry.type.ItemStack},{name:statuses,type:arc.struct.Seq},{name:team,type:mindustry.game.Team},{name:type,type:mindustry.type.UnitType},{name:updateBuilding,type:boolean},{name:vel,type:arc.math.geom.Vec2},{name:x,type:float},{name:y,type:float}]} \ No newline at end of file diff --git a/src/fos/ai/FOSPathfinder.java b/src/fos/ai/FOSPathfinder.java index 0c125342..7ecc42f0 100644 --- a/src/fos/ai/FOSPathfinder.java +++ b/src/fos/ai/FOSPathfinder.java @@ -47,7 +47,7 @@ public class FOSPathfinder implements Runnable{ (team, tile) -> { int data = tiles[tile]; if (PathTile.legSolid(data)) return -1; - return 1 + (PathTile.deep(data) ? 6000 : 0) + //leg units can now drown + return 1 + (PathTile.deep(data) ? 6000 : 0) + (PathTile.solid(data) ? 5 : 0) + FOSVars.deathMapController.deathMap[tile]; //take into account recent unit deaths }, @@ -56,7 +56,7 @@ public class FOSPathfinder implements Runnable{ (team, tile) -> { int data = tiles[tile]; if (PathTile.legSolid(data)) return -1; - return 1 + (PathTile.deep(data) ? 6000 : 0) + //leg units can now drown + return 1 + (PathTile.deep(data) ? 6000 : 0) + (PathTile.solid(data) ? 5 : 0); } ); diff --git a/src/fos/ai/bugs/BugAI.java b/src/fos/ai/bugs/BugAI.java index 968091c9..fe3c6b58 100644 --- a/src/fos/ai/bugs/BugAI.java +++ b/src/fos/ai/bugs/BugAI.java @@ -65,7 +65,7 @@ public void updateMovement() { var f = bug.following(); bug.invading(f instanceof Bugc bf && bf.invading()); - moveTo(f, 12f + f.type.hitSize, 0, true, null); + moveTo(f, 12f + f.type.hitSize, 0, false, null); return; } @@ -95,7 +95,7 @@ public void updateMovement() { @Override public Teamc target(float x, float y, float range, boolean air, boolean ground) { - var unitTarget = Units.closestTarget(unit.team, x, y, unit.range(), Unit::isValid, t -> false); + var unitTarget = Units.closestTarget(unit.team, x, y, unit.range(), u -> u.isValid() && bug.type().range > 0.01f, t -> false); if (unitTarget != null) return unitTarget; for (BlockFlag flag : unit.type.targetFlags) { diff --git a/src/fos/content/FOSBlocks.java b/src/fos/content/FOSBlocks.java index 2cb2a787..4f658bbe 100644 --- a/src/fos/content/FOSBlocks.java +++ b/src/fos/content/FOSBlocks.java @@ -33,7 +33,6 @@ import mindustry.type.*; import mindustry.ui.*; import mindustry.world.Block; -import mindustry.world.Tile; import mindustry.world.blocks.defense.Wall; import mindustry.world.blocks.defense.turrets.*; import mindustry.world.blocks.distribution.*; @@ -643,6 +642,7 @@ diamond, new StickyBulletType(8f, 60, 90){{ loopSound = Sounds.none; shootSound = FOSSounds.sticky; + squareSprite = false; ammo( tokicite, new LiquidBulletType(tokicite){ diff --git a/src/fos/content/FOSFx.java b/src/fos/content/FOSFx.java index 0f33dc78..13ddbe14 100644 --- a/src/fos/content/FOSFx.java +++ b/src/fos/content/FOSFx.java @@ -3,11 +3,12 @@ import arc.Core; import arc.graphics.Color; import arc.graphics.g2d.*; -import arc.math.Mathf; +import arc.math.*; import arc.math.geom.*; import arc.util.Tmp; import fos.graphics.FOSPal; import fos.type.bullets.OhioBeamBulletType; +import mindustry.content.Fx; import mindustry.entities.Effect; import mindustry.gen.*; import mindustry.graphics.*; @@ -215,16 +216,16 @@ public class FOSFx { burrowDustSingle = new Effect(40f, e -> { Draw.color(e.color); - Draw.alpha(0.4f); + Draw.alpha(0.6f); - randLenVectors(e.id, 1, e.fin() * 40f, (x, y) -> { - Fill.circle(e.x + x, e.y + y, e.fout() * 8f); + randLenVectors(e.id, 1, e.fin() * 160f, (x, y) -> { + Fill.circle(e.x + x, e.y + y, e.fout() * 24f); }); Draw.reset(); }).layer(Layer.groundUnit + 1f), - burrowDust = new Effect(180f, e -> { + burrowDust = new Effect(120f, e -> { burrowDustSingle.at(e.x, e.y, e.color); }), @@ -244,5 +245,34 @@ public class FOSFx { if (Mathf.chance(0.08f) && e.time < 220f) { bruntChargeSmoke.at(e.x, e.y); } - }).followParent(true); + }).followParent(true), + + bugDeath1 = new Effect(600f, e -> { + float intensity = 4f; + + color(Color.valueOf("51c7d8"), 0.6f); + for (int i = 0; i < 4; i++) { + Fx.rand.setSeed(e.id* 2L + i); + float lenScl = Fx.rand.random(0.5f, 1f); + int fi = i; + e.scaled(e.lifetime * lenScl, e2 -> { + randLenVectors(e2.id + fi - 1, e2.fin(Interp.pow10Out), (int)(2.9f * intensity), 1.8f * intensity, (x, y, in, out) -> { + float fout = e2.fout(Interp.pow5Out) * Fx.rand.random(0.5f, 1f); + float rad = fout * ((intensity - 1f)); + + Fill.circle(e2.x + x, e2.y + y, rad); + //Drawf.light(e2.x + x, e2.y + y, rad * 2.5f, e.color, 0.5f); + }); + }); + } + }).layer(Layer.floor + 1), + + bugDeath2 = new Effect(90f, e -> { + color(Color.valueOf("51c7d8"), 0.6f); + + randLenVectors(e.id, 4, e.fin() * 28f, (x, y) -> { + Fill.circle(x, y, 5f); + if (e.fin() >= 0.99f) bugDeath1.at(x, y); + }); + }).layer(Layer.legUnit + 1); } diff --git a/src/fos/content/FOSStatuses.java b/src/fos/content/FOSStatuses.java index 0654387e..a2c898d3 100644 --- a/src/fos/content/FOSStatuses.java +++ b/src/fos/content/FOSStatuses.java @@ -2,8 +2,6 @@ import arc.graphics.Color; import arc.graphics.g2d.*; -import arc.math.Angles; -import arc.math.Mathf; import arc.util.Time; import fos.graphics.FOSPal; import fos.type.draw.FOSStats; @@ -17,28 +15,13 @@ import static arc.math.Angles.randLenVectors; public class FOSStatuses { - public static StatusEffect hacked, acid, injected, tokiciteSlowed, buildBoost, dissolving; + public static StatusEffect hacked, injected, tokiciteSlowed, buildBoost, dissolving; public static void load() { hacked = new HackedEffect("hacked"){{ color = FOSPal.hackedBack; }}; - acid = new StatusEffect("acid"){{ - color = Color.valueOf("85E323"); - healthMultiplier = 0.7f; - damage = 2.5f; - speedMultiplier = 0.5f; - effect = new Effect(180f, e -> { - color(color); - - randLenVectors(e.id, 2, 3f + e.fin() * 24f, (x, y) -> { -// float a = Mathf.randomSeed(e.id+2, 0, Mathf.pi*2f) + 3 * e.fin() * Mathf.pi; -// Fill.circle(e.x + x + Mathf.cos(a)*2, e.y + y + Mathf.sin(a)*2, 1.3f*e.finpow()); - Fill.circle(e.x + x, e.y + y, 1.3f*e.finpow()); - }); - }); - }}; injected = new StatusEffect("injected"){ @Override public void setStats() { @@ -65,11 +48,14 @@ public void draw(Unit unit) { dissolving = new StatusEffect("dissolving"){{ healthMultiplier = 0.8f; damage = 1.5f; - effect = new Effect(42f, e -> { - color(Color.valueOf("6abe30")); + color = Color.valueOf("b3db81"); + effect = new Effect(180f, e -> { + color(color); - randLenVectors(e.id, 2, 1f + e.fin() * 2f, (x, y) -> { - Fill.circle(e.x + x, e.y + y, e.fout()); + randLenVectors(e.id, 2, 3f + e.fin() * 24f, (x, y) -> { +// float a = Mathf.randomSeed(e.id+2, 0, Mathf.pi*2f) + 3 * e.fin() * Mathf.pi; +// Fill.circle(e.x + x + Mathf.cos(a)*2, e.y + y + Mathf.sin(a)*2, 1.3f*e.finpow()); + Fill.circle(e.x + x, e.y + y, 1.3f*e.finpow()); }); }); }}; diff --git a/src/fos/content/FOSUnitTypes.java b/src/fos/content/FOSUnitTypes.java index 47ba1867..30a48a7e 100644 --- a/src/fos/content/FOSUnitTypes.java +++ b/src/fos/content/FOSUnitTypes.java @@ -10,7 +10,7 @@ import fos.audio.FOSSounds; import fos.gen.*; import fos.graphics.*; -import fos.type.abilities.UnitResistanceAbility; +import fos.type.abilities.*; import fos.type.bullets.*; import fos.type.content.WeaponSet; import fos.type.units.types.*; @@ -100,7 +100,7 @@ public class FOSUnitTypes { public static @EntityDef({Unitc.class, Legsc.class, Bugc.class}) UnitType // LEGS BUGS - bugSmallSpitter; + spewer; public static @EntityDef({Unitc.class, Bugc.class}) UnitType // FLYING INSECTS @@ -1315,15 +1315,23 @@ public static void load(){ segmentMag = 6f; }}; - bugSmallSpitter = new BugUnitType("bug-small-spitter", BugLegsUnit.class, false){{ - health = 600; - armor = 0; + spewer = new BugUnitType("spewer", BugLegsUnit.class, false){{ + health = 130; + armor = 5; absorption = 0; speed = 0.6f; hitSize = 8; legCount = 6; + abilities.add( + new AcidExplodeAbility(){{ + radius = 3; + damage = 5f; + lifetime = 30f * 60; + }} + ); + weapons.add( new Weapon(){{ x = 0; y = 6; @@ -1463,6 +1471,8 @@ public static void load(){ targetGround = true; targetFlags = new BlockFlag[]{BlockFlag.unitCargoUnloadPoint, BlockFlag.core, null}; + deathExplosionEffect = FOSFx.bugDeath2; + legCount = 4; legLength = 24; legBaseOffset = 12; @@ -1514,6 +1524,7 @@ public static void load(){ despawnEffect = Fx.none; smokeEffect = Fx.none; shootSound = Sounds.largeExplosion; + splashDamage = 600f; splashDamageRadius = 4f; splashDamagePierce = true; diff --git a/src/fos/content/LumoniTechTree.java b/src/fos/content/LumoniTechTree.java index b2085545..baca43ec 100644 --- a/src/fos/content/LumoniTechTree.java +++ b/src/fos/content/LumoniTechTree.java @@ -154,7 +154,7 @@ public static void load() { node(copperPipe, () -> { node(brassPipe); node(fluidRouter, () -> { - node(fluidBarrel, () -> { + node(fluidContainer, () -> { node(fluidTank); }); }); diff --git a/src/fos/controllers/AcidController.java b/src/fos/controllers/AcidController.java index 948e2632..d2db9fcf 100644 --- a/src/fos/controllers/AcidController.java +++ b/src/fos/controllers/AcidController.java @@ -2,58 +2,42 @@ import arc.Events; import arc.graphics.Color; -import arc.graphics.g2d.Draw; -import arc.graphics.g2d.Fill; -import arc.graphics.g2d.Lines; +import arc.graphics.g2d.*; import arc.math.Mathf; -import arc.struct.ObjectMap; import arc.struct.ObjectSet; -import arc.util.Log; -import arc.util.Time; -import fos.content.FOSBlocks; -import fos.content.FOSStatuses; -import fos.type.content.FOSStatusEffect; -import mindustry.Vars; -import mindustry.content.Fx; +import fos.entities.Acid; import mindustry.entities.Effect; import mindustry.game.EventType; -import mindustry.game.Team; -import mindustry.gen.Building; -import mindustry.gen.Groups; import mindustry.graphics.Layer; -import mindustry.type.StatusEffect; -import mindustry.world.Tile; public class AcidController { - public static Color - acidColor = Color.valueOf("B3DB81"); - public static Acid - acid2 = new Acid(1f, new Effect(260f, e -> { - - Draw.z(29-0.1f); - Draw.color(acidColor); - float xx = 1-(Mathf.cos(2*Mathf.pi*Mathf.pow(2.71828182845f, 3f*(1f-e.fin())-3f))+1f)/2f; - Fill.circle(e.x + Mathf.cos(Mathf.randomSeed(e.id+2, 0, Mathf.pi*2f)) * e.finpow() * 2.8f, e.y + Mathf.sin(Mathf.randomSeed(e.id+2, 0, Mathf.pi*2f)) * e.finpow() * 2.8f, 5.7f*xx); - - - e.scaled(170f, ee -> { - Draw.z(Layer.effect+0.1f); - float x = 1-(Mathf.cos(2*Mathf.pi*Mathf.pow(2.71828182845f, 3f*(1f-e.fin())-3f))+1f)/2f; - Color c = new Color(acidColor.r * Mathf.randomSeed(e.id+1, 0.7f, 1.3f), acidColor.g * Mathf.randomSeed(e.id, 0.55f, 1.55f), acidColor.b * Mathf.randomSeed(e.id+1, 0.7f, 1.3f), 0.18f); - Draw.color(c); - Fill.circle(e.x + Mathf.cos(Mathf.randomSeed(e.id, 0, Mathf.pi*2f)) * e.finpow() * 5f, e.y + Mathf.sin(Mathf.randomSeed(e.id, 0, Mathf.pi*2f)) * e.finpow() * 5f, 3.8f*x); - }); - }), 425f); + public static Color acidColor = Color.valueOf("B3DB81"); + public static Acid acid2 = new Acid(1f, new Effect(260f, e -> { + Draw.z(29-0.1f); + Draw.color(acidColor); + float xx = 1-(Mathf.cos(2*Mathf.pi*Mathf.pow(2.71828182845f, 3f*(1f-e.fin())-3f))+1f)/2f; + Fill.circle(e.x + Mathf.cos(Mathf.randomSeed(e.id+2, 0, Mathf.pi*2f)) * e.finpow() * 2.8f, e.y + Mathf.sin(Mathf.randomSeed(e.id+2, 0, Mathf.pi*2f)) * e.finpow() * 2.8f, 5.7f*xx); + + e.scaled(170f, ee -> { + Draw.z(Layer.effect+0.1f); + float x = 1-(Mathf.cos(2*Mathf.pi*Mathf.pow(2.71828182845f, 3f*(1f-e.fin())-3f))+1f)/2f; + Color c = new Color(acidColor.r * Mathf.randomSeed(e.id+1, 0.7f, 1.3f), acidColor.g * Mathf.randomSeed(e.id, 0.55f, 1.55f), acidColor.b * Mathf.randomSeed(e.id+1, 0.7f, 1.3f), 0.18f); + Draw.color(c); + Fill.circle(e.x + Mathf.cos(Mathf.randomSeed(e.id, 0, Mathf.pi*2f)) * e.finpow() * 5f, e.y + Mathf.sin(Mathf.randomSeed(e.id, 0, Mathf.pi*2f)) * e.finpow() * 5f, 3.8f*x); + }); + }), 425f); public static ObjectSet acids = new ObjectSet<>(); public static void init() { Events.run(EventType.Trigger.update, AcidController::update); Events.run(EventType.Trigger.draw, AcidController::draw); +/* Events.on(EventType.BuildDamageEvent.class, e -> { Acid.at(acid2, e.source.x, e.source.y); Log.info("Acid at " + e.build.x + " " + e.build.y); }); +*/ } private static void update() { @@ -63,92 +47,4 @@ private static void draw() { Draw.z(Layer.effect-5); acids.each(Acid::draw); } -} - -class Acid implements Cloneable{ - public Team team = Team.blue; - public boolean alive = false; - public float x; - public float y; - public float damage = 10; - public float maxLifetime = 120f; - public float lifetime = maxLifetime; - public Effect effect = Fx.none; - public StatusEffect status = FOSStatuses.acid; - public float timer = 0f; - public static float maxTimer = 20f; - - public Acid(float damage, Effect effect, float lifetime) { - this.damage = damage; - this.effect = effect; - this.maxLifetime = lifetime; - } - - public Acid() {} - - public Acid clone() { - try { - return (Acid) super.clone(); - } catch (CloneNotSupportedException e) { - throw new RuntimeException("да пошло это все нахуй\n\n" + e); - } - } - - - public void at(float x, float y) { - alive = true; - effect.at(x, y); - this.x = x; - this.y = y; - lifetime = maxLifetime; - AcidController.acids.add(this); - } - - public static void at(Acid a, float x, float y) { - Acid aa = a.clone(); - aa.at(x, y); - } - - public static void update(Acid acid) { - if (!acid.alive) return; - if (Vars.state.isPaused()) return; - acid.lifetime -= Time.delta; - if (acid.lifetime <= 0) { - dead(acid); - return; - } - - Building b = Vars.world.build(Mathf.round(acid.x/8f), Mathf.round(acid.y/8f)); - - if (b != null) { - if (b.team() != acid.team) b.damage(acid.damage*Time.delta); - } - -// if (acid.noBuild) { -// if (b == null) { -// Vars.world.tiles.set(Mathf.round(acid.x/8), Mathf.round(acid.y/8), FOSBlocks.crutch.newBuilding().tile()); -// } -// } - - Groups.unit.each(un -> Mathf.dst(un.x, un.y, acid.x, acid.y) < 6.7f, u -> { - if (!u.hasEffect(acid.status) && u.team() != acid.team) u.apply(acid.status, acid.maxLifetime); - }); - - if (acid.timer <= 0f) { - acid.timer = maxTimer; - acid.effect.at(acid.x + Mathf.cosDeg(Mathf.random(0, 360))*3f, acid.y + Mathf.sinDeg(Mathf.random(0, 360))*3f); - } - acid.timer -= Time.delta; - } - - public static void draw(Acid acid) { - - } - - public static void dead(Acid acid) { - acid.alive = false; -// Building b = Vars.world.build(Mathf.round(acid.x/8), Mathf.round(acid.y/8)); -// if (b != null && b.block.equals(FOSBlocks.crutch)) b.tile.setAir(); - AcidController.acids.remove(acid); - } } \ No newline at end of file diff --git a/src/fos/entities/Acid.java b/src/fos/entities/Acid.java new file mode 100644 index 00000000..7f1524cf --- /dev/null +++ b/src/fos/entities/Acid.java @@ -0,0 +1,107 @@ +package fos.entities; + +import arc.math.Mathf; +import arc.util.Time; +import fos.content.*; +import fos.controllers.AcidController; +import mindustry.Vars; +import mindustry.content.Fx; +import mindustry.entities.Effect; +import mindustry.game.Team; +import mindustry.gen.*; +import mindustry.type.StatusEffect; + +public class Acid implements Cloneable{ + public Team team = Team.blue; + public boolean alive = false; + public float x; + public float y; + public float damage = 10; + public float maxLifetime = 120f; + public float lifetime = maxLifetime; + public Effect effect = Fx.none; + public StatusEffect status = FOSStatuses.dissolving; + public float timer = 0f; + public static float maxTimer = 20f; + + public Acid(float damage, Effect effect, float lifetime) { + this.damage = damage; + this.effect = effect; + this.maxLifetime = lifetime; + } + + public Acid() {} + + public Acid clone() { + try { + return (Acid) super.clone(); + } catch (CloneNotSupportedException e) { + throw new RuntimeException("да пошло это все нахуй\n\n" + e); + } + } + + + public void at(float x, float y) { + alive = true; + effect.at(x, y); + this.x = x; + this.y = y; + lifetime = maxLifetime; + AcidController.acids.add(this); + } + + public static void at(Acid a, float x, float y) { + at(a, FOSTeams.bessin, 10, 120f, x, y); + } + + public static void at(Acid a, Team team, float damage, float lifetime, float x, float y) { + Acid aa = a.clone(); + aa.team = team; + aa.damage = damage; + aa.maxLifetime = lifetime; + aa.at(x, y); + } + + public static void update(Acid acid) { + if (!acid.alive) return; + if (Vars.state.isPaused()) return; + acid.lifetime -= Time.delta; + if (acid.lifetime <= 0) { + dead(acid); + return; + } + + Building b = Vars.world.buildWorld(acid.x, acid.y); + + if (b != null) { + if (b.team() != acid.team) b.damage(acid.damage*Time.delta); + } + +// if (acid.noBuild) { +// if (b == null) { +// Vars.world.tiles.set(Mathf.round(acid.x/8), Mathf.round(acid.y/8), FOSBlocks.crutch.newBuilding().tile()); +// } +// } + + Groups.unit.each(un -> Mathf.dst(un.x, un.y, acid.x, acid.y) < 6.7f, u -> { + if (!u.hasEffect(acid.status) && u.team() != acid.team) u.apply(acid.status, acid.maxLifetime); + }); + + if (acid.timer <= 0f) { + acid.timer = maxTimer; + acid.effect.at(acid.x + Mathf.cosDeg(Mathf.random(0, 360))*3f, acid.y + Mathf.sinDeg(Mathf.random(0, 360))*3f); + } + acid.timer -= Time.delta; + } + + public static void draw(Acid acid) { + + } + + public static void dead(Acid acid) { + acid.alive = false; +// Building b = Vars.world.build(Mathf.round(acid.x/8), Mathf.round(acid.y/8)); +// if (b != null && b.block.equals(FOSBlocks.crutch)) b.tile.setAir(); + AcidController.acids.remove(acid); + } +} \ No newline at end of file diff --git a/src/fos/type/abilities/AcidExplodeAbility.java b/src/fos/type/abilities/AcidExplodeAbility.java new file mode 100644 index 00000000..70067932 --- /dev/null +++ b/src/fos/type/abilities/AcidExplodeAbility.java @@ -0,0 +1,39 @@ +package fos.type.abilities; + +import arc.Core; +import arc.math.Mathf; +import arc.scene.ui.layout.Table; +import fos.content.FOSStatuses; +import fos.controllers.AcidController; +import fos.entities.Acid; +import mindustry.Vars; +import mindustry.entities.abilities.Ability; +import mindustry.gen.Unit; +import mindustry.type.StatusEffect; +import mindustry.world.meta.StatUnit; + +public class AcidExplodeAbility extends Ability { + public int radius = 3; + public float damage = 5f; + public float lifetime = 60f; + + static final StatusEffect displayStatus = FOSStatuses.dissolving; + + @Override + public void addStats(Table t) { + t.add(/*"[lightgray]" + */Core.bundle.get("ability.acidexplode.description")/* + "[]"*/); + t.row(); + t.add(Core.bundle.format("bullet.damage", damage * 60) + StatUnit.perSecond.localized()); + t.row(); + t.add(Core.bundle.format("bullet.range", radius)); + t.row(); + t.add(/*displayStatus.emoji() + " " +*/ "[lightgray][stat]" + displayStatus.localizedName + "[] ~ [stat]" + Mathf.round(lifetime / 60f) + "[] " + Core.bundle.get("unit.seconds")); + } + + @Override + public void death(Unit unit) { + unit.tileOn().circle(radius, (x, y) -> { + Acid.at(AcidController.acid2, unit.team, damage, lifetime, x * Vars.tilesize, y * Vars.tilesize); + }); + } +} diff --git a/src/fos/type/blocks/production/OreDetector.java b/src/fos/type/blocks/production/OreDetector.java index b90b2f65..5a0621c6 100644 --- a/src/fos/type/blocks/production/OreDetector.java +++ b/src/fos/type/blocks/production/OreDetector.java @@ -11,6 +11,7 @@ import arc.util.io.*; import fos.audio.FOSSounds; import fos.type.blocks.environment.UndergroundOreBlock; +import mindustry.content.Fx; import mindustry.gen.*; import mindustry.graphics.*; import mindustry.logic.Ranged; @@ -213,6 +214,18 @@ public void locateOres(float radius) { } } + @Override + public void onDestroyed() { + super.onDestroyed(); + + indexer.eachBlock(this, range(), + b -> b instanceof UndergroundDrill.UndergroundDrillBuild && b.enabled() && b.potentialEfficiency > 0, + b -> { + Fx.circleColorSpark.at(b.x, b.y, Pal.orangeSpark); + Sounds.spark.at(b); + }); + } + @Override public void write(Writes write) { write.bool(showOres); diff --git a/src/fos/type/blocks/units/BugSpawn.java b/src/fos/type/blocks/units/BugSpawn.java index c115f440..1b25bd17 100644 --- a/src/fos/type/blocks/units/BugSpawn.java +++ b/src/fos/type/blocks/units/BugSpawn.java @@ -87,7 +87,7 @@ public boolean acceptItem(Building source, Item item) { private UnitType getBug() { UnitType[][] units = { { FOSUnitTypes.bugSmall, FOSUnitTypes.bugMedium }, - { FOSUnitTypes.bugSmallSpitter }, + { FOSUnitTypes.spewer}, { FOSUnitTypes.bugScout } }; diff --git a/src/fos/type/units/comp/BurrowComp.java b/src/fos/type/units/comp/BurrowComp.java index 7057164c..e1fbd8c1 100644 --- a/src/fos/type/units/comp/BurrowComp.java +++ b/src/fos/type/units/comp/BurrowComp.java @@ -1,19 +1,28 @@ package fos.type.units.comp; -import arc.util.Time; +import arc.struct.Seq; +import arc.util.*; import arc.util.io.*; import fos.ai.FOSPathfinder; import fos.content.FOSFx; +import mindustry.Vars; +import mindustry.async.PhysicsProcess; import mindustry.content.StatusEffects; import mindustry.entities.Damage; +import mindustry.entities.units.WeaponMount; import mindustry.gen.*; import static ent.anno.Annotations.*; +import static mindustry.async.PhysicsProcess.PhysicRef; +import static mindustry.async.PhysicsProcess.PhysicsWorld.PhysicsBody; -@EntityComponent +@EntityComponent @SuppressWarnings("unused") abstract class BurrowComp implements Syncc, Unitc { - @Import float x, y, elevation; + @Import float x, y, elevation, rotation; + @Import PhysicRef physref; + @Import WeaponMount[] mounts; transient boolean burrowed = false, isBurrowing = false; + transient float timer = 0f; @Override @Replace @@ -28,13 +37,73 @@ public int pathType() { } @Override - public void write(Writes write) { - write.bool(burrowed); + @Replace(100) + public boolean collides(Hitboxc other) { + return hittable() && !burrowed; } @Override - public void read(Reads read) { - burrowed = read.bool(); + @MethodPriority(100) + public void update() { + timer -= Time.delta; + + if (timer > 0) { + for (WeaponMount mount : mounts) { + mount.charge = (timer % 20f) / 20f; + } + } + + if (burrowed && physref.body.radius > 0) + changeHitbox(); + + if ((isBurrowing && timer <= 0f)) { + if (!isValid()) return; + + Damage.damage(team(), x, y, type().hitSize / 4, 2000); + burrowed = !burrowed; + isBurrowing = false; + + changeHitbox(); + } + } + + void changeHitbox() { + float x = this.x, y = this.y; + + PhysicsProcess.PhysicsWorld physics = Reflect.get(Vars.asyncCore.processes.get(0), "physics"); + Seq refs = Reflect.get(Vars.asyncCore.processes.get(0), "refs"); + + if (burrowed) { + // create the new empty "hitbox" + PhysicsBody body = new PhysicsBody(); + body.x = x; + body.y = y; + body.mass = mass(); + body.radius = -1; + + PhysicRef ref = new PhysicRef(this, body); + + // remove the existing one from physics process + physics.remove(physref.body); + refs.remove(physref); + + // and put the empty one at its place + refs.add(ref); + physref = ref; + physics.add(body); + + ref.body.layer = 1; // PhysicsProcess.layerLegs + ref.x = x; + ref.y = y; + ref.body.local = !Vars.net.client() || isLocal(); + } else { + // when digging up, remove the empty box from physics process + physics.remove(physref.body); + refs.remove(physref); + + // then reset everything + physref = null; + } } @SuppressWarnings("unused") @@ -44,13 +113,20 @@ void burrow() { apply(StatusEffects.unmoving, 120f); apply(StatusEffects.disarmed, 120f); isBurrowing = true; - FOSFx.burrowDust.at(x, y, tileOn().floor().mapColor); - Time.run(120f, () -> { - Damage.damage(team(), x, y, type().hitSize / 4, 2000); - burrowed = !burrowed; - isBurrowing = false; + timer = 120f; + + Tmp.v1.trns(rotation, 16f); + FOSFx.burrowDust.at(x + Tmp.v1.x, y + Tmp.v1.y, tileOn().floor().mapColor); + FOSFx.burrowDust.at(x - Tmp.v1.x, y - Tmp.v1.y, tileOn().floor().mapColor); + } - // FIXME: remove collisions when burrowed - }); + @Override + public void write(Writes write) { + write.bool(burrowed); + } + + @Override + public void read(Reads read) { + burrowed = read.bool(); } } diff --git a/src/fos/type/units/types/BugUnitType.java b/src/fos/type/units/types/BugUnitType.java index 83786896..356da69b 100644 --- a/src/fos/type/units/types/BugUnitType.java +++ b/src/fos/type/units/types/BugUnitType.java @@ -3,10 +3,10 @@ import arc.Events; import arc.graphics.Color; import fos.ai.bugs.*; -import fos.content.FOSStatuses; +import fos.content.*; import fos.core.FOSEventTypes; import fos.gen.Bugc; -import mindustry.content.*; +import mindustry.content.StatusEffects; import mindustry.gen.*; import mindustry.world.meta.BlockFlag; @@ -23,10 +23,10 @@ public BugUnitType(String name, Class type, boolean flying) drawCell = false; drawBody = false; outlineColor = Color.valueOf("452319"); - createScorch = false; + //createScorch = false; //createWreck = false; canDrown = false; // FIXME: they still drown for some reason - deathExplosionEffect = Fx.none; + deathExplosionEffect = FOSFx.bugDeath1; deathSound = Sounds.plantBreak; immunities.addAll(FOSStatuses.hacked, FOSStatuses.injected, StatusEffects.sapped); omniMovement = flying; diff --git a/src/fos/type/units/types/BurrowUnitType.java b/src/fos/type/units/types/BurrowUnitType.java index 5a58eb98..45d0c7e7 100644 --- a/src/fos/type/units/types/BurrowUnitType.java +++ b/src/fos/type/units/types/BurrowUnitType.java @@ -12,9 +12,8 @@ public BurrowUnitType(String name, Class type) { //hopefully I did not break everything. @Override public void draw(Unit unit) { - if (unit instanceof Burrowc b && b.burrowed()) { - //Lines.poly(unit.x, unit.y, 5, hitSize); - return; + if (unit instanceof Burrowc b) { + if (b.burrowed()) return; } super.draw(unit);