Added protection commands

This commit is contained in:
Cooldude2606
2021-04-24 18:04:33 +01:00
parent fb51f06c84
commit 891663edb9
2 changed files with 105 additions and 1 deletions

View File

@@ -72,9 +72,15 @@ end
--- Test if a player is selecting something
-- @tparam LuaPlayer player The player to test
function Selection.is_selecting(player)
-- @tparam[opt] string selection_name If given will only return true if the selection is this selection
function Selection.is_selecting(player, selection_name)
if selection_name ~= nil then
if not selections[player.index] then return false end
return selections[player.index].name == selection_name
else
return player.cursor_stack.is_selection_tool
end
end
--- Filter on_player_selected_area to this custom selection, pretends with player and appends with selection arguments
-- @tparam string selection_name The name of the selection to listen for