Remove redundant return value from ActivatedMachine.activeUpdate

This commit is contained in:
mrkubax10 2025-03-10 11:06:38 +01:00
parent 371ef36ce3
commit ab7d011afd
4 changed files with 6 additions and 11 deletions

View File

@ -95,7 +95,6 @@ end
function industrialtest.ActivatedMachine.activeOnTimer(self,pos,elapsed)
local meta=minetest.get_meta(pos)
local inv=meta:get_inventory()
local shouldRerunTimer=false
local shouldUpdateFormspec=false
if self:shouldDeactivate(pos) then
@ -104,12 +103,12 @@ function industrialtest.ActivatedMachine.activeOnTimer(self,pos,elapsed)
end
if self.activeUpdate then
shouldRerunTimer,shouldUpdateFormspec=self:activeUpdate(pos,elapsed,meta,inv)
shouldUpdateFormspec=self:activeUpdate(pos,elapsed,meta,inv)
end
if shouldUpdateFormspec then
self:updateFormspec(pos)
end
return shouldRerunTimer
return true
end

View File

@ -216,7 +216,7 @@ function industrialtest.CanningMachine.activeUpdate(self,pos,elapsed,meta,inv)
local def=fuelSlot:get_definition()
local leftoverSlot=inv:get_stack("leftover",1)
if targetMeta:get_int("industrialtest.fluidCapacity")-targetMeta:get_int("industrialtest.fluidAmount")<def._industrialtest_fuelAmount or (def._industrialtest_emptyVariant and not leftoverSlot:item_fits(ItemStack(def._industrialtest_emptyVariant))) then
return false,shouldUpdateFormspec
return shouldUpdateFormspec
end
industrialtest.api.addFluidToItem(targetSlot,def._industrialtest_fuelAmount)
inv:set_stack("dst",1,targetSlot)
@ -231,7 +231,7 @@ function industrialtest.CanningMachine.activeUpdate(self,pos,elapsed,meta,inv)
end
industrialtest.api.addPower(meta,-self._opPower)
return true,true
return true
end
industrialtest.CanningMachine:register()

View File

@ -95,7 +95,6 @@ function industrialtest.Generator.activeUpdate(self,pos,elapsed,meta,inv)
local chargedSlot=inv:get_stack("charged",1)
local fuelSlot=inv:get_stack("src",1)
local shouldUpdateFormspec=false
local shouldRerunTimer=false
if fuelSlot:get_count()>0 and meta:get_float("fuelTime")<=0 and not industrialtest.api.isFullyCharged(meta) then
local output,after=minetest.get_craft_result({
@ -114,10 +113,9 @@ function industrialtest.Generator.activeUpdate(self,pos,elapsed,meta,inv)
meta:set_float("fuelTime",meta:get_float("fuelTime")-elapsed)
industrialtest.api.addPower(meta,200)
shouldUpdateFormspec=true
shouldRerunTimer=true
end
return shouldRerunTimer,shouldUpdateFormspec
return shouldUpdateFormspec
end
function industrialtest.Generator.shouldActivate(self,pos)

View File

@ -164,7 +164,6 @@ function industrialtest.IronFurnace.activeUpdate(self,pos,elapsed,meta,inv)
local srcSlot=inv:get_stack("src",1)
local fuelSlot=inv:get_stack("fuel",1)
local shouldUpdateFormspec=false
local shouldRerunTimer=false
if fuelSlot:get_count()>0 and meta:get_float("fuelTime")<=0 then
local output,after=minetest.get_craft_result({
@ -202,7 +201,6 @@ function industrialtest.IronFurnace.activeUpdate(self,pos,elapsed,meta,inv)
end
meta:set_float("fuelTime",meta:get_float("fuelTime")-elapsed)
shouldUpdateFormspec=true
shouldRerunTimer=true
end
if meta:get_float("srcTime")>=meta:get_float("maxSrcTime") then
local output,after=minetest.get_craft_result({
@ -218,7 +216,7 @@ function industrialtest.IronFurnace.activeUpdate(self,pos,elapsed,meta,inv)
end
end
return shouldRerunTimer,shouldUpdateFormspec
return shouldUpdateFormspec
end
function industrialtest.IronFurnace.shouldActivate(self,pos)