This commit is contained in:
Anuken 2021-01-27 11:49:04 -05:00
parent ccc59aa61b
commit 47eea79b60
3 changed files with 12 additions and 10 deletions

View file

@ -13,6 +13,7 @@ import mindustry.entities.*;
import mindustry.game.EventType.*;
import mindustry.game.*;
import mindustry.gen.*;
import mindustry.type.*;
import mindustry.world.*;
import static mindustry.Vars.*;
@ -177,10 +178,11 @@ public class WaveSpawner{
}
private void spawnEffect(Unit unit){
Call.spawnEffect(unit.x, unit.y, unit);
unit.rotation = unit.angleTo(world.width()/2f * tilesize, world.height()/2f * tilesize);
unit.apply(StatusEffects.unmoving, 30f);
unit.add();
Call.spawnEffect(unit.x, unit.y, unit.rotation, unit.type);
}
private interface SpawnConsumer{
@ -188,8 +190,8 @@ public class WaveSpawner{
}
@Remote(called = Loc.server, unreliable = true)
public static void spawnEffect(float x, float y, Unit u){
Fx.unitSpawn.at(x, y, 0f, u);
public static void spawnEffect(float x, float y, float rotation, UnitType u){
Fx.unitSpawn.at(x, y, rotation, u);
Time.run(30f, () -> Fx.spawn.at(x, y));
}

View file

@ -26,23 +26,23 @@ public class Fx{
none = new Effect(0, 0f, e -> {}),
unitSpawn = new Effect(30f, e -> {
if(!(e.data instanceof Unit unit)) return;
if(!(e.data instanceof UnitType unit)) return;
float scl = 1f + e.fout() * 2f;
TextureRegion region = unit.type.icon(Cicon.full);
TextureRegion region = unit.icon(Cicon.full);
alpha(e.fout());
mixcol(Color.white, e.fin());
rect(region, unit.x, unit.y, 180f);
rect(region, e.x, e.y, 180f);
reset();
alpha(e.fin());
rect(region, unit.x, unit.y,
region.width * Draw.scl * scl, region.height * Draw.scl * scl, unit.rotation - 90);
rect(region, e.x, e.y,
region.width * Draw.scl * scl, region.height * Draw.scl * scl, e.rotation - 90);
}),

View file

@ -283,13 +283,13 @@ public class LCanvas extends Table{
t.add().growX();
t.button(Icon.copy, Styles.logici, () -> {
}).padRight(6).get().tapped(this::copy);
}).size(24f).padRight(6).get().tapped(this::copy);
t.button(Icon.cancel, Styles.logici, () -> {
remove();
dragging = null;
statements.layout();
});
}).size(24f);
t.addListener(new InputListener(){
float lastx, lasty;