From 4c6b4b9df07c31d40536059cacd0dbe17dd05770 Mon Sep 17 00:00:00 2001 From: mrkubax10 Date: Sun, 16 Mar 2025 20:20:54 +0100 Subject: [PATCH] Fix machines not triggered when item with power storage is placed in inventory --- machines/electric_machine.lua | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/machines/electric_machine.lua b/machines/electric_machine.lua index 2134728..3096201 100644 --- a/machines/electric_machine.lua +++ b/machines/electric_machine.lua @@ -128,6 +128,20 @@ function industrialtest.ElectricMachine.allowMetadataInventoryPut(self,pos,listn return industrialtest.Machine.allowMetadataInventoryPut(self,pos,listname,index,stack,player) end +function industrialtest.ElectricMachine.onMetadataInventoryMove(self,pos,fromList,fromIndex,toList,toIndex,count) + if toList=="charged" then + self:trigger(pos) + end + industrialtest.Machine.onMetadataInventoryMove(self,pos,fromList,fromIndex,toList,toIndex,count) +end + +function industrialtest.ElectricMachine.onMetadataInventoryPut(self,pos,listname,index,stack) + if listname=="charged" then + self:trigger(pos) + end + industrialtest.Machine.onMetadataInventoryPut(self,pos,listname,index,stack) +end + function industrialtest.ElectricMachine.requestPower(self,pos) if not self.hasPowerOutput then return