Skip to main content

TemperatureGate

The gate will allow power to pass through it while the temperature is in a certain range. It can be used in conjunction with a Transistor part to control the flow of generated trigger signals based on its temperature.

Like the TemperatureSensor part, it will also use the attached Reactor temperature if there is one. Though, unlike the TemperatureSensor part, this one updates at a much faster 20 tps instead of 0.5 tps.

It is a craftable and spawnable non-flammable solid.

Here is a list of possible sizes that reach the maximum malleability (64) that have integer components: 1x64x1, 1x32x2, 1x16x4, 1x8x8, 2x16x2, 2x8x4, 4x4x4, 8x4x2

At its default size (1x1x2) it has a durability of 1, at its maximum size it has a durability of 4.

By default, its colour is #633b38.

It requires 1 Switch, 1 TemperatureSensor, and 1 Transistor to be crafted.

Methods


GetState()


GetTemp() → temperature

The temperature return is a number.


GetTemperature() → temperature

The temperature return is a number.

Configurables


Inverted

Whether or not the state will be inverted. It is a boolean.


SwitchValue

Determines whether the switch is active or not. It is a boolean.

local sift = require("sift") -- Grab this fancy library for manipulating tables provided by wos.

-- Get all of the types of objects with a `SwitchValue` (save for `TemperatureGate`) configurable
-- and merge them into one big table.
local objects = sift.Array.merge(
GetParts("Switch"),
GetParts("TriggerSwitch"),
GetParts("Valve"),
GetParts("Hatch"),
GetParts("HeatValve")
)

-- Have a 50/50 chance to be on/off when the code starts running.
local initialState = math.random() > 0.5

-- Iterate over all of the switch objects and disable them. `_` is used as a placeholder variable.
for _, switch in objects do
-- You could alternatively do `switch:Configure({ SwitchValue = initialState })`
switch.SwitchValue = initialState
end

-- Connect to the `Loop` event of the `Microcontroller` that is running the code,
-- this will make the code within run precisely every game tick.
Microcontroller.Loop:Connect(function()
-- Iterate over all the switches again!
for _, switch in objects do
-- Here we *read* the `SwitchValue`, then invert it, then write it back, as
-- to toggle the switch.
switch.SwitchValue = not switch.SwitchValue
end
end)

TemperatureRange

The range of temperatures (°F) within which the gate will be open. It is a NumberRange.

Events


Configured(configurerId)

Fires when the object is configured.

The configurerId parameter is the UserId of the player who configured the object. It is a number.