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

@@ -336,7 +336,7 @@ public class EntityProcess extends BaseProcessor{
fbuilder.initializer(varInitializers.get(f.descString())); fbuilder.initializer(varInitializers.get(f.descString()));
} }
fbuilder.addModifiers(f.has(ReadOnly.class) ? Modifier.PROTECTED : Modifier.PUBLIC); fbuilder.addModifiers(f.has(ReadOnly.class) || f.is(Modifier.PRIVATE) ? Modifier.PROTECTED : Modifier.PUBLIC);
fbuilder.addAnnotations(f.annotations().map(AnnotationSpec::get)); fbuilder.addAnnotations(f.annotations().map(AnnotationSpec::get));
FieldSpec spec = fbuilder.build(); FieldSpec spec = fbuilder.build();

Binary file not shown.

After

Width:  |  Height:  |  Size: 408 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 603 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 426 B

After

Width:  |  Height:  |  Size: 1.6 KiB

View File

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

View File

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

View File

@@ -291,16 +291,16 @@ public class SectorDamage{
} }
if(build.block instanceof MendProjector m){ 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 //point defense turrets act as flat health right now
if(build.block instanceof PointDefenseTurret && build.consValid()){ if(build.block instanceof PointDefenseTurret && build.consValid()){
sumHealth += 150f * build.timeScale; sumHealth += 150f * build.timeScale();
} }
if(build.block instanceof ForceProjector f){ if(build.block instanceof ForceProjector f){
sumHealth += f.shieldHealth * e * build.timeScale; sumHealth += f.shieldHealth * e * build.timeScale();
sumRps += e; sumRps += e;
} }
} }

View File

@@ -52,7 +52,7 @@ public class ImpactReactor extends PowerGenerator{
addBar("poweroutput", (GeneratorBuild entity) -> new Bar(() -> addBar("poweroutput", (GeneratorBuild entity) -> new Bar(() ->
Core.bundle.format("bar.poweroutput", 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, () -> Pal.powerBar,
() -> entity.productionEfficiency)); () -> entity.productionEfficiency));
} }

View File

@@ -104,7 +104,7 @@ public class Drill extends Block{
super.setBars(); super.setBars();
addBar("drillspeed", (DrillBuild e) -> 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){ public Item getDrop(Tile tile){