From 6934a8b34266f259515b9352256d8485c5d30734 Mon Sep 17 00:00:00 2001 From: mrkubax10 Date: Wed, 8 Jan 2025 22:46:16 +0100 Subject: [PATCH] Fix some oversights --- machines/activated_machine.lua | 16 ++++++++-------- machines/electric_machine.lua | 10 +++++----- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/machines/activated_machine.lua b/machines/activated_machine.lua index 64d75c7..5c344c3 100644 --- a/machines/activated_machine.lua +++ b/machines/activated_machine.lua @@ -85,14 +85,6 @@ function industrialtest.ActivatedMachine.activeOnTimer(self,pos,elapsed) local shouldRerunTimer=false local shouldUpdateFormspec=false - if self.activeUpdate then - shouldRerunTimer,shouldUpdateFormspec=self:activeUpdate(pos,elapsed,meta,inv) - end - - if shouldUpdateFormspec then - self:updateFormspec(pos) - end - if self:shouldDeactivate(pos) then minetest.swap_node(pos,{ name=self.name, @@ -103,5 +95,13 @@ function industrialtest.ActivatedMachine.activeOnTimer(self,pos,elapsed) return false end + if self.activeUpdate then + shouldRerunTimer,shouldUpdateFormspec=self:activeUpdate(pos,elapsed,meta,inv) + end + + if shouldUpdateFormspec then + self:updateFormspec(pos) + end + return shouldRerunTimer end diff --git a/machines/electric_machine.lua b/machines/electric_machine.lua index be1604a..2864699 100644 --- a/machines/electric_machine.lua +++ b/machines/electric_machine.lua @@ -41,9 +41,9 @@ function industrialtest.ElectricMachine.onConstruct(self,pos) end end end - if self.hasPowerOutput then - meta:set_string("industrialtest.network",minetest.serialize(industrialtest.api.createNetworkMap(pos))) - end + end + if self.hasPowerOutput then + meta:set_string("industrialtest.network",minetest.serialize(industrialtest.api.createNetworkMap(pos))) end industrialtest.Machine.onConstruct(self,pos) @@ -82,7 +82,7 @@ function industrialtest.ElectricMachine.onTimer(self,pos,elapsed) return result or result2 end -function industrialtest.Machine.allowMetadataInventoryMove(self,pos,fromList,fromIndex,toList,toIndex,count) +function industrialtest.ElectricMachine.allowMetadataInventoryMove(self,pos,fromList,fromIndex,toList,toIndex,count) local found=false if self.powerLists then for _,value in ipairs(self.powerLists) do @@ -99,7 +99,7 @@ function industrialtest.Machine.allowMetadataInventoryMove(self,pos,fromList,fro return industrialtest.Machine.allowMetadataInventoryMove(self,pos,fromList,fromIndex,toList,toIndex,count) end -function industrialtest.Machine.allowMetadataInventoryPut(self,pos,listname,index,stack,player) +function industrialtest.ElectricMachine.allowMetadataInventoryPut(self,pos,listname,index,stack,player) local found=false if self.powerLists then for _,value in ipairs(self.powerLists) do