Barotrauma

Barotrauma

LuaNet Component [Obsolete]
31 Comments
Matheus 27 Sep, 2023 @ 5:48am 
Since the author marked both this mod, and it's intended replacement, as Obsolete / Outdated, and since even the intended replacement lacks documentation, I am going to propose a replacement here, for the benefit of the stranded users:

MicroLua

Full disclosure: I am the author of that mod.

Main advantages it has over this mod and it's replacement:
* Multiplayer works better, as it runs the script both on the server and all the clients.
This matches how all in-game logic components work, and means that there are no latency / update frequency issues or knobs to fiddle around.
* The setup is much simpler and more powerful: A single 32 input / 32 output component, and the actual property setup is much cleaner.
* No separate JSON memory thing for storing state to persist across frames, just store state as regular variables.
* There are other advantages, which the documentation will clarify.
Mr.x13 25 Jul, 2023 @ 3:40pm 
Description just says "RGzXTrauma". It requires Lua/Cs for Barotrauma to be installed, and adds two new components to the editor, one with 8 in and 8 outputs, and one with 16 of each.
Just a shame it comes with zero documentation (if it's identical to this mod, then state that in the description )
DorylPlz 24 Jul, 2023 @ 9:44pm 
What does the RGzTrauma mod actually does? i can't find any new component or anything on it
Mr.x13 24 Jul, 2023 @ 8:00am 
Hi! I tried using rgzxtrauma but found your mod preferable for me, mostly because it comes with actual documentation. I do have a few questions though.
Does 2nd memorycomponent just take a json object to preload the mem[] in editor?
What does the whole "buttonterminal" part seen in the sub editor do, could it be useful to me?
Is there a way to have lua components work when testing out something in the sub editor, or do i have to ask the lua for barotrauma people about this?
Is the implementation of the mod optimised enough that i can just have logic always output a value to every pin, or should i use if-statements and such to only output a toggle signal to a pin when needed?
And lastly if i write a 1 to an output pin, will that pin still have a value of 1 the next time my code gets ran or will it be 0 or nil? (my current code assumes this is not the case)
whosyourdaddy  [author] 28 May, 2023 @ 8:28am 
There is a better lua component implementation here: RGzXTrauma , the mod has some new component types.
I tested it with 20+ players in pvp and everything works fine.
whosyourdaddy  [author] 28 May, 2023 @ 8:25am 
@Schrödinger's Cat maybe yes
whosyourdaddy  [author] 28 May, 2023 @ 8:23am 
@K 我这边还是正常的,如果问题仍然存在,我会检查一下
whosyourdaddy  [author] 28 May, 2023 @ 8:23am 
@天启洪流apocalyptic 按照描述里的标准来,这份报错如果现在还有,我会去检查下
Schrödinger's Cat 14 May, 2023 @ 1:03am 
Is there more reliable way to make delay / count time beside counting ticks? Like DateTime.Now or something?
天启洪流apocalyptic 6 May, 2023 @ 2:06am 
仅安装前置模组以及该模组后出现控制台报错
[CL CS error] CS MODS loading | compiler error: C: / user/administrator/AppData/local / / pressure trauma/WorkshopMods Daedalic entertainment GmbH/installation / 2937571024 / / CSharp/Shared/LuaNetComponent cs (21, 20) : error CS0104: 'Closure' is an ambiguous references between System.Runtime.CompilerServices. A Closure 'and' MoonSharp. Interpreter. Closure '[CL CS error] system. Exception: Unable to create cs module assembly. B: programming\c#\ barotrauma \ barotrauma \SharedSource\LuaCs\Cs\CsScriptLoader.cs: Line 242: barotrauma Initialization (Boolean forceEnableCs)B: programming \c#\ barometric trauma \ barometric trauma \ shared source \LuaCs\LuaCsSetup.cs: Line 398
天启洪流apocalyptic 5 May, 2023 @ 11:56pm 
打扰一下,作者大大,我想学习用这个模组制作能识别敌我自动炮和切换炮,但对如何编辑这个组件一窍不通:lunar2019laughingpig:我该从哪里学起?能否指点一二:lunar2019crylaughingpig:
K 17 Apr, 2023 @ 1:58am 
为什么加了这个组件后无法使用?lua已经安装了
DorylPlz 16 Apr, 2023 @ 9:45pm 
So... with this -theorically-, could i install doom inside barotrauma?...
whosyourdaddy  [author] 14 Apr, 2023 @ 10:00pm 
Assume you wire trigger_out(Periscope) to signal_in1(Lua Component), then you should wire signal_out 1 (Lua Component) to triggin_in(Turret) and write the following code in MemoryComponent[1]:
out[1] = inp[1]

so when you trigger the periscope, the gun will launches a projectile and the attacked target will hatred you.
Admiral Oomfie 14 Apr, 2023 @ 4:29pm 
This sounds absolutely awesome, but i have a question
you write: "signal_out can inherit the source (sender) of the signal_in with the same number, so as to attract targets' hatred and gain weapon skills when operating the turret to deal damage to the enemy".
are there any requirements on the scripts for this to work or is it enough that a periscope wires goes into one of the inputs and the corresponding output leads to a gun and also ends up firing?
Zetsumi 3 Apr, 2023 @ 3:36am 
Would it be possible to spawn a monster using this?
zomgtehderpy 1 Apr, 2023 @ 10:09pm 
this is way better that the one I made, cheers.
you could try detecting infinite loops by executing lua in a different thread and measuring the time it takes to run: if it is past 100 (?) ms - discard and send a warning message.
whosyourdaddy  [author] 15 Mar, 2023 @ 8:38pm 
Oh wait, it doesn’t seem to be the reason I said. All lua components will indeed stop running after the round ends. If you have time, you can send me your sub anytime and I’ll check what’s wrong.
whosyourdaddy  [author] 15 Mar, 2023 @ 8:30pm 
It may be that the lua component is still executing during the round loading process, I will fix it.
Yumemirareru 15 Mar, 2023 @ 3:13pm 
Well, I made an ARC with this mod and while it works fine through a mission, as soon as the round changes (i.e., the sub docks), it makes the reactor explode.

As much as I love this idea of this mod, it's just too unreliable...
whosyourdaddy  [author] 14 Mar, 2023 @ 9:21pm 
I worry that there might be a traitor who will write an infinite loop code such as "while true do end" in a lua component and cause the server to crash, so you can subscribe to Milord's patch to remove the crafting restriction.
Yumemirareru 14 Mar, 2023 @ 8:04pm 
Hm. So, I think that this item is spawn-by-cheat-command-only is a bit of a weakness to it. It would be nice if there was some way to get it in game. Be that crafting like the person that made the patch, or merchants, or so on.
Yumemirareru 14 Mar, 2023 @ 5:14am 
I tried again this morning and it worked. Maybe it didn't update before but did now, or something; thank you for checking.
whosyourdaddy  [author] 14 Mar, 2023 @ 3:06am 
I compiled this code and did not reproduce the problem shown in the picture, and everything works fine. Is your LuaForBarotrauma updated and installed to the latest version? If you did, you can transfer everything to me, i will check that.
Yumemirareru 14 Mar, 2023 @ 12:20am 
Hm, so trying to run a very simple test script...
[code]
if inp[3] == 1 then
out[1] = 25
else
out[1] = 0
end
[/code]

Gives this error on compile:
https://i.imgur.com/Z41p4bj.png
Yumemirareru 11 Mar, 2023 @ 2:50am 
Is there anyone that could help me translate these designs into lua?
https://steamhost.cn/steamcommunity_com/sharedfiles/filedetails/?id=2877028714
https://steamhost.cn/steamcommunity_com/sharedfiles/filedetails/?id=2877582632

I'd love to use a this so I don't need a billion circuit components but I can't translate the complex designs...
whosyourdaddy  [author] 1 Mar, 2023 @ 3:42am 
Thanks, I added your patch to the description because I was afraid some traitors execute "while true end"
Noble 28 Feb, 2023 @ 4:54pm 
Made an addon that makes component craftable.
Think this could be a great addition to your mod.
https://steamhost.cn/steamcommunity_com/sharedfiles/filedetails/?id=2940534789
黑暗料理 24 Feb, 2023 @ 3:54pm 
虽然我对电路一窍不通 但对于这简化非常赞
Littlecaptain 23 Feb, 2023 @ 7:12am 
恭喜潜渊症进入单片机时代
Biff_W 23 Feb, 2023 @ 7:01am 
对于这种mod,我只能用一个词来形容,无敌!