fix(light-server): missing rs lib import

This commit is contained in:
Guillaume ARM 2024-05-28 01:06:14 +02:00
parent 7285c63b57
commit c00d495460

View File

@ -1,3 +1,5 @@
local rs = require('libs/rs.lua')
local MAIN_DELAY_ON = 0.25
local MAIN_DELAY_OFF = 0
local SECONDARY_DELAY_ON = 0.75
@ -9,6 +11,8 @@ local MAIN_OUTPUT_SIDE = 'left'
local SECONDARY_INPUT_SIDE = 'back'
local SECONDARY_OUTPUT_SIDE = 'front'
local VERSION = '1.0.0'
local function getMainColorsOrder()
return {
colors.white,
@ -70,7 +74,7 @@ local function mainLoop()
local secondaryColorsOrder = getSecondaryColorsOrder()
while true do
local _, lightIsOn, typeOfRoom = os.pullEvent('light_command')
local _, typeOfRoom, lightIsOn = os.pullEvent('light_command')
if typeOfRoom == 'main' then
if lightIsOn then
@ -100,16 +104,17 @@ local function redstoneLoop()
if mainState ~= newMainState then
mainState = newMainState
os.queueEvent('main', newMainState)
os.queueEvent('light_command', 'main', newMainState)
end
if secondaryState ~= newSecondaryState then
secondaryState = newSecondaryState
os.queueEvent('secondary', newSecondaryState)
os.queueEvent('light_command', 'secondary', newSecondaryState)
end
os.pullEvent('redstone')
end
end
print('> Starting light server v' .. VERSION)
parallel.waitForAny(mainLoop, redstoneLoop)