rounding over radio

This commit is contained in:
Boblet 2026-06-23 16:19:12 +02:00
parent cdaff12cb6
commit 372c51e411
4 changed files with 12 additions and 3 deletions

View File

@ -25,6 +25,10 @@
* Flashgold and flashlead are now made in the PUREX instead of the crafting table
* The flashgold recipe now yields two billets instead of one
* Slightly changed the HSS ingot texture to not look identical to steel except slightly greenish
* The AUTOCAL's buffer is now limited to 256 characters instead of being infinite
* Increased the blast furnace's fuel buffer by 50%, allowing coke blocks to be used
* If an RoR controller tries to parse an integer, but the supplied string represents a decimal, instead of canceling the operation, the system will now interpret decimals and round them to be integers
* This means that the AUTOCAL can now send RoR commands using calculated values directly without the use of `round` or `evalr`
## Fixed
* Fixed AUTOCAL's number comparison functions not working with variable substitution as advertised

View File

@ -34,7 +34,9 @@ public interface IRORInteractive extends IRORInfo {
public static int parseInt(String val, int min, int max) {
int result = 0;
try { result = Integer.parseInt(val); } catch(Exception x) { throw new RORFunctionException(EX_FORMAT); };
try { result = Integer.parseInt(val); } catch(Exception x) {
try { result = (int) Math.round(Double.parseDouble(val)); } catch(Exception y) { throw new RORFunctionException(EX_FORMAT); }
}
if(result < min || result > max) throw new RORFunctionException(EX_FORMAT);
return result;
}

View File

@ -46,7 +46,7 @@ public class TileEntityMachineBlastFurnace extends TileEntityMachineBase impleme
public int fuel;
public static final int FUEL_COAL = 200 * 8;
public static final int FUEL_RATE = 200 * 4; // half coal per operation
public static final int MAX_FUEL = FUEL_COAL * 16; // 16 pieces of coal
public static final int MAX_FUEL = FUEL_COAL * 24; // 24 pieces of coal, can also fit a bit more than a coal coke block
public static final int FLUE_GAS = 100; // per finished operation, not per tick
public ModuleBurnTime burnModule = new ModuleBurnTime()
@ -56,7 +56,7 @@ public class TileEntityMachineBlastFurnace extends TileEntityMachineBase impleme
super(5);
this.tanks = new FluidTank[2];
this.tanks[0] = new FluidTank(Fluids.AIRBLAST, 4_000);
this.tanks[1] = new FluidTank(Fluids.FLUE, 1_000); // TEMP
this.tanks[1] = new FluidTank(Fluids.FLUE, 1_000);
}
@Override

View File

@ -27,6 +27,8 @@ public class TileEntityRadioAUTOCAL extends TileEntityTickingBase implements ICo
public boolean ignoreError = false;
public boolean autoReboot = false;
public static final int MAX_BUFFER_LENGTH = 256;
public String[] script = new String[0];
public IParse msesv1 = new ParseMSES1();
public ParseContext ctx;
@ -68,6 +70,7 @@ public class TileEntityRadioAUTOCAL extends TileEntityTickingBase implements ICo
this.ctx.current ++;
String line = this.script[index];
EnumStatementReturn ret = msesv1.eval(ctx, line);
if(ctx.buffer.length() > MAX_BUFFER_LENGTH) ctx.buffer = ctx.buffer.substring(0, MAX_BUFFER_LENGTH);
if(ret != EnumStatementReturn.SKIP) pushMsg(index + ": " + line);
this.history[0] = "Buffer: " + ctx.buffer;
if(ret == EnumStatementReturn.END_TICK) break;