Exports
Exports
BUPA AnimPos는 다른 리소스가 프로그래밍 방식으로 도구를 제어할 수 있도록 세 가지 클라이언트 export를 제공합니다. 모든 export는 bupa-animpos 리소스 이름으로 실행됩니다.
Open
도구를 엽니다. 플레이어가 명령어이나 키보드 단축키를 사용할 때와 정확히 동일하게 전체 검증 파이프라인(이미 사용 중, 쿨다운, 권한, 상태 제한 및 Config.CanUse 훅)을 실행합니다. 도구가 실제로 열렸으면 true를, 그렇지 않으면 false를 반환합니다.
local opened = exports['bupa-animpos']:Open()
if opened then
print('Positioning mode started')
endClose
도구가 현재 활성화되어 있는 경우 닫기를 요청합니다. 취소 키를 누르는 것과 같이 작동하며, 캐릭터가 시작 위치와 방향으로 되돌아갑니다.
exports['bupa-animpos']:Close()IsActive
로컬 플레이어에게 현재 위치 지정 모드가 열려 있는지 여부를 나타내는 부울 값을 반환합니다.
if exports['bupa-animpos']:IsActive() then
-- e.g. block another interaction while the tool is open
endExample — pair with an emote menu
-- After playing an emote, let the player nudge it into place
RegisterCommand('fixpos', function()
if not exports['bupa-animpos']:IsActive() then
exports['bupa-animpos']:Open()
end
end)Related — the CanUse config hook
export 외에도 Config.CanUse는 매번 열기를 시도할 때(Open()을 통한 시도 포함) 실행되는 클라이언트 사이드 훅입니다. 차단하려면 false를 반환하고, 선택적으로 플레이어에게 표시할 메시지 문자열을 반환할 수 있습니다. 이곳은 서버 고유의 제한 로직(전투, 피해, 커스텀 상태 등)을 구현하기에 알맞은 곳입니다.
Config.CanUse = function()
-- return false, 'You cannot do this right now!'
return true
end