52 lines
1.7 KiB
Lua
52 lines
1.7 KiB
Lua
local print = c.log
|
|
local max_light=math.floor(minetest.LIGHT_MAX/2)
|
|
print(max_light)
|
|
local breakskybox = function()
|
|
minetest.override_item(minetest.get_name_from_content_id(minetest.get_content_id(minetest.get_name_from_content_id(minetest.CONTENT_AIR))), {
|
|
drawtype = "nodebox",
|
|
sunlight_propagates = true,
|
|
walkable = false,
|
|
is_ground_content = false,
|
|
light_source = max_light, --this breaks everything!
|
|
|
|
|
|
use_texture_alpha = "opaque",
|
|
paramtype = "light",
|
|
paramtype2 = "wallmounted",
|
|
sunlight_propagates = true,
|
|
walkable = false,
|
|
})
|
|
end
|
|
--print(minetest.LIGHT_MAX, max_light,0)
|
|
local fixskybox = function()
|
|
|
|
minetest.register_on_mods_loaded(function()
|
|
core.fix_light(vector.new(-31000, -31000, -31000), vector.new(31000, 31000, 31000))
|
|
end)
|
|
local chunkSize = tonumber(minetest.settings:get("chunksize")) or 16
|
|
local maxBlockSendDistance = tonumber(minetest.settings:get("max_block_send_distance")) or 10
|
|
local maxRenderDistance = (chunkSize * ((maxBlockSendDistance * 2) * .25) )
|
|
local deltaCount = 0
|
|
local deltaLimit = 3
|
|
|
|
minetest.register_globalstep(function(dtime)
|
|
deltaCount = deltaCount + dtime
|
|
print(deltaCount)
|
|
if not (deltaCount >= deltaLimit) then
|
|
return nil
|
|
end
|
|
deltaCount=deltaCount-deltaLimit
|
|
for _, player in ipairs(minetest.get_connected_players()) do
|
|
local username = player:get_player_name()
|
|
local userpos = player:get_pos()
|
|
local currentuserchunk = vector.floor(vector.divide(userpos, maxRenderDistance))
|
|
|
|
local minp = vector.multiply(currentuserchunk, maxRenderDistance)
|
|
local maxp = vector.add(minp, maxRenderDistance - 1)
|
|
core.fix_light(vector.new(minp.x, minp.y, minp.z), vector.new(maxp.x, maxp.y, maxp.z))
|
|
end
|
|
end)
|
|
|
|
end
|
|
breakskybox()
|
|
fixskybox()
|