Normalise config names

This commit is contained in:
SquidDev 2020-05-15 22:49:12 +01:00
parent 7af63d052d
commit 5a816917d5
5 changed files with 33 additions and 33 deletions

View File

@ -68,13 +68,13 @@ public final class ComputerCraft
public static int computerSpaceLimit = 1000 * 1000;
public static int floppySpaceLimit = 125 * 1000;
public static int maximumFilesOpen = 128;
public static boolean disable_lua51_features = false;
public static String default_computer_settings = "";
public static boolean debug_enable = true;
public static boolean disableLua51Features = false;
public static String defaultComputerSettings = "";
public static boolean debugEnable = true;
public static boolean logComputerErrors = true;
public static boolean commandRequireCreative = true;
public static int computer_threads = 1;
public static int computerThreads = 1;
public static long maxMainGlobalTime = TimeUnit.MILLISECONDS.toNanos( 10 );
public static long maxMainComputerTime = TimeUnit.MILLISECONDS.toNanos( 5 );
@ -93,10 +93,10 @@ public final class ComputerCraft
public static int httpMaxWebsockets = 4;
public static boolean enableCommandBlock = false;
public static int modem_range = 64;
public static int modem_highAltitudeRange = 384;
public static int modem_rangeDuringStorm = 64;
public static int modem_highAltitudeRangeDuringStorm = 384;
public static int modemRange = 64;
public static int modemHighAltitudeRange = 384;
public static int modemRangeDuringStorm = 64;
public static int modemHighAltitudeRangeDuringStorm = 384;
public static int maxNotesPerTick = 8;
public static MonitorRenderer monitorRenderer = MonitorRenderer.BEST;

View File

