Wave spawning improvements
This commit is contained in:
@@ -13,7 +13,6 @@ 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.*;
|
||||||
@@ -73,7 +72,7 @@ public class WaveSpawner{
|
|||||||
for(int i = 0; i < spawned; i++){
|
for(int i = 0; i < spawned; i++){
|
||||||
Unit unit = group.createUnit(state.rules.waveTeam, state.wave - 1);
|
Unit unit = group.createUnit(state.rules.waveTeam, state.wave - 1);
|
||||||
unit.set(spawnX + Mathf.range(spread), spawnY + Mathf.range(spread));
|
unit.set(spawnX + Mathf.range(spread), spawnY + Mathf.range(spread));
|
||||||
unit.add();
|
spawnEffect(unit);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}else{
|
}else{
|
||||||
@@ -178,8 +177,10 @@ public class WaveSpawner{
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void spawnEffect(Unit unit){
|
private void spawnEffect(Unit unit){
|
||||||
Call.spawnEffect(unit.x, unit.y, unit.type);
|
Call.spawnEffect(unit.x, unit.y, unit);
|
||||||
Time.run(30f, unit::add);
|
unit.rotation = unit.angleTo(world.width()/2f * tilesize, world.height()/2f * tilesize);
|
||||||
|
unit.apply(StatusEffects.unmoving, 30f);
|
||||||
|
unit.add();
|
||||||
}
|
}
|
||||||
|
|
||||||
private interface SpawnConsumer{
|
private interface SpawnConsumer{
|
||||||
@@ -187,8 +188,8 @@ public class WaveSpawner{
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Remote(called = Loc.server, unreliable = true)
|
@Remote(called = Loc.server, unreliable = true)
|
||||||
public static void spawnEffect(float x, float y, UnitType type){
|
public static void spawnEffect(float x, float y, Unit u){
|
||||||
Fx.unitSpawn.at(x, y, 0f, type);
|
Fx.unitSpawn.at(x, y, 0f, u);
|
||||||
|
|
||||||
Time.run(30f, () -> Fx.spawn.at(x, y));
|
Time.run(30f, () -> Fx.spawn.at(x, y));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,17 +26,23 @@ 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 UnitType)) return;
|
if(!(e.data instanceof Unit unit)) return;
|
||||||
|
|
||||||
alpha(e.fin());
|
|
||||||
|
|
||||||
float scl = 1f + e.fout() * 2f;
|
float scl = 1f + e.fout() * 2f;
|
||||||
|
|
||||||
UnitType unit = e.data();
|
TextureRegion region = unit.type.icon(Cicon.full);
|
||||||
TextureRegion region = unit.icon(Cicon.full);
|
|
||||||
|
|
||||||
rect(region, e.x, e.y,
|
alpha(e.fout());
|
||||||
region.width * Draw.scl * scl, region.height * Draw.scl * scl, 180f);
|
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);
|
||||||
|
|
||||||
}),
|
}),
|
||||||
|
|
||||||
|
|||||||
@@ -200,7 +200,7 @@ public class Logic implements ApplicationListener{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void skipWave(){
|
public void skipWave(){
|
||||||
state.wavetime = 0;
|
runWave();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void runWave(){
|
public void runWave(){
|
||||||
|
|||||||
@@ -204,7 +204,6 @@ public class DesktopInput extends InputHandler{
|
|||||||
if(input.keyDown(Binding.mouse_move)){
|
if(input.keyDown(Binding.mouse_move)){
|
||||||
panCam = true;
|
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));
|
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){
|
}else if(!player.dead() && !panning){
|
||||||
|
|||||||
@@ -888,6 +888,7 @@ public class LExecutor{
|
|||||||
String strValue =
|
String strValue =
|
||||||
v.objval == null ? "null" :
|
v.objval == null ? "null" :
|
||||||
v.objval instanceof String s ? s :
|
v.objval instanceof String s ? s :
|
||||||
|
v.objval == Blocks.stoneWall ? "solid" : //special alias
|
||||||
v.objval instanceof MappableContent content ? content.name :
|
v.objval instanceof MappableContent content ? content.name :
|
||||||
v.objval instanceof Content ? "[content]" :
|
v.objval instanceof Content ? "[content]" :
|
||||||
v.objval instanceof Building build ? build.block.name :
|
v.objval instanceof Building build ? build.block.name :
|
||||||
|
|||||||
Reference in New Issue
Block a user