Barotrauma

Barotrauma

RuyiLuaComponent
whosyourdaddy  [developer] 24 Apr @ 7:08am
User Manual
Local variables pre-declared in the chunk build time scope require user-defined values to work:
Parameters
Type
Description
deltaTime
number
In game development, it represents the time interval between the previous frame and the current frame (measured in seconds). The game uses a fixed deltaTime (update interval = 1/60 second ≈ 16.67 ms), meaning the physics engine and logic updates run strictly at a fixed timestep, independent of the rendering framerate or hardware performance. This prevents instability in physics simulation and entity update caused by framerate fluctuations.
function update(deltaTime) end
Called when the component updates
Parameters
Type
Description
pin
integer
The input pin number that received the signal.
value
string|number
The signal value.
function inp(pin, value) end
Called when the component receives an input signal.
---Keys (integer) represent the input pin numbers,
---values (string|number) represent the received signal values.
---@type table<integer, string|number>
inp = {}
When inp is defined as a table, it usually handled in function update
---@type table<integer, userdata>
inpSenders = {}
Used to retrieve the signal sender of a specified pin, where the key is the input pin and the value is the sender of the input signal for that pin.
function onItemLoaded() end
Called when all the components of the item have been loaded.
function onMapLoaded() end
Called when all items have been loaded.
function onSave() end
Called when the component begins serialization/saving.
Parameters
Type
Description
message
string
The network message to send.
client
userdata
The object of clr type Barotrauma.Networking.Client, which send the net message.
function netReceive(message, client) end
Used to handle network messages sent from the other end (Clients ↔ Server)

Local variables pre-defined in the chunk build time scope:
---@type boolean
local isSinglePlayer, isMultiplayer, isClient, isServer
As the name suggests
---@type { [integer]: string|number }
local out
Use the setindex operation to send a signal to a specified output pin. e.g. out[5] = 10 means sending "10" from signal_out5.
---@type userdata # the object of type Barotrauma.Character
local outSender
Set the sender of the output signal. Used for the recipients (turret, detonator, navigation terminal and so on) to capture the signal source (character), take source's talents, skill level bonuses, etc into account.
---@return string
local function readMemory() end
Reads the component's Memory property
Parameters
Type
Description
value
string
The value that needs to be written into the memory.
local function writeMemory(value) end
Writes a value to the component's Memory property
Parameters
Type
Description
t
table
The table that needs to be cleared.
local function clear(t) end
Used to conveniently and efficiently clear a table
Parameters
Type
Description
message
string
The received network message.
function netSend(message) end
Used to send network messages to the other end (Clients ↔ Server)
---@type userdata
local ruyiLua
The component itself. If you have deeper understanding of Lua usage for baro, you can directly manipulate CLR objects to get more possibilities.
---@return number
local function GetTotalTime() end
Total amount of the time the game has run
Last edited by whosyourdaddy; 25 Apr @ 3:26am