From eab8f3579133ab98d0fa71fa6579713da69ebe0e Mon Sep 17 00:00:00 2001 From: Gabriel Moreira Minossi Date: Mon, 18 Jan 2021 17:38:39 -0300 Subject: [PATCH] Fixing toggleMultiblockUsecase Referencing self so the multiblock class can pass the call to the machine --- Programs/monitor-system/api/gui/widget.lua | 4 ++-- .../domain/multiblock/toggle-multiblock-work.lua | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Programs/monitor-system/api/gui/widget.lua b/Programs/monitor-system/api/gui/widget.lua index 9df3559..2e993cc 100644 --- a/Programs/monitor-system/api/gui/widget.lua +++ b/Programs/monitor-system/api/gui/widget.lua @@ -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 = { diff --git a/Programs/monitor-system/domain/multiblock/toggle-multiblock-work.lua b/Programs/monitor-system/domain/multiblock/toggle-multiblock-work.lua index b5039ef..b0ce22b 100755 --- a/Programs/monitor-system/domain/multiblock/toggle-multiblock-work.lua +++ b/Programs/monitor-system/domain/multiblock/toggle-multiblock-work.lua @@ -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