Change Activated{Electric}Machine.before{Activation|Deactivation} to Activated{Electric}Machine.after{Activation|Deactivation}
This commit is contained in:
parent
fd3df487e5
commit
442d3a42b1
@ -29,9 +29,9 @@ industrialtest.ActivatedElectricMachine.shouldActivate=industrialtest.ActivatedM
|
|||||||
|
|
||||||
industrialtest.ActivatedElectricMachine.shouldDeactivate=industrialtest.ActivatedMachine.shouldDeactivate
|
industrialtest.ActivatedElectricMachine.shouldDeactivate=industrialtest.ActivatedMachine.shouldDeactivate
|
||||||
|
|
||||||
industrialtest.ActivatedElectricMachine.beforeActivation=industrialtest.ActivatedMachine.beforeActivation
|
industrialtest.ActivatedElectricMachine.afterActivation=industrialtest.ActivatedMachine.afterActivation
|
||||||
|
|
||||||
industrialtest.ActivatedElectricMachine.beforeDeactivation=industrialtest.ActivatedMachine.beforeDeactivation
|
industrialtest.ActivatedElectricMachine.afterDeactivation=industrialtest.ActivatedMachine.afterDeactivation
|
||||||
|
|
||||||
function industrialtest.ActivatedElectricMachine.activeOnTimer(self,pos,elapsed)
|
function industrialtest.ActivatedElectricMachine.activeOnTimer(self,pos,elapsed)
|
||||||
industrialtest.ElectricMachine.requestPower(self,pos)
|
industrialtest.ElectricMachine.requestPower(self,pos)
|
||||||
|
@ -20,11 +20,11 @@ function industrialtest.ActivatedMachine.onTimer(self,pos,elapsed)
|
|||||||
local result=industrialtest.Machine.onTimer(self,pos,elapsed)
|
local result=industrialtest.Machine.onTimer(self,pos,elapsed)
|
||||||
|
|
||||||
if self:shouldActivate(pos) then
|
if self:shouldActivate(pos) then
|
||||||
self:beforeActivation(pos)
|
|
||||||
minetest.swap_node(pos,{
|
minetest.swap_node(pos,{
|
||||||
name=self.name.."_active",
|
name=self.name.."_active",
|
||||||
param2=minetest.get_node(pos).param2
|
param2=minetest.get_node(pos).param2
|
||||||
})
|
})
|
||||||
|
self:afterActivation(pos)
|
||||||
minetest.get_node_timer(pos):start(industrialtest.updateDelay)
|
minetest.get_node_timer(pos):start(industrialtest.updateDelay)
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
@ -61,10 +61,10 @@ function industrialtest.ActivatedMachine.shouldDeactivate(self,pos)
|
|||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
function industrialtest.ActivatedMachine.beforeActivation(self,pos)
|
function industrialtest.ActivatedMachine.afterActivation(self,pos)
|
||||||
end
|
end
|
||||||
|
|
||||||
function industrialtest.ActivatedMachine.beforeDeactivation(self,pos)
|
function industrialtest.ActivatedMachine.afterDeactivation(self,pos)
|
||||||
end
|
end
|
||||||
|
|
||||||
function industrialtest.ActivatedMachine.activeOnTimer(self,pos,elapsed)
|
function industrialtest.ActivatedMachine.activeOnTimer(self,pos,elapsed)
|
||||||
@ -82,11 +82,11 @@ function industrialtest.ActivatedMachine.activeOnTimer(self,pos,elapsed)
|
|||||||
end
|
end
|
||||||
|
|
||||||
if self:shouldDeactivate(pos) then
|
if self:shouldDeactivate(pos) then
|
||||||
self:beforeDeactivation(pos)
|
|
||||||
minetest.swap_node(pos,{
|
minetest.swap_node(pos,{
|
||||||
name=self.name,
|
name=self.name,
|
||||||
param2=minetest.get_node(pos).param2
|
param2=minetest.get_node(pos).param2
|
||||||
})
|
})
|
||||||
|
self:afterDeactivation(pos)
|
||||||
minetest.get_node_timer(pos):start(industrialtest.updateDelay)
|
minetest.get_node_timer(pos):start(industrialtest.updateDelay)
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user