Editor & access modifier fixes

This commit is contained in:
Anuken
2022-02-20 16:58:29 -05:00
parent 21bf26fa78
commit 8b916d03af
10 changed files with 24 additions and 12 deletions

View File

@@ -273,7 +273,13 @@ public class MapEditorDialog extends Dialog implements Disposable{
world.endMapLoad();
player.set(world.width() * tilesize/2f, world.height() * tilesize/2f);
player.clearUnit();
Groups.unit.clear();
for(var unit : Groups.unit){
if(unit.spawnedByCore){
unit.remove();
}
}
Groups.build.clear();
Groups.weather.clear();
logic.play();

View File

@@ -20,9 +20,8 @@ public class EmpBulletType extends BasicBulletType{
if(!b.absorbed){
Vars.indexer.allBuildings(x, y, radius, other -> {
if(other.team == b.team){
if(other.block.hasPower && other.block.canOverdrive && other.timeScale < timeIncrease){
other.timeScale = Math.max(other.timeScale, timeIncrease);
other.timeScaleDuration = Math.max(other.timeScaleDuration, timeDuration);
if(other.block.hasPower && other.block.canOverdrive && other.timeScale() < timeIncrease){
other.applyBoost(timeIncrease, timeDuration);
chainEffect.at(x, y, 0, hitColor, other);
applyEffect.at(other, other.block.size * 7f);
}
@@ -39,8 +38,7 @@ public class EmpBulletType extends BasicBulletType{
}
if(other.power != null && other.power.graph.getLastPowerProduced() > 0f){
other.timeScale = Math.min(other.timeScale, powerSclDecrease);
other.timeScaleDuration = timeDuration;
other.applySlowdown(powerSclDecrease, timeDuration);
other.damage(damage * powerDamageScl);
hitPowerEffect.at(other.x, other.y, b.angleTo(other), hitColor);
chainEffect.at(x, y, 0, hitColor, other);

View File

@@ -346,6 +346,14 @@ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc,
timeScale = Math.max(timeScale, intensity);
}
public void applySlowdown(float intensity, float duration){
//do not refresh time scale when getting a weaker intensity
if(intensity <= this.timeScale - 0.001f){
timeScaleDuration = Math.max(timeScaleDuration, duration);
}
timeScale = Math.min(timeScale, intensity);
}
public void applyHealSuppression(float amount){
healSuppressionTime = Math.max(healSuppressionTime, Time.time + amount);
}

View File

@@ -291,16 +291,16 @@ public class SectorDamage{
}
if(build.block instanceof MendProjector m){
sumRps += m.healPercent / m.reload * avgHealth * 60f / 100f * e * build.timeScale;
sumRps += m.healPercent / m.reload * avgHealth * 60f / 100f * e * build.timeScale();
}
//point defense turrets act as flat health right now
if(build.block instanceof PointDefenseTurret && build.consValid()){
sumHealth += 150f * build.timeScale;
sumHealth += 150f * build.timeScale();
}
if(build.block instanceof ForceProjector f){
sumHealth += f.shieldHealth * e * build.timeScale;
sumHealth += f.shieldHealth * e * build.timeScale();
sumRps += e;
}
}

View File

@@ -52,7 +52,7 @@ public class ImpactReactor extends PowerGenerator{
addBar("poweroutput", (GeneratorBuild entity) -> new Bar(() ->
Core.bundle.format("bar.poweroutput",
Strings.fixed(Math.max(entity.getPowerProduction() - consPower.usage, 0) * 60 * entity.timeScale, 1)),
Strings.fixed(Math.max(entity.getPowerProduction() - consPower.usage, 0) * 60 * entity.timeScale(), 1)),
() -> Pal.powerBar,
() -> entity.productionEfficiency));
}

View File

@@ -104,7 +104,7 @@ public class Drill extends Block{
super.setBars();
addBar("drillspeed", (DrillBuild e) ->
new Bar(() -> Core.bundle.format("bar.drillspeed", Strings.fixed(e.lastDrillSpeed * 60 * e.timeScale, 2)), () -> Pal.ammo, () -> e.warmup));
new Bar(() -> Core.bundle.format("bar.drillspeed", Strings.fixed(e.lastDrillSpeed * 60 * e.timeScale(), 2)), () -> Pal.ammo, () -> e.warmup));
}
public Item getDrop(Tile tile){