Bugfixes and Improvments
This commit is contained in:
parent
b0927884ed
commit
e4ea1c1a59
9
api.lua
9
api.lua
@ -14,7 +14,12 @@ light_tool.light_beam = function(pos, dir, range)
|
|||||||
for i = 0, math.floor(range / vector.length(normalized_dir)) do
|
for i = 0, math.floor(range / vector.length(normalized_dir)) do
|
||||||
local new_pos = vector.add(pos, vector.multiply(normalized_dir, i))
|
local new_pos = vector.add(pos, vector.multiply(normalized_dir, i))
|
||||||
|
|
||||||
local node = minetest.get_node(new_pos)
|
local node = minetest.get_node_or_nil(new_pos)
|
||||||
|
if not node or not node.name then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
local def = minetest.registered_nodes[node.name]
|
||||||
|
if not def then return end
|
||||||
local lightable = light_tool.check(light_tool.lightable_nodes, node.name)
|
local lightable = light_tool.check(light_tool.lightable_nodes, node.name)
|
||||||
local lightable_index = light_tool.check_index(light_tool.lightable_nodes, node.name)
|
local lightable_index = light_tool.check_index(light_tool.lightable_nodes, node.name)
|
||||||
local lit = light_tool.check(light_tool.lit_nodes, node.name)
|
local lit = light_tool.check(light_tool.lit_nodes, node.name)
|
||||||
@ -25,7 +30,7 @@ light_tool.light_beam = function(pos, dir, range)
|
|||||||
local index = light_tool.check_index(light_tool.lightable_nodes, node.name)
|
local index = light_tool.check_index(light_tool.lightable_nodes, node.name)
|
||||||
minetest.set_node(new_pos, {name = light_tool.lightable_nodes[index].."_glowing"})
|
minetest.set_node(new_pos, {name = light_tool.lightable_nodes[index].."_glowing"})
|
||||||
|
|
||||||
elseif node.name and minetest.registered_nodes[node.name].sunlight_propagates == false and not lightable and not lit then
|
elseif def and def.sunlight_propagates == false and not lightable and not lit then
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user