Skip to content

Commit

Permalink
add nil check for eye level
Browse files Browse the repository at this point in the history
  • Loading branch information
tenplus1 committed Oct 29, 2021
1 parent e19fca8 commit 4acc464
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -134,13 +134,14 @@ local get_ambience = function(player, tod, name)
-- get foot and head level nodes at player position
local pos = player:get_pos() ; if not pos then return end
local prop = player:get_properties()
local eyeh = prop.eye_height or 1.47 -- eye level with fallback

pos.y = pos.y + prop.eye_height -- eye level
pos.y = pos.y + eyeh

local nod_head = pplus and name and playerplus[name]
and playerplus[name].nod_head or minetest.get_node(pos).name

pos.y = (pos.y - prop.eye_height) + 0.2 -- foot level
pos.y = (pos.y - eyeh) + 0.2 -- foot level

local nod_feet = pplus and name and playerplus[name]
and playerplus[name].nod_feet or minetest.get_node(pos).name
Expand Down

0 comments on commit 4acc464

Please sign in to comment.