DEATH AND DESTRUCTION
This commit is contained in:
@@ -22,8 +22,6 @@ public enum Binding implements KeyBind{
|
||||
pickupCargo(KeyCode.leftBracket),
|
||||
dropCargo(KeyCode.rightBracket),
|
||||
|
||||
command(KeyCode.g),
|
||||
|
||||
clear_building(KeyCode.q),
|
||||
pause_building(KeyCode.e),
|
||||
rotate(new Axis(KeyCode.scroll)),
|
||||
|
||||
@@ -278,7 +278,7 @@ public class DesktopInput extends InputHandler{
|
||||
|
||||
shouldShoot = !scene.hasMouse() && !locked;
|
||||
|
||||
if(!locked && state.rules.unitCommand && block == null && !scene.hasField()){
|
||||
if(!locked && block == null && !scene.hasField()){
|
||||
commandMode = input.keyDown(Binding.commandMode);
|
||||
}else{
|
||||
commandMode = false;
|
||||
@@ -806,10 +806,5 @@ public class DesktopInput extends InputHandler{
|
||||
tryDropPayload();
|
||||
}
|
||||
}
|
||||
|
||||
//update commander unit
|
||||
if(Core.input.keyTap(Binding.command) && unit.type.commandLimit > 0){
|
||||
Call.unitCommand(player);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,7 +13,6 @@ import arc.scene.event.*;
|
||||
import arc.scene.ui.layout.*;
|
||||
import arc.struct.*;
|
||||
import arc.util.*;
|
||||
import mindustry.ai.formations.patterns.*;
|
||||
import mindustry.ai.types.*;
|
||||
import mindustry.annotations.Annotations.*;
|
||||
import mindustry.content.*;
|
||||
@@ -241,14 +240,8 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
|
||||
throw new ValidateException(player, "Player cannot request items.");
|
||||
}
|
||||
|
||||
//remove item for every controlling unit
|
||||
player.unit().eachGroup(unit -> {
|
||||
Call.takeItems(build, item, Math.min(unit.maxAccepted(item), amount), unit);
|
||||
|
||||
if(unit == player.unit()){
|
||||
Events.fire(new WithdrawEvent(build, player, item, amount));
|
||||
}
|
||||
});
|
||||
Call.takeItems(build, item, Math.min(player.unit().maxAccepted(item), amount), player.unit());
|
||||
Events.fire(new WithdrawEvent(build, player, item, amount));
|
||||
}
|
||||
|
||||
@Remote(targets = Loc.both, forward = true, called = Loc.server)
|
||||
@@ -264,16 +257,13 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
|
||||
}
|
||||
|
||||
//deposit for every controlling unit
|
||||
player.unit().eachGroup(unit -> {
|
||||
Item item = unit.item();
|
||||
int accepted = build.acceptStack(item, unit.stack.amount, unit);
|
||||
var unit = player.unit();
|
||||
Item item = unit.item();
|
||||
int accepted = build.acceptStack(item, unit.stack.amount, unit);
|
||||
|
||||
Call.transferItemTo(unit, item, accepted, unit.x, unit.y, build);
|
||||
Call.transferItemTo(unit, item, accepted, unit.x, unit.y, build);
|
||||
|
||||
if(unit == player.unit()){
|
||||
Events.fire(new DepositEvent(build, player, item, accepted));
|
||||
}
|
||||
});
|
||||
Events.fire(new DepositEvent(build, player, item, accepted));
|
||||
}
|
||||
|
||||
@Remote(variants = Variant.one)
|
||||
@@ -369,11 +359,6 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
|
||||
pay.set(x, y);
|
||||
pay.dropLastPayload();
|
||||
pay.set(prevx, prevy);
|
||||
pay.controlling().each(u -> {
|
||||
if(u instanceof Payloadc){
|
||||
Call.payloadDropped(u, u.x, u.y);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -385,10 +370,9 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
|
||||
throw new ValidateException(player, "Player cannot drop an item.");
|
||||
}
|
||||
|
||||
player.unit().eachGroup(unit -> {
|
||||
Fx.dropItem.at(unit.x, unit.y, angle, Color.white, unit.item());
|
||||
unit.clearItem();
|
||||
});
|
||||
var unit = player.unit();
|
||||
Fx.dropItem.at(unit.x, unit.y, angle, Color.white, unit.item());
|
||||
unit.clearItem();
|
||||
}
|
||||
|
||||
@Remote(targets = Loc.both, called = Loc.server, forward = true, unreliable = true)
|
||||
@@ -545,24 +529,6 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
|
||||
player.deathTimer = Player.deathDelay + 1f; //for instant respawn
|
||||
}
|
||||
|
||||
@Remote(targets = Loc.both, called = Loc.server, forward = true)
|
||||
public static void unitCommand(Player player){
|
||||
if(player == null || player.dead() || (player.unit() == null)) return;
|
||||
|
||||
//make sure player is allowed to make the command
|
||||
if(net.server() && !netServer.admins.allowAction(player, ActionType.command, action -> {})){
|
||||
throw new ValidateException(player, "Player cannot command a unit.");
|
||||
}
|
||||
|
||||
if(player.unit().isCommanding()){
|
||||
player.unit().clearCommand();
|
||||
}else if(player.unit().type.commandLimit > 0){
|
||||
|
||||
player.unit().commandNearby(new CircleFormation());
|
||||
Fx.commandSend.at(player, player.unit().type.commandRadius);
|
||||
}
|
||||
}
|
||||
|
||||
/** Adds an input lock; if this function returns true, input is locked. Used for mod 'cutscenes' or custom camera panning. */
|
||||
public void addLock(Boolp lock){
|
||||
inputLocks.add(lock);
|
||||
|
||||
@@ -620,20 +620,16 @@ public class MobileInput extends InputHandler implements GestureListener{
|
||||
if(count == 2){
|
||||
//reset payload target
|
||||
payloadTarget = null;
|
||||
//apply command on double tap when own unit is tapped
|
||||
if(!player.dead() && Mathf.within(worldx, worldy, player.unit().x, player.unit().y, player.unit().hitSize * 0.6f + 8f) && player.unit().type.commandLimit > 0){
|
||||
Call.unitCommand(player);
|
||||
}else{
|
||||
//control a unit/block detected on first tap of double-tap
|
||||
if(unitTapped != null){
|
||||
Call.unitControl(player, unitTapped);
|
||||
recentRespawnTimer = 1f;
|
||||
}else if(buildingTapped != null){
|
||||
Call.buildingControlSelect(player, buildingTapped);
|
||||
recentRespawnTimer = 1f;
|
||||
}else if(!tryBeginMine(cursor)){
|
||||
tileTapped(linked.build);
|
||||
}
|
||||
|
||||
//control a unit/block detected on first tap of double-tap
|
||||
if(unitTapped != null){
|
||||
Call.unitControl(player, unitTapped);
|
||||
recentRespawnTimer = 1f;
|
||||
}else if(buildingTapped != null){
|
||||
Call.buildingControlSelect(player, buildingTapped);
|
||||
recentRespawnTimer = 1f;
|
||||
}else if(!tryBeginMine(cursor)){
|
||||
tileTapped(linked.build);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user