local oi = {}

-- not part of the lua implementation of climate simulation
function oi.seasonal_humidity(world, ti, month)
	-- return 0.3 -- Calandiel said it was meant to be phased out, so just use a hardcoded value for now
	return world:get_humidity_for(ti, month) -- using port of current humidity implementation
end

-- not implemented in SotE
function oi.add_sea_ice(world, ti)
	world.snow[ti] = 0
end

-- the formula in the original is overriden by 0, for as yet unknown reasons
function oi.current_saturation(world, ti, capacity)
	--return world.soil_moisture[ti] / capacity
	return 0
end

-- game\scenes\world-loader.lua:process_pixel does not seem to handle a rank 7 land waterflow (>= 1,000,000 or color 2, 35, 209)
-- they do seem to occur, at least during worldgen waterflow calculations, but perhaps they are clamped down somewhere later on?
function oi.waterflow_for_rank_7()
	return 50000
end

-- odd thing to do, wiping out water movement that was calculated in 'calculate-waterflow'
-- 2024.09.28: might be ok, according to original authors;
--             water movement might have been calculated and used in intermediary step(s) (like gen-parent-material), then wiped out and re-calculated
function oi.set_water_movement_for_lakes(world, ti)
	world.water_movement[ti] = 0
end

-- soil_organics is a ushort in the original implementation, so division by '1000' will be truncated, which is odd when computing a factor
function oi.calc_organic_factor(soil_organics)
	return math.floor(soil_organics / 1000) ^ 0.5 + 1
end

return oi