LuaNet Component [Obsolete]
Добавить в игру через Steam
Нажмите «Подписаться»
На странице Steam войдите в аккаунт, если потребуется.
Подписаться
О материале
«LuaNet Component [Obsolete]» — материал мастерской Barotrauma. Моды, подлодки, предметы и новые задания для экипажа. Данные Steam, описание автора и ссылка для установки через подписку. Совместимость редакцией не проверена.
Описание автора
Another Lua Component Mods: MicroLua RuyiLuaComponent
All descriptions are generated by the translator
Introduction
The mod aims to do away with the original's complex circuitry, dazzling wires, and IC pressure that cpu0 can't tolerates Now just only one lua component can be used to replace the whole celestial engineering! lua uses less computing resources when the circuit functions are the same! Lua is very easy to learn, it just needs to takes you less than ten minutes to understand and master the basic body of knowledge of Lua and create an application! Click here to link Lua Novice Tutorial The mod is a complete copy of Lua Component (By zomgtehderpy), but with some improvements, including the following:
-
Instead of reloading chunk in real time, it does this automatically when the round starts
-
Can manually load chunk in real time, improving the development efficiency of lua component function
-
Debug information is printed in the console when any error occurs
-
In multiplayer game mode, signal output can be synchronized in real time to avoid asynchronism between server and client. (Enabled by default, you can select the lua component in the sub-editor and disable synchronization in custom interface)
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
-
lua components are programmed in C#, which is more efficient than lua
-
lua components run by separate scripts and are in Hard-Sandbox (only supported string, math, table, bit32, constants and table iterators. The time methods of the "os" package: "clock", "difftime", "date" and "time")
Instructions for use
Read lua chunk in memory 1 inp[] is used to receive signal input out[] is used to generate signal output mem[] Stores temporary data (reads and initializes json format data from memory 2) *WARNING It is currently not possible to store data permanently in the campaign *
Code Example
*You can open the Demo.sub file in the submarine editor to get more applications of lua components *
- I-1 receives any signal and outputs a random number between 1000 and 9999 in O-1
if inp[1] then
out[1] = math.random(1000, 9999)
end
- I-1 receives the digital signal and outputs its symbol in O-1
if inp[1] and type(inp[1]) == "number" then
if inp[1] == 0 then
out[1] = 0
else
out[1] = (inp[1] > 0) and 1 or -1
end
end
- Convert the constant signal received by I-1 into a pulse signal and output it from O-1
if inp[1] then
if mem[1] ~= inp[1] then
out[1] = inp[1]
mem[1] = inp[1]
end
end
- Double-click detection
if mem['mouseUp'] == nil then mem['mouseUp'] = true end
if mem['timer'] == nil then mem['timer'] = -1 end
if mem['count'] == nil then mem['count'] = 0 end
if mem['timer'] < 0 then
goto next
elseif mem['timer'] > 0 then
mem['timer'] = mem['timer'] - 1
else
mem['timer'] = -1
mem['count'] = 0
end
::next::
if inp[1] then
if mem['mouseUp'] then
mem['count'] = mem['count'] + 1
if mem['count'] == 2 then
mem['count'] = 0
out[1] = 1
end
mem['timer'] = 15
mem['mouseUp'] = false
end
else
mem['mouseUp'] = true
end
- The periscope controls the drone. Assuming that the neutral ballast level is 0.5000, then neutral_velocity_y_out should be 0.0. At this time, I-1 receives position_out , I-2 receives trigger_out , so O-1 outputs engine force and O-2 outputs velocity_y_out
local y_neutral = 0.0
if inp[2] and inp[1] then
inp[1] = math.rad(inp[1])
out[1] = math.cos(inp[1]) * 100
local y_ratio = math.sin(inp[1])
if y_ratio ~= 0 then
local y_max = y_ratio > 0 and 100 or -100
out[2] = y_neutral + (y_max - y_neutral) * math.abs(y_ratio)
end
end
- Short press detection(<0.25s≈15tick), memory 2 stores {"press":false,"timer":-1}
if inp[1] then
if not mem['press'] then
mem['press'] = true
mem['timer'] = 0
else
local timer = mem['timer']
if timer == -1 then
return
elseif timer > 15 then
mem['timer'] = -1
elseif timer >= 0 then
mem['timer'] = timer + 1
end
end
else
if mem['press'] and mem['timer'] >= 0 then
out[1] = 1
end
mem['press'] = false
end
- Long press detection(>0.25s), memory 2 stores {"press":false,"timer":-1}
if inp[1] then
if not mem['press'] then
mem['press'] = true
mem['timer'] = 0
else
local timer = mem['timer']
if timer == -1 then
out[1] = 1
return
elseif timer > 15 then
mem['timer'] = -1
elseif timer >= 0 then
mem['timer'] = timer + 1
end
end
else
mem['press'] = false
end
Patches
Как установить и запустить
Откройте оригинальную страницу в Steam Workshop, проверьте версию игры, зависимости и порядок загрузки в описании автора. Нажмите «Подписаться» и дождитесь загрузки Steam. Включите материал в меню модификаций или контента игры, если это требуется. Совместимость и запуск редакцией не проверены.