Skip to content

Latest commit

 

History

History
556 lines (358 loc) · 10.3 KB

File metadata and controls

556 lines (358 loc) · 10.3 KB

CC: Tweaked peripheral documentation

Documentation on the lua peripherals and their functions implemented as CC: Tweaked compat.


Generic gas node peripheral

Available on most blocks that have an internal inventory of gas (some exceptions apply, which are gas-storing blocks with their own custom peripheral)


getGasDetails(gasName: string) -> table

Returns a table representing the gas properties, in the following format:

{
    name = <string>
    density = <number>
    viscosity = <number>
    specificHeatCapacity = <number>
    thermalConductivity = <number>
    sutherlandConstant = <number>
    adiabaticIndex = <number>
}

Throws if the gasName (resource location) is not found in the gas registry


getGasMass() -> table<string, number>

Returns a table of each gas name to its mass in the node. Will contain every gas name, even if the node does not contain that gas.


getHeatEnergy() -> number

Returns the total heat energy in the node, in Joules


getPressure() -> number

Returns the pressure of the node, in Pascals


getTemperature() -> number

Returns the temperature of the node, in Kelvin


pushGas(toName: string, gasName: string, amount: number | nil)

Push the gas of type gasName from this node to the node with the peripheral name toName. If amount is not specified, it will move the entire amount of gasName in the node.

Throws if:

  • toName is not found as a peripheral
  • toName is not a gas node peripheral
  • gasName is not found in the gas registry
  • amount is <=0
  • amount is larger than the amount of gasName in the node
  • cheatKelvinPeripheral is not enabled in the server config (disabled by default)

pullGas(fromName: string, gasName: string, amount: number | nil)

The same as pushGas, documented above, except the gas is being moved from the fromName into this node.


pushTemperature(toName: string, amount: number | nil)

Push amount of Kelvin from this node to the node peripheral named toName. If amount is not specific, it will transfer all heat from this node into toName.

Throws if:

  • toName is not found as a peripheral
  • toName is not a gas node peripheral
  • amount is <=0
  • amount is larger than the temperature in the node
  • cheatKelvinPeripheral is not enabled in the server config (disabled by default)

pullTemperature(fromName: string, amount: number | nil)

The same as pushTemperature, documented above, except the temperature is being moved from the fromName into this node.


Physics Bearing peripheral

Peripheral type: cw_phys_bearing


assemble()

Sets the physics bearing to assemble on the next tick


disassemble()

Sets the physics to disassemble as soon as possible (not necessarily on the same tick)


setFollowAngleMode()

Sets the bearing mode to FOLLOW_ANGLE


setUnlockedMode()

Sets the bearing mode to UNLOCKED


setAngle(angle: number)

Sets the current angle of the physics bearing


isBeingDisassembled() -> bool

Whether the physics bearing is currently trying to disassemble (aka trying to align to the grid)


isActive() -> bool

Is the physics bearing assembled


isInFollowAngleMode() -> bool

Is the physics bearing currently in FOLLOW_ANGLE mode


getConnectedToShip() -> number

Returns the numeric ship id this bearing is controlling. Will be -1 if the bearing is not currently assembled / has no ship id.


getTargetAngle() -> number

The current target angle the bearing is trying to get to


getActualAngle() -> number

The current angle the bearing is actually at


getTargetAngleChangeSpeed() -> number

The current speed the bearing is moving at to get to the target angle


getRPM() -> number

The current Create RPM being given to the bearing


getFacingDirection() -> string

The name of the direction the bearing block is rotated. Possible values: up, down, north, south, east, west


Gas Nozzle peripheral

Peripheral type: cw_gas_nozzle


setPointer(value: number)

Sets the gas nozzle "power" (the dial on the front). Equivalent to using create rotation on the side of the nozzle. value should be between 0.0 and 1.0, and represent a percentage of max power.


getPointer() -> number

Returns a number between 0.0 and 1.0 of the gas nozzles current "power"


getPointerSpeed() -> number

Returns the current speed the gas nozzle power dial is moving at because of Create rotation.


hasBalloon() -> bool

Whether the gas nozzle currently has a balloon air pocket attached/detected.


getPocketTemperature() -> number

Gets the total temperature of the attached air pocket, in Kelvin. If no air pocket is attached, will return 0.0


getTargetTemperature() -> number