@ -136,7 +136,7 @@ static void start()
if( runners == null )
{
// TODO: Change the runners length on config reloads
runners = new TaskRunner[ComputerCraft.computer_threads];
runners = new TaskRunner[ComputerCraft.computerThreads];
// latency and minPeriod are scaled by 1 + floor(log2(threads)). We can afford to execute tasks for
// longer when executing on more than one thread.

View File

@ -95,7 +95,7 @@ public CobaltLuaMachine( Computer computer, TimeoutState timeout )
m_globals.load( state, new CoroutineLib() );
m_globals.load( state, new Bit32Lib() );
m_globals.load( state, new Utf8Lib() );
if( ComputerCraft.debug_enable ) m_globals.load( state, new DebugLib() );
if( ComputerCraft.debugEnable ) m_globals.load( state, new DebugLib() );
// Remove globals we don't want to expose
m_globals.rawset( "collectgarbage", Constants.NIL );
@ -106,8 +106,8 @@ public CobaltLuaMachine( Computer computer, TimeoutState timeout )
// Add version globals
m_globals.rawset( "_VERSION", valueOf( "Lua 5.1" ) );
m_globals.rawset( "_HOST", valueOf( computer.getAPIEnvironment().getComputerEnvironment().getHostString() ) );
m_globals.rawset( "_CC_DEFAULT_SETTINGS", valueOf( ComputerCraft.default_computer_settings ) );
if( ComputerCraft.disable_lua51_features )
m_globals.rawset( "_CC_DEFAULT_SETTINGS", valueOf( ComputerCraft.defaultComputerSettings ) );
if( ComputerCraft.disableLua51Features )
{
m_globals.rawset( "_CC_DISABLE_LUA51_FEATURES", Constants.TRUE );
}

View File

@ -101,17 +101,17 @@ private Config() {}
disableLua51Features = builder
.comment( "Set this to true to disable Lua 5.1 functions that will be removed in a future update. " +
"Useful for ensuring forward compatibility of your programs now." )
.define( "disable_lua51_features", ComputerCraft.disable_lua51_features );
.define( "disable_lua51_features", ComputerCraft.disableLua51Features );
defaultComputerSettings = builder
.comment( "A comma separated list of default system settings to set on new computers. Example: " +
"\"shell.autocomplete=false,lua.autocomplete=false,edit.autocomplete=false\" will disable all " +
"autocompletion" )
.define( "default_computer_settings", ComputerCraft.default_computer_settings );
.define( "default_computer_settings", ComputerCraft.defaultComputerSettings );
debugEnabled = builder
.comment( "Enable Lua's debug library. This is sandboxed to each computer, so is generally safe to be used by players." )
.define( "debug_enabled", ComputerCraft.debug_enable );
.define( "debug_enabled", ComputerCraft.debugEnable );
logComputerErrors = builder
.comment( "Log exceptions thrown by peripherals and other Lua objects.\n" +
@ -129,7 +129,7 @@ private Config() {}
"at once, but may induce lag.\n" +
"Please note that some mods may not work with a thread count higher than 1. Use with caution." )
.worldRestart()
.defineInRange( "computer_threads", ComputerCraft.computer_threads, 1, Integer.MAX_VALUE );
.defineInRange( "computer_threads", ComputerCraft.computerThreads, 1, Integer.MAX_VALUE );
maxMainGlobalTime = builder
.comment( "The maximum time that can be spent executing tasks in a single tick, in milliseconds.\n" +
@ -191,19 +191,19 @@ private Config() {}
modemRange = builder
.comment( "The range of Wireless Modems at low altitude in clear weather, in meters" )
.defineInRange( "modem_range", ComputerCraft.modem_range, 0, MODEM_MAX_RANGE );
.defineInRange( "modem_range", ComputerCraft.modemRange, 0, MODEM_MAX_RANGE );
modemHighAltitudeRange = builder
.comment( "The range of Wireless Modems at maximum altitude in clear weather, in meters" )
.defineInRange( "modem_high_altitude_range", ComputerCraft.modem_highAltitudeRange, 0, MODEM_MAX_RANGE );
.defineInRange( "modem_high_altitude_range", ComputerCraft.modemHighAltitudeRange, 0, MODEM_MAX_RANGE );
modemRangeDuringStorm = builder
.comment( "The range of Wireless Modems at low altitude in stormy weather, in meters" )
.defineInRange( "modem_range_during_storm", ComputerCraft.modem_rangeDuringStorm, 0, MODEM_MAX_RANGE );
.defineInRange( "modem_range_during_storm", ComputerCraft.modemRangeDuringStorm, 0, MODEM_MAX_RANGE );
modemHighAltitudeRangeDuringStorm = builder
.comment( "The range of Wireless Modems at maximum altitude in stormy weather, in meters" )
.defineInRange( "modem_high_altitude_range_during_storm", ComputerCraft.modem_highAltitudeRangeDuringStorm, 0, MODEM_MAX_RANGE );
.defineInRange( "modem_high_altitude_range_during_storm", ComputerCraft.modemHighAltitudeRangeDuringStorm, 0, MODEM_MAX_RANGE );
maxNotesPerTick = builder
.comment( "Maximum amount of notes a speaker can play at once" )
@ -265,14 +265,14 @@ public static void sync()
ComputerCraft.computerSpaceLimit = computerSpaceLimit.get();
ComputerCraft.floppySpaceLimit = floppySpaceLimit.get();
ComputerCraft.maximumFilesOpen = maximumFilesOpen.get();
ComputerCraft.disable_lua51_features = disableLua51Features.get();
ComputerCraft.default_computer_settings = defaultComputerSettings.get();
ComputerCraft.debug_enable = debugEnabled.get();
ComputerCraft.computer_threads = computerThreads.get();
ComputerCraft.disableLua51Features = disableLua51Features.get();
ComputerCraft.defaultComputerSettings = defaultComputerSettings.get();
ComputerCraft.debugEnable = debugEnabled.get();
ComputerCraft.computerThreads = computerThreads.get();
ComputerCraft.logComputerErrors = logComputerErrors.get();
// Execution
ComputerCraft.computer_threads = computerThreads.get();
ComputerCraft.computerThreads = computerThreads.get();
ComputerCraft.maxMainGlobalTime = TimeUnit.MILLISECONDS.toNanos( maxMainGlobalTime.get() );
ComputerCraft.maxMainComputerTime = TimeUnit.MILLISECONDS.toNanos( maxMainComputerTime.get() );
@ -288,10 +288,10 @@ public static void sync()
// Peripheral
ComputerCraft.enableCommandBlock = commandBlockEnabled.get();
ComputerCraft.maxNotesPerTick = maxNotesPerTick.get();
ComputerCraft.modem_range = modemRange.get();
ComputerCraft.modem_highAltitudeRange = modemHighAltitudeRange.get();
ComputerCraft.modem_rangeDuringStorm = modemRangeDuringStorm.get();
ComputerCraft.modem_highAltitudeRangeDuringStorm = modemHighAltitudeRangeDuringStorm.get();
ComputerCraft.modemRange = modemRange.get();
ComputerCraft.modemHighAltitudeRange = modemHighAltitudeRange.get();
ComputerCraft.modemRangeDuringStorm = modemRangeDuringStorm.get();
ComputerCraft.modemHighAltitudeRangeDuringStorm = modemHighAltitudeRangeDuringStorm.get();
// Turtles
ComputerCraft.turtlesNeedFuel = turtlesNeedFuel.get();

View File

@ -41,12 +41,12 @@ public double getRange()
if( world != null )
{
Vec3d position = getPosition();
double minRange = ComputerCraft.modem_range;
double maxRange = ComputerCraft.modem_highAltitudeRange;
double minRange = ComputerCraft.modemRange;
double maxRange = ComputerCraft.modemHighAltitudeRange;
if( world.isRaining() && world.isThundering() )
{
minRange = ComputerCraft.modem_rangeDuringStorm;
maxRange = ComputerCraft.modem_highAltitudeRangeDuringStorm;
minRange = ComputerCraft.modemRangeDuringStorm;
maxRange = ComputerCraft.modemHighAltitudeRangeDuringStorm;
}
if( position.y > 96.0 && maxRange > minRange )
{