Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

csp-lua

БесплатноБез исполняемых скриптовНе проверен

CSP (Custom Shaders Patch) Lua API reference and workflow for Assetto Corsa modding. Use when writing, reviewing, debugging, or testing CSP Lua code…

tobiот tobi★ 21 звезда на GitHub15 установок в других каталогах

Об этом скилле

CSP Lua

Use this skill for Assetto Corsa Custom Shaders Patch Lua work. Prefer local bundled references first; they match the installed SDK snapshot better than memory or web snippets.

Workflow

  1. Read the repo instructions first when working inside a project, especially AGENTS.md or CLAUDE.md.
  2. Search the local API before inventing names:
    .\.claude\skills\csp-lua\scripts\find-api.ps1 "ac.getCar"
    .\.claude\skills\csp-lua\scripts\find-api.ps1 "function ui.slider"
    rg -n "StateCar|splinePosition|trackLengthM" .\.claude\skills\csp-lua\reference\lib.lua
    
  3. Prefer the smaller SDK source files when you know the namespace:
    • reference/sdk/common/ac_state.lua: car/sim/session state.
    • reference/sdk/common/ac_ui.lua: ui.*, windows, settings, controls.
    • reference/sdk/common/ac_storage.lua and .d.lua: persistent storage.
    • reference/sdk/common/io.lua and .d.lua: CSP file APIs.
    • reference/sdk/common/ac_render.lua: render.* drawing callbacks.
    • reference/sdk/common/ac_physics*.lua: physics.*, AI, reset, car control.
    • reference/sdk/common/ac_web*.lua and lib_web.lua: HTTP/web APIs.
    • reference/sdk/common/ac_audio*.lua: audio events.
    • reference/lib.lua: generated complete EmmyLua API, enums, classes, overloads.
  4. Implement with immediate-mode CSP patterns, then run local Lua tests or syntax checks where available.
  5. If debugging in-game behavior, inspect filtered CSP logs:
    .\.claude\skills\csp-lua\scripts\logs.ps1 -l 80 -only ERROR
    .\.claude\skills\csp-lua\scripts\logs.ps1 -l 120
    

