Merge remote-tracking branch 'origin/master'

This commit is contained in:
Anuken
2026-02-08 22:25:49 -05:00
23 changed files with 595 additions and 466 deletions

View File

@@ -1617,7 +1617,7 @@ public class Blocks{
}};
cyanogenSynthesizer = new HeatCrafter("cyanogen-synthesizer"){{
requirements(Category.crafting, with(Items.carbide, 50, Items.silicon, 80, Items.beryllium, 90));
requirements(Category.crafting, with(Items.carbide, 80, Items.silicon, 120, Items.beryllium, 140, Items.oxide, 40));
heatRequirement = 20f;
maxEfficiency = 1f;
@@ -2770,8 +2770,8 @@ public class Blocks{
}};
fluxReactor = new VariableReactor("flux-reactor"){{
requirements(Category.power, with(Items.graphite, 300, Items.carbide, 100, Items.oxide, 100, Items.silicon, 600, Items.surgeAlloy, 200));
powerProduction = 265f;
requirements(Category.power, with(Items.graphite, 240, Items.carbide, 60, Items.oxide, 80, Items.silicon, 480, Items.surgeAlloy, 120));
powerProduction = 18000f / 60f;
maxHeat = 150f;
consumeLiquid(Liquids.cyanogen, 9f / 60f);
@@ -4510,8 +4510,8 @@ public class Blocks{
shootEffect = Fx.shootBigColor;
smokeEffect = Fx.shootSmokeSquareSparse;
ammoMultiplier = 1;
hitColor = backColor = trailColor = Pal.graphiteAmmoBack;
frontColor = Pal.graphiteAmmoFront;
hitColor = backColor = trailColor = Pal.siliconAmmoBack;
frontColor = Color.valueOf("dae1ee");
trailWidth = 6f;
trailLength = 6;
hitEffect = despawnEffect = Fx.hitSquaresColor;
@@ -4597,7 +4597,7 @@ public class Blocks{
outlineColor = Pal.darkOutline;
liquidCapacity = 50f;
liquidConsumed = 15f / 60f;
liquidConsumed = 18f / 60f;
targetInterval = 5f;
newTargetInterval = 30f;
targetUnderBlocks = false;
@@ -4613,6 +4613,7 @@ public class Blocks{
Liquids.ozone, new ContinuousFlameBulletType(){{
damage = 60f;
length = r;
ammoMultiplier = 1.2f;
knockback = 1f;
pierceCap = 2;
buildingDamageMultiplier = 0.3f;
@@ -4623,7 +4624,6 @@ public class Blocks{
Liquids.cyanogen, new ContinuousFlameBulletType(){{
damage = 130f;
rangeChange = 70f;
ammoMultiplier = 1.5f;
length = r + rangeChange;
knockback = 2f;
pierceCap = 3;
@@ -4746,10 +4746,10 @@ public class Blocks{
lifetime = 190f;
height = 19f;
width = 17f;
reloadMultiplier = 0.65f;
reloadMultiplier = 0.7f;
splashDamageRadius = 110f;
rangeChange = 8f;
splashDamage = 150f;
splashDamage = 180f;
scaledSplashDamage = true;
hitColor = backColor = trailColor = Color.valueOf("a0b380");
frontColor = Color.valueOf("e4ffd6");
@@ -4772,7 +4772,26 @@ public class Blocks{
shrinkY = 0.1f;
buildingDamageMultiplier = 0.25f;
status = StatusEffects.corroded;
statusDuration = 300f;
statusDuration = 60f * 8f;
fragBullets = 1;
fragBullet = new EmptyBulletType(){{
damage = 0f;
lifetime = 60f * 2.5f;
bulletInterval = 20f;
hitEffect = despawnEffect = Fx.none;
intervalBullet = new EmptyBulletType(){{
splashDamage = 15f;
collidesGround = true;
collidesAir = false;
collides = false;
hitEffect = despawnEffect = Fx.none;
pierce = true;
instantDisappear = true;
splashDamageRadius = 90f;
buildingDamageMultiplier = 0f;
}};
}};
}}
);
@@ -4894,8 +4913,8 @@ public class Blocks{
collidesTiles = false;
shootEffect = Fx.shootBig2;
smokeEffect = Fx.shootSmokeDisperse;
frontColor = Pal.graphiteAmmoFront;
backColor = trailColor = hitColor = Pal.graphiteAmmoBack;
frontColor = Color.valueOf("dae1ee");
backColor = trailColor = hitColor = Pal.siliconAmmoBack;
ammoMultiplier = 4f;
lifetime = 34f;
@@ -5213,6 +5232,7 @@ public class Blocks{
speed = 4.6f;
maxRange = 6f;
lifetime = 60f * 5.5f;
hitSize = 10f;
outlineColor = Pal.darkOutline;
engineColor = trailColor = Pal.redLight;
engineLayer = Layer.effect;
@@ -5293,13 +5313,14 @@ public class Blocks{
shootEffect = Fx.shootBig;
smokeEffect = Fx.shootSmokeMissileColor;
hitColor = Color.valueOf("ffd37f");
ammoMultiplier = 3f;
ammoMultiplier = 5f;
reloadMultiplier = 0.8f;
spawnUnit = new MissileUnitType("scathe-missile-phase"){{
speed = 4f;
speed = 2.5f;
maxRange = 6f;
lifetime = 60f * 6.1f;
lifetime = 60f * 9.77f;
hitSize = 10f;
outlineColor = Pal.darkOutline;
engineColor = trailColor = Color.valueOf("ffd37f");
engineLayer = Layer.effect;
@@ -5337,10 +5358,9 @@ public class Blocks{
deathExplosionEffect = Fx.massiveExplosion;
shootOnDeath = true;
shake = 10f;
bullet = new ExplosionBulletType(400f, 120f){{
//stats must be mirrored to the bullet that the unit uses
bullet = new ExplosionBulletType(320f, 120f){{
reloadMultiplier = 0.8f;
ammoMultiplier = 3f;
ammoMultiplier = 5f;
hitColor = engineColor;
shootEffect = new MultiEffect(Fx.massiveExplosion, Fx.scatheExplosion, Fx.scatheLight, new WaveEffect(){{
@@ -5364,7 +5384,7 @@ public class Blocks{
width = height = 18f;
collidesTiles = false;
splashDamageRadius = 56f;
splashDamage = 164f;
splashDamage = 120f;
backColor = trailColor = hitColor = engineColor;
frontColor = Color.white;
smokeEffect = Fx.shootBigSmoke2;
@@ -5385,10 +5405,10 @@ public class Blocks{
rotation = 180f;
y = -9f;
color = Color.grays(0.6f).lerp(Pal.redLight, 0.5f).a(0.4f);
interval = 7f;
interval = 15f;
}});
abilities.add(new ForceFieldAbility(90f, 0f, 2000f, 999999999f));
abilities.add(new ForceFieldAbility(120f, 0f, 3000f, 999999999f));
}};
}},
@@ -5399,13 +5419,13 @@ public class Blocks{
hitColor = Color.valueOf("f7e97e");
ammoMultiplier = 1f;
rangeChange = -8f*9f;
reloadMultiplier = 0.9f;
spawnUnit = new MissileUnitType("scathe-missile-surge"){{
speed = 4.4f;
maxRange = 6f;
lifetime = 60f * 1.4f;
hitSize = 10f;
outlineColor = Pal.darkOutline;
engineColor = trailColor = Color.valueOf("f7e97e");
engineLayer = Layer.effect;
@@ -5436,7 +5456,6 @@ public class Blocks{
bullet = new ExplosionBulletType(1800f, 40f){{
//mirror stats
ammoMultiplier = 1f;
rangeChange = -8f*9f;
reloadMultiplier = 0.9f;
lightning = 10;
lightningDamage = 45f;
@@ -5461,7 +5480,7 @@ public class Blocks{
spawnUnit = new MissileUnitType("scathe-missile-surge-split"){{
speed = 4.8f;
maxRange = 6f;
lifetime = 60f * 3.5f;
lifetime = 60f * 3.7f;
outlineColor = Pal.darkOutline;
engineColor = trailColor = Color.valueOf("f7e97e");
engineLayer = Layer.effect;

View File

@@ -905,6 +905,16 @@ public class Fx{
Drawf.light(e.x, e.y, 20f, e.color, 0.6f * e.fout());
}),
squareWaveEffect = new Effect(14, 40f, e -> {
rand.setSeed(e.id);
color(Color.white, e.color, rand.random(0.8f, 1.5f) * e.fin());
stroke(rand.random(0.4f, 0.8f) + e.fout() * 2);
float rot = rand.random(45f, 180f) * e.fin();
float rotation = rand.random(0, 1) > 0.5f ? rot : -rot;
Lines.square(e.x, e.y, e.fin() * rand.random(4f, 11f) + 4f, e.rotation + rand.random(360f) + rotation);
Drawf.light(e.x, e.y, 23f, e.color, e.fout() * 0.7f);
}),
hitFuse = new Effect(14, e -> {
color(Color.white, Pal.surge, e.fin());

View File

@@ -192,8 +192,8 @@ public class StatusEffects{
corroded = new StatusEffect("corroded"){{
color = Color.valueOf("e4ffd6");
intervalDamage = 25f;
intervalDamageTime = 30f;
intervalDamage = 20f;
intervalDamageTime = 15f;
effectChance = 0.1f;
effect = Fx.corrosionVapor;

View File

@@ -2826,7 +2826,7 @@ public class UnitTypes{
y = -1f;
heatColor = Color.valueOf("f9350f");
cooldownTime = 30f;
bullet = new BasicBulletType(7f, 120){{
bullet = new BasicBulletType(7f, 10){{
sprite = "missile-large";
width = 7.5f;
height = 13f;
@@ -2891,7 +2891,7 @@ public class UnitTypes{
weapons.add(new Weapon("vanquish-weapon"){{
shootSound = Sounds.shootTank;
layerOffset = 0.0001f;
reload = 70f;
reload = 80f;
shootY = 71f / 4f;
shake = 5f;
recoil = 4f;
@@ -2904,17 +2904,18 @@ public class UnitTypes{
heatColor = Color.valueOf("f9350f");
cooldownTime = 80f;
bullet = new BasicBulletType(8f, 190){{
bullet = new BasicBulletType(8f, 150f){{
sprite = "missile-large";
width = 9.5f;
height = 13f;
lifetime = 18f;
height = 18f;
lifetime = 16f;
hitSize = 6f;
shootEffect = Fx.shootTitan;
smokeEffect = Fx.shootSmokeTitan;
pierceCap = 2;
pierce = true;
pierceBuilding = true;
hitColor = backColor = trailColor = Color.valueOf("feb380");
frontColor = Color.white;
trailWidth = 3.1f;
@@ -2922,19 +2923,21 @@ public class UnitTypes{
hitEffect = despawnEffect = Fx.blastExplosion;
splashDamageRadius = 20f;
splashDamage = 50f;
maxRange = 190f;
fragOnHit = false;
pierceFragCap = 1;
fragRandomSpread = 0f;
fragSpread = 10f;
fragBullets = 5;
fragVelocityMin = 1f;
despawnSound = Sounds.explosionDull;
fragBullet = new BasicBulletType(8f, 35){{
fragBullet = new BasicBulletType(8f, 35f){{
sprite = "missile-large";
width = 8f;
height = 12f;
lifetime = 15f;
height = 16f;
lifetime = 10f;
hitSize = 4f;
hitColor = backColor = trailColor = Color.valueOf("feb380");
frontColor = Color.white;
@@ -2951,7 +2954,7 @@ public class UnitTypes{
for(float f : new float[]{34f / 4f, -36f / 4f}){
int fi = i ++;
weapons.add(new Weapon("vanquish-point-weapon"){{
reload = 35f + fi * 5;
reload = 22 + fi * 5;
x = 48f / 4f;
y = f;
shootY = 5.5f;
@@ -2960,16 +2963,21 @@ public class UnitTypes{
rotateSpeed = 2f;
shootSound = Sounds.shootStell;
bullet = new BasicBulletType(4.5f, 25){{
bullet = new BasicBulletType(12f, 50f){{
sprite = "missile-large";
width = 6.5f;
height = 11f;
shrinkY = 0f;
shrinkX = 0.2f;
lifetime = 15f;
shootEffect = Fx.sparkShoot;
smokeEffect = Fx.shootBigSmoke;
hitColor = backColor = trailColor = Color.valueOf("feb380");
frontColor = Color.white;
trailWidth = 1.5f;
trailLength = 4;
hitEffect = despawnEffect = Fx.hitBulletColor;
trailWidth = 2.5f;
trailLength = 5;
hitEffect = Fx.blastExplosion;
despawnEffect = Fx.hitBulletColor;
}};
}});
}
@@ -3358,7 +3366,7 @@ public class UnitTypes{
drag = 0.1f;
hitSize = 21f;
rotateSpeed = 3f;
health = 2900;
health = 2700;
armor = 7f;
fogRadius = 40f;
stepShake = 0f;
@@ -3473,9 +3481,9 @@ public class UnitTypes{
trailColor = engineColor = Pal.techBlue;
engineSize = 1.75f;
engineLayer = Layer.effect;
speed = 3.7f;
speed = 3.35f;
maxRange = 6f;
lifetime = 60f * 1.5f;
lifetime = 60f * 1.66f;
outlineColor = Pal.darkOutline;
health = 55;
lowAltitude = true;
@@ -3533,9 +3541,9 @@ public class UnitTypes{
region = "tecta-shield";
radius = 45f;
angle = 82f;
regen = 40f / 60f;
regen = 45f / 60f;
cooldown = 60f * 8f;
max = 2200f;
max = 2500f;
y = -20f;
width = 8f;
whenShooting = false;
@@ -3581,14 +3589,14 @@ public class UnitTypes{
velocityRnd = 0.33f;
heatColor = Color.red;
bullet = new MissileBulletType(4.2f, 60){{
bullet = new MissileBulletType(4.2f, 51){{
homingPower = 0.2f;
weaveMag = 4;
weaveScale = 4;
lifetime = 55f;
shootEffect = Fx.shootBig2;
smokeEffect = Fx.shootSmokeTitan;
splashDamage = 70f;
splashDamage = 60f;
splashDamageRadius = 30f;
frontColor = Color.white;
hitSound = Sounds.none;
@@ -3679,7 +3687,7 @@ public class UnitTypes{
shadow = 10f;
shootStatus = StatusEffects.slow;
shootStatusDuration = reload + 1f;
shootStatusDuration = reload + 170f;
shoot.shots = 1;
heatColor = Color.red;
@@ -3901,13 +3909,31 @@ public class UnitTypes{
width = 7f;
height = 12f;
lifetime = 18f;
//floating point inaccuracy makes 0.6f show as -39%
buildingDamageMultiplier = 0.599999f;
shootEffect = Fx.sparkShoot;
smokeEffect = Fx.shootBigSmoke;
hitColor = backColor = trailColor = Pal.suppress;
frontColor = Color.white;
trailWidth = 1.5f;
trailLength = 5;
hitEffect = despawnEffect = Fx.hitBulletColor;
hitEffect = despawnEffect = new MultiEffect(Fx.hitSquaresColor, Fx.squareWaveEffect);
fragOnDespawn = false;
fragBullets = 2;
fragBullet = new BasicBulletType(3f, 15){{
width = 5f;
height = 8f;
lifetime = 14f;
fragVelocityMax = 1f;
fragVelocityMin = 0.7f;
buildingDamageMultiplier = 0.5f;
hitColor = backColor = trailColor = Pal.suppress;
frontColor = Color.white;
trailWidth = 1.2f;
trailLength = 4;
hitEffect = despawnEffect = Fx.hitBulletColor;
}};
}};
}});
}};
@@ -4046,7 +4072,7 @@ public class UnitTypes{
health = 6000f;
armor = 4f;
hitSize = 36f;
payloadCapacity = Mathf.sqr(3f) * tilePayload;
payloadCapacity = Mathf.sqr(4f) * tilePayload;
researchCostMultiplier = 0f;
targetAir = false;

View File

@@ -13,6 +13,7 @@ import arc.util.serialization.*;
import arc.util.serialization.JsonValue.*;
import mindustry.*;
import mindustry.annotations.Annotations.*;
import mindustry.content.*;
import mindustry.core.GameState.*;
import mindustry.entities.*;
import mindustry.game.EventType.*;
@@ -699,7 +700,7 @@ public class NetClient implements ApplicationListener{
unit == null ? 0f : unit.vel.x, unit == null ? 0f : unit.vel.y,
dead ? null : unit.mineTile,
player.boosting, player.shooting, ui.chatfrag.shown(), control.input.isBuilding,
player.isBuilder() && unit != null ? unit.plans : null,
player.selectedBlock, player.selectedRotation, player.isBuilder() && unit != null ? unit.plans : null,
Core.camera.position.x, Core.camera.position.y,
Core.camera.width, Core.camera.height
);

View File

@@ -647,7 +647,7 @@ public class NetServer implements ApplicationListener{
float xVelocity, float yVelocity,
Tile mining,
boolean boosting, boolean shooting, boolean chatting, boolean building,
@Nullable Queue<BuildPlan> plans,
Block selectedBlock, int selectedRotation, @Nullable Queue<BuildPlan> plans,
float viewX, float viewY, float viewWidth, float viewHeight
){
NetConnection con = player.con;
@@ -686,6 +686,8 @@ public class NetServer implements ApplicationListener{
player.typing = chatting;
player.shooting = shooting;
player.boosting = boosting;
player.selectedBlock = selectedBlock;
player.selectedRotation = selectedRotation;
@Nullable var unit = player.unit();

View File

@@ -100,6 +100,17 @@ public class Units{
unit.remove();
}
/** Removes a unit after spawning the death effects. */
@Remote(called = Loc.server)
public static void unitSafeDeath(Unit unit){
if(unit == null) return;
unit.type.deathExplosionEffect.at(unit.x, unit.y, unit.hitSize / 8f);
float shake = unit.type.deathShake < 0 ? unit.hitSize / 3f : unit.type.deathShake;
Effect.shake(shake, shake, unit);
unit.type.deathSound.at(unit, 1f, unit.type.deathSoundVolume);
unit.remove();
}
/** @return whether a new instance of a unit of this team can be created. */
public static boolean canCreate(Team team, UnitType type){
return !type.useUnitCap || (team.data().countType(type) < getCap(team) && !type.isBanned());

View File

@@ -38,13 +38,18 @@ public class ShieldArcAbility extends Ability{
if(penX > penY){
b.vel.x *= -1;
b.vel.y *= paramField.reflectVel;
}else{
b.vel.y *= -1;
b.vel.x *= paramField.reflectVel;
}
b.owner = paramUnit;
b.team = paramUnit.team;
b.time += 1f;
b.time = b.lifetime * paramField.reflectTime;
if(paramField.reflectBuildingDamage > 0f){
b.buildingDamageMultiplier = paramField.reflectBuildingDamage;
}
}else{
b.absorb();
@@ -75,13 +80,10 @@ public class ShieldArcAbility extends Ability{
(Tmp.v1.set(unit).add(unit.deltaX, unit.deltaY).within(paramPos, paramField.radius + paramField.width) || unit.within(paramPos, paramField.radius + paramField.width)) &&
(Angles.within(paramPos.angleTo(unit), paramUnit.rotation + paramField.angleOffset, paramField.angle / 2f) || Angles.within(paramPos.angleTo(unit.x + unit.deltaX, unit.y + unit.deltaY), paramUnit.rotation + paramField.angleOffset, paramField.angle / 2f))){
if(unit.isMissile() && unit.killable() && paramField.missileUnitMultiplier >= 0f){
unit.remove();
unit.type.deathSound.at(unit);
unit.type.deathExplosionEffect.at(unit);
if(unit.isMissile() && paramField.missileUnitMultiplier >= 0f){
Call.unitSafeDeath(unit);
Fx.absorb.at(unit);
Fx.circleColorSpark.at(unit.x, unit.y,paramUnit.team.color);
paramField.pushEffect.at(unit.x, unit.y,paramUnit.team.color);
// consider missile hp and gamerule to damage the shield
paramField.data -= unit.health() * paramField.missileUnitMultiplier * Vars.state.rules.unitDamage(unit.team);
@@ -98,8 +100,8 @@ public class ShieldArcAbility extends Ability{
// get out
unit.move(Tmp.v1.set(unit).sub(paramUnit).setLength(overlapDst + 0.01f));
if(Mathf.chanceDelta(0.5f*Time.delta)){
Fx.circleColorSpark.at(unit.x,unit.y,paramUnit.team.color);
if(Mathf.chanceDelta(0.3f * Time.delta)){
paramField.pushEffect.at(unit.x, unit.y, paramUnit.team.color);
}
}
}
@@ -124,6 +126,12 @@ public class ShieldArcAbility extends Ability{
public float width = 6f;
/** Bullet deflection chance. -1 to disable */
public float chanceDeflect = -1f;
/** Multiplier for reflected bullet building damage. -1 to disable */
public float reflectBuildingDamage = 1f;
/** Velocity multiplier for reflected bullets on the opposite axis. Negative values = concave, positive values = convex */
public float reflectVel = 1f;
/** Time multiplier for reflected bullets. */
public float reflectTime = 1f - 0.5f;
/** Deflection sound. */
public Sound deflectSound = Sounds.none;
public Sound breakSound = Sounds.shieldBreakSmall;
@@ -142,6 +150,7 @@ public class ShieldArcAbility extends Ability{
public boolean offsetRegion = false;
/** If true, enemy units are pushed out. */
public boolean pushUnits = true;
public Effect pushEffect = Fx.circleColorSpark;
/** State. */
protected float widthScale, alpha;
@@ -154,8 +163,10 @@ public class ShieldArcAbility extends Ability{
t.add(abilityStat("repairspeed", Strings.autoFixed(regen * 60f, 2)));
t.row();
t.add(abilityStat("cooldown", Strings.autoFixed(cooldown / 60f, 2)));
t.row();
t.add(abilityStat("deflectchance", Strings.autoFixed(chanceDeflect *100f, 2)));
if(chanceDeflect > 0f){
t.row();
t.add(abilityStat("deflectchance", Strings.autoFixed(chanceDeflect *100f, 2)));
}
}
@Override

View File

@@ -157,7 +157,7 @@ public class BulletType extends Content implements Cloneable{
public float extraRangeMargin = 0f;
/** Range initialized in init(). */
public float range = 0f;
/** When used in a turret with multiple ammoo types, this can be set to a non-zero value to influence minRange */
/** When used in a turret with multiple ammo types, this can be set to a non-zero value to influence minRange */
public float minRangeChange = 0f;
/** % of block health healed **/
public float healPercent = 0f;
@@ -173,11 +173,13 @@ public class BulletType extends Content implements Cloneable{
public boolean makeFire = false;
/** Whether this bullet will always hit blocks under it. */
public boolean hitUnder = false;
/** Whether to create hit effects on despawn. Forced to true if this bullet has any special effects like splash damage. */
/** Whether to create hit effects on despawn. Forced to true if this bullet has any special effects like splash damage. Disable setDefaults to avoid override */
public boolean despawnHit = false;
/** If true, this bullet will create bullets when it hits anything, not just when it despawns. */
/** If true, this bullet will create bullets when it hits anything */
public boolean fragOnHit = true;
/** If false, this bullet will not create fraags when absorbed by a shield. */
/** If true, this bullet will create bullets when it despawns */
public boolean fragOnDespawn = true;
/** If false, this bullet will not create frags when absorbed by a shield. */
public boolean fragOnAbsorb = true;
/** If true, unit armor is ignored in damage calculations. */
public boolean pierceArmor = false;
@@ -269,7 +271,7 @@ public class BulletType extends Content implements Cloneable{
/** Random offset of trail effect. */
public float trailSpread = 0f;
/** Rotation/size parameter that is passed to trail. Usually, this controls size. */
public float trailParam = 2f;
public float trailParam = 2f;
/** Whether the parameter passed to the trail is the bullet rotation, instead of a flat value. */
public boolean trailRotation = false;
/** Interpolation for trail width as function of bullet lifetime */
@@ -527,16 +529,20 @@ public class BulletType extends Content implements Cloneable{
}
public void hit(Bullet b){
hit(b, b.x, b.y);
hit(b, b.x, b.y, true);
}
public void hit(Bullet b, float x, float y){
hit(b, b.x, b.y, true);
}
public void hit(Bullet b, float x, float y, boolean createFrags){
hitEffect.at(x, y, b.rotation(), hitColor);
hitSound.at(x, y, hitSoundPitch + Mathf.range(hitSoundPitchRange), hitSoundVolume);
Effect.shake(hitShake, hitShake, b);
if(fragOnHit){
if(createFrags && fragOnHit){
if(delayFrags && fragBullet != null && fragBullet.delayFrags){
Time.run(0f, () -> createFrags(b, x, y));
}else{
@@ -596,7 +602,7 @@ public class BulletType extends Content implements Cloneable{
}
public void createFrags(Bullet b, float x, float y){
if(fragBullet != null && (fragOnAbsorb || !b.absorbed) && !(b.frags >= pierceFragCap && pierceFragCap > 0)){
if(fragBullet != null && (fragOnAbsorb || !b.absorbed) && (pierceFragCap < 0 || b.frags < pierceFragCap)){
for(int i = 0; i < fragBullets; i++){
float len = Mathf.random(fragOffsetMin, fragOffsetMax);
float a = b.rotation() + Mathf.range(fragRandomSpread / 2) + fragAngle + fragSpread * i - (fragBullets - 1) * fragSpread / 2f;
@@ -620,15 +626,11 @@ public class BulletType extends Content implements Cloneable{
/** Called when the bullet reaches the end of its lifetime or is destroyed by something external. */
public void despawned(Bullet b){
if(despawnHit){
hit(b);
hit(b, b.x, b.y, false);
}else{
createUnits(b, b.x, b.y);
}
if(!fragOnHit){
createFrags(b, b.x, b.y);
}
despawnEffect.at(b.x, b.y, b.rotation(), hitColor);
despawnSound.at(b, 1f + Mathf.range(hitSoundPitchRange));
@@ -641,15 +643,13 @@ public class BulletType extends Content implements Cloneable{
Fx.trailFade.at(b.x, b.y, trailWidth, trailColor, b.trail.copy());
}
//if the bullet never created any frags and is removed (probably by hitting something), it needs to spawn those
//TODO: disabled for now as this makes vanquish significantly more powerful
if(b.frags == 0 && !fragOnHit && fragBullet != null){
// createFrags(b, b.x, b.y);
if(b.frags == 0 && fragOnDespawn && fragBullet != null){
createFrags(b, b.x, b.y);
}
}
public float buildingDamage(Bullet b){
return b.damage() * buildingDamageMultiplier;
return b.damage() * b.buildingDamageMultiplier;
}
public float shieldDamage(Bullet b){
@@ -960,6 +960,7 @@ public class BulletType extends Content implements Cloneable{
bullet.hitSize = hitSize;
bullet.mover = mover;
bullet.damage = (damage < 0 ? this.damage : damage) * bullet.damageMultiplier();
bullet.buildingDamageMultiplier = buildingDamageMultiplier;
//reset trail
if(bullet.trail != null){
bullet.trail.clear();

View File

@@ -45,6 +45,7 @@ abstract class BulletComp implements Timedc, Damagec, Hitboxc, Teamc, Posc, Draw
transient @Nullable Tile aimTile;
transient float aimX, aimY;
transient float originX, originY;
transient float buildingDamageMultiplier;
transient @Nullable Mover mover;
transient boolean absorbed, hit;
transient @Nullable Trail trail;

View File

@@ -21,6 +21,7 @@ import mindustry.net.Administration.*;
import mindustry.net.*;
import mindustry.net.Packets.*;
import mindustry.ui.*;
import mindustry.world.*;
import mindustry.world.blocks.storage.*;
import mindustry.world.blocks.storage.CoreBlock.*;
@@ -37,6 +38,8 @@ abstract class PlayerComp implements UnitController, Entityc, Syncc, Timerc, Dra
transient @Nullable NetConnection con;
@ReadOnly Team team = Team.sharded;
@SyncLocal boolean typing, shooting, boosting;
@SyncLocal @Nullable Block selectedBlock;
@SyncLocal int selectedRotation;
@SyncLocal float mouseX, mouseY;
/** command the unit had before it was controlled. */
@Nullable @NoSync UnitCommand lastCommand;

View File

@@ -276,6 +276,8 @@ abstract class UnitComp implements Healthc, Physicsc, Hitboxc, Statusc, Teamc, I
case mining -> mining() ? 1 : 0;
case mineX -> mining() ? mineTile.x : -1;
case mineY -> mining() ? mineTile.y : -1;
case buildX -> isBuilding() ? buildPlan().x : -1;
case buildY -> isBuilding() ? buildPlan().y : -1;
case armor -> armorOverride >= 0f ? armorOverride : armor;
case flag -> flag;
case speed -> type.speed * 60f / tilesize * speedMultiplier;
@@ -289,6 +291,7 @@ abstract class UnitComp implements Healthc, Physicsc, Hitboxc, Statusc, Teamc, I
case payloadCapacity -> type.payloadCapacity / tilePayload;
case size -> hitSize / tilesize;
case color -> Color.toDoubleBits(team.color.r, team.color.g, team.color.b, 1f);
case selectedRotation -> controller instanceof Player p ? p.selectedRotation : 0;
default -> Float.NaN;
};
}
@@ -304,6 +307,9 @@ abstract class UnitComp implements Healthc, Physicsc, Hitboxc, Statusc, Teamc, I
(pay.payloads().isEmpty() ? null :
pay.payloads().peek() instanceof UnitPayload p1 ? p1.unit.type :
pay.payloads().peek() instanceof BuildPayload p2 ? p2.block() : null) : null;
case building -> isBuilding() && !buildPlan().breaking ? buildPlan().tile().build : null;
case breaking -> isBuilding() && buildPlan().breaking ? buildPlan().tile().build : null;
case selectedBlock -> controller instanceof Player p ? p.selectedBlock : null;
default -> noSensed;
};
}

View File

@@ -944,6 +944,9 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
block = null;
}
player.selectedBlock = block;
player.selectedRotation = rotation;
wasShooting = player.shooting;
//only reset the controlled type and control a unit after the timer runs out

View File

@@ -392,11 +392,12 @@ public class TypeIO{
}
public static void writeBlock(Writes write, Block block){
write.s(block.id);
write.s(block == null ? -1 : block.id);
}
public static Block readBlock(Reads read){
return content.block(read.s());
short id = read.s();
return id == -1 ? null : content.block(id);
}
/** @return the maximum acceptable amount of plans to send over the network */

View File

@@ -51,6 +51,10 @@ public enum LAccess{
mineX,
mineY,
mining,
buildX,
buildY,
building,
breaking,
speed,
team,
type,
@@ -64,6 +68,8 @@ public enum LAccess{
payloadCapacity,
maxUnits,
id,
selectedBlock,
selectedRotation,
//values with parameters are considered controllable
enabled("to"), //"to" is standard for single parameter access

View File

@@ -212,8 +212,19 @@ public class ConstructBlock extends Block{
@Override
public double sense(LAccess sensor){
if(sensor == LAccess.progress) return Mathf.clamp(progress);
return super.sense(sensor);
return switch(sensor){
case progress -> Mathf.clamp(progress);
case breaking -> activeDeconstruct ? 1 : 0;
default -> super.sense(sensor);
};
}
@Override
public Object senseObject(LAccess sensor){
return switch(sensor){
case building -> current;
default -> super.senseObject(sensor);
};
}
@Override

View File

@@ -13,6 +13,7 @@ import mindustry.game.Teams.*;
import mindustry.gen.*;
import mindustry.graphics.*;
import mindustry.io.*;
import mindustry.logic.*;
import mindustry.type.*;
import mindustry.world.*;
import mindustry.world.blocks.ConstructBlock.*;
@@ -264,5 +265,21 @@ public class BuildTurret extends BaseTurret{
}
}
}
@Override
public double sense(LAccess sensor){
return switch(sensor){
case buildX, buildY -> unit.sense(sensor);
default -> super.sense(sensor);
};
}
@Override
public Object senseObject(LAccess sensor){
return switch(sensor){
case building, breaking -> unit.senseObject(sensor);
default -> super.senseObject(sensor);
};
}
}
}