Turret rotation during placement / Status effect display changes

This commit is contained in:
Anuken
2025-08-29 19:15:19 -04:00
parent 4ae49cfc60
commit fdf0640d65
9 changed files with 33 additions and 22 deletions

View File

@@ -87,7 +87,7 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
public Interval controlInterval = new Interval();
public @Nullable Block block;
public boolean overrideLineRotation;
public int rotation;
public int rotation = 1;
public boolean droppingItem;
public float itemDepositCooldown;
public Group uiGroup;

View File

@@ -33,7 +33,8 @@ public class CrashHandler{
return report
+ "Version: " + Version.combined() + (Version.buildDate.equals("unknown") ? "" : " (Built " + Version.buildDate + ")") + (Vars.headless ? " (Server)" : "") + "\n"
+ "Date: " + new SimpleDateFormat("MMMM d, yyyy HH:mm:ss a", Locale.getDefault()).format(new Date()) + "\n"
+ "OS: " + OS.osName + (OS.osArchBits != null ? " x" + (OS.osArchBits) : "") + " (" + OS.osArch + ")\n"
+ "OS: " + OS.osName + (OS.osArchBits != null ? " x" + (OS.osArchBits) : "") + " (" + OS.osArch + ")\n" +
(graphics == null || graphics.getGLVersion() == null ? "" : "GL Version: " + graphics.getGLVersion() + "\n")
+ ((OS.isAndroid || OS.isIos) && app != null ? "Android API level: " + Core.app.getVersion() + "\n" : "")
+ "Java Version: " + OS.javaVersion + "\n"
+ "Runtime Available Memory: " + (Runtime.getRuntime().maxMemory() / 1024 / 1024) + "mb\n"

View File

@@ -106,7 +106,7 @@ public class StatusEffect extends UnlockableContent{
if(intervalDamageTime > 0f && intervalDamage > 0){
stats.add(Stat.damage, intervalDamage);
stats.add(Stat.damage, 60f / intervalDamageTime, StatUnit.perSecond);
stats.add(Stat.frequency, 60f / intervalDamageTime, StatUnit.perSecond);
}
boolean reacts = false;

View File

@@ -782,22 +782,7 @@ public class UnitType extends UnlockableContent implements Senseable{
}
if(immunities.size > 0){
var imm = immunities.toSeq().sort();
//it's redundant to list wet for naval units
if(naval){
imm.remove(StatusEffects.wet);
}
stats.add(Stat.immunities, StatValues.statusEffects(imm));
}
}
//never actually called; it turns out certain mods have custom weapons that do not need bullets.
protected void validateWeapons(){
for(int i = 0; i < weapons.size; i++){
var wep = weapons.get(i);
if(wep.bullet == Bullets.placeholder || wep.bullet == null){
throw new RuntimeException("Unit: " + name + ": weapon #" + i + " ('" + wep.name + "') does not have a bullet defined. Make sure you have a bullet: (JSON) or `bullet = ` field in your unit definition.");
}
stats.add(Stat.immunities, StatValues.statusEffects(immunities.toSeq().sort()));
}
}

View File

@@ -17,6 +17,7 @@ import mindustry.entities.*;
import mindustry.entities.Units.*;
import mindustry.entities.bullet.*;
import mindustry.entities.pattern.*;
import mindustry.entities.units.*;
import mindustry.game.EventType.*;
import mindustry.game.*;
import mindustry.gen.*;
@@ -152,10 +153,12 @@ public class Turret extends ReloadTurret{
public Turret(String name){
super(name);
liquidCapacity = 20f;
quickRotate = false;
outlinedIcon = 1;
drawLiquidLight = false;
sync = true;
rotate = true;
quickRotate = false;
drawArrow = false;
}
@Override
@@ -211,6 +214,11 @@ public class Turret extends ReloadTurret{
drawer.load(this);
}
@Override
public void drawPlanRegion(BuildPlan plan, Eachable<BuildPlan> list){
drawer.drawPlan(this, plan, list);
}
@Override
public TextureRegion[] icons(){
return drawer.finalIcons(this);
@@ -267,6 +275,14 @@ public class Turret extends ReloadTurret{
float lastRangeChange;
@Override
public void placed(){
super.placed();
if(rotate){
rotation = rotdeg();
}
}
@Override
public void remove(){
super.remove();

View File

@@ -6,6 +6,7 @@ import arc.math.*;
import arc.struct.*;
import arc.util.*;
import mindustry.entities.part.*;
import mindustry.entities.units.*;
import mindustry.gen.*;
import mindustry.graphics.*;
import mindustry.type.*;
@@ -45,6 +46,12 @@ public class DrawTurret extends DrawBlock{
block.resetGeneratedIcons();
}
@Override
public void drawPlan(Block block, BuildPlan plan, Eachable<BuildPlan> list){
Draw.rect(base, plan.drawx(), plan.drawy());
Draw.rect(preview, plan.drawx(), plan.drawy(), plan.rotation * 90f - 90f);
}
@Override
public void draw(Building build){
Turret turret = (Turret)build.block;

View File

@@ -85,6 +85,7 @@ public class Stat implements Comparable<Stat>{
targetsAir = new Stat("targetsAir", StatCat.function),
targetsGround = new Stat("targetsGround", StatCat.function),
damage = new Stat("damage", StatCat.function),
frequency = new Stat("frequency", StatCat.function),
ammo = new Stat("ammo", StatCat.function),
ammoCapacity = new Stat("ammoCapacity", StatCat.function),
ammoUse = new Stat("ammoUse", StatCat.function),