Wave spawning improvements

This commit is contained in:
Anuken
2021-01-25 10:28:36 -05:00
parent f16990edcb
commit 4630e5b3a4
5 changed files with 22 additions and 15 deletions

View File

@@ -13,7 +13,6 @@ import mindustry.entities.*;
import mindustry.game.EventType.*;
import mindustry.game.*;
import mindustry.gen.*;
import mindustry.type.*;
import mindustry.world.*;
import static mindustry.Vars.*;
@@ -73,7 +72,7 @@ public class WaveSpawner{
for(int i = 0; i < spawned; i++){
Unit unit = group.createUnit(state.rules.waveTeam, state.wave - 1);
unit.set(spawnX + Mathf.range(spread), spawnY + Mathf.range(spread));
unit.add();
spawnEffect(unit);
}
});
}else{
@@ -178,8 +177,10 @@ public class WaveSpawner{
}
private void spawnEffect(Unit unit){
Call.spawnEffect(unit.x, unit.y, unit.type);
Time.run(30f, unit::add);
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();
}
private interface SpawnConsumer{
@@ -187,8 +188,8 @@ public class WaveSpawner{
}
@Remote(called = Loc.server, unreliable = true)
public static void spawnEffect(float x, float y, UnitType type){
Fx.unitSpawn.at(x, y, 0f, type);
public static void spawnEffect(float x, float y, Unit u){
Fx.unitSpawn.at(x, y, 0f, u);
Time.run(30f, () -> Fx.spawn.at(x, y));
}

View File

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

View File

@@ -200,7 +200,7 @@ public class Logic implements ApplicationListener{
}
public void skipWave(){
state.wavetime = 0;
runWave();
}
public void runWave(){

View File

@@ -204,7 +204,6 @@ public class DesktopInput extends InputHandler{
if(input.keyDown(Binding.mouse_move)){
panCam = true;
}
panning = false;
Core.camera.position.add(Tmp.v1.setZero().add(Core.input.axis(Binding.move_x), Core.input.axis(Binding.move_y)).nor().scl(camSpeed));
}else if(!player.dead() && !panning){

View File

@@ -888,6 +888,7 @@ public class LExecutor{
String strValue =
v.objval == null ? "null" :
v.objval instanceof String s ? s :
v.objval == Blocks.stoneWall ? "solid" : //special alias
v.objval instanceof MappableContent content ? content.name :
v.objval instanceof Content ? "[content]" :
v.objval instanceof Building build ? build.block.name :