Misc bugfixes
This commit is contained in:
@@ -17,8 +17,8 @@ import java.io.*;
|
||||
|
||||
import static mindustry.Vars.*;
|
||||
|
||||
/** Stores global constants for logic processors. */
|
||||
public class GlobalConstants{
|
||||
/** Stores global logic variables for logic processors. */
|
||||
public class GlobalVars{
|
||||
public static final int ctrlProcessor = 1, ctrlPlayer = 2, ctrlCommand = 3;
|
||||
public static final ContentType[] lookableContent = {ContentType.block, ContentType.unit, ContentType.item, ContentType.liquid};
|
||||
/** Global random state. */
|
||||
@@ -58,7 +58,7 @@ public class LAssembler{
|
||||
/** @return a variable ID by name.
|
||||
* This may be a constant variable referring to a number or object. */
|
||||
public int var(String symbol){
|
||||
int constId = Vars.constants.get(symbol);
|
||||
int constId = Vars.logicVars.get(symbol);
|
||||
if(constId > 0){
|
||||
//global constants are *negated* and stored separately
|
||||
return -constId;
|
||||
|
||||
@@ -108,7 +108,7 @@ public class LExecutor{
|
||||
|
||||
public Var var(int index){
|
||||
//global constants have variable IDs < 0, and they are fetched from the global constants object after being negated
|
||||
return index < 0 ? constants.get(-index) : vars[index];
|
||||
return index < 0 ? logicVars.get(-index) : vars[index];
|
||||
}
|
||||
|
||||
public @Nullable Building building(int index){
|
||||
@@ -1104,7 +1104,7 @@ public class LExecutor{
|
||||
|
||||
@Override
|
||||
public void run(LExecutor exec){
|
||||
exec.setobj(dest, constants.lookupContent(type, exec.numi(from)));
|
||||
exec.setobj(dest, logicVars.lookupContent(type, exec.numi(from)));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -704,7 +704,7 @@ public class LStatements{
|
||||
|
||||
table.button(b -> {
|
||||
b.label(() -> type.name());
|
||||
b.clicked(() -> showSelect(b, GlobalConstants.lookableContent, type, o -> {
|
||||
b.clicked(() -> showSelect(b, GlobalVars.lookableContent, type, o -> {
|
||||
type = o;
|
||||
}));
|
||||
}, Styles.logict, () -> {}).size(64f, 40f).pad(4f).color(table.color);
|
||||
|
||||
@@ -40,7 +40,7 @@ public enum LogicOp{
|
||||
floor("floor", Math::floor),
|
||||
ceil("ceil", Math::ceil),
|
||||
sqrt("sqrt", Math::sqrt),
|
||||
rand("rand", d -> GlobalConstants.rand.nextDouble() * d),
|
||||
rand("rand", d -> GlobalVars.rand.nextDouble() * d),
|
||||
|
||||
sin("sin", d -> Math.sin(d * Mathf.doubleDegRad)),
|
||||
cos("cos", d -> Math.cos(d * Mathf.doubleDegRad)),
|
||||
|
||||
Reference in New Issue
Block a user