Allow desktop players to configure blocks and view inventories when dead
This commit is contained in:
@@ -538,10 +538,14 @@ public class DesktopInput extends InputHandler{
|
||||
if(Core.input.keyTap(Binding.select) && !Core.scene.hasMouse()){
|
||||
tappedOne = false;
|
||||
|
||||
Tile selected = tileAt(Core.input.mouseX(), Core.input.mouseY());
|
||||
|
||||
if(commandMode){
|
||||
commandRect = true;
|
||||
commandRectX = input.mouseWorldX();
|
||||
commandRectY = input.mouseWorldY();
|
||||
}else if(selected != null){
|
||||
tileTapped(selected.build);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,8 +11,8 @@ import arc.math.geom.*;
|
||||
import arc.scene.*;
|
||||
import arc.scene.event.*;
|
||||
import arc.scene.ui.layout.*;
|
||||
import arc.struct.*;
|
||||
import arc.struct.Queue;
|
||||
import arc.struct.*;
|
||||
import arc.util.*;
|
||||
import mindustry.*;
|
||||
import mindustry.ai.*;
|
||||
@@ -40,7 +40,6 @@ import mindustry.world.blocks.*;
|
||||
import mindustry.world.blocks.distribution.*;
|
||||
import mindustry.world.blocks.payloads.*;
|
||||
import mindustry.world.blocks.storage.*;
|
||||
import mindustry.world.blocks.storage.CoreBlock.*;
|
||||
import mindustry.world.meta.*;
|
||||
|
||||
import java.util.*;
|
||||
@@ -664,6 +663,7 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
|
||||
return;
|
||||
}
|
||||
}
|
||||
if(player != null) build.updateLastAccess(player);
|
||||
build.configured(player == null || player.dead() ? null : player.unit(), value);
|
||||
Events.fire(new ConfigEvent(build, player, value));
|
||||
}
|
||||
|
||||
@@ -47,6 +47,8 @@ public class CoreBlock extends StorageBlock{
|
||||
public @Load(value = "@-thruster2", fallback = "clear-effect") TextureRegion thruster2; //bot left
|
||||
public float thrusterLength = 14f/4f, thrusterOffset = 0f;
|
||||
public boolean isFirstTier;
|
||||
/** If false, players can't respawn at this core. */
|
||||
public boolean allowSpawn = true;
|
||||
/** If true, this core type requires a core zone to upgrade. */
|
||||
public boolean requiresCoreZone;
|
||||
public boolean incinerateNonBuildable = false;
|
||||
@@ -553,7 +555,7 @@ public class CoreBlock extends StorageBlock{
|
||||
|
||||
@Override
|
||||
public void onControlSelect(Unit unit){
|
||||
if(!unit.isPlayer()) return;
|
||||
if(!unit.isPlayer() || !allowSpawn) return;
|
||||
Player player = unit.getPlayer();
|
||||
|
||||
Fx.spawn.at(player);
|
||||
@@ -568,7 +570,7 @@ public class CoreBlock extends StorageBlock{
|
||||
|
||||
public void requestSpawn(Player player){
|
||||
//do not try to respawn in unsupported environments at all
|
||||
if(!unitType.supportsEnv(state.rules.env)) return;
|
||||
if(!unitType.supportsEnv(state.rules.env) || !allowSpawn) return;
|
||||
|
||||
Call.playerSpawn(tile, player);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user