2021-01-18 13:34:00 -05:00
|
|
|
-----------------------------------
|
2020-01-05 02:45:59 -05:00
|
|
|
-- func: breaklinkshell
|
|
|
|
|
-- desc: Breaks a linkshell and all pearls/sacks
|
2021-01-18 13:34:00 -05:00
|
|
|
-----------------------------------
|
2024-08-25 10:54:45 -04:00
|
|
|
---@type TCommand
|
2023-09-02 07:01:35 -04:00
|
|
|
local commandObj = {}
|
2020-01-05 02:45:59 -05:00
|
|
|
|
2023-09-02 07:01:35 -04:00
|
|
|
commandObj.cmdprops =
|
2020-01-05 02:45:59 -05:00
|
|
|
{
|
|
|
|
|
permission = 4,
|
2023-08-28 21:02:28 -04:00
|
|
|
parameters = 's'
|
2020-07-27 16:54:47 -07:00
|
|
|
}
|
2020-01-05 02:45:59 -05:00
|
|
|
|
2023-09-02 07:01:35 -04:00
|
|
|
local function error(player, msg)
|
2023-12-09 23:54:00 +00:00
|
|
|
player:printToPlayer(msg)
|
|
|
|
|
player:printToPlayer('!breaklinkshell <linkshell name>')
|
2020-07-27 16:54:47 -07:00
|
|
|
end
|
2020-01-05 02:45:59 -05:00
|
|
|
|
2023-09-02 07:01:35 -04:00
|
|
|
commandObj.onTrigger = function(player, target)
|
2020-01-05 02:45:59 -05:00
|
|
|
-- validate target
|
|
|
|
|
if not target then
|
2023-08-28 21:02:28 -04:00
|
|
|
error(player, 'You must enter a linkshell name.')
|
2020-01-05 02:45:59 -05:00
|
|
|
return
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
if player:breakLinkshell(target) then
|
2023-12-09 23:54:00 +00:00
|
|
|
player:printToPlayer('Linkshell named \''..target..'\' has been broken!')
|
2020-01-05 02:45:59 -05:00
|
|
|
else
|
2023-08-28 21:02:28 -04:00
|
|
|
error(player, string.format('Linkshell named \'%s\' not found!', target))
|
2020-01-05 02:45:59 -05:00
|
|
|
end
|
2020-03-19 18:41:42 -07:00
|
|
|
end
|
2023-09-02 07:01:35 -04:00
|
|
|
|
|
|
|
|
return commandObj
|