Skip to content

Commit 036f836

Browse files
committed
Make kelvin cheat peripheral disabled by default
1 parent 25cd690 commit 036f836

File tree

3 files changed

+10
-0
lines changed

3 files changed

+10
-0
lines changed

common/src/main/kotlin/org/valkyrienskies/clockwork/ClockworkConfig.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,5 +180,8 @@ object ClockworkConfig {
180180

181181
@ConfigEntry(description = "Whether the (smart) flap bearing peripheral can use setAngle without rotational power")
182182
var cheatFlapBearingPeripheral = false
183+
184+
@ConfigEntry(description = "Whether the generic kelvin peripheral can move gas/heat through only a peripheral connection")
185+
var cheatKelvinPeripheral = false
183186
}
184187
}

common/src/main/kotlin/org/valkyrienskies/clockwork/integration/cc/GasHeatSource.kt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import dan200.computercraft.api.peripheral.GenericPeripheral
88
import dan200.computercraft.api.peripheral.IComputerAccess
99
import dan200.computercraft.api.peripheral.PeripheralType
1010
import net.minecraft.resources.ResourceLocation
11+
import org.valkyrienskies.clockwork.ClockworkConfig
1112
import org.valkyrienskies.clockwork.ClockworkMod.MOD_ID
1213
import org.valkyrienskies.clockwork.ClockworkMod.getKelvin
1314
import org.valkyrienskies.kelvin.api.DuctNodePos
@@ -53,6 +54,7 @@ object GasHeatSource: GenericPeripheral {
5354
@LuaFunction
5455
@JvmStatic
5556
fun pushGas(from: INodeBlockEntity, computer: IComputerAccess, toName: String, gasName: String, amount: Optional<Double>) {
57+
if (!ClockworkConfig.SERVER.cheatKelvinPeripheral) throw LuaException("Cheat kelvin peripheral not enabled in config")
5658
val origin = from.getDuctNodePosition()
5759
val end = getNodePosFromPeripheral(computer, toName)
5860
val gas = getGasOrThrow(gasName)
@@ -63,6 +65,7 @@ object GasHeatSource: GenericPeripheral {
6365
@LuaFunction
6466
@JvmStatic
6567
fun pullGas(to: INodeBlockEntity, computer: IComputerAccess, fromName: String, gasName: String, amount: Optional<Double>) {
68+
if (!ClockworkConfig.SERVER.cheatKelvinPeripheral) throw LuaException("Cheat kelvin peripheral not enabled in config")
6669
val end = to.getDuctNodePosition()
6770
val origin = getNodePosFromPeripheral(computer, fromName)
6871
val gas = getGasOrThrow(gasName)
@@ -73,6 +76,7 @@ object GasHeatSource: GenericPeripheral {
7376
@LuaFunction
7477
@JvmStatic
7578
fun pushTemperature(from: INodeBlockEntity, computer: IComputerAccess, toName: String, amount: Optional<Double>) {
79+
if (!ClockworkConfig.SERVER.cheatKelvinPeripheral) throw LuaException("Cheat kelvin peripheral not enabled in config")
7680
val origin = from.getDuctNodePosition()
7781
val end = getNodePosFromPeripheral(computer, toName)
7882

@@ -82,6 +86,7 @@ object GasHeatSource: GenericPeripheral {
8286
@LuaFunction
8387
@JvmStatic
8488
fun pullTemperature(to: INodeBlockEntity, computer: IComputerAccess, fromName: String, amount: Optional<Double>) {
89+
if (!ClockworkConfig.SERVER.cheatKelvinPeripheral) throw LuaException("Cheat kelvin peripheral not enabled in config")
8590
val end = to.getDuctNodePosition()
8691
val origin = getNodePosFromPeripheral(computer, fromName)
8792

peripherals.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ Throws if:
7878
- `gasName` is not found in the gas registry
7979
- `amount` is `<=0`
8080
- `amount` is larger than the amount of `gasName` in the node
81+
- `cheatKelvinPeripheral` is not enabled in the server config (disabled by default)
8182

8283
---
8384

@@ -101,6 +102,7 @@ Throws if:
101102
- `toName` is not a gas node peripheral
102103
- `amount` is `<=0`
103104
- `amount` is larger than the temperature in the node
105+
- `cheatKelvinPeripheral` is not enabled in the server config (disabled by default)
104106

105107
---
106108

0 commit comments

Comments
 (0)