--
-- Author: Martin Fabik (aka LoogleCZ)
--
-- version ID   - 1.0
-- version date - 13.3.2016 (12:45)
-- 
-- Free for non-comerecial usage
--
--[[
]]--

noSmokeNoFun = {};

function noSmokeNoFun.prerequisitesPresent(specializations)
    return true;
end;

function noSmokeNoFun:load(savegame)
    self.LSF = {};
    self.LSF.emittTime = 0;
    
    self.LSF.threshingStartPS = {};
    Utils.loadParticleSystem(self.xmlFile, self.LSF.threshingStartPS, "vehicle.threshingStartParticleSystem", self.components, false, nil, self.baseDirectory);
    self.LSF.allowedEmittTime = Utils.getNoNil(getXMLFloat(self.xmlFile, "vehicle.threshingStartParticleSystem#startOffset"),0.1)*1000;

end;

function noSmokeNoFun:delete()
    Utils.deleteParticleSystem(self.LSF.threshingStartPS);
end;

function noSmokeNoFun:writeStream(streamId, connection)
end;

function noSmokeNoFun:readStream(streamId, connection)
end;

function noSmokeNoFun:mouseEvent(posX, posY, isDown, isUp, button)
end;

function noSmokeNoFun:keyEvent(unicode, sym, modifier, isDown)
end;

function noSmokeNoFun:update(dt)
end;

function noSmokeNoFun:updateTick(dt)
    if self:getIsActive() then
        if self.isClient then
            if self.LSF.emitting then
                if self.LSF.emittTime >= self.LSF.allowedEmittTime then
                    Utils.setEmittingState(self.LSF.threshingStartPS, false);
                    self.LSF.emittTime = 0;
                else
                    self.LSF.emittTime = self.LSF.emittTime + dt;
                end;
            end;
        end;
    end;
end;

function noSmokeNoFun:onTurnedOn()
    if self:getIsActive() then
        if self.isClient then
            Utils.setEmittingState(self.LSF.threshingStartPS, true);
            self.LSF.emitting = true;
        end;
    end;
end;

function noSmokeNoFun:draw()
end;