barotrauma-custom-components
Several Lua-based wiring components for the game Barotrauma. Requires the Lua for Barotrauma mod to be installed.
They are mainly designed to improve the performance of an advanced custom submarine called Daedalus by replacing large collections of vanilla components with a single Lua-based component.
Design Considerations
You might notice some weird design decisions in the code as well as in-game. These decisions are summarized below.
Usage of sub-components in item XML
As far as I know, Barotrauma does not have an easy way to store arbitrary variables in items. Instead, most custom component mods use a global Lua table that stores variables indexed by the item IDs they belong to. However, that comes with an important drawback: Lua tables are very slow, especially when accessed 60 times per second.
This is where the sub-components come in. They are used to store arbitrary values in their attributes, so editing them in-game is not recommended.
Specifically, the following sub-components are used depending on the stored variable type: