DirtyJustStandingThere = {
	prerequisitesPresent = function (specializations)
		return SpecializationUtil.hasSpecialization(Washable, specializations)
	end,
	initSpecialization = function ()
		local schema = Vehicle.xmlSchema

		schema:setXMLSpecializationType("DirtyJustStandingThere")
		schema:register(XMLValueType.BOOL, "vehicle.washable#dirtyWhileStopped", "Should vehicle get dirty while not moving?", false)
		schema:register(XMLValueType.FLOAT, "vehicle.washable#stoppedDirtMultiplier", "Dirt multiplier, when not moving", 1)
		schema:setXMLSpecializationType()
	end
}

function DirtyJustStandingThere.registerOverwrittenFunctions(vehicleType)
	SpecializationUtil.registerOverwrittenFunction(vehicleType, "getDirtMultiplier", DirtyJustStandingThere.getDirtMultiplier)
end

function DirtyJustStandingThere.registerEventListeners(vehicleType)
	SpecializationUtil.registerEventListener(vehicleType, "onLoad", DirtyJustStandingThere)
end

function DirtyJustStandingThere:onLoad(savegame)
	local spec = self.spec_washable
	spec.dirtyWhileStopped = self.xmlFile:getValue("vehicle.washable#dirtyWhileStopped")
	spec.stoppedDirtMultiplier = self.xmlFile:getValue("vehicle.washable#stoppedDirtMultiplier")
end

function DirtyJustStandingThere:getDirtMultiplier(superFunc)
	local multiplier = superFunc(self)
	local spec = self.spec_washable
	if self:getLastSpeed() < 1 and spec.dirtyWhileStopped then
		multiplier = spec.stoppedDirtMultiplier
	end
	return multiplier
end
