mirror of
https://github.com/luanti-org/luanti.git
synced 2025-09-15 18:57:08 +00:00
Add metatables to lua vectors (#11039)
Add backwards-compatible metatable functions for vectors.
This commit is contained in:
parent
e15cae9fa0
commit
8f085e02a1
16 changed files with 570 additions and 179 deletions
|
@ -499,10 +499,10 @@ core.register_chatcommand("remove_player", {
|
|||
-- pos may be a non-integer position
|
||||
local function find_free_position_near(pos)
|
||||
local tries = {
|
||||
{x=1, y=0, z=0},
|
||||
{x=-1, y=0, z=0},
|
||||
{x=0, y=0, z=1},
|
||||
{x=0, y=0, z=-1},
|
||||
vector.new( 1, 0, 0),
|
||||
vector.new(-1, 0, 0),
|
||||
vector.new( 0, 0, 1),
|
||||
vector.new( 0, 0, -1),
|
||||
}
|
||||
for _, d in ipairs(tries) do
|
||||
local p = vector.add(pos, d)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue