mirror of
https://github.com/luanti-org/luanti.git
synced 2025-10-15 17:35:37 +02:00
Add /emergeblocks command and core.emerge_area() Lua API
This commit is contained in:
@@ -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
|
||||
|
Reference in New Issue
Block a user