diff --git a/core/src/mindustry/content/ErekirTechTree.java b/core/src/mindustry/content/ErekirTechTree.java index 21d894257a..c4b14a8a5f 100644 --- a/core/src/mindustry/content/ErekirTechTree.java +++ b/core/src/mindustry/content/ErekirTechTree.java @@ -226,14 +226,14 @@ public class ErekirTechTree{ }); }); - node(shipAssembler, Seq.with(tmpNever), () -> { + node(shipAssembler, () -> { node(UnitTypes.quell, () -> { node(UnitTypes.disrupt, Seq.with(tmpNever), () -> { }); }); - node(mechAssembler, () -> { + node(mechAssembler, Seq.with(tmpNever), () -> { node(UnitTypes.bulwark, () -> { node(UnitTypes.krepost, Seq.with(tmpNever), () -> { diff --git a/core/src/mindustry/content/Planets.java b/core/src/mindustry/content/Planets.java index c3c2f7c25c..95df967cfb 100644 --- a/core/src/mindustry/content/Planets.java +++ b/core/src/mindustry/content/Planets.java @@ -60,6 +60,7 @@ public class Planets{ totalRadius += 2.6f; lightSrcTo = 0.5f; lightDstFrom = 0.2f; + clearSectorOnLose = true; hiddenItems.addAll(Items.serpuloItems).removeAll(Items.erekirItems); ruleSetter = r -> { r.unitCommand = true; diff --git a/core/src/mindustry/core/Control.java b/core/src/mindustry/core/Control.java index 973b127ef1..d48b65a635 100644 --- a/core/src/mindustry/core/Control.java +++ b/core/src/mindustry/core/Control.java @@ -346,7 +346,7 @@ public class Control implements ApplicationListener, Loadable{ ui.planet.hide(); SaveSlot slot = sector.save; sector.planet.setLastSector(sector); - if(slot != null && !clearSectors){ + if(slot != null && !clearSectors && (!sector.planet.clearSectorOnLose || sector.info.hasCore)){ try{ boolean hadNoCore = !sector.info.hasCore; diff --git a/core/src/mindustry/entities/Effect.java b/core/src/mindustry/entities/Effect.java index 9104b870ec..c3f6fd9ec5 100644 --- a/core/src/mindustry/entities/Effect.java +++ b/core/src/mindustry/entities/Effect.java @@ -280,6 +280,10 @@ public class Effect{ return (T)data; } + public EffectContainer inner(){ + return innerContainer == null ? (innerContainer = new EffectContainer()) : innerContainer; + } + public void scaled(float lifetime, Cons cons){ if(innerContainer == null) innerContainer = new EffectContainer(); if(time <= lifetime){ diff --git a/core/src/mindustry/entities/effect/SeqEffect.java b/core/src/mindustry/entities/effect/SeqEffect.java new file mode 100644 index 0000000000..0ac1179cac --- /dev/null +++ b/core/src/mindustry/entities/effect/SeqEffect.java @@ -0,0 +1,46 @@ +package mindustry.entities.effect; + +import mindustry.entities.*; + +/** + * Renders multiple particle effects in sequence. + * Will not work correctly for effects that modify life dynamically. + * */ +public class SeqEffect extends Effect{ + public Effect[] effects = {}; + + public SeqEffect(){ + clip = 100f; + } + + public SeqEffect(Effect... effects){ + this(); + this.effects = effects; + } + + @Override + public void init(){ + lifetime = 0f; + for(Effect f : effects){ + f.init(); + clip = Math.max(clip, f.clip); + lifetime += f.lifetime; + } + } + + @Override + public void render(EffectContainer e){ + var cont = e.inner(); + float life = e.time, sum = 0f; + for(int i = 0; i < effects.length; i++){ + var fx = effects[i]; + if(life <= fx.lifetime + sum){ + cont.set(e.id + i, e.color, life - sum, fx.lifetime, e.rotation, e.x, e.y, e.data); + fx.render(cont); + clip = Math.max(clip, fx.clip); + break; + } + sum += fx.lifetime; + } + } +} diff --git a/core/src/mindustry/type/Planet.java b/core/src/mindustry/type/Planet.java index 5e5839017d..5798ac0934 100644 --- a/core/src/mindustry/type/Planet.java +++ b/core/src/mindustry/type/Planet.java @@ -93,6 +93,8 @@ public class Planet extends UnlockableContent{ public boolean allowSectorInvasion = false; /** If true, builder AI is turned on for all sectors on this planet by default. */ public boolean defaultAI = false; + /** If true, sectors saves are cleared when lost. */ + public boolean clearSectorOnLose = false; /** Sets up rules on game load for any sector on this planet. */ public Cons ruleSetter = r -> {}; /** Parent body that this planet orbits around. If null, this planet is considered to be in the middle of the solar system.*/