Logic rule instruction / Lock erekir proc sectors

This commit is contained in:
Anuken
2022-02-10 09:36:31 -05:00
parent 63ef847690
commit 04c2bbc24d
16 changed files with 179 additions and 17 deletions

View File

@@ -1,6 +1,7 @@
package mindustry.logic;
import arc.func.*;
import arc.graphics.*;
import arc.struct.*;
import arc.util.*;
import mindustry.*;
@@ -99,10 +100,20 @@ public class LAssembler{
//parse hex/binary syntax
if(symbol.startsWith("0b")) return Strings.parseLong(symbol, 2, 2, symbol.length(), invalidNum);
if(symbol.startsWith("0x")) return Strings.parseLong(symbol, 16, 2, symbol.length(), invalidNum);
if(symbol.startsWith("%") && (symbol.length() == 7 || symbol.length() == 9)) return parseColor(symbol);
return Strings.parseDouble(symbol, invalidNum);
}
double parseColor(String symbol){
int
r = Strings.parseInt(symbol, 16, 0, 1, 3),
g = Strings.parseInt(symbol, 16, 0, 3, 5),
b = Strings.parseInt(symbol, 16, 0, 5, 7),
a = symbol.length() == 9 ? Strings.parseInt(symbol, 16, 0, 7, 9) : 255;
return Color.toDoubleBits(r, g, b, a);
}
/** Adds a constant value by name. */
public BVar putConst(String name, Object value){
BVar var = putVar(name);