Fixing toggleMultiblockUsecase

Referencing self so the multiblock class can pass the call to the machine
This commit is contained in:
Gabriel Moreira Minossi 2021-01-18 17:38:39 -03:00
parent 415ffe0fff
commit eab8f35791
2 changed files with 4 additions and 4 deletions

View File

@ -216,8 +216,8 @@ function widget.createMachineWidget(address, name)
end
local toggleMultiblockWork = require("domain.multiblock.toggle-multiblock-work")
local function onClick()
toggleMultiblockWork(address)
local function onClick(self)
toggleMultiblockWork(address, self.name)
end
local machineWidget = {

View File

@ -5,8 +5,8 @@ Alarm = require("api.sound.alarm")
local function exec(address, name)
local multiblock = Machine.getMachine(address, name, Machine.types.multiblock)
local workAllowed = multiblock.isWorkAllowed()
multiblock.setWorkAllowed(not workAllowed)
local workAllowed = multiblock:isWorkAllowed()
multiblock:setWorkAllowed(not workAllowed)
end
return exec