Particle not re-enabling
Posted: Fri Aug 26, 2016 3:53 pm
Here is a custom object :
The idea is that when activated, it enables the particle system (the water essence) and makes it fade out. When the fading finishes, every spawner on the tile will spawn.
It works... the first time. If i try to activate it again, the timer starts and the spawning is done when it should be done, but the particle system doesn't appear again and, so, don't fade out.
Why ?
Code: Select all
defineObject{
name = "particlesThatVanishes_vieuxchat",
baseObject = "base_floor_decoration",
components = {
{
class = "Particle",
offset = vec(0.0, 1, 0.0),
particleSystem = "essence_water",
enabled = false,
},
{
class = "Timer",
enabled = false,
currentLevelOnly = true,
triggerOnStart = false,
timerInterval = 4,
disableSelf = true,
onActivate = function(self)
self.go:spawn("wizard_explosion")
for e in self.go.map:entitiesAt(self.go.x, self.go.y) do
if e.name == "spawner" then
e.spawner:activate()
end
end
self.go.timer:disable()
end
},
{
class = "Controller",
onActivate = function(self)
if not self.go.timer:isEnabled() then
self.go.particle:enable()
self.go.particle:fadeOut(self.go.timer:getTimerInterval(0))
self.go.timer:start()
end
end,
},
},
tags = { "custom_vieuxchat"},
}
It works... the first time. If i try to activate it again, the timer starts and the spawning is done when it should be done, but the particle system doesn't appear again and, so, don't fade out.
Why ?