Paste #137145: Стандартная программа вышки Ген X

Date: 2025/11/04 23:40:11 UTC-08:00
Type: lua

View Raw Paste Download This Paste
Copy Link


-- Дефолтная программа вышки с якорями

function onTowerScan(towerData)

    local isShieldsEnabled = towerData.ShieldsMode
    local isSoundsEnabled = towerData.Sounds
    local isPingsEnabled = towerData.PingEffects
    local isDangerEnabled = towerData.DangerMode
    local towerLoc = towerData.Location
    local pingLoc = towerData.PingLocation

    local players = towerLoc:find_players(15)

    local shieldsText = isShieldsEnabled:bool_condition(" &9[ЩИТЫ ПОДКЛЮЧЕНЫ]&a]", "&a]")


    if isDangerEnabled == true then

        print("actionbar", "&c⚠ Аварийный режим включен ⚠", players) -- Отправляем в actionbar сообщение

        if isSoundsEnabled == true then
            playsound(towerLoc, "block\pnote_block\pbit", 0) -- Издаем звук
        end

        return "CANCELLED" -- Отменяем событие, чтобы скан не происходил 

    end

    print("actionbar","&a[Сканирование\p\p\p" .. shieldsText, players) -- Если щиты включены, добавляем надпись об этом

    if isSoundsEnabled == true then
        playsound(towerLoc, "buster_lor\panchor\pbeep", 1, 1, "master", true)
    end

    if isPingsEnabled == true then
        pingEffect(towerLoc:add(0, 1, 0), "&c")
        pingEffect(pingLoc, "&f")
    end

end

function onTowerScanResults(towerData)
    local ResultPlayers = towerData.Results.Players
    local ResultEntities = towerData.Results.Entities
    local ResultDangers = towerData.Results.Dangers

    local frequency = towerData.Frequency -- Частота

    local isShieldsEnabled = towerData.ShieldsMode
    local isSoundsEnabled = towerData.Sounds
    local isPingsEnabled = towerData.PingEffects
    local towerLoc = towerData.Location
    local pingLoc = towerData.PingLocation

    local soundButton = towerData.Buttons.Sound
    local reloadButton = towerData.Buttons.Reload
    local pingButton = towerData.Buttons.Ping

    local players = towerLoc:find_players(15)
    local shieldsTextGreen = isShieldsEnabled:bool_condition(" &9[ЩИТЫ ПОДКЛЮЧЕНЫ]&a]", "&a]")
    local shieldsTextRed = isShieldsEnabled:bool_condition(" &9[ЩИТЫ ПОДКЛЮЧЕНЫ]&c]", "&c]")

    if #ResultDangers == 0 then
        print("actionbar","&a[Угроз нет" .. shieldsTextGreen, players)
    else
        print("actionbar","&c[Обнаружено " .. #ResultDangers .. "&c угроз" .. shieldsTextRed, players)
    end

    if isSoundsEnabled == true then
        playsound(towerLoc, "buster_lor\panchor\pboop", 1, 1, "master", true)
    end

    if isPingsEnabled == true then
        pingEffect(pingLoc, "&b")
    end

    createClickCommand(playersCommand, context_player, function ()
        print("chat", "\n&9Игроки\c\n&r  ●&9 " .. ResultPlayers:separated_by('\v '), context_player)
        playsound(context_player, 'ui.button.click')
    end)
    createClickCommand(entitiesCommand, context_player, function ()
        print("chat", "\n&bСущности\c\n&r  ●&b " .. ResultEntities:separated_by('\v '), context_player)
        playsound(context_player, 'ui.button.click')
    end)
    createClickCommand(dangersCommand, context_player, function ()
        print("chat", "\n&cУгрозы\c\n&r  ●&c " .. ResultDangers:separated_by('\v '), context_player)
        playsound(context_player, 'ui.button.click')
    end)

    local playersButton = '[⛏ Игроки (' .. #ResultPlayers .. ')]'
    local playersButton = playersButton:on_click(playersCommand):on_hover('&9Нажмите, чтобы\nпосмотреть игроков')

    local entitiesButton = '[⚓ Сущности (' .. #ResultEntities .. ')]'
    local entitiesButton = entitiesButton:on_click(entitiesCommand):on_hover('&bНажмите, чтобы\nпосмотреть сущностей')

    local dangersButton = '[⚠ Угрозы (' .. #ResultDangers .. ')]'
    local dangersButton = dangersButton:on_click(dangersCommand):on_hover('&cНажмите, чтобы\nпосмотреть угрозы')

    local message_line1 = '\n\n&6                        Отчет сканирования (' .. frequency ..')\c'
    local message_line2 = '\n&r   &9' .. playersButton
    local message_line3 = '\n&r   &b' .. entitiesButton
    local message_line4 = '\n&r   &c' .. dangersButton .. "\n\n"
    local buttons = "   " .. soundButton .. "    " .. pingButton .. "    " .. reloadButton .. "\n\n"

    print("chat", message_line1 .. message_line2 .. message_line3 .. message_line4 .. buttons, players)
end

function onTowerMessage(towerData)

    print("actionbar", "&c" .. towerData.Error, towerData.Location:find_players(15))
    playsound(towerData.Location, "block\pnote_block\pbit", 2)

end

function onAnchorPings(towerData)
    local isSoundsEnabled = towerData.Sounds
    local isPingsEnabled = towerData.PingEffects
    local towerLoc = towerData.Location
    local pingLoc = towerData.PingLocation
    local players = towerLoc:find_players(15)

    print("actionbar", "&a[Пинг якорей\p\p\p]", players)

    if isSoundsEnabled == true then
        playsound(towerLoc, "buster_lor\panchor\pbeep", 1, 1, "master", true)
    end

    if isPingsEnabled == true then
        pingEffect(towerLoc:add(0,1,0), "&c")
        pingEffect(pingLoc, "&f")
    end

end

function onAnchorPingResults(towerData)
    local isSoundsEnabled = towerData.Sounds
    local isPingsEnabled = towerData.PingEffects
    local towerLoc = towerData.Location
    local pingLoc = towerData.PingLocation
    local anchors = towerData.Anchors
    local players = towerLoc:find_players(15)

    if isSoundsEnabled == true then
        playsound(towerLoc, "buster_lor\panchor\pboop", 1, 1, "master", true)
    end

    if isPingsEnabled == true then
        pingEffect(pingLoc, "&b")
    end

    print("actionbar", "&a[Ответ получен]", players)

    print("chat", "\n&6                           Результат пингов\c\n   &dУстройства (" .. #anchors .. ")\c", players)
    local i = 0
    for anchor in anchors do
        local i = i:add(1)
        if anchor.Cracked == true then
            print("chat", "&f  - &cЯкорь #" .. i .. " &c⚠ " .. anchor.Code .. " &c(" .. anchor.Shift .. "&c)", players)
        else
            print("chat", "&f  - &6Якорь #" .. i, players)
        end
        print("actionbar", "&a[Пакет получен\v отправка ответа\p\p\p]", anchor.Location:find_players(15))
        playsound(anchor.Location, "buster_lor\panchor\pboop", 1, 1, "master", true)
        pingEffect(anchor.Location, "&b")
    end
    print("chat", "\n", players)

end

Highlighting for 'Other' types handled by Highlight.JS, which was released under the BSD 3-Clause License.