mirror of
https://github.com/sbrl/Minetest-WorldEditAdditions.git
synced 2024-11-25 16:43:05 +00:00
core/pos: implement set_multi as a convenient alternative to multiple set() calls
/cc @VorTechnix & https://github.com/sbrl/Minetest-WorldEditAdditions/pull/112/files?diff=unified&w=1
This commit is contained in:
parent
17390ab064
commit
5fd0c3dad3
1 changed files with 12 additions and 0 deletions
|
@ -218,9 +218,20 @@ local function set2(player_name, pos)
|
|||
return set(player_name, 2, pos)
|
||||
end
|
||||
|
||||
--- Sets multiple positions for the given player.
|
||||
-- @param player_name string The name of the player to set the positions for.
|
||||
-- @param pos_list table<int, Vector3> A table of Vector3 positions to set, where the key is the index and the value is the position.
|
||||
local function set_multi(player_name, pos_list)
|
||||
for i,pos_new in pairs(pos_list) do
|
||||
set(player_name, i, pos_new)
|
||||
end
|
||||
end
|
||||
|
||||
--- Sets the all the positions for the given player.
|
||||
-- You probably want push_pos, not this function.
|
||||
--
|
||||
-- WARNING: Will DELETE all points registered for the given player!
|
||||
--
|
||||
-- @param player_name string The name of the player to set the positions for.
|
||||
-- @param pos_list Vector3 The table of positions to set.
|
||||
-- @returns bool Whether the operation was successful or not (players aren't allowed more than positions_count_limit number of positions at a time).
|
||||
|
@ -319,6 +330,7 @@ anchor = wea_c.EventEmitter.new({
|
|||
set = set,
|
||||
set1 = set1,
|
||||
set2 = set2,
|
||||
set_multi = set_multi,
|
||||
set_all = set_all,
|
||||
unmark = unmark,
|
||||
mark = mark,
|
||||
|
|
Loading…
Reference in a new issue