add thing (#7012)
This commit is contained in:
@@ -42,6 +42,8 @@ public class Rules{
|
|||||||
public boolean coreCapture = false;
|
public boolean coreCapture = false;
|
||||||
/** Whether reactors can explode and damage other blocks. */
|
/** Whether reactors can explode and damage other blocks. */
|
||||||
public boolean reactorExplosions = true;
|
public boolean reactorExplosions = true;
|
||||||
|
/** Whether to allow manual unit control. */
|
||||||
|
public boolean possessionAllowed = true;
|
||||||
/** Whether schematics are allowed. */
|
/** Whether schematics are allowed. */
|
||||||
public boolean schematicsAllowed = true;
|
public boolean schematicsAllowed = true;
|
||||||
/** Whether friendly explosions can occur and set fire/damage other blocks. */
|
/** Whether friendly explosions can occur and set fire/damage other blocks. */
|
||||||
|
|||||||
@@ -127,7 +127,7 @@ public class OverlayRenderer{
|
|||||||
|
|
||||||
Sized select = input.selectedUnit();
|
Sized select = input.selectedUnit();
|
||||||
if(select == null) select = input.selectedControlBuild();
|
if(select == null) select = input.selectedControlBuild();
|
||||||
if(!Core.input.keyDown(Binding.control)) select = null;
|
if(!Core.input.keyDown(Binding.control) || !state.rules.possessionAllowed) select = null;
|
||||||
|
|
||||||
unitFade = Mathf.lerpDelta(unitFade, Mathf.num(select != null), 0.1f);
|
unitFade = Mathf.lerpDelta(unitFade, Mathf.num(select != null), 0.1f);
|
||||||
|
|
||||||
|
|||||||
@@ -254,7 +254,7 @@ public class DesktopInput extends InputHandler{
|
|||||||
//validate commanding units
|
//validate commanding units
|
||||||
selectedUnits.removeAll(u -> !u.isCommandable() || !u.isValid());
|
selectedUnits.removeAll(u -> !u.isCommandable() || !u.isValid());
|
||||||
|
|
||||||
if(!scene.hasMouse() && !locked){
|
if(!scene.hasMouse() && !locked && state.rules.possessionAllowed){
|
||||||
if(Core.input.keyDown(Binding.control) && Core.input.keyTap(Binding.select)){
|
if(Core.input.keyDown(Binding.control) && Core.input.keyTap(Binding.select)){
|
||||||
Unit on = selectedUnit();
|
Unit on = selectedUnit();
|
||||||
var build = selectedControlBuild();
|
var build = selectedControlBuild();
|
||||||
|
|||||||
@@ -475,7 +475,7 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
|
|||||||
if(player == null) return;
|
if(player == null) return;
|
||||||
|
|
||||||
//make sure player is allowed to control the unit
|
//make sure player is allowed to control the unit
|
||||||
if(net.server() && !netServer.admins.allowAction(player, ActionType.control, action -> action.unit = unit)){
|
if(net.server() && (!state.rules.possessionAllowed || !netServer.admins.allowAction(player, ActionType.control, action -> action.unit = unit))){
|
||||||
throw new ValidateException(player, "Player cannot control a unit.");
|
throw new ValidateException(player, "Player cannot control a unit.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -658,10 +658,10 @@ public class MobileInput extends InputHandler implements GestureListener{
|
|||||||
payloadTarget = null;
|
payloadTarget = null;
|
||||||
|
|
||||||
//control a unit/block detected on first tap of double-tap
|
//control a unit/block detected on first tap of double-tap
|
||||||
if(unitTapped != null){
|
if(unitTapped != null && state.rules.possessionAllowed){
|
||||||
Call.unitControl(player, unitTapped);
|
Call.unitControl(player, unitTapped);
|
||||||
recentRespawnTimer = 1f;
|
recentRespawnTimer = 1f;
|
||||||
}else if(buildingTapped != null){
|
}else if(buildingTapped != null && state.rules.possessionAllowed){
|
||||||
Call.buildingControlSelect(player, buildingTapped);
|
Call.buildingControlSelect(player, buildingTapped);
|
||||||
recentRespawnTimer = 1f;
|
recentRespawnTimer = 1f;
|
||||||
}else if(!checkConfigTap() && !tryBeginMine(cursor)){
|
}else if(!checkConfigTap() && !tryBeginMine(cursor)){
|
||||||
|
|||||||
Reference in New Issue
Block a user