This commit is contained in:
Anuken
2020-08-18 11:23:17 -04:00
parent 065a8e712c
commit 1007667f9a
4 changed files with 22 additions and 11 deletions

View File

@@ -5,11 +5,13 @@ import arc.func.*;
import arc.math.*; import arc.math.*;
import arc.struct.*; import arc.struct.*;
import arc.util.*; import arc.util.*;
import mindustry.annotations.Annotations.*;
import mindustry.content.*; import mindustry.content.*;
import mindustry.entities.*; import mindustry.entities.*;
import mindustry.game.EventType.*; import mindustry.game.EventType.*;
import mindustry.game.*; import mindustry.game.*;
import mindustry.gen.*; import mindustry.gen.*;
import mindustry.type.*;
import mindustry.world.*; import mindustry.world.*;
import static mindustry.Vars.*; import static mindustry.Vars.*;
@@ -127,14 +129,18 @@ public class WaveSpawner{
} }
private void spawnEffect(Unit unit){ private void spawnEffect(Unit unit){
Fx.unitSpawn.at(unit.x(), unit.y(), 0f, unit); Call.spawnEffect(unit.x, unit.y, unit.type());
Time.run(30f, () -> { Time.run(30f, unit::add);
unit.add();
Fx.spawn.at(unit);
});
} }
private interface SpawnConsumer{ private interface SpawnConsumer{
void accept(float x, float y, boolean shockwave); void accept(float x, float y, boolean shockwave);
} }
@Remote(called = Loc.server, unreliable = true)
public static void spawnEffect(float x, float y, UnitType type){
Fx.unitSpawn.at(x, y, 0f, type);
Time.run(30f, () -> Fx.spawn.at(x, y));
}
} }

View File

@@ -26,15 +26,15 @@ public class Fx{
none = new Effect(0, 0f, e -> {}), none = new Effect(0, 0f, e -> {}),
unitSpawn = new Effect(30f, e -> { unitSpawn = new Effect(30f, e -> {
if(!(e.data instanceof Unit)) return; if(!(e.data instanceof UnitType)) return;
alpha(e.fin()); alpha(e.fin());
float scl = 1f + e.fout() * 2f; float scl = 1f + e.fout() * 2f;
Unit unit = e.data(); UnitType unit = e.data();
rect(unit.type().region, e.x, e.y, rect(unit.region, e.x, e.y,
unit.type().region.getWidth() * Draw.scl * scl, unit.type().region.getHeight() * Draw.scl * scl, 180f); unit.region.getWidth() * Draw.scl * scl, unit.region.getHeight() * Draw.scl * scl, 180f);
}), }),
@@ -369,7 +369,7 @@ public class Fx{
hitLiquid = new Effect(16, e -> { hitLiquid = new Effect(16, e -> {
color(e.color); color(e.color);
randLenVectors(e.id, 5, e.fin() * 15f, e.rotation + 180f, 60f, (x, y) -> { randLenVectors(e.id, 5, e.fin() * 15f, e.rotation, 60f, (x, y) -> {
Fill.circle(e.x + x, e.y + y, e.fout() * 2f); Fill.circle(e.x + x, e.y + y, e.fout() * 2f);
}); });

View File

@@ -69,7 +69,7 @@ public class LiquidBulletType extends BulletType{
super.despawned(b); super.despawned(b);
//don't create liquids when the projectile despawns //don't create liquids when the projectile despawns
hitEffect.at(b.x, b.y, liquid.color); hitEffect.at(b.x, b.y, b.rotation(), liquid.color);
} }
@Override @Override

View File

@@ -208,6 +208,10 @@ public class ServerControl implements ApplicationListener{
} }
}); });
//autosave settings once a minute
float saveInterval = 60;
Timer.schedule(() -> Core.settings.forceSave(), saveInterval, saveInterval);
if(!mods.list().isEmpty()){ if(!mods.list().isEmpty()){
info("&lc@ mods loaded.", mods.list().size); info("&lc@ mods loaded.", mods.list().size);
} }
@@ -516,6 +520,7 @@ public class ServerControl implements ApplicationListener{
} }
Log.info("&lc@&lg set to &lc@.", c.name(), c.get()); Log.info("&lc@&lg set to &lc@.", c.name(), c.get());
Core.settings.forceSave();
} }
}catch(IllegalArgumentException e){ }catch(IllegalArgumentException e){
err("Unknown config: '@'. Run the command with no arguments to get a list of valid configs.", arg[0]); err("Unknown config: '@'. Run the command with no arguments to get a list of valid configs.", arg[0]);