Add playfield check
parent
ee05696fd7
commit
6a4f6926f9
|
@ -4,6 +4,12 @@ local MAX_LASER_ITERATIONS = 10000
|
|||
-- Add a laser node to pos with the direction `dir`.
|
||||
-- Dir is a direction vector, and only one direction must be set
|
||||
function lzr_laser.add_laser(pos, dir)
|
||||
-- Check if laser is still within the playfield
|
||||
if pos.x < lzr_globals.PLAYFIELD_START.x or pos.x > lzr_globals.PLAYFIELD_END.x or
|
||||
pos.y < lzr_globals.PLAYFIELD_START.y or pos.y > lzr_globals.PLAYFIELD_END.y or
|
||||
pos.z < lzr_globals.PLAYFIELD_START.z or pos.z > lzr_globals.PLAYFIELD_END.z then
|
||||
return false
|
||||
end
|
||||
local node = minetest.get_node(pos)
|
||||
-- Laser through air
|
||||
if node.name == "air" then
|
||||
|
|
Loading…
Reference in New Issue