From b1e683a96337175515e61a6a05549c92333897ec Mon Sep 17 00:00:00 2001 From: Mythril382 <77225817+Mythril382@users.noreply.github.com> Date: Thu, 13 Jun 2024 05:32:53 +0800 Subject: [PATCH] JSON Stuff (#9933) * why is everything- * don't shrink * they're different???????? * varabel * i cannot ignore it * check * a * missing ops --- .../mindustry/ai/types/FlyingFollowAI.java | 2 +- .../entities/bullet/MassDriverBolt.java | 21 +++++++------------ .../entities/units/AIController.java | 2 +- core/src/mindustry/mod/ContentParser.java | 2 ++ core/src/mindustry/type/UnitType.java | 4 +++- 5 files changed, 14 insertions(+), 17 deletions(-) diff --git a/core/src/mindustry/ai/types/FlyingFollowAI.java b/core/src/mindustry/ai/types/FlyingFollowAI.java index 111c9f632c..f870f136f3 100644 --- a/core/src/mindustry/ai/types/FlyingFollowAI.java +++ b/core/src/mindustry/ai/types/FlyingFollowAI.java @@ -39,7 +39,7 @@ public class FlyingFollowAI extends FlyingAI{ @Override public void updateVisuals(){ if(unit.isFlying()){ - unit.wobble(); + if(unit.type.wobble) unit.wobble(); if(!shouldFaceTarget()){ unit.lookAt(unit.prefRotation()); diff --git a/core/src/mindustry/entities/bullet/MassDriverBolt.java b/core/src/mindustry/entities/bullet/MassDriverBolt.java index 006c490183..b9a0526e40 100644 --- a/core/src/mindustry/entities/bullet/MassDriverBolt.java +++ b/core/src/mindustry/entities/bullet/MassDriverBolt.java @@ -10,31 +10,24 @@ import mindustry.world.blocks.distribution.MassDriver.*; import static mindustry.Vars.*; -public class MassDriverBolt extends BulletType{ +public class MassDriverBolt extends BasicBulletType{ public MassDriverBolt(){ super(1f, 75); collidesTiles = false; lifetime = 1f; + width = 11f; + height = 13f; + shrinkY = 0f; + sprite = "shell"; despawnEffect = Fx.smeltsmoke; hitEffect = Fx.hitBulletBig; } - @Override - public void draw(Bullet b){ - float w = 11f, h = 13f; - - Draw.color(Pal.bulletYellowBack); - Draw.rect("shell-back", b.x, b.y, w, h, b.rotation() + 90); - - Draw.color(Pal.bulletYellow); - Draw.rect("shell", b.x, b.y, w, h, b.rotation() + 90); - - Draw.reset(); - } - @Override public void update(Bullet b){ + super.update(b); + //data MUST be an instance of DriverBulletData if(!(b.data() instanceof DriverBulletData data)){ hit(b); diff --git a/core/src/mindustry/entities/units/AIController.java b/core/src/mindustry/entities/units/AIController.java index 6025ea611c..8adea77edb 100644 --- a/core/src/mindustry/entities/units/AIController.java +++ b/core/src/mindustry/entities/units/AIController.java @@ -83,7 +83,7 @@ public class AIController implements UnitController{ public void updateVisuals(){ if(unit.isFlying()){ - unit.wobble(); + if(unit.type.wobble) unit.wobble(); unit.lookAt(unit.prefRotation()); } diff --git a/core/src/mindustry/mod/ContentParser.java b/core/src/mindustry/mod/ContentParser.java index a2f33cbf13..8e9f759ffb 100644 --- a/core/src/mindustry/mod/ContentParser.java +++ b/core/src/mindustry/mod/ContentParser.java @@ -954,6 +954,8 @@ public class ContentParser{ case "min" -> base.min(parser.readValue(PartProgress.class, data.get("other"))); case "sin" -> base.sin(data.has("offset") ? data.getFloat("offset") : 0f, data.getFloat("scl"), data.getFloat("mag")); case "absin" -> base.absin(data.getFloat("scl"), data.getFloat("mag")); + case "mod" -> base.mod(data.getFloat("amount")); + case "loop" -> base.loop(data.getFloat("time")); case "curve" -> data.has("interp") ? base.curve(parser.readValue(Interp.class, data.get("interp"))) : base.curve(data.getFloat("offset"), data.getFloat("duration")); default -> throw new RuntimeException("Unknown operation '" + op + "', check PartProgress class for a list of methods."); }; diff --git a/core/src/mindustry/type/UnitType.java b/core/src/mindustry/type/UnitType.java index 2b50ff09fe..89c8b98f2d 100644 --- a/core/src/mindustry/type/UnitType.java +++ b/core/src/mindustry/type/UnitType.java @@ -141,8 +141,10 @@ public class UnitType extends UnlockableContent implements Senseable{ /** if true, this unit counts as an enemy in the wave counter (usually false for support-only units) */ public boolean isEnemy = true, - /** If true, the unit is always at elevation 1. */ + /** if true, the unit is always at elevation 1 */ flying = false, + /** whether this flying unit should wobble around */ + wobble = true, /** whether this unit tries to attack air units */ targetAir = true, /** whether this unit tries to attack ground units */