1
0
mirror of https://github.com/Anuken/Mindustry.git synced 2024-09-21 13:28:12 +03:00

Unit Command Radius (#5269)

* Unit Command Radius

* Make effect change with radius

* Fix command center effect

* Display true radius
This commit is contained in:
MEEP of Faith 2021-05-19 11:34:57 -07:00 committed by GitHub
parent 86d50e9147
commit db897d037d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 7 additions and 5 deletions

View File

@ -159,7 +159,7 @@ public class Fx{
commandSend = new Effect(28, e -> {
color(Pal.command);
stroke(e.fout() * 2f);
Lines.circle(e.x, e.y, 4f + e.finpow() * 120f);
Lines.circle(e.x, e.y, 4f + e.finpow() * e.rotation);
}),
upgradeCore = new Effect(120f, e -> {

View File

@ -64,7 +64,7 @@ abstract class CommanderComp implements Entityc, Posc{
units.clear();
Units.nearby(team, x, y, 150f, u -> {
Units.nearby(team, x, y, type.commandRadius, u -> {
if(u.isAI() && include.get(u) && u != self() && u.type.flying == type.flying && u.hitSize <= hitSize * 1.1f){
units.add(u);
}

View File

@ -388,11 +388,11 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
if(commander.isCommanding()){
commander.clearCommand();
}else if(player.unit().type.commandLimit > 0){
}else if(player.unit().type.commandLimit > 0 && player.unit().type.commandRadius > 0){
//TODO try out some other formations
commander.commandNearby(new CircleFormation());
Fx.commandSend.at(player);
Fx.commandSend.at(player, player.unit().type.commandRadius);
}
}

View File

@ -55,6 +55,7 @@ public class UnitType extends UnlockableContent{
public float aimDst = -1f;
public float buildBeamOffset = 3.8f;
public int commandLimit = 8;
public float commandRadius = 150f;
public float visualElevation = -1f;
public boolean allowLegStep = false;
public boolean hovering = false;

View File

@ -23,6 +23,7 @@ public class CommandCenter extends Block{
public TextureRegionDrawable[] commandRegions = new TextureRegionDrawable[UnitCommand.all.length];
public Color topColor = null, bottomColor = Color.valueOf("5e5e5e");
public Effect effect = Fx.commandSend;
public float effectSize = 150f;
public CommandCenter(String name){
super(name);
@ -35,7 +36,7 @@ public class CommandCenter extends Block{
config(UnitCommand.class, (CommandBuild build, UnitCommand command) -> {
build.team.data().command = command;
effect.at(build);
effect.at(build, effectSize);
Events.fire(new CommandIssueEvent(build, command));
});
}