Skip to content

Commit

Permalink
Mortarin time
Browse files Browse the repository at this point in the history
  • Loading branch information
MEEPofFaith committed Nov 16, 2024
1 parent 8a042ad commit 4dfbd82
Show file tree
Hide file tree
Showing 5 changed files with 115 additions and 4 deletions.
20 changes: 17 additions & 3 deletions src/progressed/content/PMLiquids.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,31 @@
import arc.graphics.*;
import mindustry.content.*;
import mindustry.type.*;
import progressed.graphics.*;

public class PMLiquids{
public static Liquid
magma;
magma, sludge;

public static void load() {
magma = new Liquid("magma"){{
magma = new Liquid("magma", Color.valueOf("F58859")){{
effect = StatusEffects.melting;
flammability = temperature = 2f;
viscosity = 0.3f;
color = lightColor = Color.valueOf("F58859");
lightColor = color;
hideDetails = false;
hidden = true;
}};

sludge = new CellLiquid("sludge", PMPal.sludge){{
effect = PMStatusEffects.sludgeIncineration;
flammability = temperature = 2f;
viscosity = 0.3f;
lightColor = color;
moveThroughBlocks = true;
incinerable = false;
blockReactive = false;
canStayOn.addAll(Liquids.water, Liquids.oil, Liquids.cryofluid);
hideDetails = false;
hidden = true;
}};
Expand Down
10 changes: 9 additions & 1 deletion src/progressed/content/PMStatusEffects.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
public class PMStatusEffects{
public static StatusEffect
//Misc
incendiaryBurn, empStun, pinpointTarget,
incendiaryBurn, empStun, pinpointTarget, sludgeIncineration,

//Anti-vaxxers are quivering in fear
vcFrenzy, vcDisassembly, vcWeaken, vcCorvus,
Expand Down Expand Up @@ -79,6 +79,14 @@ public void draw(Unit u){
}
};

sludgeIncineration = new PMStatusEffect("sludge-incineration"){{
color = PMPal.sludge;
speedMultiplier = reloadMultiplier = buildSpeedMultiplier = 0.75f;
dragMultiplier = 2f;
damage = 200f / 60f;
effect = MissileFx.incendBurning;
}};

//Anti-vaxxers are quivering in fear
vcFrenzy = new ExclusiveStatusEffect("frenzy"){{
color = Color.valueOf("E25656");
Expand Down
2 changes: 2 additions & 0 deletions src/progressed/graphics/PMPal.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ public class PMPal{
missileFrag = valueOf("9CB664"),
nukeEmp = valueOf("a1b0ff"),

sludge = valueOf("ad510a"),

nexusLaser = valueOf("da89fa"),
nexusLaserDark = valueOf("cf6aec");

Expand Down
17 changes: 17 additions & 0 deletions src/progressed/util/Math3D.java
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,23 @@ public static Vec2 inaccuracy(float inaccuracy){
return vec;
}

/** Returns only a single float if dst is beyond where it can reach.
* Otherwise, the float array has two terms: 1st is the lower trajectory, 2nd is the higher trajectory */
public static float[] shootAngle(float dst, float g, float v){
float v2 = v * v;
float in = ((v2*v2) / (g*g * dst*dst)) - 1;

if(in < 0) return new float[]{Mathf.pi / 4};

float a = sqrt(in);
float b = v2 / (g * a);

return new float[]{
(float)Math.atan(b + a),
(float)Math.atan(b - a)
};
}

//See my notebook for half the calculation. Oh wait, you don't have access to it because I physically hold it.
//And apparently neither do I; I forgot to bring it with me to my dorm.
public static float homingPitch(float x1, float y1, float z1, float x2, float y2, float v2, float a, float g){
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
package progressed.world.blocks.defence.turret.payload.modular.modules;

import arc.math.*;
import arc.math.geom.*;
import mindustry.entities.*;
import mindustry.entities.bullet.*;
import progressed.entities.bullet.pseudo3d.*;
import progressed.util.*;

public class MortarLiquidTurretModule extends LiquidTurretModule{
public MortarLiquidTurretModule(String name){
super(name);
predictTarget = false; //I don't know how to do this
}

public class MortarLiquidTurretModuleBuild extends LiquidTurretModuleBuild{
@Override
protected void bullet(BulletType type, float xOffset, float yOffset, float angleOffset, Mover mover){
queuedBullets--;
if(dead || (!consumeAmmoOnce && !hasAmmo())) return;

ArcMissileBulletType m = (ArcMissileBulletType)type;
Vec2 inacc = Math3D.inaccuracy(inaccuracy);

float
xSpread = Mathf.range(xRand),
bulletX = x + Angles.trnsx(rotation - 90, shootX + xOffset + xSpread, shootY + yOffset),
bulletY = y + Angles.trnsy(rotation - 90, shootX + xOffset + xSpread, shootY + yOffset),
shootAngle = rotation + angleOffset + inacc.x,
shootVAngle = shootAngle(m) + inacc.y,
velScl = 1f + Mathf.range(velocityRnd / 2f);

handleBullet(m.create3D(this, team, bulletX, bulletY, 0, shootAngle, shootVAngle, m.gravity, velScl, targetPos.x, targetPos.y), xOffset, yOffset, shootAngle - rotation);

(shootEffect == null ? type.shootEffect : shootEffect).at(bulletX, bulletY, rotation + angleOffset, type.hitColor);
(smokeEffect == null ? type.smokeEffect : smokeEffect).at(bulletX, bulletY, rotation + angleOffset, type.hitColor);
shootSound.at(bulletX, bulletY, Mathf.random(soundPitchMin, soundPitchMax));

ammoUseEffect.at(
x - Angles.trnsx(rotation, ammoEjectBack),
y - Angles.trnsy(rotation, ammoEjectBack),
rotation * Mathf.sign(xOffset)
);

if(shake > 0){
Effect.shake(shake, shake, this);
}

curRecoil = 1f;
if(recoils > 0){
curRecoils[barrelCounter % recoils] = 1f;
}
heat = 1f;
totalShots++;

if(!consumeAmmoOnce){
useAmmo();
}
}

protected float shootAngle(ArcBulletType b){
float[] angs = Math3D.shootAngle(Math.min(dst(targetPos), range()), b.gravity, b.speed);
if(angs.length == 2){
return angs[1];
}else{
return angs[0];
}
}
}
}

0 comments on commit 4dfbd82

Please sign in to comment.