Differences From
Artifact [a2ac450e1c]:
7 7 local day = days % world.planet.orbit;
8 8 return {
9 9 year = year, day = day;
10 10 season = day / world.planet.orbit + 0.5; -- begin summer
11 11 }
12 12 end
13 13 local lerp = lib.math.lerp
14 -
15 -local function gradient(grad, pos)
16 - local n = #grad
17 - if n == 1 then return grad[1] end
18 - local op = pos*(n-1)
19 - local idx = math.floor(op)
20 - local t = op-idx
21 - return lerp(t, grad[1 + idx], grad[2 + idx])
22 -end
14 +local gradient = lib.math.gradient
23 15
24 16 local altitudeCooling = 10 / 100
25 -local heatRange = {min = -70, max = 70} -- translate mt temps into real temps
17 +local heatRange = {min = -50, max = 50} -- translate mt temps into real temps
26 18
27 19 -- this function provides the basis for temperature calculation,
28 20 -- which is performed by adding this value to the ambient temperature,
29 21 -- determined by querying nearby group:heatSource items in accordance
30 22 -- with the inverse-square law
31 23 function world.climate.eval(pos, tod, season)
32 24 local data = minetest.get_biome_data(pos)
33 25 local biome = world.ecology.biomes.db[minetest.get_biome_name(data.biome)]
26 +-- print('climate:', dump(data))
34 27 local heat, humid = data.heat, data.humidity
35 28 heat = lerp(heat/100, heatRange.min, heatRange.max)
36 29 tod = tod or minetest.get_timeofday()
37 30 heat = lerp(math.abs(tod - 0.5)*2, heat, heat + biome.nightTempDelta)
38 31 -- print('base heat', heat)
39 32
40 33 local td = world.date()