K700DK = {};

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

function K700DK:load(xmlFile)

	self.on = true;

	local numWheelAreas = Utils.getNoNil(getXMLInt(xmlFile, "vehicle.wheelAreas#count"), 0);
    self.wheelAreas = {}
    for i=1, numWheelAreas do
        self.wheelAreas[i] = {4};
        local areanamei = string.format("vehicle.wheelAreas.wheelArea%d", i);
        self.wheelAreas[i].point = Utils.indexToObject(self.components, getXMLString(xmlFile, areanamei .. "#pointIndex"));
        self.wheelAreas[i].width = Utils.getNoNil(getXMLFloat(xmlFile, areanamei .. "#width"), 0.5)
        self.wheelAreas[i].height = Utils.getNoNil(getXMLFloat(xmlFile, areanamei .. "#height"), 0.25)
    end;
	
end;

function K700DK:delete()
end;

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

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

function K700DK:update(dt)

if self.on then
	for k, wheelArea in pairs(self.wheelAreas) do
        local x,y,z = getWorldTranslation(wheelArea.point);
        local w = wheelArea.width;
        local h = wheelArea.height;
		local x1 = x + h/2
		local x2 = x - h/2
		local z1 = z + w/2
		local z2 = z - w/2
		
		
		Utils.cutFruitArea( 1, x1, z2, x1, z1, x2, z2);
		Utils.cutFruitArea( 2, x1, z2, x1, z1, x2, z2);
		Utils.cutFruitArea( 3, x1, z2, x1, z1, x2, z2);
		Utils.cutFruitArea( 4, x1, z2, x1, z1, x2, z2);
		Utils.cutFruitArea( 9, x1, z2, x1, z1, x2, z2);
		Utils.updateMeadowArea(x1, z2, x1, z1, x2, z2);
		Utils.updateCuttedMeadowArea(x1, z2, x1, z1, x2, z2);
	end;
end;

end;

function K700DK:draw()
end;

