1
0
Fork 0

Tweak night vision conditions

objects
Wuzzy 2020-08-19 10:53:44 +02:00
parent 3bdd95fe47
commit 1816324fe5
1 changed files with 6 additions and 2 deletions

View File

@ -55,9 +55,13 @@ mcl_weather.skycolor = {
-- Wrapper for updating day/night ratio that respects night vision
override_day_night_ratio = function(player, ratio)
local meta = player:get_meta()
local night_vision = meta:get_int("night_vision")
local has_night_vision = meta:get_int("night_vision") == 1
local arg
if night_vision == 1 then
-- Apply night vision only for dark sky
local is_dark = minetest.get_timeofday() > 0.8 or minetest.get_timeofday() < 0.2 or mcl_weather.state ~= "none"
local pos = player:get_pos()
local dim = mcl_worlds.pos_to_dimension(pos)
if has_night_vision and is_dark and dim ~= "nether" and dim ~= "end" then
if ratio == nil then
arg = NIGHT_VISION_RATIO
else