Add disarmed status effect that disarms (#4762)
* Add disarmed status effect that disarms * Update core/src/mindustry/entities/comp/StatusComp.java Co-authored-by: Anuken <arnukren@gmail.com> * Rename disarms -> disarm Co-authored-by: Anuken <arnukren@gmail.com>
This commit is contained in:
committed by
GitHub
parent
2f836d779a
commit
aabbfd624a
@@ -12,7 +12,7 @@ import mindustry.graphics.*;
|
|||||||
import static mindustry.Vars.*;
|
import static mindustry.Vars.*;
|
||||||
|
|
||||||
public class StatusEffects implements ContentList{
|
public class StatusEffects implements ContentList{
|
||||||
public static StatusEffect none, burning, freezing, unmoving, slow, wet, muddy, melting, sapped, tarred, overdrive, overclock, shielded, shocked, blasted, corroded, boss, sporeSlowed;
|
public static StatusEffect none, burning, freezing, unmoving, slow, wet, muddy, melting, sapped, tarred, overdrive, overclock, shielded, shocked, blasted, corroded, boss, sporeSlowed, disarmed;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void load(){
|
public void load(){
|
||||||
@@ -173,5 +173,10 @@ public class StatusEffects implements ContentList{
|
|||||||
color = Pal.plastanium;
|
color = Pal.plastanium;
|
||||||
damage = 0.1f;
|
damage = 0.1f;
|
||||||
}};
|
}};
|
||||||
|
|
||||||
|
disarmed = new StatusEffect("disarmed"){{
|
||||||
|
color = Color.valueOf("e9ead3");
|
||||||
|
disarm = true;
|
||||||
|
}};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ abstract class StatusComp implements Posc, Flyingc{
|
|||||||
private transient Bits applied = new Bits(content.getBy(ContentType.status).size);
|
private transient Bits applied = new Bits(content.getBy(ContentType.status).size);
|
||||||
|
|
||||||
@ReadOnly transient float speedMultiplier = 1, damageMultiplier = 1, healthMultiplier = 1, reloadMultiplier = 1;
|
@ReadOnly transient float speedMultiplier = 1, damageMultiplier = 1, healthMultiplier = 1, reloadMultiplier = 1;
|
||||||
|
@ReadOnly transient boolean disarmed = false;
|
||||||
|
|
||||||
@Import UnitType type;
|
@Import UnitType type;
|
||||||
|
|
||||||
@@ -111,6 +112,7 @@ abstract class StatusComp implements Posc, Flyingc{
|
|||||||
|
|
||||||
applied.clear();
|
applied.clear();
|
||||||
speedMultiplier = damageMultiplier = healthMultiplier = reloadMultiplier = 1f;
|
speedMultiplier = damageMultiplier = healthMultiplier = reloadMultiplier = 1f;
|
||||||
|
disarmed = false;
|
||||||
|
|
||||||
if(statuses.isEmpty()) return;
|
if(statuses.isEmpty()) return;
|
||||||
|
|
||||||
@@ -132,6 +134,9 @@ abstract class StatusComp implements Posc, Flyingc{
|
|||||||
healthMultiplier *= entry.effect.healthMultiplier;
|
healthMultiplier *= entry.effect.healthMultiplier;
|
||||||
damageMultiplier *= entry.effect.damageMultiplier;
|
damageMultiplier *= entry.effect.damageMultiplier;
|
||||||
reloadMultiplier *= entry.effect.reloadMultiplier;
|
reloadMultiplier *= entry.effect.reloadMultiplier;
|
||||||
|
|
||||||
|
disarmed |= entry.effect.disarm;
|
||||||
|
|
||||||
entry.effect.update(self(), entry.time);
|
entry.effect.update(self(), entry.time);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ import static mindustry.Vars.*;
|
|||||||
@Component(base = true)
|
@Component(base = true)
|
||||||
abstract class UnitComp implements Healthc, Physicsc, Hitboxc, Statusc, Teamc, Itemsc, Rotc, Unitc, Weaponsc, Drawc, Boundedc, Syncc, Shieldc, Commanderc, Displayable, Senseable, Ranged, Minerc, Builderc{
|
abstract class UnitComp implements Healthc, Physicsc, Hitboxc, Statusc, Teamc, Itemsc, Rotc, Unitc, Weaponsc, Drawc, Boundedc, Syncc, Shieldc, Commanderc, Displayable, Senseable, Ranged, Minerc, Builderc{
|
||||||
|
|
||||||
@Import boolean hovering, dead;
|
@Import boolean hovering, dead, disarmed;
|
||||||
@Import float x, y, rotation, elevation, maxHealth, drag, armor, hitSize, health, ammo, minFormationSpeed;
|
@Import float x, y, rotation, elevation, maxHealth, drag, armor, hitSize, health, ammo, minFormationSpeed;
|
||||||
@Import Team team;
|
@Import Team team;
|
||||||
@Import int id;
|
@Import int id;
|
||||||
@@ -178,7 +178,7 @@ abstract class UnitComp implements Healthc, Physicsc, Hitboxc, Statusc, Teamc, I
|
|||||||
@Replace
|
@Replace
|
||||||
public boolean canShoot(){
|
public boolean canShoot(){
|
||||||
//cannot shoot while boosting
|
//cannot shoot while boosting
|
||||||
return !(type.canBoost && isFlying());
|
return !disarmed && !(type.canBoost && isFlying());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ import static mindustry.Vars.*;
|
|||||||
@Component
|
@Component
|
||||||
abstract class WeaponsComp implements Teamc, Posc, Rotc, Velc, Statusc{
|
abstract class WeaponsComp implements Teamc, Posc, Rotc, Velc, Statusc{
|
||||||
@Import float x, y, rotation, reloadMultiplier;
|
@Import float x, y, rotation, reloadMultiplier;
|
||||||
|
@Import boolean disarmed;
|
||||||
@Import Vec2 vel;
|
@Import Vec2 vel;
|
||||||
@Import UnitType type;
|
@Import UnitType type;
|
||||||
|
|
||||||
@@ -81,7 +82,7 @@ abstract class WeaponsComp implements Teamc, Posc, Rotc, Velc, Statusc{
|
|||||||
}
|
}
|
||||||
|
|
||||||
boolean canShoot(){
|
boolean canShoot(){
|
||||||
return true;
|
return !disarmed;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -17,8 +17,10 @@ public class StatusEffect extends MappableContent{
|
|||||||
public float healthMultiplier = 1f;
|
public float healthMultiplier = 1f;
|
||||||
/** Unit speed multiplier */
|
/** Unit speed multiplier */
|
||||||
public float speedMultiplier = 1f;
|
public float speedMultiplier = 1f;
|
||||||
/** Unit speed multiplier */
|
/** Unit reload multiplier. */
|
||||||
public float reloadMultiplier = 1f;
|
public float reloadMultiplier = 1f;
|
||||||
|
/** Unit weapon(s) disabled. */
|
||||||
|
public boolean disarm = false;
|
||||||
/** Damage per frame. */
|
/** Damage per frame. */
|
||||||
public float damage;
|
public float damage;
|
||||||
/** Chance of effect appearing. */
|
/** Chance of effect appearing. */
|
||||||
|
|||||||
Reference in New Issue
Block a user