pos: add set_pos1 and set_pos2 convenience functions

This commit is contained in:
Starbeamrainbowlabs 2022-09-19 23:40:42 +01:00
parent e2e235ce6d
commit 7423bee714
Signed by: sbrl
GPG Key ID: 1BE5172E637709C2
1 changed files with 19 additions and 0 deletions

View File

@ -66,6 +66,23 @@ local function set_pos(player_name, i, pos)
anchor:emit("set", { player_name = player_name, i = i, pos = pos })
return true
end
--- Convenience function that set position 1 for the given player.
-- @param player_name string The name of the player to set pos1 for.
-- @param pos Vector3? The new Vector3 for pos1 to set.
-- @returns bool Whether the operation was successful or not, but in this case will always return true so can be ignored.
local function set_pos1(player_name, pos)
return set_pos(player_name, 1, pos)
end
--- Convenience function that set position 2 for the given player.
-- @param player_name string The name of the player to set pos1 for.
-- @param pos Vector3? The new Vector3 for pos2 to set.
-- @returns bool Whether the operation was successful or not, but in this case will always return true so can be ignored.
local function set_pos2(player_name, pos)
return set_pos(player_name, 2, pos)
end
--- Sets the all the positions for the given player.
-- You probably want push_pos, not this function.
-- @param player_name string The name of the player to set the positions for.
@ -121,6 +138,8 @@ anchor = wea_c.EventEmitter.new({
pop = pop_pos,
push = push_pos,
set = set_pos,
set_pos1 = set_pos1,
set_pos2 = set_pos2,
set_all = set_pos_all
})