This commit is contained in:
slava0135
2020-11-28 19:53:04 +03:00
4 changed files with 15 additions and 3 deletions

View File

@@ -14,7 +14,7 @@ import mindustry.world.*;
/** "Compiles" a sequence of statements into instructions. */
public class LAssembler{
public static ObjectMap<String, Func<String[], LStatement>> customParsers = new ObjectMap<>();
public static final int maxTokenLength = 40;
public static final int maxTokenLength = 36;
private int lastVar;
/** Maps names to variable IDs. */

View File

@@ -29,7 +29,11 @@ public class Bar extends Element{
public Bar(Prov<String> name, Prov<Color> color, Floatp fraction){
this.fraction = fraction;
lastValue = value = Mathf.clamp(fraction.get());
try{
lastValue = value = Mathf.clamp(fraction.get());
}catch(Exception e){ //getting the fraction may involve referring to invalid data
lastValue = value = 0f;
}
update(() -> {
try{
this.name = name.get();