Remove redundant return value from ActivatedMachine.activeUpdate
This commit is contained in:
parent
371ef36ce3
commit
ab7d011afd
@ -95,7 +95,6 @@ end
|
|||||||
function industrialtest.ActivatedMachine.activeOnTimer(self,pos,elapsed)
|
function industrialtest.ActivatedMachine.activeOnTimer(self,pos,elapsed)
|
||||||
local meta=minetest.get_meta(pos)
|
local meta=minetest.get_meta(pos)
|
||||||
local inv=meta:get_inventory()
|
local inv=meta:get_inventory()
|
||||||
local shouldRerunTimer=false
|
|
||||||
local shouldUpdateFormspec=false
|
local shouldUpdateFormspec=false
|
||||||
|
|
||||||
if self:shouldDeactivate(pos) then
|
if self:shouldDeactivate(pos) then
|
||||||
@ -104,12 +103,12 @@ function industrialtest.ActivatedMachine.activeOnTimer(self,pos,elapsed)
|
|||||||
end
|
end
|
||||||
|
|
||||||
if self.activeUpdate then
|
if self.activeUpdate then
|
||||||
shouldRerunTimer,shouldUpdateFormspec=self:activeUpdate(pos,elapsed,meta,inv)
|
shouldUpdateFormspec=self:activeUpdate(pos,elapsed,meta,inv)
|
||||||
end
|
end
|
||||||
|
|
||||||
if shouldUpdateFormspec then
|
if shouldUpdateFormspec then
|
||||||
self:updateFormspec(pos)
|
self:updateFormspec(pos)
|
||||||
end
|
end
|
||||||
|
|
||||||
return shouldRerunTimer
|
return true
|
||||||
end
|
end
|
||||||
|
@ -216,7 +216,7 @@ function industrialtest.CanningMachine.activeUpdate(self,pos,elapsed,meta,inv)
|
|||||||
local def=fuelSlot:get_definition()
|
local def=fuelSlot:get_definition()
|
||||||
local leftoverSlot=inv:get_stack("leftover",1)
|
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
|
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
|
end
|
||||||
industrialtest.api.addFluidToItem(targetSlot,def._industrialtest_fuelAmount)
|
industrialtest.api.addFluidToItem(targetSlot,def._industrialtest_fuelAmount)
|
||||||
inv:set_stack("dst",1,targetSlot)
|
inv:set_stack("dst",1,targetSlot)
|
||||||
@ -231,7 +231,7 @@ function industrialtest.CanningMachine.activeUpdate(self,pos,elapsed,meta,inv)
|
|||||||
end
|
end
|
||||||
industrialtest.api.addPower(meta,-self._opPower)
|
industrialtest.api.addPower(meta,-self._opPower)
|
||||||
|
|
||||||
return true,true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
industrialtest.CanningMachine:register()
|
industrialtest.CanningMachine:register()
|
||||||
|
@ -95,7 +95,6 @@ function industrialtest.Generator.activeUpdate(self,pos,elapsed,meta,inv)
|
|||||||
local chargedSlot=inv:get_stack("charged",1)
|
local chargedSlot=inv:get_stack("charged",1)
|
||||||
local fuelSlot=inv:get_stack("src",1)
|
local fuelSlot=inv:get_stack("src",1)
|
||||||
local shouldUpdateFormspec=false
|
local shouldUpdateFormspec=false
|
||||||
local shouldRerunTimer=false
|
|
||||||
|
|
||||||
if fuelSlot:get_count()>0 and meta:get_float("fuelTime")<=0 and not industrialtest.api.isFullyCharged(meta) then
|
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({
|
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)
|
meta:set_float("fuelTime",meta:get_float("fuelTime")-elapsed)
|
||||||
industrialtest.api.addPower(meta,200)
|
industrialtest.api.addPower(meta,200)
|
||||||
shouldUpdateFormspec=true
|
shouldUpdateFormspec=true
|
||||||
shouldRerunTimer=true
|
|
||||||
end
|
end
|
||||||
|
|
||||||
return shouldRerunTimer,shouldUpdateFormspec
|
return shouldUpdateFormspec
|
||||||
end
|
end
|
||||||
|
|
||||||
function industrialtest.Generator.shouldActivate(self,pos)
|
function industrialtest.Generator.shouldActivate(self,pos)
|
||||||
|
@ -164,7 +164,6 @@ function industrialtest.IronFurnace.activeUpdate(self,pos,elapsed,meta,inv)
|
|||||||
local srcSlot=inv:get_stack("src",1)
|
local srcSlot=inv:get_stack("src",1)
|
||||||
local fuelSlot=inv:get_stack("fuel",1)
|
local fuelSlot=inv:get_stack("fuel",1)
|
||||||
local shouldUpdateFormspec=false
|
local shouldUpdateFormspec=false
|
||||||
local shouldRerunTimer=false
|
|
||||||
|
|
||||||
if fuelSlot:get_count()>0 and meta:get_float("fuelTime")<=0 then
|
if fuelSlot:get_count()>0 and meta:get_float("fuelTime")<=0 then
|
||||||
local output,after=minetest.get_craft_result({
|
local output,after=minetest.get_craft_result({
|
||||||
@ -202,7 +201,6 @@ function industrialtest.IronFurnace.activeUpdate(self,pos,elapsed,meta,inv)
|
|||||||
end
|
end
|
||||||
meta:set_float("fuelTime",meta:get_float("fuelTime")-elapsed)
|
meta:set_float("fuelTime",meta:get_float("fuelTime")-elapsed)
|
||||||
shouldUpdateFormspec=true
|
shouldUpdateFormspec=true
|
||||||
shouldRerunTimer=true
|
|
||||||
end
|
end
|
||||||
if meta:get_float("srcTime")>=meta:get_float("maxSrcTime") then
|
if meta:get_float("srcTime")>=meta:get_float("maxSrcTime") then
|
||||||
local output,after=minetest.get_craft_result({
|
local output,after=minetest.get_craft_result({
|
||||||
@ -218,7 +216,7 @@ function industrialtest.IronFurnace.activeUpdate(self,pos,elapsed,meta,inv)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
return shouldRerunTimer,shouldUpdateFormspec
|
return shouldUpdateFormspec
|
||||||
end
|
end
|
||||||
|
|
||||||
function industrialtest.IronFurnace.shouldActivate(self,pos)
|
function industrialtest.IronFurnace.shouldActivate(self,pos)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user