Skip to content

Instantly share code, notes, and snippets.

@oatmealine
Last active October 2, 2024 13:41
Show Gist options
  • Save oatmealine/168af0540867ec89765f29a12804380c to your computer and use it in GitHub Desktop.
Save oatmealine/168af0540867ec89765f29a12804380c to your computer and use it in GitHub Desktop.
Lua type definitions for EX-XDRiVER
---@meta
xdrv = {}
-- 0. https://github.com/tari-cat/XDRV/blob/main/Assets/Scripts/XDRVEditorScripts/ChartMod.cs#L90
-- 1. /ChartModLookup\.Add\("/ -> ''
-- 2. /", ChartModType\..+\)/ -> ''
-- 3. /^//.+/ -> ''
-- 4. /^([\w]+);\n+/ -> ''$1' | '
---@alias xdrv.ModName 'speed' | 'camera_position_x' | 'camera_position_y' | 'camera_position_z' | 'camera_rotation_x' | 'camera_rotation_y' | 'camera_rotation_z' | 'camera_move_x' | 'camera_move_y' | 'camera_move_z' | 'camera_rotate_x' | 'camera_rotate_y' | 'camera_rotate_z' | 'camera_fov' | 'camera_field_of_view' | 'note_move_x' | 'note_move_y' | 'note_move_z' | 'note_rotate_x' | 'note_rotate_y' | 'note_rotate_z' | 'note1_move_x' | 'note1_move_y' | 'note1_move_z' | 'note1_rotate_x' | 'note1_rotate_y' | 'note1_rotate_z' | 'note2_move_x' | 'note2_move_y' | 'note2_move_z' | 'note2_rotate_x' | 'note2_rotate_y' | 'note2_rotate_z' | 'note3_move_x' | 'note3_move_y' | 'note3_move_z' | 'note3_rotate_x' | 'note3_rotate_y' | 'note3_rotate_z' | 'note4_move_x' | 'note4_move_y' | 'note4_move_z' | 'note4_rotate_x' | 'note4_rotate_y' | 'note4_rotate_z' | 'note5_move_x' | 'note5_move_y' | 'note5_move_z' | 'note5_rotate_x' | 'note5_rotate_y' | 'note5_rotate_z' | 'note6_move_x' | 'note6_move_y' | 'note6_move_z' | 'note6_rotate_x' | 'note6_rotate_y' | 'note6_rotate_z' | 'track_move_x' | 'track_move_y' | 'track_move_z' | 'track_rotate_x' | 'track_rotate_y' | 'track_rotate_z' | 'trackleft_move_x' | 'trackleft_move_y' | 'trackleft_move_z' | 'trackleft_rotate_x' | 'trackleft_rotate_y' | 'trackleft_rotate_z' | 'trackright_move_x' | 'trackright_move_y' | 'trackright_move_z' | 'trackright_rotate_x' | 'trackright_rotate_y' | 'trackright_rotate_z' | 'gear_move_x' | 'gear_move_y' | 'gear_move_z' | 'gear_rotate_x' | 'gear_rotate_y' | 'gear_rotate_z' | 'gearleft_move_x' | 'gearleft_move_y' | 'gearleft_move_z' | 'gearleft_rotate_x' | 'gearleft_rotate_y' | 'gearleft_rotate_z' | 'gearright_move_x' | 'gearright_move_y' | 'gearright_move_z' | 'gearright_rotate_x' | 'gearright_rotate_y' | 'gearright_rotate_z' | 'black_bar_top_position' | 'black_bar_bottom_position' | 'black_bar_left_position' | 'black_bar_right_position' | 'black_bar_top_rotation' | 'black_bar_bottom_rotation' | 'black_bar_left_rotation' | 'black_bar_right_rotation' | 'lane_color_red' | 'lane_color_green' | 'lane_color_blue' | 'lane_color_alpha' | 'lane_left_color_red' | 'lane_left_color_green' | 'lane_left_color_blue' | 'lane_left_color_alpha' | 'lane_right_color_red' | 'lane_right_color_green' | 'lane_right_color_blue' | 'lane_right_color_alpha' | 'track_color_red' | 'track_color_green' | 'track_color_blue' | 'track_color_alpha' | 'track_left_color_red' | 'track_left_color_green' | 'track_left_color_blue' | 'track_left_color_alpha' | 'track_right_color_red' | 'track_right_color_green' | 'track_right_color_blue' | 'track_right_color_alpha' | 'drift_move_x' | 'drift_move_y' | 'drift_move_z' | 'drift_rotate_x' | 'drift_rotate_y' | 'drift_rotate_z' | 'driftleft_move_x' | 'driftleft_move_y' | 'driftleft_move_z' | 'driftleft_rotate_x' | 'driftleft_rotate_y' | 'driftleft_rotate_z' | 'driftright_move_x' | 'driftright_move_y' | 'driftright_move_z' | 'driftright_rotate_x' | 'driftright_rotate_y' | 'driftright_rotate_z' | 'note_scale_x' | 'note_scale_y' | 'note_scale_z' | 'note1_scale_x' | 'note1_scale_y' | 'note1_scale_z' | 'note2_scale_x' | 'note2_scale_y' | 'note2_scale_z' | 'note3_scale_x' | 'note3_scale_y' | 'note3_scale_z' | 'note4_scale_x' | 'note4_scale_y' | 'note4_scale_z' | 'note5_scale_x' | 'note5_scale_y' | 'note5_scale_z' | 'note6_scale_x' | 'note6_scale_y' | 'note6_scale_z' | 'gear_scale_x' | 'gear_scale_y' | 'gear_scale_z' | 'gearleft_scale_x' | 'gearleft_scale_y' | 'gearleft_scale_z' | 'gearright_scale_x' | 'gearright_scale_y' | 'gearright_scale_z' | 'drift_scale_x' | 'drift_scale_y' | 'drift_scale_z' | 'driftleft_scale_x' | 'driftleft_scale_y' | 'driftleft_scale_z' | 'driftright_scale_x' | 'driftright_scale_y' | 'driftright_scale_z' | 'track_scale_x' | 'track_scale_y' | 'track_scale_z' | 'trackleft_scale_x' | 'trackleft_scale_y' | 'trackleft_scale_z' | 'trackright_scale_x' | 'trackright_scale_y' | 'trackright_scale_z' | 'note1_speed' | 'note2_speed' | 'note3_speed' | 'note4_speed' | 'note5_speed' | 'note6_speed' | 'gearleft_speed' | 'gearright_speed' | 'drift_speed' | 'speed1' | 'speed2' | 'speed3' | 'speed4' | 'speed5' | 'speed6' | 'speed7' | 'speed8' | 'speed9' | 'brake' | 'note1_brake' | 'note2_brake' | 'note3_brake' | 'note4_brake' | 'note5_brake' | 'note6_brake' | 'gearleft_brake' | 'gearright_brake' | 'drift_brake' | 'brake1' | 'brake2' | 'brake3' | 'brake4' | 'brake5' | 'brake6' | 'brake7' | 'brake8' | 'brake9' | 'accel' | 'note1_accel' | 'note2_accel' | 'note3_accel' | 'note4_accel' | 'note5_accel' | 'note6_accel' | 'gearleft_accel' | 'gearright_accel' | 'drift_accel' | 'accel1' | 'accel2' | 'accel3' | 'accel4' | 'accel5' | 'accel6' | 'accel7' | 'accel8' | 'accel9' | 'background_speed_additive' | 'background_speed_multiplier' | 'bg_speed_mult' | 'bg_speed_add' | 'judgment_line_offset' | 'judgment_line_left_offset' | 'judgment_line_right_offset' | 'note_opacity' | 'note1_opacity' | 'note2_opacity' | 'note3_opacity' | 'note4_opacity' | 'note5_opacity' | 'note6_opacity' | 'gear_opacity' | 'gearleft_opacity' | 'gearright_opacity' | 'drift_opacity' | 'driftleft_opacity' | 'driftright_opacity' | 'note_opacity1' | 'note_opacity2' | 'note_opacity3' | 'note_opacity4' | 'note_opacity5' | 'note_opacity6' | 'note_opacity7' | 'note_opacity8' | 'note_opacity9' | 'render_line_offset' | 'render_line_left_offset' | 'render_line_right_offset'
---@alias xdrv.EaseName 'linear' | 'inquad' | 'outquad' | 'inoutquad' | 'incubic' | 'outcubic' | 'inoutcubic' | 'inquart' | 'outquart' | 'inoutquart' | 'inquint' | 'outquint' | 'inoutquint' | 'insine' | 'outsine' | 'inoutsine' | 'inexpo' | 'outexpo' | 'inoutexpo' | 'incirc' | 'outcirc' | 'inoutcirc' | 'inelastic' | 'outelastic' | 'inoutelastic' | 'inback' | 'outback' | 'inoutback' | 'inbounce' | 'outbounce' | 'inoutbounce' | 'bounce' | 'tri' | 'bell' | 'pop' | 'tap' | 'pulse' | 'spike' | 'inverse' | 'instant' | 'smoothstep' | 'smootherstep' | 'smootheststep'
---@alias xdrv.Column 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7
---@param mod xdrv.ModName @ The mod name
---@param value number @ The value to set the mod to
---@param timing 'beat' | 'time' @ Whether to set the mod at a specific beat or time in seconds ('beat' or 'time')
---@param at number @ The beat or time in seconds
function xdrv.Mod(mod, value, timing, at) end
xdrv.mod = xdrv.Mod
xdrv.Set = xdrv.Mod
xdrv.set = xdrv.Set
---@param mod xdrv.ModName @ The mod name
---@param from number @ The starting value
---@param to number @ The ending value
---@param timing 'beat' | 'time' @ Whether to set the mod at a specific beat or time in seconds ('beat' or 'time')
---@param at number @ The beat or time in seconds to start easing our mod
---@param lenmode 'end' | 'len' @ Whether to set the duration as length or as its ending point, in beat or time in seconds as determined by the fourth parameter ('end' or 'len')
---@param len number @ The end point of our ease as a beat or time in seconds, or length in beats or time in seconds
---@param ease xdrv.EaseName @ The type of ease to use
function xdrv.Ease(mod, from, to, timing, at, lenmode, len, ease) end
xdrv.ease = xdrv.Ease
---@param eventName string @ The event name
---@param beatOrTime 'beat' | 'time' @ Whether to set the mod at a specific beat or time in seconds ('beat' or 'time')
---@param timingValue number
---@param ... any
function xdrv.RunEvent(eventName, beatOrTime, timingValue, ...) end
xdrv.run_event = xdrv.RunEvent
---@param column xdrv.Column
---@return {[1]: number, [2]: number, [3]: number, [4]: number} @ A float array containing 4 floats, with red, green, blue, and alpha channels ranging from 0 to 1
function xdrv.GetPlayerNoteColor(column) end
xdrv.get_player_note_color = xdrv.GetPlayerNoteColor
---@param column xdrv.Column
---@param index 0 | 1 | 2 | 3
---@return number
function xdrv.GetPlayerNoteColorChannel(column, index) end
xdrv.get_player_note_color_channel = xdrv.GetPlayerNoteColorChannel
---@param column xdrv.Column
---@return number
function xdrv.GetPlayerNoteColorRed(column) end
xdrv.get_player_note_color_red = xdrv.GetPlayerNoteColorRed
---@param column xdrv.Column
---@return number
function xdrv.GetPlayerNoteColorGreen(column) end
xdrv.get_player_note_color_green = xdrv.GetPlayerNoteColorGreen
---@param column xdrv.Column
---@return number
function xdrv.GetPlayerNoteColorBlue(column) end
xdrv.get_player_note_color_blue = xdrv.GetPlayerNoteColorBlue
---@param column xdrv.Column
---@return number
function xdrv.GetPlayerNoteColorAlpha(column) end
xdrv.get_player_note_color_alpha = xdrv.GetPlayerNoteColorAlpha
---@return number @ Minimum of 0.5, no maximum
function xdrv.GetPlayerScrollSpeed() end
xdrv.get_player_scroll_speed = xdrv.GetPlayerScrollSpeed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment