1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-08-16 18:01:40 +00:00

Add /emergeblocks command and core.emerge_area() Lua API

This commit is contained in:
kwolekr 2015-09-23 00:31:45 -04:00
parent 596484da4f
commit f062bbd7a1
9 changed files with 162 additions and 49 deletions

View file

@ -109,6 +109,25 @@ function core.get_connected_players()
return temp_table
end
-- Returns two position vectors representing a box of `radius` in each
-- direction centered around the player corresponding to `player_name`
function core.get_player_radius_area(player_name, radius)
local player = core.get_player_by_name(player_name)
if player == nil then
return nil
end
local p1 = player:getpos()
local p2 = p1
if radius then
p1 = vector.subtract(p1, radius)
p2 = vector.add(p2, radius)
end
return p1, p2
end
function core.hash_node_position(pos)
return (pos.z+32768)*65536*65536 + (pos.y+32768)*65536 + pos.x+32768
end