Paste #137903: vats fallout

Date: 2025/12/08 12:44:57 UTC-08:00
Type: Denizen Script

View Raw Paste Download This Paste
Copy Link


vats_task:
    type: task
    definitions: __player
    debug: false
    settings:
        ##ОТВЕЧАЕТ ЗА РАДИУС ПОИСКА ЭНТИТИ ОТ КУРСОРА ИГРОКА
        find: 1
        ##ОТВЕЧАЕТ ЗА СКОРОСТЬ ПОВОРОТА
        look: 20
        ##ОТВЕЧАЕТ ЗА ДАЛЬНОСТЬ ЛУЧА
        range: 30
        ##ДИСТАНЦИЯ ДО ЭНТИТИ НА КОТОРОЙ ВЫКЛЮЧАЕТСЯ ВАТС
        distance: 30
    script:
    - flag <player> vats
    - announce start
    - while <player.is_online> and <player.has_flag[vats]>:
        - define find <script[vats_task].data_key[settings].get[find]>
        - if <player.is_sneaking>:
            - define trg <player.eye_location.ray_trace_target[ignore=<player>;range=<script[vats_task].data_key[settings].get[range]>;raysize=<[find]>]||null>
            - if <[trg].is_living||false> and <[trg].equals[<player.flag[vats.select_ent]||null>].not||true>:
                - playsound sound:block.copper_bulb.turn_on <player>
                - glow false for:<player> <player.flag[vats.select_ent]> if:<player.flag[vats.select_ent].is_spawned||false>
                - flag <player> vats.select_ent:<[trg]>
                - glow true for:<player> <[trg]>
        - else:
            - run smooth_face_to_entity def:<player>|<player.flag[vats.select_ent]> if:<player.flag[vats.select_ent].is_spawned||false>
        - if <player.flag[vats.select_ent].is_spawned.not||false> or <player.flag[vats.select_ent].location.distance[<player.location>].is_more_than[<script[vats_task].data_key[settings].get[distance]>]||false>:
            - while stop
        - wait 1t
    - announce stop
    - glow false for:<player> <player.flag[vats.select_ent]> if:<player.flag[vats.select_ent].is_spawned||false>
    - flag <player> vats:!

vats_cmd:
    type: command
    name: vats
    description: Does something
    usage: /vats
    permission: op
    script:
    - if <player.has_flag[vats]>:
        - glow false for:<player> <player.flag[vats.select_ent]> if:<player.flag[vats.select_ent].is_spawned||false>
        - flag <player> vats:!
    - else:
        - run vats_task

smooth_face_to_entity:
    type: task
    definitions: __player|ent
    debug: false
    script:
    - define face <player.eye_location.face[<[ent].eye_location>]>
    - define op <[face].pitch.sub[<player.eye_location.pitch>]>
    - define oy <[face].yaw.sub[<player.eye_location.yaw>]>
    - define oy:+:360 if:<[oy].is_less_than[-180]>
    - define oy:-:360 if:<[oy].is_more_than[180]>
    - define div <script[vats_task].data_key[settings].get[look]>
    - define new_p <player.eye_location.pitch.add[<[op].div[<[div]>]>]>
    - define new_y <player.eye_location.yaw.add[<[oy].div[<[div]>]>]>
    - look <player> yaw:<[new_y]> pitch:<[new_p]> offthread_repeat:5