JSON Stuff (#9933)

* why is everything-

* don't shrink

* they're different????????

* varabel

* i cannot ignore it

* check

* a

* missing ops
This commit is contained in:
Mythril382
2024-06-12 17:32:53 -04:00
committed by GitHub
parent 885c173efe
commit b1e683a963
5 changed files with 14 additions and 17 deletions
@@ -39,7 +39,7 @@ public class FlyingFollowAI extends FlyingAI{
@Override @Override
public void updateVisuals(){ public void updateVisuals(){
if(unit.isFlying()){ if(unit.isFlying()){
unit.wobble(); if(unit.type.wobble) unit.wobble();
if(!shouldFaceTarget()){ if(!shouldFaceTarget()){
unit.lookAt(unit.prefRotation()); unit.lookAt(unit.prefRotation());
@@ -10,31 +10,24 @@ import mindustry.world.blocks.distribution.MassDriver.*;
import static mindustry.Vars.*; import static mindustry.Vars.*;
public class MassDriverBolt extends BulletType{ public class MassDriverBolt extends BasicBulletType{
public MassDriverBolt(){ public MassDriverBolt(){
super(1f, 75); super(1f, 75);
collidesTiles = false; collidesTiles = false;
lifetime = 1f; lifetime = 1f;
width = 11f;
height = 13f;
shrinkY = 0f;
sprite = "shell";
despawnEffect = Fx.smeltsmoke; despawnEffect = Fx.smeltsmoke;
hitEffect = Fx.hitBulletBig; 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 @Override
public void update(Bullet b){ public void update(Bullet b){
super.update(b);
//data MUST be an instance of DriverBulletData //data MUST be an instance of DriverBulletData
if(!(b.data() instanceof DriverBulletData data)){ if(!(b.data() instanceof DriverBulletData data)){
hit(b); hit(b);
@@ -83,7 +83,7 @@ public class AIController implements UnitController{
public void updateVisuals(){ public void updateVisuals(){
if(unit.isFlying()){ if(unit.isFlying()){
unit.wobble(); if(unit.type.wobble) unit.wobble();
unit.lookAt(unit.prefRotation()); unit.lookAt(unit.prefRotation());
} }
@@ -954,6 +954,8 @@ public class ContentParser{
case "min" -> base.min(parser.readValue(PartProgress.class, data.get("other"))); 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 "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 "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")); 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."); default -> throw new RuntimeException("Unknown operation '" + op + "', check PartProgress class for a list of methods.");
}; };
+3 -1
View File
@@ -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) */ /** if true, this unit counts as an enemy in the wave counter (usually false for support-only units) */
public boolean isEnemy = true, public boolean isEnemy = true,
/** If true, the unit is always at elevation 1. */ /** if true, the unit is always at elevation 1 */
flying = false, flying = false,
/** whether this flying unit should wobble around */
wobble = true,
/** whether this unit tries to attack air units */ /** whether this unit tries to attack air units */
targetAir = true, targetAir = true,
/** whether this unit tries to attack ground units */ /** whether this unit tries to attack ground units */