This repository has been archived on 2025-07-31. You can view files and clone it, but cannot push or open issues or pull requests.
Files
barotrauma-custom-components/README.md

22 lines
1.3 KiB
Markdown

# barotrauma-custom-components
Several Lua-based wiring components for the game [Barotrauma](https://barotraumagame.com/). Requires the [Lua for Barotrauma](https://steamcommunity.com/workshop/filedetails/?id=2559634234) 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:
## Useful Resources
* [Barotrauma Modding Docs](https://regalis11.github.io/BaroModDoc/)
* [Lua For Barotrauma Docs](https://evilfactory.github.io/LuaCsForBarotrauma/lua-docs/)