Factor in ammo reload multiplier + liquid heat capacity in turret coolant calculations
This commit is contained in:
@@ -2812,7 +2812,7 @@ public class Blocks{
|
|||||||
output = Items.sand;
|
output = Items.sand;
|
||||||
fogRadius = 3;
|
fogRadius = 3;
|
||||||
ambientSound = Sounds.drill;
|
ambientSound = Sounds.drill;
|
||||||
ambientSoundVolume = 0.05f;
|
ambientSoundVolume = 0.08f;
|
||||||
|
|
||||||
consumeLiquid(Liquids.ozone, 1f / 60f);
|
consumeLiquid(Liquids.ozone, 1f / 60f);
|
||||||
|
|
||||||
|
|||||||
@@ -50,13 +50,6 @@ public class ContinuousLiquidTurret extends ContinuousTurret{
|
|||||||
public void display(Stats stats){
|
public void display(Stats stats){
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO
|
|
||||||
//@Override
|
|
||||||
//protected float use(Building entity){
|
|
||||||
// BulletType type = ammoTypes.get(entity.liquids.current());
|
|
||||||
// return Math.min(amount * entity.edelta(), entity.block.liquidCapacity) / (type == null ? 1f : type.ammoMultiplier);
|
|
||||||
//}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
ammoTypes.each((item, type) -> placeOverlapRange = Math.max(placeOverlapRange, range + type.rangeChange + placeOverlapMargin));
|
ammoTypes.each((item, type) -> placeOverlapRange = Math.max(placeOverlapRange, range + type.rangeChange + placeOverlapMargin));
|
||||||
|
|||||||
@@ -1,9 +1,6 @@
|
|||||||
package mindustry.world.blocks.defense.turrets;
|
package mindustry.world.blocks.defense.turrets;
|
||||||
|
|
||||||
import arc.math.*;
|
import arc.math.*;
|
||||||
import arc.struct.*;
|
|
||||||
import arc.util.*;
|
|
||||||
import mindustry.type.*;
|
|
||||||
import mindustry.world.consumers.*;
|
import mindustry.world.consumers.*;
|
||||||
import mindustry.world.meta.*;
|
import mindustry.world.meta.*;
|
||||||
|
|
||||||
@@ -21,23 +18,7 @@ public class ReloadTurret extends BaseTurret{
|
|||||||
super.setStats();
|
super.setStats();
|
||||||
|
|
||||||
if(coolant != null){
|
if(coolant != null){
|
||||||
stats.remove(Stat.booster);
|
stats.replace(Stat.booster, StatValues.boosters(reload, coolant.amount, coolantMultiplier, true, coolant::consumes));
|
||||||
|
|
||||||
//TODO this is very hacky, there is no current way to check if a ConsumeLiquidBase accepts something individually. fix later
|
|
||||||
ObjectSet<Liquid> notBooster = content.liquids().select(l -> {
|
|
||||||
for(Consume c : consumers){
|
|
||||||
if(!c.booster && c != coolant &&
|
|
||||||
((c instanceof ConsumeLiquid cl && cl.liquid == l) ||
|
|
||||||
(c instanceof ConsumeLiquids cl2 && Structs.contains(cl2.liquids, s -> s.liquid == l)) ||
|
|
||||||
(c instanceof ConsumeLiquidFilter clf && clf.filter.get(l)))){
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}).asSet();
|
|
||||||
|
|
||||||
stats.add(Stat.booster, StatValues.boosters(reload, coolant.amount, coolantMultiplier, true, l -> l.coolant && consumesLiquid(l) && !notBooster.contains(l)));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -46,10 +27,10 @@ public class ReloadTurret extends BaseTurret{
|
|||||||
|
|
||||||
protected void updateCooling(){
|
protected void updateCooling(){
|
||||||
if(reloadCounter < reload && coolant != null && coolant.efficiency(this) > 0 && efficiency > 0){
|
if(reloadCounter < reload && coolant != null && coolant.efficiency(this) > 0 && efficiency > 0){
|
||||||
float capacity = coolant instanceof ConsumeLiquidFilter filter ? filter.getConsumed(this).heatCapacity : 1f;
|
float capacity = coolant instanceof ConsumeLiquidFilter filter ? filter.getConsumed(this).heatCapacity : (coolant.consumes(liquids.current()) ? liquids.current().heatCapacity : 0.4f);
|
||||||
float amount = coolant.amount * coolant.efficiency(this);
|
float amount = coolant.amount * coolant.efficiency(this);
|
||||||
coolant.update(this);
|
coolant.update(this);
|
||||||
reloadCounter += amount * edelta() * capacity * coolantMultiplier;
|
reloadCounter += amount * edelta() * capacity * coolantMultiplier * ammoReloadMultiplier();
|
||||||
|
|
||||||
if(Mathf.chance(0.06 * amount)){
|
if(Mathf.chance(0.06 * amount)){
|
||||||
coolEffect.at(x + Mathf.range(size * tilesize / 2f), y + Mathf.range(size * tilesize / 2f));
|
coolEffect.at(x + Mathf.range(size * tilesize / 2f), y + Mathf.range(size * tilesize / 2f));
|
||||||
@@ -57,6 +38,10 @@ public class ReloadTurret extends BaseTurret{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected float ammoReloadMultiplier(){
|
||||||
|
return 1f;
|
||||||
|
}
|
||||||
|
|
||||||
protected float baseReloadSpeed(){
|
protected float baseReloadSpeed(){
|
||||||
return efficiency;
|
return efficiency;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -575,13 +575,17 @@ public class Turret extends ReloadTurret{
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected void updateReload(){
|
protected void updateReload(){
|
||||||
float multiplier = hasAmmo() ? peekAmmo().reloadMultiplier : 1f;
|
reloadCounter += delta() * ammoReloadMultiplier() * baseReloadSpeed();
|
||||||
reloadCounter += delta() * multiplier * baseReloadSpeed();
|
|
||||||
|
|
||||||
//cap reload for visual reasons
|
//cap reload for visual reasons
|
||||||
reloadCounter = Math.min(reloadCounter, reload);
|
reloadCounter = Math.min(reloadCounter, reload);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected float ammoReloadMultiplier(){
|
||||||
|
return hasAmmo() ? peekAmmo().reloadMultiplier : 1f;
|
||||||
|
}
|
||||||
|
|
||||||
protected void updateShooting(){
|
protected void updateShooting(){
|
||||||
|
|
||||||
if(reloadCounter >= reload && !charging() && shootWarmup >= minWarmup){
|
if(reloadCounter >= reload && !charging() && shootWarmup >= minWarmup){
|
||||||
|
|||||||
@@ -73,6 +73,12 @@ public class Stats{
|
|||||||
add(stat, StatValues.string(format, args));
|
add(stat, StatValues.string(format, args));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Replaces a stat, removing the old value if it exists. */
|
||||||
|
public void replace(Stat stat, StatValue value){
|
||||||
|
remove(stat);
|
||||||
|
add(stat, value);
|
||||||
|
}
|
||||||
|
|
||||||
/** Adds a stat value. */
|
/** Adds a stat value. */
|
||||||
public void add(Stat stat, StatValue value){
|
public void add(Stat stat, StatValue value){
|
||||||
if(map == null) map = new OrderedMap<>();
|
if(map == null) map = new OrderedMap<>();
|
||||||
|
|||||||
Reference in New Issue
Block a user