mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-01-13 00:05:23 +07:00
Oct now has an octagon shield
This commit is contained in:
parent
243c50be02
commit
0582ba1c47
@ -1468,7 +1468,7 @@ public class UnitTypes{
|
|||||||
buildBeamOffset = 43;
|
buildBeamOffset = 43;
|
||||||
ammoCapacity = 1;
|
ammoCapacity = 1;
|
||||||
|
|
||||||
abilities.add(new ForceFieldAbility(140f, 4f, 7000f, 60f * 8), new RepairFieldAbility(130f, 60f * 2, 140f));
|
abilities.add(new ForceFieldAbility(140f, 4f, 7000f, 60f * 8, 8, 0f), new RepairFieldAbility(130f, 60f * 2, 140f));
|
||||||
}};
|
}};
|
||||||
|
|
||||||
//endregion
|
//endregion
|
||||||
|
@ -22,6 +22,10 @@ public class ForceFieldAbility extends Ability{
|
|||||||
public float max = 200f;
|
public float max = 200f;
|
||||||
/** Cooldown after the shield is broken, in ticks. */
|
/** Cooldown after the shield is broken, in ticks. */
|
||||||
public float cooldown = 60f * 5;
|
public float cooldown = 60f * 5;
|
||||||
|
/** Sides of shield polygon. */
|
||||||
|
public int sides = 6;
|
||||||
|
/** Rotation of shield. */
|
||||||
|
public float rotation = 0f;
|
||||||
|
|
||||||
/** State. */
|
/** State. */
|
||||||
protected float radiusScale, alpha;
|
protected float radiusScale, alpha;
|
||||||
@ -30,7 +34,7 @@ public class ForceFieldAbility extends Ability{
|
|||||||
private static Unit paramUnit;
|
private static Unit paramUnit;
|
||||||
private static ForceFieldAbility paramField;
|
private static ForceFieldAbility paramField;
|
||||||
private static final Cons<Bullet> shieldConsumer = trait -> {
|
private static final Cons<Bullet> shieldConsumer = trait -> {
|
||||||
if(trait.team != paramUnit.team && trait.type.absorbable && Intersector.isInsideHexagon(paramUnit.x, paramUnit.y, realRad * 2f, trait.x(), trait.y()) && paramUnit.shield > 0){
|
if(trait.team != paramUnit.team && trait.type.absorbable && Intersector.isInRegularPolygon(paramField.sides, paramUnit.x, paramUnit.y, realRad, paramField.rotation, trait.x(), trait.y()) && paramUnit.shield > 0){
|
||||||
trait.absorb();
|
trait.absorb();
|
||||||
Fx.absorb.at(trait);
|
Fx.absorb.at(trait);
|
||||||
|
|
||||||
@ -53,6 +57,15 @@ public class ForceFieldAbility extends Ability{
|
|||||||
this.cooldown = cooldown;
|
this.cooldown = cooldown;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ForceFieldAbility(float radius, float regen, float max, float cooldown, int sides, float rotation){
|
||||||
|
this.radius = radius;
|
||||||
|
this.regen = regen;
|
||||||
|
this.max = max;
|
||||||
|
this.cooldown = cooldown;
|
||||||
|
this.sides = sides;
|
||||||
|
this.rotation = rotation;
|
||||||
|
}
|
||||||
|
|
||||||
ForceFieldAbility(){}
|
ForceFieldAbility(){}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -85,13 +98,13 @@ public class ForceFieldAbility extends Ability{
|
|||||||
Draw.color(unit.team.color, Color.white, Mathf.clamp(alpha));
|
Draw.color(unit.team.color, Color.white, Mathf.clamp(alpha));
|
||||||
|
|
||||||
if(Vars.renderer.animateShields){
|
if(Vars.renderer.animateShields){
|
||||||
Fill.poly(unit.x, unit.y, 6, realRad);
|
Fill.poly(unit.x, unit.y, sides, realRad, rotation);
|
||||||
}else{
|
}else{
|
||||||
Lines.stroke(1.5f);
|
Lines.stroke(1.5f);
|
||||||
Draw.alpha(0.09f);
|
Draw.alpha(0.09f);
|
||||||
Fill.poly(unit.x, unit.y, 6, radius);
|
Fill.poly(unit.x, unit.y, sides, radius, rotation);
|
||||||
Draw.alpha(1f);
|
Draw.alpha(1f);
|
||||||
Lines.poly(unit.x, unit.y, 6, radius);
|
Lines.poly(unit.x, unit.y, sides, radius, rotation);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -25,4 +25,4 @@ org.gradle.caching=true
|
|||||||
#used for slow jitpack builds; TODO see if this actually works
|
#used for slow jitpack builds; TODO see if this actually works
|
||||||
org.gradle.internal.http.socketTimeout=100000
|
org.gradle.internal.http.socketTimeout=100000
|
||||||
org.gradle.internal.http.connectionTimeout=100000
|
org.gradle.internal.http.connectionTimeout=100000
|
||||||
archash=b32576ca09
|
archash=1d7a035858
|
||||||
|
Loading…
Reference in New Issue
Block a user