Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -42,6 +42,8 @@ public class Rules{
|
||||
public boolean coreCapture = false;
|
||||
/** Whether reactors can explode and damage other blocks. */
|
||||
public boolean reactorExplosions = true;
|
||||
/** Whether to allow manual unit control. */
|
||||
public boolean possessionAllowed = true;
|
||||
/** Whether schematics are allowed. */
|
||||
public boolean schematicsAllowed = true;
|
||||
/** Whether friendly explosions can occur and set fire/damage other blocks. */
|
||||
@@ -56,6 +58,8 @@ public class Rules{
|
||||
public boolean unitCapVariable = true;
|
||||
/** If true, unit spawn points are shown. */
|
||||
public boolean showSpawns = false;
|
||||
/** Multiplies power output of solar panels. */
|
||||
public float solarMultiplier = 1f;
|
||||
/** How fast unit factories build units. */
|
||||
public float unitBuildSpeedMultiplier = 1f;
|
||||
/** How much damage any other units deal. */
|
||||
|
||||
@@ -127,7 +127,7 @@ public class OverlayRenderer{
|
||||
|
||||
Sized select = input.selectedUnit();
|
||||
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);
|
||||
|
||||
|
||||
@@ -254,7 +254,7 @@ public class DesktopInput extends InputHandler{
|
||||
//validate commanding units
|
||||
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)){
|
||||
Unit on = selectedUnit();
|
||||
var build = selectedControlBuild();
|
||||
|
||||
@@ -475,7 +475,7 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
|
||||
if(player == null) return;
|
||||
|
||||
//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.");
|
||||
}
|
||||
|
||||
|
||||
@@ -658,10 +658,10 @@ public class MobileInput extends InputHandler implements GestureListener{
|
||||
payloadTarget = null;
|
||||
|
||||
//control a unit/block detected on first tap of double-tap
|
||||
if(unitTapped != null){
|
||||
if(unitTapped != null && state.rules.possessionAllowed){
|
||||
Call.unitControl(player, unitTapped);
|
||||
recentRespawnTimer = 1f;
|
||||
}else if(buildingTapped != null){
|
||||
}else if(buildingTapped != null && state.rules.possessionAllowed){
|
||||
Call.buildingControlSelect(player, buildingTapped);
|
||||
recentRespawnTimer = 1f;
|
||||
}else if(!checkConfigTap() && !tryBeginMine(cursor)){
|
||||
|
||||
@@ -1401,6 +1401,7 @@ public class LExecutor{
|
||||
}
|
||||
}
|
||||
case ambientLight -> state.rules.ambientLight.fromDouble(exec.num(value));
|
||||
case solarMultiplier -> state.rules.solarMultiplier = exec.numf(value);
|
||||
case unitBuildSpeed, unitDamage, blockHealth, blockDamage, buildSpeed, rtsMinSquad, rtsMinWeight -> {
|
||||
Team team = exec.team(p1);
|
||||
if(team != null){
|
||||
|
||||
@@ -13,6 +13,7 @@ public enum LogicRule{
|
||||
mapArea,
|
||||
lighting,
|
||||
ambientLight,
|
||||
solarMultiplier,
|
||||
|
||||
//team specific
|
||||
buildSpeed,
|
||||
|
||||
@@ -208,6 +208,8 @@ public class CustomRulesDialog extends BaseDialog{
|
||||
numberi("h", h -> state.rules.limitHeight = h, () -> state.rules.limitHeight, () -> state.rules.limitMapArea, 0, 10000);
|
||||
}
|
||||
|
||||
number("@rules.solarmultiplier", f -> rules.solarMultiplier = f, () -> rules.solarMultiplier);
|
||||
|
||||
main.button(b -> {
|
||||
b.left();
|
||||
b.table(Tex.pane, in -> {
|
||||
|
||||
@@ -26,7 +26,7 @@ public class SolarGenerator extends PowerGenerator{
|
||||
@Override
|
||||
public void updateTile(){
|
||||
productionEfficiency = enabled ?
|
||||
Mathf.maxZero(Attribute.light.env() +
|
||||
state.rules.solarMultiplier * Mathf.maxZero(Attribute.light.env() +
|
||||
(state.rules.lighting ?
|
||||
1f - state.rules.ambientLight.a :
|
||||
1f
|
||||
|
||||
Reference in New Issue
Block a user