Install Steam
login
|
language
简体中文 (Simplified Chinese)
繁體中文 (Traditional Chinese)
日本語 (Japanese)
한국어 (Korean)
ไทย (Thai)
Български (Bulgarian)
Čeština (Czech)
Dansk (Danish)
Deutsch (German)
Español - España (Spanish - Spain)
Español - Latinoamérica (Spanish - Latin America)
Ελληνικά (Greek)
Français (French)
Italiano (Italian)
Bahasa Indonesia (Indonesian)
Magyar (Hungarian)
Nederlands (Dutch)
Norsk (Norwegian)
Polski (Polish)
Português (Portuguese - Portugal)
Português - Brasil (Portuguese - Brazil)
Română (Romanian)
Русский (Russian)
Suomi (Finnish)
Svenska (Swedish)
Türkçe (Turkish)
Tiếng Việt (Vietnamese)
Українська (Ukrainian)
Report a translation problem
RuyiLuaComponent
For compatibility, please keep the 32 nodes version existing.
So that I don't need to refactor my code.
I will take this into consideration to the next update. I think it needs to be way harder to craft than a circuit box.
1. Input and output nodes are limited to 8/16
2. Can't be used in Circuit Boxes
3. A bit harder to craft. May be the same recipie as vanilla Circuit Box
4. Crafting depends on one of the top engineer's perks
5. Rare and expensive to buy in outposts
I mean, with this thing everyone can handle whole submarine's automatization (even by copying code from internet), save many copper and tin and collect great bunch of FPGAs by disassembling old components. This ability should be deserved by making decisions and having a real engineer game experience
It means somewhere in the code, we are applying table indexing, for example foo , to an object which does not support it.
The console error should say which line and column have a problem.
Can you double check and paste here?
Before, the door controller example assumed the motion sensor would be in reversed polarity, relative to the default it gets from placement.
I did not explain that previously in the comments, so that caused a bit of confusion for some users.
I have since edited the code so that it works with the normal polarity (0: no presence, 1: presence)
Can you double check your build for that mistake?
function upd ()
out[1] = inp[1]
end
that wired to a button with hello world as output passes through to the screen. i have other lua componets running too. ive gone over my wiring again on the door but still not working for some reason. It's weird cos when i first got this mod it worked and i picked the code apart to learn how to use lua a bit.
I’ll have another look tomorrow in any case.
Well it because
"A memory component does not send outputs every frame, it only does when the memorized value changes and some other corner cases, like the first frame."
So I confused. If mem does not produce output, how vanilla components gets its output?
You only get an input if the component connected to that input produces an output.
A memory component does not send outputs every frame, it only does when the memorized value changes and some other corner cases, like the first frame.
I suspect you are suffering from an update order issue: The game will first process components which have a lower numerical ID, and I suspect your memory component was placed after the microlua component, hence it has a higher ID, and hence it sends its first update too late.
For large circuits where just replacing the components is difficult, you can try using: https://github.com/Jlobblet/Barotrauma-Circuit-Resolver/blob/master/README.md
I want to read inputs from memory components not give them values myself
For example:
inp = {}
for i = 1, 32 do
inp[i] = 0
end
function upd()
…
end
However I just remembered the door controller example is expecting the motion sensor output to be inverted, and this is not mentioned in the document.
Sorry about that!
Either modify Motion Sensor properties so 'Output' is 0 and 'False Output' is 1, or modify the example source code such that this line:
local isDoorwayObstructed = inp[2] ~= 1
is replaced with:
local isDoorwayObstructed = inp[2] ~= 0
After that, did you follow https://steamhost.cn/steamcommunity_com/sharedfiles/filedetails/?id=2940324793
in order to get client-side lua working with Lua for Barotrauma?
If you followed all that, if there were any problems with the mod, I would expect there to be errors on the console. Did you get any?
In any case, I will double check everything this weekend.
If it doesnt work, please report here and I will have it fixed.
Note that while this is fine for experimentation and running on small servers and fast networks, please consider that JSON is very space inefficient, even if you use no objects / only arrays.
Even so, numbers will be represented in decimal ascii, instead of just packed in few bytes.
This space inefficiency will translate into more lag and less FPS for your users.
Also note that Barotrauma imposes limits on message sizes, if your message becomes too big, you might need to split it into multiple messages, which might increase lag further.
If I have some time, I will try to implement string.pack and string.unpack, which are lua 5.3 features MoonSharp lacks. This will allow implementing much more space efficient struct packing than possible with JSON.
Functions are untyped, and there is no runtime enforcement of arguments passed versus parameters taken.
If you pass more arguments than parameters, extra arguments are discarded.
If you pass less arguments than parameters, then unfilled arguments will just have 'nil' value.
inp = {}
function upd(deltaTime)
if inp[1] < 80 then
out[1] = "text"
end
end