mirror of
https://github.com/Anuken/Mindustry.git
synced 2026-01-23 21:12:52 -08:00
Fixed #5648
This commit is contained in:
parent
f3b6f0a29b
commit
aab79a90fb
3 changed files with 11 additions and 4 deletions
|
|
@ -2055,6 +2055,7 @@ public class UnitTypes implements ContentList{
|
|||
rotateSpeed = 1.4f;
|
||||
rotateShooting = false;
|
||||
ammoType = AmmoTypes.powerHigh;
|
||||
ammoCapacity = 40;
|
||||
|
||||
//clip size is massive due to energy field
|
||||
clipSize = 250f;
|
||||
|
|
|
|||
|
|
@ -14,6 +14,8 @@ import mindustry.gen.*;
|
|||
import mindustry.graphics.*;
|
||||
import mindustry.type.*;
|
||||
|
||||
import static mindustry.Vars.*;
|
||||
|
||||
public class EnergyFieldAbility extends Ability{
|
||||
private static final Seq<Healthc> all = new Seq<>();
|
||||
|
||||
|
|
@ -31,6 +33,7 @@ public class EnergyFieldAbility extends Ability{
|
|||
public float effectRadius = 5f, sectorRad = 0.14f, rotateSpeed = 0.5f;
|
||||
public int sectors = 5;
|
||||
public Color color = Pal.heal;
|
||||
public boolean useAmmo = true;
|
||||
|
||||
protected float timer, curStroke;
|
||||
protected boolean anyNearby = false;
|
||||
|
|
@ -88,8 +91,7 @@ public class EnergyFieldAbility extends Ability{
|
|||
|
||||
curStroke = Mathf.lerpDelta(curStroke, anyNearby ? 1 : 0, 0.09f);
|
||||
|
||||
if((timer += Time.delta) >= reload){
|
||||
|
||||
if((timer += Time.delta) >= reload && (!useAmmo || unit.ammo > 0 || !state.rules.unitAmmo)){
|
||||
Tmp.v1.trns(unit.rotation - 90, x, y).add(unit.x, unit.y);
|
||||
float rx = Tmp.v1.x, ry = Tmp.v1.y;
|
||||
anyNearby = false;
|
||||
|
|
@ -143,6 +145,10 @@ public class EnergyFieldAbility extends Ability{
|
|||
|
||||
if(anyNearby){
|
||||
shootSound.at(unit);
|
||||
|
||||
if(useAmmo && state.rules.unitAmmo){
|
||||
unit.ammo --;
|
||||
}
|
||||
}
|
||||
|
||||
timer = 0f;
|
||||
|
|
|
|||
|
|
@ -384,9 +384,9 @@ public class UnitType extends UnlockableContent{
|
|||
|
||||
//dynamically create ammo capacity based on firing rate
|
||||
if(ammoCapacity < 0){
|
||||
float shotsPerSecond = weapons.sumf(w -> 60f / w.reload);
|
||||
float shotsPerSecond = weapons.sumf(w -> w.useAmmo ? 60f / w.reload : 0f);
|
||||
//duration of continuous fire without reload
|
||||
float targetSeconds = 30;
|
||||
float targetSeconds = 35;
|
||||
|
||||
ammoCapacity = Math.max(1, (int)(shotsPerSecond * targetSeconds));
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue