This page documents the Galacticraft world sensor integration exposed to Lua by OpenComputers.
- Dependency:
gc - Label:
integration-required
world_sensor
- Reading gravity and wind values in Galacticraft dimensions.
- Checking whether the current world has a breathable atmosphere.
- Testing whether a specific atmospheric gas is present.
world_sensor is exposed by the Galacticraft world sensor card.
- Syntax:
getGravity(): number - Purpose: Return the gravity value of the current world.
- Returns:
- Galacticraft gravity multiplier for the current dimension.
- Usage notes:
- If the host world is not a Galacticraft world provider, this falls back to
1.
- If the host world is not a Galacticraft world provider, this falls back to
- Syntax:
getWindLevel(): number - Purpose: Return the wind level of the current world.
- Returns:
- Wind level for the current dimension.
- Usage notes:
- If the host world is not a Galacticraft world provider, this falls back to
1.
- If the host world is not a Galacticraft world provider, this falls back to
- Syntax:
hasBreathableAtmosphere(): boolean - Purpose: Return whether the current world has a breathable atmosphere.
- Returns:
trueif breathing is possible without extra support.falseotherwise.
- Usage notes:
- Non-Galacticraft worlds default to
true.
- Non-Galacticraft worlds default to
- Syntax:
isGasPresent(gas: string): boolean - Purpose: Return whether the current world atmosphere contains the specified gas.
- Parameters:
gas: stringAtmospheric gas name such asoxygenornitrogen.
- Returns:
trueif the gas is present.falseotherwise.
- Usage notes:
- The string is converted to uppercase before matching Galacticraft's gas enum.
- Non-Galacticraft worlds default to
true.
local component = require("component")
local sensor = component.world_sensor
print("Gravity:", sensor.getGravity())
print("Wind:", sensor.getWindLevel())
print("Breathable:", sensor.hasBreathableAtmosphere())
print("Has oxygen:", sensor.isGasPresent("oxygen"))stargatetech2vanilla