@@ -497,46 +497,6 @@ minetest.register_abm({
497
497
})
498
498
499
499
500
- --
501
- -- Checks if specified volume intersects a protected volume
502
- --
503
-
504
- function default .intersects_protection (minp , maxp , player_name , interval )
505
- -- 'interval' is the largest allowed interval for the 3D lattice of checks
506
-
507
- -- Compute the optimal float step 'd' for each axis so that all corners and
508
- -- borders are checked. 'd' will be smaller or equal to 'interval'.
509
- -- Subtracting 1e-4 ensures that the max co-ordinate will be reached by the
510
- -- for loop (which might otherwise not be the case due to rounding errors).
511
- local d = {}
512
- for _ , c in pairs ({" x" , " y" , " z" }) do
513
- if maxp [c ] > minp [c ] then
514
- d [c ] = (maxp [c ] - minp [c ]) / math.ceil ((maxp [c ] - minp [c ]) / interval ) - 1e-4
515
- elseif maxp [c ] == minp [c ] then
516
- d [c ] = 1 -- Any value larger than 0 to avoid division by zero
517
- else -- maxp[c] < minp[c], print error and treat as protection intersected
518
- minetest .log (" error" , " maxp < minp in 'default.intersects_protection()'" )
519
- return true
520
- end
521
- end
522
-
523
- for zf = minp .z , maxp .z , d .z do
524
- local z = math.floor (zf + 0.5 )
525
- for yf = minp .y , maxp .y , d .y do
526
- local y = math.floor (yf + 0.5 )
527
- for xf = minp .x , maxp .x , d .x do
528
- local x = math.floor (xf + 0.5 )
529
- if minetest .is_protected ({x = x , y = y , z = z }, player_name ) then
530
- return true
531
- end
532
- end
533
- end
534
- end
535
-
536
- return false
537
- end
538
-
539
-
540
500
--
541
501
-- Coral death near air
542
502
--
0 commit comments