Non-Negotiables

  • Do not put shell execution in CSP runtime code. Avoid io.popen, os.execute, start, cmd, PowerShell, and external CLI calls from Lua. Use CSP APIs such as io.open, io.save, io.load, io.scanDir, io.createDir, web.*, ac.*, and physics.*.
  • Do not guess API names. Search reference/lib.lua or reference/sdk/** before using unfamiliar CSP APIs.
  • Keep runtime work small in script.update(dt) and UI draw callbacks. Expensive parsing, scans, and bulk serialization should be throttled, cached, or moved out of per-frame paths.
  • Use script.* callbacks, not legacy global callbacks, unless maintaining old code. CSP looks up and caches callback functions.
  • Treat AC/CSP code as LuaJIT 2.1 with Lua 5.1 behavior plus CSP extensions, not stock Lua 5.4.

App Structure

Lua apps live in assettocorsa/apps/lua/<app-id>/ with a manifest.ini and <app-id>.lua entry file. The official CSP Lua app wiki describes app folders, manifest.ini, lazy loading, window callbacks, UI callbacks, render callbacks, and script.update(dt).

Typical manifest window:

[ABOUT]
NAME = My App
AUTHOR = ...
VERSION = 1.0
DESCRIPTION = ...

[CORE]
LAZY = PARTIAL

[WINDOW_MAIN]
ID = main
NAME = My App
FUNCTION_MAIN = windowMain
FUNCTION_SETTINGS = windowSettings
SIZE = 400, 240
FLAGS = SETTINGS

Typical entry file:

local state = { clicks = 0 }

function script.update(dt)
  local car = ac.getCar(0)
  if not car then return end
end

function script.windowMain(dt)
  if ui.button('Click') then
    state.clicks = state.clicks + 1
  end
  ui.text('Clicks: ' .. state.clicks)
end

script.update(dt) runs every frame even when app windows are closed, depending on app laziness. Window functions run only when their windows are visible. UI_CALLBACKS draw outside app windows and need an explicit ui.transparentWindow() or ui.toolWindow().

Core State APIs

Use ac.getSim() for global simulation state:

  • sim.dt: simulation delta in seconds; can be 0 while paused.
  • sim.time: total AC time in milliseconds.
  • sim.gameTime: total AC time in seconds.
  • sim.trackLengthM: track length in meters.
  • sim.isPaused, sim.isOnlineRace, sim.currentSessionIndex, sim.sessionTimeLeft.
  • sim.rainIntensity, sim.roadGrip, sim.connectedCars.

Use ac.getCar(index) for car state; index 0 is the player:

  • car.speedKmh, car.splinePosition, car.lapCount, car.lapTimeMs, car.bestLapTimeMs.
  • car.gas, car.brake, car.clutch, car.steer, car.gear, car.handbrake.
  • car.isLapValid, car.resetCounter, car.lastLapCutsCount, car.collisionDepth, car.isInPitlane.
  • car.racePosition, car.fuel, tyre/wheel fields, contact/slip fields; search StateCar for the full list.

Track and car helpers:

local trackId = ac.getTrackID()      -- preferred spelling
local carId = ac.getCarID(0)
local carName = ac.getCarName(0, true)
local meters = ac.getSim().trackLengthM or 0
local world = ac.trackProgressToWorldCoordinate(0.25)
local progress = ac.worldCoordinateToTrackProgress(world)
local sectorName = ac.getTrackSectorName(0.25)

ac.getSim().trackId is not a valid substitute for ac.getTrackID().

Files And Storage

Use CSP io.* APIs in runtime code:

io.createDir(path)
local f = io.open(path, 'w')
if f then
  f:write(data)
  f:close()
end

l
Полный SKILL.md на GitHub

Установить csp-lua в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

Вложенные файлы

reference/lib.luareference/sdk/LICENSEreference/sdk/README.mdreference/sdk/ac_apps.luareference/sdk/ac_background.luareference/sdk/ac_background_pw.luareference/sdk/ac_car_cphys.luareference/sdk/ac_car_scriptable_display.luareference/sdk/ac_chaser_camera.luareference/sdk/ac_cockpit_camera.luareference/sdk/ac_common.luareference/sdk/ac_common_base.luareference/sdk/ac_ffb_postprocess.luareference/sdk/ac_joypad_assist.luareference/sdk/ac_new_modes.luareference/sdk/ac_online_script.luareference/sdk/ac_pfx_fireworks.luareference/sdk/ac_pp_filters.luareference/sdk/ac_scripted_texture.luareference/sdk/ac_splashscreen.luareference/sdk/ac_tools.luareference/sdk/ac_track_script.luareference/sdk/ac_wfx_controller.luareference/sdk/ac_wfx_impl.luareference/sdk/car_scriptable_display/car_scriptable_display_structs.luareference/sdk/car_scriptable_display/car_scriptable_display_utils.d.luareference/sdk/car_scriptable_display/car_scriptable_display_utils.luareference/sdk/common/ac_apps.luareference/sdk/common/ac_audio.d.luareference/sdk/common/ac_audio.luareference/sdk/common/ac_audio_enums.luareference/sdk/common/ac_car_control.luareference/sdk/common/ac_car_control_physics.luareference/sdk/common/ac_car_control_switch.luareference/sdk/common/ac_car_cphys_enums.luareference/sdk/common/ac_color_corrections.luareference/sdk/common/ac_configs.d.luareference/sdk/common/ac_configs.luareference/sdk/common/ac_display.luareference/sdk/common/ac_dualsense.lua

FAQ

Что делает скилл csp-lua?

CSP (Custom Shaders Patch) Lua API reference and workflow for Assetto Corsa modding. Use when writing, reviewing, debugging, or testing CSP Lua code, including Assetto Corsa Lua apps, ac.*, ui.*, render.*, physics.*, io.*, web.*, storage, app windows, telemetry, track/car state, memory-mapped files, LuaJIT/FFI, and AC Tracer-specific CSP integration.

Как установить скилл csp-lua?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл csp-lua запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить csp-lua с