Barotrauma 潜渊症

Barotrauma 潜渊症

评价数不足
RuyiLuaComponent
   
奖励
收藏
已收藏
取消收藏
文件大小
发表于
更新日期
199.674 KB
4 月 24 日 上午 7:05
4 月 25 日 上午 3:17
2 项改动说明 ( 查看 )

订阅以下载
RuyiLuaComponent

描述
​Introduction​
The mod has numerous code snippets from MicroLua by Matheus
The mod allows you to scripting in Lua for new circuit component, which offering ​32 I/O ports, enough to replace many complex vanilla circuits.
The lua component is ​lightweight, has high-performance, supports ​hot-reloading, event-driven, and detailed error logging.
The script runs on both the server and all clients, like vanilla logic components.
You can check out Code Examples and User Manual in the discussion section for more details.

Advanced techniques

​Dependencies​
Both the server and clients must have the following mods installed:

​Technical Foundation​
The mod is built upon ​Lua for Barotrauma​​ and follow to ​MoonSharp-compatible Lua 5.2[www.lua.org]​ standards.
You can check the official Moonsharp website for related documentation:

Cybersecurity Statement
In Multiplayer
For clients, each RuyiLua component creates a separate sandboxed script that removes the following APIs to restrict script access to the system:
  • Methods in the "os" package except those listed for OS_Time
  • Methods in the "io" and "file" packages
  • Load-related methods: "load", "loadsafe", "loadfile", "loadfilesafe", "dofile", and "require"
Furthermore, MoonSharp Lua interpreter prohibits Cross-Script Access to private resources, including dangerous APIs such as "​File", "​Hook", "​dofile", and "​loadfile​" provided by LuaForBarotrauma's primary script. This nearly eliminates potential malicious act by users.
However, these restrictions do not affect access to common game objects such as ​Character, ​Item, ​Entity, ​Outpost, ​InputType, etc. APIs for these game objects are provided in the mod installed folder:
...\RuyiLuaComponent\Sandboxing\libs\
And, it cannot be ruled out that a malicious host might execute infinite loop code and bugs to crash your game program, or counterfeit this mod.
​For server hosts, Each RuyiLua component runs on LuaForBarotrauma's primary script, which offers more possibilities but also introduces security risks. I strongly recommend keeping the RuyiLua component’s AllowInGameEditingInMultiplayer setting ​false​ (the default value). This prevents clients from editing the component’s code and uploading it to the server for execution.
In Singleplayer
I can't guarantee anything, just please only use mods you trust!

Project Repository

热门讨论 查看全部(2)
1
10 月 11 日 上午 8:40
Code Example
whosyourdaddy
0
4 月 24 日 上午 7:08
User Manual
whosyourdaddy
2 条留言
天启洪流apocalyptic 10 月 16 日 上午 4:48 
I attempted to use deepseek to create an intelligent reactor component (as shown in the Code Example), but the 200,000kw reactor I tested currently has a tendency to overheat and exceed pressure limits in the early stages. It requires manual assistance to control the reactor for some time before it can stabilize within a normal operating range. However, even so, there would still be regular reactor overheating alarms and reduced output power. How should I modify it to be perfect?
Serverus 10 月 2 日 下午 2:47 
Good job. The pre-built CreateStatic for GUI greatly simplifies the creation of custom interfaces without creating a separate mod