Refactor power storage

This commit is contained in:
2025-03-27 22:54:31 +01:00
parent 6c9c69a308
commit 69aadeae71
2 changed files with 120 additions and 111 deletions

View File

@@ -98,7 +98,7 @@ function industrialtest.ElectricMachine.allowMetadataInventoryMove(self,pos,from
local found=false
if self.powerLists then
for _,value in ipairs(self.powerLists) do
if value==toList then
if value.list==toList then
found=true
break
end
@@ -115,7 +115,7 @@ function industrialtest.ElectricMachine.allowMetadataInventoryPut(self,pos,listn
local found=false
if self.powerLists then
for _,value in ipairs(self.powerLists) do
if value==listname then
if value.list==listname then
found=true
break
end
@@ -129,15 +129,25 @@ function industrialtest.ElectricMachine.allowMetadataInventoryPut(self,pos,listn
end
function industrialtest.ElectricMachine.onMetadataInventoryMove(self,pos,fromList,fromIndex,toList,toIndex,count)
if toList=="charged" then
self:trigger(pos)
if self.powerLists then
for _,value in ipairs(self.powerLists) do
if value.list==toList then
self:trigger(pos)
break
end
end
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)
if self.powerLists then
for _,value in ipairs(self.powerLists) do
if value.list==listname then
self:trigger(pos)
break
end
end
end
industrialtest.Machine.onMetadataInventoryPut(self,pos,listname,index,stack)
end