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
5 changed files with 7 additions and 5 deletions

View File

@@ -159,7 +159,7 @@ public class Fx{
commandSend = new Effect(28, e -> { commandSend = new Effect(28, e -> {
color(Pal.command); color(Pal.command);
stroke(e.fout() * 2f); 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 -> { upgradeCore = new Effect(120f, e -> {

View File

@@ -64,7 +64,7 @@ abstract class CommanderComp implements Entityc, Posc{
units.clear(); 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){ if(u.isAI() && include.get(u) && u != self() && u.type.flying == type.flying && u.hitSize <= hitSize * 1.1f){
units.add(u); units.add(u);
} }

View File

@@ -388,11 +388,11 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
if(commander.isCommanding()){ if(commander.isCommanding()){
commander.clearCommand(); 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 //TODO try out some other formations
commander.commandNearby(new CircleFormation()); 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 aimDst = -1f;
public float buildBeamOffset = 3.8f; public float buildBeamOffset = 3.8f;
public int commandLimit = 8; public int commandLimit = 8;
public float commandRadius = 150f;
public float visualElevation = -1f; public float visualElevation = -1f;
public boolean allowLegStep = false; public boolean allowLegStep = false;
public boolean hovering = 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 TextureRegionDrawable[] commandRegions = new TextureRegionDrawable[UnitCommand.all.length];
public Color topColor = null, bottomColor = Color.valueOf("5e5e5e"); public Color topColor = null, bottomColor = Color.valueOf("5e5e5e");
public Effect effect = Fx.commandSend; public Effect effect = Fx.commandSend;
public float effectSize = 150f;
public CommandCenter(String name){ public CommandCenter(String name){
super(name); super(name);
@@ -35,7 +36,7 @@ public class CommandCenter extends Block{
config(UnitCommand.class, (CommandBuild build, UnitCommand command) -> { config(UnitCommand.class, (CommandBuild build, UnitCommand command) -> {
build.team.data().command = command; build.team.data().command = command;
effect.at(build); effect.at(build, effectSize);
Events.fire(new CommandIssueEvent(build, command)); Events.fire(new CommandIssueEvent(build, command));
}); });
} }