Gets the current target temperature the gas nozzle is trying to achieve. Affected by both the gas nozzles current gas temperature, and the "power" dial.


getDuctTemperature() -> number

Gets the current internal temperature of the gas nozzle (not the pocket!) in Kelvin.


getBalloonVolume() -> number

The total volume (in metres cubed) of the attached air pocket. If no air pocket is attached, will return 0.0.


getLeaks() -> number

Returns the number of leaks found in the air pocket. If no air pocket is attached, will return 0.0.


Flap Bearing peripheral

Peripheral type: cw_flap_bearing


isSmart() -> bool

Whether the flap bearing is a smart flap bearing


getAngle() -> number

The current angle the bearing is at. Will be within the range -22.5 .. 22.5


setAngle(angle: number, locked: bool | nil)

Sets the angle the bearing is currently at. angle must be in the range -22.5 .. 22.5.

If locked is not specified, the bearing will be "locked" and no longer respond to any redstone input (only computer input) until setLocked is used. If locked is specified as false, the bearing will not be locked, and will respond to redstone input, but will also reset every tick.

Throws if:

  • The peripheral is not a smart flap bearing
  • The flap bearing is not being provided rotational power (enable cheatFlapBearingPeripheral in the server config to bypass this)
  • Flap bearing is not assembled

isLocked() -> bool

Whether the flap bearing is currently locked, and will only respond to computer input (not redstone).


setLocked(locked: bool)

Set the flap bearing to locked true/false. If true, the flap bearing will only respond to computer angle input. If false, the computer can accept redstone or computer input, but will reset the computer input each tick.


isRunning() -> bool

Is the flap bearing currently assembled


assemble() -> bool

Assembles the flap bearing. Returns true, unless the bearing was already assembled, in which case it will return false


disassemble() -> bool

Disassembles the flap bearing. Returns true, unless the bearing was already disassembled, in which case it will return false


Propeller Bearing peripheral

Peripheral type: cw_prop_bearing


isBrass() -> bool

Whether the propeller bearing is a brass propeller bearing (false if it is a jury rigged bearing)


getAngle() -> number

The current angle the bearing is at. Will be within the range -360 .. 360


setBladeAngle(angle: number, locked: bool | nil)

Sets the blade angle of any blade controllers on the bearing. angle must be in the range -180 .. 180.

If locked is not specified, the bearing will be "locked" and no longer respond to any redstone input (only computer input) until setLocked is used. If locked is specified as false, the bearing will not be locked, and will respond to redstone input, but will also reset every tick.

Throws if:

  • The peripheral is not a brass propeller bearing
  • The propeller bearing is not assembled

isLocked() -> bool

Whether the propeller bearing is currently locked, and will only respond to computer input (not redstone).


setLocked(locked: bool)

Set the propeller bearing locked to true/false. If true, the propeller bearing will only respond to computer blade angle input. If false, the propeller bearing can accept redstone or computer input, but will reset to the redstone input each tick.


isRunning() -> bool

Is the propeller bearing currently assembled


assemble() -> bool

Assembles the propeller bearing. Returns true, unless the bearing was already assembled, in which case it will return false


disassemble() -> bool

Disassembles the propeller bearing. Returns true, unless the bearing was already disassembled, in which case it will return false


Altimeter peripheral

Peripheral type: cw_alt_meter


getHeight() -> number

Returns the current height the altimeter is at. If the altimeter is on a ship, the height is automatically transformed from the shipyard into worldspace.


getOutput() -> number

Gets the current redstone signal strength the altimeter is outputting, in the range 0..15.


getTargetHeight() -> number

Returns the target height the altimeter is currently set to.


setTargetHeight(height: number)

Sets the target height of the altimeter. If height has decimals, they will be truncated.


getSensitivity() -> number

Returns the sensitivity the altimeter is currently set to.


setSensitivity(sensitivity: number)

Sets the sensitivity of the altimeter. If sensitivity has decimals, they will be truncated.


getDirection() -> string

Returns the current direction mode of the altimeter. Will be one of: UP, DOWN or BOTH.


setDirection(direction: string)

Sets the current direction mode of the altimeter. Not uppercase sensitive.

Throws if direction is not one of: UP, DOWN or BOTH.


This page is still a work in progress.

Spot an error, or want to add extra information? Then feel free to contribute to this page with a pull request