I'm getting this really wierd problem with some firefight code I'm writing from scratch:
function fxDTSBrick::catchFire(%brick) {
echo(%brick SPC "caught fire");
if(!%brick.isBaseplate && !%brick.burning && !%brick.burntOut) {
%brick.setemitter(burnemittera);
%brick.burning = true;
%brick.spreadAttemptSchedule = schedule(5000, %brick, spreadFire);
%brick.killAttemptSchedule = schedule(10000, %brick, fireKill);
}
}
function fxDTSBrick::spreadFire(%brick) {
echo(%brick SPC "spread fire");
InitContainerRadiusSearch(%brick.gettransform(),1,$typemasks::fxbrickobjecttype);
while((%target=containerSearchNext())!=0){
%target.catchFire();
}
}
function fxDTSBrick::fireKill(%brick) {
echo(%brick SPC "burned out");
if(!%brick.willCauseChainKill()) {
%brick.dissapear(-1);
%brick.putOut();
%brick.burntOut = true;
} else {
cancel(%brick.spreadAttemptSchedule); // if spread time is longer than kill time
%brick.spreadAttemptSchedule = schedule(5000, %brick, spreadFire);
%brick.killAttemptSchedule = schedule(10000, %brick, fireKill);
%brick.setFireSchedules();
}
}
function fxDTSBrick::putOut(%brick) {
%brick.setemitter(0);
%brick.burning = false;
cancel(%brick.spreadAttemptSchedule);
cancel(%brick.killAttemptSchedule);
}
function lighterProjectile::onCollision(%this,%obj,%col,%fade,%pos,%normal)
{
%col.catchFire();
}
function FireHoseProjectile::onCollision(%this,%obj,%col,%fade,%pos,%normal)
{
%col.putOut();
}
The bug is that the schedules in catchFire(); never seem to work. I light a brick on fire, and it just burns forever without any spreading or burning out. Manually calling spreadFire(); on bricks works fine, as does fireKill();. Does anyone have any idea what's wrong? Note that it also does it if I change the schedule calls to %brick.schedule or try using scheduleNoQuota.