New map rule to disable unit control via logic (#11627)
* map rule to disable unit control via logic * syntaxn't
This commit is contained in:
@@ -90,6 +90,8 @@ public class Rules{
|
||||
public float unitMineSpeedMultiplier = 1f;
|
||||
/** If true, ghost blocks will appear upon destruction, letting builder blocks/units rebuild them. */
|
||||
public boolean ghostBlocks = true;
|
||||
/** Whether to allow logic to control units. */
|
||||
public boolean logicUnitControl = true;
|
||||
/** Whether to allow units to build with logic. */
|
||||
public boolean logicUnitBuild = true;
|
||||
/** Whether to allow units to deconstruct blocks with logic. */
|
||||
|
||||
@@ -168,6 +168,8 @@ public class LExecutor{
|
||||
|
||||
@Override
|
||||
public void run(LExecutor exec){
|
||||
if(!exec.privileged && !state.rules.logicUnitControl) return;
|
||||
|
||||
if(exec.binds == null || exec.binds.length != content.units().size){
|
||||
exec.binds = new int[content.units().size];
|
||||
}
|
||||
@@ -219,6 +221,8 @@ public class LExecutor{
|
||||
|
||||
@Override
|
||||
public void run(LExecutor exec){
|
||||
if(!exec.privileged && !state.rules.logicUnitControl) return;
|
||||
|
||||
Object unitObj = exec.unit.obj();
|
||||
LogicAI ai = UnitControlI.checkLogicAI(exec, unitObj);
|
||||
|
||||
@@ -329,6 +333,8 @@ public class LExecutor{
|
||||
|
||||
@Override
|
||||
public void run(LExecutor exec){
|
||||
if(!exec.privileged && !state.rules.logicUnitControl) return;
|
||||
|
||||
Object unitObj = exec.unit.obj();
|
||||
LogicAI ai = checkLogicAI(exec, unitObj);
|
||||
|
||||
|
||||
@@ -300,7 +300,8 @@ public class LogicDialog extends BaseDialog{
|
||||
for(Prov<LStatement> prov : LogicIO.allStatements){
|
||||
LStatement example = prov.get();
|
||||
if(example instanceof InvalidStatement || example.hidden() || (example.privileged() && !privileged) || (example.nonPrivileged() && privileged) ||
|
||||
(!text.isEmpty() && !example.name().toLowerCase(Locale.ROOT).contains(text) && !example.typeName().toLowerCase(Locale.ROOT).contains(text))) continue;
|
||||
(!text.isEmpty() && !example.name().toLowerCase(Locale.ROOT).contains(text) && !example.typeName().toLowerCase(Locale.ROOT).contains(text)) ||
|
||||
(!privileged && !state.rules.logicUnitControl && example.category() == LCategory.unit)) continue;
|
||||
|
||||
if(matched[0] == null){
|
||||
matched[0] = prov;
|
||||
|
||||
@@ -199,8 +199,9 @@ public class CustomRulesDialog extends BaseDialog{
|
||||
number("@rules.unitminespeedmultiplier", f -> rules.unitMineSpeedMultiplier = f, () -> rules.unitMineSpeedMultiplier);
|
||||
number("@rules.unitbuildspeedmultiplier", f -> rules.unitBuildSpeedMultiplier = f, () -> rules.unitBuildSpeedMultiplier, 0f, 50f);
|
||||
number("@rules.unitcostmultiplier", f -> rules.unitCostMultiplier = f, () -> rules.unitCostMultiplier);
|
||||
check("@rules.logicunitbuild", b -> rules.logicUnitBuild = b, () -> rules.logicUnitBuild);
|
||||
check("@rules.logicunitdeconstruct", b -> rules.logicUnitDeconstruct = b, () -> rules.logicUnitDeconstruct);
|
||||
check("@rules.logicunitcontrol", b -> rules.logicUnitControl = b, () -> rules.logicUnitControl);
|
||||
check("@rules.logicunitbuild", b -> rules.logicUnitBuild = b, () -> rules.logicUnitBuild, () -> rules.logicUnitControl);
|
||||
check("@rules.logicunitdeconstruct", b -> rules.logicUnitDeconstruct = b, () -> rules.logicUnitDeconstruct, () -> rules.logicUnitControl);
|
||||
|
||||
if(Core.bundle.get("bannedunits").toLowerCase().contains(ruleSearch)){
|
||||
current.button("@bannedunits", () -> bannedUnits.show(rules.bannedUnits)).left().width(300f).row();
|
||||
|
||||
Reference in New Issue
Block a user