starlit  Diff

Differences From Artifact [a2ac450e1c]:

To Artifact [5368f81f41]:


7
8
9
10
11
12
13

14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33

34
35
36
37
38
39
40
	local day = days % world.planet.orbit;
	return {
		year = year, day = day;
		season = day / world.planet.orbit + 0.5; -- begin summer
	}
end
local lerp = lib.math.lerp


local function gradient(grad, pos)
	local n = #grad
	if n == 1 then return grad[1] end
	local op = pos*(n-1)
	local idx = math.floor(op)
	local t = op-idx
	return lerp(t, grad[1 + idx], grad[2 + idx])
end

local altitudeCooling = 10 / 100
local heatRange = {min = -70, max = 70} -- translate mt temps into real temps

-- this function provides the basis for temperature calculation,
-- which is performed by adding this value to the ambient temperature,
-- determined by querying nearby group:heatSource items in accordance
-- with the inverse-square law
function world.climate.eval(pos, tod, season)
	local data = minetest.get_biome_data(pos)
	local biome = world.ecology.biomes.db[minetest.get_biome_name(data.biome)]

	local heat, humid = data.heat, data.humidity
	heat = lerp(heat/100, heatRange.min, heatRange.max)
	tod = tod or minetest.get_timeofday()
	heat = lerp(math.abs(tod - 0.5)*2, heat, heat + biome.nightTempDelta)
-- 	print('base heat', heat)

	local td = world.date()







>

<
<
<
<
<
<
<
<
<

|








>







7
8
9
10
11
12
13
14
15









16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
	local day = days % world.planet.orbit;
	return {
		year = year, day = day;
		season = day / world.planet.orbit + 0.5; -- begin summer
	}
end
local lerp = lib.math.lerp
local gradient = lib.math.gradient










local altitudeCooling = 10 / 100
local heatRange = {min = -50, max = 50} -- translate mt temps into real temps

-- this function provides the basis for temperature calculation,
-- which is performed by adding this value to the ambient temperature,
-- determined by querying nearby group:heatSource items in accordance
-- with the inverse-square law
function world.climate.eval(pos, tod, season)
	local data = minetest.get_biome_data(pos)
	local biome = world.ecology.biomes.db[minetest.get_biome_name(data.biome)]
-- 	print('climate:', dump(data))
	local heat, humid = data.heat, data.humidity
	heat = lerp(heat/100, heatRange.min, heatRange.max)
	tod = tod or minetest.get_timeofday()
	heat = lerp(math.abs(tod - 0.5)*2, heat, heat + biome.nightTempDelta)
-- 	print('base heat', heat)

	local td = world.date()