This is reverse-engineered from the game.
These functions are registered when LuaController.Start() is called.
These are used by skins.
Write object/text to the debug console for skins.
// public class LuaManager
public void write(object o)
{
string text = null;
if (o != null)
{
text = ((o is string) ? ((string)o) : ((!(o is LuaTable)) ? o.ToString() : LuaX.TableToString_Recursive((LuaTable)o)));
}
Messenger<string>.Broadcast("LuaSkinPrintText", text);
if (!Application.isEditor)
{
UnityEngine.Debug.Log("Lua Skin:" + text);
}
}Can the player jump?
// public class SceneManager
public bool PlayerCanJump()
{
return CharacterManager.Instance.canJump;
}Set player attributes, mostly related to appearance and camera. tbl is a table containing any of the following
fov = 90.0- Field of viewcameraortho = false- Orthographic camera?cameraignoreslope = false- ???cameraHeightTrackingRatio = 1.0- Camera height tracking ratiocameramode- String describing camera modecameramode = "first"- First-person camera modecameramode = "third"- Third-person camera modecameramode = "first_jumpthird"- First-person camera, but third-person when jumpingcameramode = "first_trickthird"- First-person camera, but third-person when performing a trickcameramode = "first_trickjumpthird"- First preson camera, but third-person when jumping or performing a trick
cameradynamics- Camera dynamicscameradynamics = "high"- Use extra camera dynamicscameradynamics = "..."(Anything but"high") - Do not use extra camera dynamics
camfirst = { ... }- First-person camera properties table.pos = {x, y, z}- Camera position.rot = {rX, rY, rZ}- Camera rotation (does not apply in VR mode).strafefactor = 1.0- Strafe factor (does not apply in VR mode).puzzleoffset- Ring offset (if puzzle renderer present)
camthird = { ... }- Third-person camera properties table.pos = {x, y, z}- Camera position.rot = {rX, rY, rZ}- Camera rotation (does not apply in VR mode).strafefactor = 0.5- Camera strafe factor (does not apply in VR mode).pos2 = {x, y, z}- Near position.rot2 = {rX, rY, rZ}- Near rotation (only ifcamthird.pos2is present, does not apply in VR mode).strafefactorFar = 1.0- Far strafe factor (only ifcamthird.pos2is present, does not apply in VR mode).transitionspeed = 1.0- Transition speed between camera perspectives.puzzleoffset- Close ring offset (if puzzle renderer present).puzzleoffset2- Far ring offset (if puzzle renderer present)
vehicle- Vehicle parameters.reflect = false- Enable vehicle reflector (mirroring?).min_hover_height = 0.0- Minimum hover height.max_hover_height = 0.0- Maximum hover height.use_water_rooster = true- Boat????.rollscaler = -1.0- ???.smooth_tilting = false- Smooth tilting.smooth_tilting_speed = 10.0- Smooth tilting speed.smooth_tilting_max_offset = -20.0.water_rooster_z_offset = -1.04.roostercolor = {0.133, 0.22, 0.486, 1.0}.airvehicle = {<GameObject>}.watervehicle = {<GameObject>}.surfer.use_water_rooser = true.roosercolor = {0.133, 0.22, 0.486, 1.0}.arms = {<GameObject>}.leg = {<GameObject>}.body = {<GameObject>}.board = {<GameObject>}.towrope_node = {<GameObject>}.towboat = {<GameObject>}
Print time since last call. name is used only for debug, and has no effect on metrics.
Get the track.
Get current intensity
Get FFT16 at instant
Update FFT16
Update FFT512
Get FFT16 (logarithmic)
Build mesh (will document shape and purpose later)
Create a rail
Create an object
Set the level skybox. params contains an enourmous quantity of fields.
Set rings, params may contain the following
shadowcaster = false- Rings cast shadows?shadoreceiver = false- Rings receive shadows?layer = 11- Layeroffset = <real>- Offsetsize = 0.0- Sizepercentringed = 0.0useairrings = truematerial = {<Material>}airsize = 0.0airmaterial = {<Material>}
Set wake props, params may contain the following
height = 0.0fallrate = 0.0layer = 11material = {<Material>}offsets = {{x, y, z}...}bottomcolor = "..." | {r, g, b, a}bottomcolor = "highway"bottomcolor = "highwayinverted"
topcolor = "..." | {r, g, b, a}- Seebottomcolorextraspray = false
Mode/mod functions
Set gameplay params. settings contains
jumpheightscaler = 1.0gravity = -0.45allowmusicdroponfail = falsepreventautomaticoverfillclear = falseusetraffic = trueairstrafing = falseusejumpmarkers = falsefullgrid_collectiongracetime = 0.0smoothstrafetowake = falsepuzzleblockfallinterval = 0.1blockflight_secondstopuzzle = 0.35calculate_antijumps_and_antitraffic = falseautomatic_traffic_collisions = trueusepuzzlegrid = true- Mode uses puzzle gridpuzzlerows = 7- Number of rows in puzzle gridpuzzlecols = 3- Number of columns in puzzle gridcleargridonlanding = true- Clear the grid on landing after trick?forceclearingsinglecolumns = trueforcecollectionoverfill = trueshow_x_in_a_row_text = falseuseBlockTrailToOptimalJumps = falseremoveBlocksNearOptimalJumps = 0usePinatas = falseuseAirBlocks = falseblocksInLanes = trueuseLivingScoreboardGhosts = truecancrash = true|false- Can tricks fail?canpush- Can push?canScoop- Can collect blocks for use later?blocktype_grey = 5blocktype_highway = 6blocktype_highwayinverted = 7rightsticksteering = false- Steer with right stick (gamepad)minvisibletrafficblocks = 0greypercent = 0.3- Percent of blocks that are greys (spikes)greyrandomdistribution = false- Use a random distribution for greysusecaterpillars = bool- Use caterpillars?minimummultiplier = realjumpautofixscaler = realsideview = false- Side scroller?minstrafespeedforwakejump = real- Minimum strafe speed to go into jumpdegreyatlandingzone = bool- Remove greys in zone after landing from jumplaunchtrickmultiplier = realmaxnumtricksperjump = intautofinishgamepadjumps = boolautofinishmousejumps = boolpuzzlematchmultiplier = realstealthscoremultiplier = realsecondstoblockjumpsafterlanding = realeasytraffic = boolautostartlaunchtricksforheldbuttons = truejumpmode = "..."- Jump mode"none"- Disable jumping"manual""ramps""button""wake""wake_or_button""button_press""auto"
minimumjump_airtime = realminimumjump_height = realstartingscore = 0pointspergrey = intpointspercolor = intmatchcollectionseconds = 1.5minmatchsizes = {<int>...}greyaction = "...""clog" | "stuck" | "permanent"- Stays in grid"eraseone" | "erasesingle" | "eraseblock"- Remove nearest block from grid"erasecolumn"- Remove nearest column from grid"erasegrid" | "eraseall"- Remove all blocks from grid
usetrickscorewindow = truetrickdurations = {<real>...}trickpoints = {<real>...}playerminspeed = realplayermaxspeed = realminimumbestjumptime = realuphilltiltscaler = realdownhilltiltscaler = realuphilltiltsmoother = realdownhilltiltsmoother = realuseadvancedsteepalgorithm = truealldownhill = falserailedblockscanbegrey = falsetrafficcompression = boolwatercompression = boolautocenter = boolmaxstrafe = realusesnowboardphysics = boolfreqtrafficbins = 256- (must be at least 256)freqtrafficbins_logspaced = false
Set visualizer viewports. ports is a table of tables, where each table a viewport.
A viewport table has the following fields:
pos = {x, y, z}- Positionrot = {rX, rY, rZ}- Rotationscale = {mX, mY, mZ}- Scale
Print object to the unity debug log.
Get the puzzle.
Get the trick multiplier
Things to render?
Render things?
Update a batch renderer
Get current track location
Get current track world position.
Create clones of things???
Interface with the event system.
Logic:
- If
cmd.nameis set- Then, if
cmd.nameis a clone,- Then, if
cmd.commandis a string,- Then, if
cmd.paramis a table- Then, call one of
SetParent,ChangeShaderColors,SetTransform,Blink,ChangeTrackNodeOffset,ChangeTrafficBlockConeTypebased oncmd.commandwithcmd.paramas the arguments on the clone corresponding tocmd.name - Otherwise, broadcast
cmd.commandto the clone corresponding tocmd.name
- Then, call one of
- Then, if
- Then, if
- Otherwise, print a warning to the Unity debug log
- Then, if
Call SendCommand(cmd) on each table in cmds
Get input state.
Set local score.
params is
name = "nameless"- Competitor namescore = 0.0- Competitor scoredisplayScore = string- Competitor display score
Set global score. Achieved by broadcasting SetScoreFromMod(int, bool, Color).
params is
score = 0- Scoreshowdelta = true- Show changedeltacolor = Color.white- Color to show change in
Play a sound.
sound is
soundType = "none"- Sound to playavatar = "na"- If playing"grunt", this is the avatar that will play it
Returns a table of real with ring jump heights
params is
launchNode = int
Set puzzle params. params may contain the following fields.
Note that params is not a {<Puzzle>}
trackoffset = realtiming = {...}.addallinflightblocksnow = any- Presence of this key causes all blocks to land.matchtimer = real- Time til match is cleared.matchtimerthreshold = real.collectnow_usingmultiplier = real- Collect points from match using given multiplier NOW.colectioncanautoplaysounds = true- Can auto-play sounds when forcing collect with multiplier?
newblocks = {...}- Blocks to add#n- A block to add.type = 0- Block type.collision_strafe = 0.0.add_top = false.transitionseconds = real.powerupname = string..shrinkdown = true
cells = {...}#n- Columnn, value is array of tables#n- Rownin column, value is table.type = -1- Color ID
flyups = {...}#n.row = 0- Row.col = 0- Column.type = 0- Color ID
Hide the surfer, vehicle, and rooster.
Set camera params.
// class LuaMods
public void SetCamera(LuaTable table)
{
object obj = table["cameraortho"];
if (obj is bool)
{
SkinManager.useOrthographicCameras = (bool)obj;
}
obj = table["pos"];
if (obj is LuaTable)
{
SkinManager.useModForcedCamera = true;
SkinManager.modForcedPos = LuaX.OToVector3(table["pos"], Vector3.zero);
SkinManager.modForcedRot = LuaX.OToVector3(table["rot"], Vector3.zero);
if (LuaX.TryReadVector3(table["parentrot"], ref SkinManager.modForcedParentRot))
{
SkinManager.useModForcedCameraParentRot = true;
}
LuaValue value = table.GetValue("railoffset");
switch (value.Type)
{
case LuaType.String:
if ((string)value == "detached")
{
SkinManager.attachCameraToTrack = false;
}
break;
case LuaType.Number:
SkinManager.cameraTrackOffset = (float)value;
break;
}
}
else
{
LuaTable luaTable = table["nearcam"] as LuaTable;
if (luaTable != null)
{
SkinManager.firstPersonPos = LuaX.OToVector3(luaTable["pos"], Vector3.zero);
SkinManager.ThirdPersonNearPos = LuaX.OToVector3(luaTable["pos"], Vector3.zero);
SkinManager.firstPersonRot = LuaX.OToVector3(luaTable["rot"], Vector3.zero);
SkinManager.ThirdPersonNearRot = LuaX.OToVector3(luaTable["rot"], Vector3.zero);
SkinManager.thirdPersonNearStrafeFactor = luaTable.GetValue("strafiness").OrDefault(0f);
}
luaTable = (table["farcam"] as LuaTable);
if (luaTable != null)
{
SkinManager.ThirdPersonFarPos = LuaX.OToVector3(luaTable["pos"], Vector3.zero);
SkinManager.ThirdPersonFarRot = LuaX.OToVector3(luaTable["rot"], Vector3.zero);
SkinManager.thirdPersonFarStrafeFactor = luaTable.GetValue("strafiness").OrDefault(0f);
}
}
table.Dispose();
}Hide the given blocks.
Set skin properties.
Get quality level
Set scoreboard note.
details is
secondsvisible = 0- Visibility durationcolor = {195, 195, 195, 255}- Note colortext = ""- Note text
Jump now.
Mess with traffic.
public void ChangeTraffic(LuaTable table)
{
List<TrafficManager.BlockModifier> changes = new List<TrafficManager.BlockModifier>();
table.ForEachV(delegate(LuaValue key, object value)
{
LuaTable luaTable = value as LuaTable;
if (!(luaTable == null))
{
LuaTable luaTable2 = luaTable;
try
{
TrafficManager.BlockModifier item = default(TrafficManager.BlockModifier);
LuaValue value2 = luaTable.GetValue("index");
if (value2.Type != 0)
{
item.index = value2.OrDefault(1) - 1;
item.powerupName = luaTable.GetValue("powerupname").AsString;
LuaValue value3 = luaTable.GetValue("type");
if (value3.Type != 0)
{
item.type = value3.OrDefault(1);
}
item.vOffset = luaTable.GetVector3("v3offset");
changes.Add(item);
}
}
finally
{
if (luaTable2 != null)
{
((IDisposable)luaTable2).Dispose();
}
}
}
});
Messenger<List<TrafficManager.BlockModifier>>.Broadcast("ChangeBlocks", changes, MessengerMode.DONT_REQUIRE_LISTENER);
table.Dispose();
}Change block colors
public void SetBlockColors(LuaTable table)
{
Color[] array = LuaX.TableToColors(table);
bool flag = false;
if (array.Length != GlobalColors.blockColors.Length)
{
flag = true;
}
if (!flag)
{
for (int i = 0; i < array.Length; i++)
{
if (array[i] != GlobalColors.blockColors[i])
{
flag = true;
break;
}
}
}
if (flag)
{
GlobalColors.SetBlockColors(array);
}
}Get block colors.
xor1- X coordinateyor2- Y coordinatezor3- Z coordinate
mouse.x- Mouse X delta.y- Mouse Y delta.LMB- Mouse button 0 (X11 numbering) state.MMB- Mouse button 1 (X11 numbering) state.RMB- Mouse button 2 (X11 numbering) state.wheel- Mouse wheel delta
keyboard.a ... .z- Key states.'0' ... .'9'- Key states.uparrow- Key states.downarrow- Key states.leftarrow- Key states.rightarrow- Key states.semicolon- Key states.comma- Key states.period- Key states.space- Key states.anykey- Is any key pressed?.nokey- Are no keys pressed?
activedevice- active input device (single player?).Horizontal- Left stick X.Vertical- Left stick Y.Horizontal2- Right stick X.Vertical2- Right stick Y.button1 ... .button4- Button states.LeftBumper- Left bumper state.RightBumper- Right bumper state.LeftTrigger- Left trigger value.RightTrigger- Right trigger value.name- Device name
players- Player devices.1 ... .4- Devices, shape is identical toactivedevice
cells#n- Columnnin puzzle#n- Rownin columntype- Cell color IDmatched- Cell is matched?matchsize- Number of other cells in the matchmatccols- Number of columns in the matchmatchedcellscount- Number of matched cells in grid overallpendingblockcounts#n- Pending blocks for columnn
lanedividers = {{1.0, -1.5}, {2.0, 1.5}}shoulderlines = {{1.0, 4.5}, {2.0, -4.5}}trackwidth = 11.6prefersteep = false
A table, with the following fields
assetBundle = "..."- bundle nameprefabName = "..."- prefab name (not used ifassetBundleis string)pos = {x, y, z}scale = {<Scale>} | 1.0lookat = "..."lookat = "camera"- look at cameralookat = "start"- look at starting pointlookat = "..."- look at last ringtransform = {<Transform>}layer = 0 ... 31material = {<Material>}materials = {<Material>...}- (not used ifmaterialis present)prefabKeepExistingMaterial = trueshadowcaster = true|falseshadowreceiver = true|false
There are several more, but I don't terribly care much about this
A table, with the following fields
min = 1.0- min scalemax = 1.0- max scale
A table, with the following fields
position = {x, y, z}rotation | rot = {rX, rY, rZ}scale = {mX, mY, mZ}
A table, with fields and member tables representing nodes
#n- Member tables, each represents a node.maxair- Node max air.minair- Node min air.jumpairtime- Node jump air time.pos- Node position (3 reals).seconds- Node length.color- Node color.r- Red.g- Green.b- Blue.a- Alpha.pan- Node rotation on the X axis.tilt- Node rotation on the Y axis.roll- Node rotation on the Z axis.rot- Above rotation values as a vector (viaLuaX.VectorToTable).intensity- Node intensity (normalized).funkyrot- ???.antiairtime- Node anti-jump seconds.trafficstrength- Node traffic strength.antitrafficstrength- Node anti-traffic strength (???).slope- Node physical tilt (slope, "steep"-ness).intensityRaw- Raw intensityminbounds- Min bounds (vector, viaLuaX.VectorToTable)maxbounds- Max bounds (vector, viaLuaX.VectorToTable)minslope- Min slopemaxslope- Max slope