Skip to content

AngelScript

tomek0055 edited this page Jun 30, 2024 · 10 revisions

Introduction

AngelScript is a scripting language used in TMUnlimiter to create custom behaviour that cannot be achieved using the built-in editor functionality or by parameter sets. Each track created with the TMUnlimiter 2.0 track version has a built-in module called Core that can be used to implement a variety of callbacks to control the game state more precisely. TMUnlimiter allows the user to define any number of modules, but they can only be used to implement a limited set of callbacks. To load the script file into the game, you need to create a file with the .tmunlimiter.as extension. Script files can be placed in the Scripts folder in the game's user data directory.

Script user interface showing available modules with the Core module selected, showing basic information about the module.

There is a bug in the game that does not allow you to update the file list when trying to load a script using the in-game file browser. To solve this problem, leave the track editor and click the refresh button in the track list or replay list.

TMUnlimiter API exposes only one global variable, a console.

const Console@ console;

Callback list

getStartBlock

Note

Can only be applied to the Core module.

const GameBlock@ const getStartBlock(const GameChallenge@ challenge);

This callback is executed when the Randomized start points option is enabled and the player is about to be placed on the start. If the callback function would return null or the block that is not the start or multilap block, the logic will randomize the start block from the pool of available start blocks placed on the map instead. This callback is executed before onStart callback.

onTick

Note

Can only be applied to the Core module.

void onTick(TrackManiaRace@ race);

This callback is executed every simulation tick after the countdown has reached Go!.

onBindInputEvent

Note

Can only be applied to the Core module.

bool onBindInputEvent(TrackManiaRace@ race, BindInputEvent@ inputEvent, uint eventTime);

This callback is executed when the player presses (or unpresses) a predefined input during the race (excluding vehicle inputs that are called in onVehicleInputEvent callback).

Some input events can be cancelled by simply returning true from the callback, otherwise an exception will be thrown:

  • MouseX input event (moving the mouse cursor on the X axis).
  • MouseY input event (moving the mouse cursor on the Y axis).
  • Respawn input event (pressing the respawn key bind).
  • Horn input event (pressing the horn key bind).

Warning

It is known that the game does not fire unpress input events when the input mapping has been changed (for example, by going to the pause menu).

onVehicleInputEvent

Note

Can only be applied to the Core module.

void onVehicleInputEvent(TrackManiaRace@ race, VehicleInputEvent@ inputEvent, uint eventTime);

This callback is executed every simulation tick for each available vehicle input. From there you can change the input values to complete different ones.

onVehicleCollision

Note

Can only be applied to the Core module.

bool onVehicleCollision(TrackManiaRace@ race, PhysicalContact@ physicalContact);

This callback is executed whenever the player's vehicle collides with an object. This callback can prevent this event from being passed to the vehicle itself by returning true value.

onChat

Note

Can only be applied to the Core module.

void onChat(TrackManiaRace@ race, TrackManiaPlayer@ player, const string&in message);

This callback is executed every time when the player receives a message on the chat.

Warning

If the server is using manual chat routing, the player will always be the server.

Warning

Any changes to the game physics will result in non-deterministic behaviour.

onStart

Note

Can only be applied to the Core module.

void onStart(TrackManiaRace@ race);

This callback is executed when the player is about to start.

onCheckPoint

Note

Can only be applied to the Core module.

void onCheckPoint(TrackManiaRace@ race, GameBlock@ checkPointBlock);

This callback is executed when the player passes a checkpoint block.

onLap

Note

Can only be applied to the Core module.

void onLap(TrackManiaRace@ race, GameBlock@ finishBlock);

This callback is executed when the player has completed a lap.

onFinish

Note

Can only be applied to the Core module.

void onFinish(TrackManiaRace@ race, GameBlock@ finishBlock);

This callback is executed when the player finishes a map.

onTunnelDataReceived

Note

Can only be applied to the Core module.

void onTunnelDataReceived(TrackManiaRace@ race, const ReadableStream&in stream);

This callback is executed when the player receives a tunnel data from the server.

Warning

Any changes to the game physics will result in non-deterministic behaviour.

onFrame

Note

Can only be applied to the Core module.

void onFrame(TrackManiaRace@ race, GameCamVal& camVal);

This callback is executed every game frame.

Warning

Any changes to the game physics will result in non-deterministic behaviour.

onTriggerGroupCondition

Note

Can be used with all modules

bool onTriggerGroupCondition(TrackManiaRace@ race, TriggerGroup@ triggerGroup, GameBlock@ triggerBlock);

This callback is executed each time the player touches the trigger group before an event is more accurately dispatched. The result of the function prevents further processing of the trigger block on that particular tick.

Warning

The triggerBlock argument is not always guaranteed to be non-null. If you want to use triggerBlock do a null check on it before.

onTriggerGroupEnter

Note

Can be used with all modules

void onTriggerGroupEnter(TrackManiaRace@ race, TriggerGroup@ triggerGroup, GameBlock@ triggerBlock);

This callback is executed when the player enters to the trigger group.

onTriggerGroupInside

Note

Can be used with all modules

void onTriggerGroupInside(TrackManiaRace@ race, TriggerGroup@ triggerGroup, GameBlock@ triggerBlock);

This callback is executed every tick when the player is inside of the trigger group.

onTriggerGroupLeave

Note

Can be used with all modules

void onTriggerGroupLeave(TrackManiaRace@ race, TriggerGroup@ triggerGroup);

This callback is executed when the player leaves from the trigger group.

onParameterSetCall

Note

Can be used with all modules

void onParameterSetCall(TrackManiaRace@ race);

This callback is executed when the parameter set calls the script module specified in the parameter.

Class list

class string

string is an object representation of text.

Functions

~string();
string();
string(const string&in other);
int find(const string&in value) const;
int findLast(const string&in value) const;
string& slice(int start);
string& slice(int start, int end);
string& remove(uint start);
string& remove(uint start, uint count);
string opAdd(bool value) const;
string opAdd(int8 value) const;
string opAdd(int16 value) const;
string opAdd(int value) const;
string opAdd(int64 value) const;
string opAdd(uint8 value) const;
string opAdd(uint16 value) const;
string opAdd(uint value) const;
string opAdd(uint64 value) const;
string opAdd(float value) const;
string opAdd(double value) const;
string opAdd(const string&in value) const;
string& opAddAssign(bool value);
string& opAddAssign(int8 value);
string& opAddAssign(int16 value);
string& opAddAssign(int value);
string& opAddAssign(int64 value);
string& opAddAssign(uint8 value);
string& opAddAssign(uint16 value);
string& opAddAssign(uint value);
string& opAddAssign(uint64 value);
string& opAddAssign(float value);
string& opAddAssign(double value);
string& opAddAssign(const string&in value);
string& opAssign(const string&in value);
bool opEquals(const string&in value) const;

Fields

/* Length of the text */
const uint length;

class Nat3

Nat3 is a set of three unsigned integers for the X, Y and Z axis.

Methods

Nat3();
Nat3(uint value);
Nat3(uint x, uint y, uint z);

Fields

/* X Axis */
uint x;
/* Y Axis */
uint y;
/* Z Axis */
uint z;

class Vec2

Vec2 is a set of two floats for the X and Y axis.

Methods

Vec2();
Vec2(float v);
Vec2(float x, float y);
Vec2 opAdd(const float&in value) const;
Vec2 opSub(const float&in value) const;
Vec2 opMul(const float&in value) const;
Vec2 opDiv(const float&in value) const;
Vec2 opAdd(const Vec2&in value) const;
Vec2 opSub(const Vec2&in value) const;
Vec2 opMul(const Vec2&in value) const;
Vec2 opDiv(const Vec2&in value) const;
Vec2& opAddAssign(const float&in value);
Vec2& opSubAssign(const float&in value);
Vec2& opMulAssign(const float&in value);
Vec2& opDivAssign(const float&in value);
Vec2& opAddAssign(const Vec2&in value);
Vec2& opSubAssign(const Vec2&in value);
Vec2& opMulAssign(const Vec2&in value);
Vec2& opDivAssign(const Vec2&in value);
bool opEquals(const Vec2&in value) const;
string toString() const;
float angle(const Vec2&in value);
float distance(const Vec2&in value);
float dot(const Vec2&in value);

Fields

/* X Axis */
float x;
/* Y Axis */
float y;

class Vec3

Vec3 is a set of three floats for the X, Y and Z axis.

Methods

Vec3();
Vec3(float v);
Vec3(float x, float y, float z);
Vec3 opAdd(const float&in value) const;
Vec3 opSub(const float&in value) const;
Vec3 opMul(const float&in value) const;
Vec3 opDiv(const float&in value) const;
Vec3 opAdd(const Vec3&in value) const;
Vec3 opSub(const Vec3&in value) const;
Vec3 opMul(const Vec3&in value) const;
Vec3 opDiv(const Vec3&in value) const;
Vec3& opAddAssign(const float&in value);
Vec3& opSubAssign(const float&in value);
Vec3& opMulAssign(const float&in value);
Vec3& opDivAssign(const float&in value);
Vec3& opAddAssign(const Vec3&in value);
Vec3& opSubAssign(const Vec3&in value);
Vec3& opMulAssign(const Vec3&in value);
Vec3& opDivAssign(const Vec3&in value);
bool opEquals(const Vec3&in value) const;
string toString() const;
float angle(const Vec3&in value);
float distance(const Vec3&in value);
float dot(const Vec3&in value);
void mult(const Mat3&in value);
void mult(const Iso4&in value);

Fields

/* X Axis */
float x;
/* Y Axis */
float y;
/* Z Axis */
float z;

class Mat3

Mat3 is a representation of the 3x3 matrix.

Methods

Mat3();
void transpose();
uint inverse();
void mult(const Mat3&in other);
void leftMult(const Mat3&in other);
void set(const Quat&in quat);
void setRotateX(float x);
void setRotateY(float y);
void setRotateZ(float z);
void setIdentity();

Fields

Vec3 x;
Vec3 y;
Vec3 z;

class Iso4

Iso4 is a representation of the 3x3 matrix with the position component.

Methods

Iso4();
void getUp(Vec3&out result) const;
void getDir(Vec3&out result) const;
void inverse();
void setIdentity();
void mult(const Iso4&inout other);
void setRotateX(float x);
void setRotateY(float y);
void setRotateZ(float z);

Fields

Mat3 rotation;
Vec3 position;

class Quat

Quat is a representation of the quaternion.

Methods

Quat();
Quat(float x, float y, float z, float w);
void getYawPitchRoll(float&out yaw, float&out pitch, float&out roll) const;
void setYawPitchRoll(float yaw, float pitch, float roll);
void mult(const Quat&in other);
void set(const Mat3&in other);

Fields

float x;
float y;
float z;
float w;

class Color

Color is a set of four floats in <0, 1> range for the red, green, blue and alpha color components.

Methods

Color();
Color(float r, float g, float b, float a);
Vec3 getHsv() const;
Vec3 getHsl() const;
void setHsv(const Vec3&in hsv);
void setHsl(const Vec3&in hsl);
void setByteRgb(uint8 r, uint8 g, uint8 b);
void setByteRgba(uint8 r, uint8 g, uint8 b, uint8 a);

Fields

float r;
float g;
float b;
float a;

class ReadableStream

ReadableStream

Methods

~ReadableStream();
ReadableStream();
ReadableStream& opAssign(const ReadableStream&in other);
ReadableStream& opAssign(const WritableStream&in other);
void skipData(uint length);
int8 readInt8() const;
int16 readInt16() const;
int readInt32() const;
int64 readInt64() const;
uint8 readNat8() const;
uint16 readNat16() const;
uint readNat32() const;
uint64 readNat64() const;
float readFloat() const;
double readDouble() const;
void readString(string&inout value) const;
void readData(array<uint8>&inout value, uint length) const;
void reset();

Fields

const uint size;
const uint currentOffset;

class WritableStream

WritableStream

Methods

~WritableStream();
WritableStream();
WritableStream& opAssign(const ReadableStream&in other);
WritableStream& opAssign(const WritableStream&in other);
void writeInt8(int8 value);
void writeInt16(int16 value);
void writeInt32(int value);
void writeInt64(int64 value);
void writeNat8(uint8 value);
void writeNat16(uint16 value);
void writeNat32(uint value);
void writeNat64(uint64 value);
void writeFloat(float value);
void writeDouble(double value);
void writeString(const string&in value);
void writeData(const array<uint8>&in value);
void reset();

Fields

const uint size;
const uint currentOffset;

class array

The array<T> class represents a generic list of elements of type T.

Methods

array();

Array default constructor, without elements.


array() { repeat T };

Array list constructor with elements specified within a repeat block.


uint add(const T&in value);

Adds an element to the array. Returns the number of elements in the array.


void removeAt(uint index, uint count = 1);

Removes count elements from the array at the specified index.


T& opIndex(uint index);
const T& opIndex(uint index) const;

Returns an element from the array at the specified index.


string toString() const;

Returns string representation of the array.


array<T>& opAssign(const array<T>&in other);

Assignment operation between two arrays of the same T type.


void insertAt(uint index, const T&in value);

Inserts an element at the specified index.


Note

Available in TMUnlimiter 2.0 track version only

uint find(const bool&in value) const;
uint find(const int8&in value) const;
uint find(const int16&in value) const;
uint find(const int&in value) const;
uint find(const int64&in value) const;
uint find(const uint8&in value) const;
uint find(const uint16&in value) const;
uint find(const uint&in value) const;
uint find(const uint64&in value) const;
uint find(const float&in value) const;
uint find(const double&in value) const;
uint find(const string&in value) const;
uint find(const Nat3&in value) const;
uint find(const Vec2&in value) const;
uint find(const Vec3&in value) const;
uint find(const Mat3&in value) const;
uint find(const Iso4&in value) const;
uint find(const Quat&in value) const;
uint find(const Color&in value) const;
uint find(const ReadableStream&in value) const;
uint find(const WritableStream&in value) const;
uint find(const TrackManiaPlayer::CheckPointTimeScore&in value) const;

Returns the index of the element in the array. If nothing is found, the result is -1.


Note

Available from TMUnlimiter 2.1 track version

uint find(const T&in value) const;

Returns the index of the element in the array. If nothing is found, the result is -1.

Fields

const uint length;

The number of elements in an array.

class GameCamVal

GameCamVal

Methods

~GameCamVal();
GameCamVal();

Fields

Iso4 location;
float fov;
float focusZ;
float lensSize;
float nearZ;
float farZ;
Vec3 speed;
int field_0x50;
int followedGameMobilId;
bool followAboveWater;

enum FuncKeysReal::Interpolation

enum Interpolation
{
    Linear,
    None
}

class FuncKeysReal

FuncKeysReal

Methods

uint addPair();
Vec2 getPair(uint pairIndex) const;
void setPair(uint pairIndex, const Vec2&in pair);
void removePair(uint pairIndex);
uint getPairCount() const;
FuncKeysReal& opAssign(const FuncKeysReal&in other);

Fields

FuncKeysReal::Interpolation interpolation;

enum TexFilter

enum TexFilter
{
    Point,
    Bilinear,
    Trilinear,
    Anisotropic
}

class PlugBitmap

PlugBitmap

Methods

TexFilter get_texFilter() const property;
void set_texFilter(TexFilter texFilter) property;
uint getWidth() const;
uint getHeight() const;
Color getPixel(uint x, uint y) const;
void setPixel(uint x, uint y, const Color&in color);
void setDirty();

Fields

This class does not have fields.

enum MediaTrackerBlock::Type

enum Type
{
    Unsupported,
    Image,
    Text,
    TransitionFade,
    Triangles
}

class MediaTrackerBlock

MediaTrackerBlock

Methods

float getStartTime() const;
float getEndTime() const;
bool isVisible() const;
Iso4 getLocation() const;
void reset();
void setLocation(const Iso4&in location);
MediaTrackerBlock::Type getType() const;
void image_setImage(PlugBitmap@ bitmap);
string text_getText() const;
void text_setText(const string&in text);
Color transitionFade_getColor() const;
void transitionFade_setColor(const Color&in color);
uint triangles_getVertexCount() const;
Vec3 triangles_getVertexCoord(uint vertexIndex) const;
Vec3 triangles_getVertexNormal(uint vertexIndex) const;
Color triangles_getVertexColor(uint vertexIndex) const;
void triangles_setVertexCoord(uint vertexIndex, const Vec3&in vertexCoord);
void triangles_setVertexNormal(uint vertexIndex, const Vec3&in vertexNormal);
void triangles_setVertexColor(uint vertexIndex, const Color&in vertexColor);

Fields

This class does not have fields.

class MediaTrackerTrack

MediaTrackerTrack

Methods

This class does not have methods.

Fields

const string name;
const array<MediaTrackerBlock@ const> blocks;

class MediaTrackerClip

MediaTrackerClip

Methods

This class does not have methods.

Fields

const array<MediaTrackerTrack@ const> tracks;
const string name;

class MediaTrackerClipGroup

MediaTrackerClipGroup

Methods

This class does not have methods.

Fields

const array<MediaTrackerClip@ const> clips;

class MediaTrackerClipPlayer

MediaTrackerClipPlayer

Methods

void stop();
void play(const MediaTrackerClip@ const clip);
void setPlaySpeed(float playSpeed);
bool isPlaying() const;

Fields

const MediaTrackerClip@ const clip;
float currentTime;

class BlockGroup

BlockGroup

Methods

string get_name() const property;

Fields

This class does not have fields.

enum BlockSettings::SpawnPointAlterMethod

enum SpawnPointAlterMethod
{
    None,
    Manual,
    Automatic
}

enum BlockSettings::BlockTriggerActivationMethod

enum BlockTriggerActivationMethod
{
    Default,
    Disabled,
    TriggerManually
}

enum BlockSettings::RespawnCapability

enum RespawnCapability
{
    Default,
    ForceIsRespawnable,
    ForceIsNonRespawnable
}

class BlockSettings

BlockSettings

Methods

bool isOffsetApplied() const;
bool isRotationApplied() const;
bool isScaleApplied() const;
bool isMotionApplied() const;
bool isOriginOffsetApplied() const;
Vec3 getOffset() const;
Vec3 getRotation() const;
Vec3 getScale() const;
Vec3 getOriginOffset() const;
bool isInBlockGroup(const BlockGroup&inout blockGroup) const;
bool isDynamic() const;
bool isInvisible() const;
bool isNonCollidable() const;
BlockSettings::SpawnPointAlterMethod getSpawnPointAlterMethod() const;
BlockSettings::BlockTriggerActivationMethod getBlockTriggerActivationMethod() const;
BlockSettings::RespawnCapability getRespawnCapability() const;
Vec3 getManualSpawnPointLocation() const;
Vec3 getManualSpawnPointRotation() const;

Fields

This class does not have fields.

enum FlagOption

enum FlagOption
{
    Disable,
    Enable,
    NoChange
}

class GameBlockState

GameBlockState

Methods

bool isVisible() const;
bool isCollidable() const;
Vec3 getPosition() const;
Quat getRotation() const;
bool canChangeLocation() const;
void setPosition(const Vec3&in position);
void setRotation(const Quat&in rotation);
bool canChangeFlags() const;
void setFlags(FlagOption IsInvisible, FlagOption IsNonCollidable);

Fields

This class does not have fields.

enum CardinalDir

enum CardinalDir
{
    North,
    East,
    South,
    West
}

enum BlockType

enum BlockType
{
    Flat,
    Frontier,
    Classic,
    Road,
    Clip,
    Slope,
    Pylon,
    RectAsym
}

enum WaypointType

enum WaypointType
{
    Start,
    Finish,
    Checkpoint,
    None,
    StartFinish
}

class GameBlock

The GameBlock class represents a single block placed on the map.

Methods

string get_id() const property; // or `block.id`

Returns the identifier of the block, for example: StadiumCirucitBase


string get_collection() const property; // or `block.collection`

Returns the collection of the block, for example: Stadium


string get_author() const property; // or `block.author`

Returns the author of the block, for example: Nadeo


GameBlockState@ const getBlockState();
const GameBlockState@ const getBlockState() const;

This property returns a GameBlockState instance that allows the user to manipulate the block during the race.


const BlockSettings@ const get_blockSettings() const property; // or `block.blockSettings`

This property returns a BlockSettings instance representing TMUnlimiter specific features set for the block before it was placed on the map. If the block has no TMUnlimiter specific features set, then this property returns null.

Fields

const BlockType blockType;

The BlockType of the placed block.


const WaypointType waypointType;

The WaypointType of the placed block.


const Nat3 coord;

The placement coordinates of the placed block.


const CardinalDir direction;

The cardinal direction of the placed block.

class ParameterSet

ParameterSet

Methods

string get_name() const property;

Fields

This class does not have fields.

class TriggerGroup

TriggerGroup

Methods

string get_name() const property;

Fields

This class does not have fields.

class GameChallenge

The GameChallenge class represents a challenge (also known as a track or map) that is being played on.

Methods

string get_challengeId() const property; // or `challenge.challengeId`

This property returns the identifier of the challenge, for example: BeySZdnfuSh4nHY5xztiXLmlrXe


string get_challengeCollection() const property; // or `challenge.challengeCollection`

This property returns the collection of the challenge, for example: Stadium


string get_challengeAuthor() const property; // or `challenge.challengeAuthor`

This property returns the author of the challenge, for example: Nadeo


string get_decorationId() const property; // or `challenge.decorationId`

This property returns the identifier of the decoration in the challenge, for example: Day


string get_decorationCollection() const property; // or `challenge.decorationCollection`

This property returns the collection of the decoration in the challenge, for example: Stadium


string get_decorationAuthor() const property; // or `challenge.decorationAuthor`

This property returns the author of the decoration in the challenge, for example: Nadeo


string get_vehicleId() const property; // or `challenge.vehicleId`

This property returns the identifier of the vehicle in the challenge, for example: StadiumCar


string get_vehicleCollection() const property; // or `challenge.vehicleCollection`

This property returns the collection of the vehicle in the challenge, for example: Vehicles


string get_vehicleAuthor() const property; // or `challenge.vehicleAuthor`

This property returns the author of the vehicle in the challenge, for example: Nadeo


const BlockGroup@ const getBlockGroup(const string&in blockGroupName) const;

This method returns a BlockGroup instance representing the block group. If the block group with the given blockGroupName does not exist, the method returns null.


const ParameterSet@ const getParameterSet(const string&in parameterSetName) const;

This method returns a ParameterSet instance representing the parameter set. If the parameter set with the given parameterSetName does not exist, the method returns null.


const TriggerGroup@ const getTriggerGroup(const string&in triggerGroupName) const;

This method returns a TriggerGroup instance representing the trigger group. If the trigger group with the given triggerGroupName does not exist, the method returns null.

Fields

const array<GameBlock@ const> blocks;

The array of blocks placed on this challenge. Blocks are not guaranteed to be in the same place within the array due to challenge modifications or challenge reloads.


const Nat3 size;

The size of the build area on this challenge.


const string name;

The name of the challenge.


Note

Available from TMUnlimiter 2.1 track version

const string comments

The comments to the challenge.


MediaTrackerClip@ const introClip;

The MediaTrackerClip instance of the intro clip sequence. This field is null if no intro clip sequence has been created.


MediaTrackerClip@ const globalClip;

The MediaTrackerClip instance of the global clip sequence. This field is null if no global clip sequence has been created.


MediaTrackerClipGroup@ const inGameClipGroup;

The MediaTrackerClipGroup instance of the in-game clip sequence. This field is null if no in-game clip sequence has been created.


MediaTrackerClipGroup@ const endRaceClipGroup;

The MediaTrackerClipGroup instance of the outro clip sequence. This field is null if no outro clip sequence has been created.

class HmsStateDyna

HmsStateDyna

Methods

This class does not have methods.

Fields

Quat rotation;
Vec3 location;
Vec3 linearSpeed;
Vec3 addLinearSpeed;
Vec3 angularSpeed;
Vec3 force;
Vec3 torque;
Vec3 inverseInertiaTensor;
Vec3 notTweakedLinearSpeed;

class HmsDyna

HmsDyna

Methods

This class does not have methods.

Fields

bool hasAngularVelocityLimit;
float angularVelocityLimit;
HmsStateDyna previousState;
HmsStateDyna currentState;
HmsStateDyna tempState;
array<Vec3> replacements;
bool hasReplacement;

enum PlugSurfaceMaterialId

enum PlugSurfaceMaterialId
{
    Concrete,
    Pavement,
    Grass,
    Ice,
    Metal,
    Sand,
    Dirt,
    Turbo,
    DirtRoad,
    Rubber,
    SlidingRubber,
    Test,
    Rock,
    Water,
    Wood,
    Danger,
    Asphalt,
    WetDirtRoad,
    WetAsphalt,
    WetPavement,
    WetGrass,
    Snow,
    ResonantMetal,
    GolfBall,
    GolfWall,
    GolfGround,
    Turbo2,
    Bumper,
    NotCollidable,
    FreeWheeling,
    TurboRoulette
}

enum VehicleCarTuning::ShockModel

enum ShockModel
{
    Demo01,
    Demo02,
    Demo03
}

enum VehicleCarTuning::SteerModel

enum SteerModel
{
    Steer01,
    Steer02,
    Steer03,
    Steer04,
    Steer05,
    Steer06
}

class VehicleCarTuning

VehicleCarTuning

Methods

string get_name() const property;
float get_steerSlowDownCoef() const property;
void set_steerSlowDownCoef(float steerSlowDownCoef) property;
uint get_steerSlowDownFadeInDuration() const property;
void set_steerSlowDownFadeInDuration(uint steerSlowDownFadeInDuration) property;
uint get_steerSlowDownFadeOutDuration() const property;
void set_steerSlowDownFadeOutDuration(uint steerSlowDownFadeOutDuration) property;
float get_mass() const property;
void set_mass(float mass) property;
float get_inertiaMass() const property;
void set_inertiaMass(float inertiaMass) property;
Vec3 getInertiaHalfDiag() const;
void setInertiaHalfDiag(const Vec3&in inertiaHalfDiag);
float get_cmAftFore() const property;
void set_cmAftFore(float cmAftFore) property;
float get_cmDownUp() const property;
void set_cmDownUp(float cmDownUp) property;
float get_maxDistPerStep() const property;
void set_maxDistPerStep(float maxDistPerStep) property;
PlugSurfaceMaterialId get_tireMaterial() const property;
void set_tireMaterial(PlugSurfaceMaterialId tireMaterial) property;
float get_m6MaxRpm() const property;
void set_m6MaxRpm(float m6MaxRpm) property;

Fields

float field_0x18;
float field_0x1c;
float field_0x20;
FuncKeysReal@ waterSplashFromSpeed;
float field_0x28;
float maxSpeed;
float reverseMaxSpeed;
FuncKeysReal@ accelCurve;
float field_0x38;
float field_0x3c;
float brakeBase;
float brakeCoef;
float brakeMax;
float brakeMaxDynamic;
float field_0x50;
float field_0x54;
float groundSlowDownBase;
float groundSlowDownCoef;
float limitToMaxSpeedForce;
float slopeSpeedGainLimit;
FuncKeysReal@ lateralContactSlowDown;
float steerRadiusMin;
float steerRadiusCoef;
float steerLowSpeed;
FuncKeysReal@ steerSlowDown;
bool noSteerSlowDownWhenSlipping;
uint m5KeepNoSteerSlowDownWhenSlippingDuration;
uint steerDurationBeforeSteerSlowDown;
float steerSpeed;
float steerGroundTorque;
float steerGroundTorqueSlippingCoef;
FuncKeysReal@ steerDriveTorque;
float sideFriction1;
float sideFriction2;
FuncKeysReal@ maxSideFriction;
float maxSideFrictionSliding;
float maxSideFrictionBlendCoef;
FuncKeysReal@ rolloverLateral;
FuncKeysReal@ rolloverLateralFromAngle;
float rolloverAxial;
float steerAngleMax;
float slipAngleForceMax;
float slipAngleForceCoef1;
float slipAngleForceCoef2;
float lateralSlopeAdherenceMin;
float lateralSlopeAdherenceMax;
float axialSlopeAdherenceMin;
float axialSlopeAdherenceMax;
float steerMaxBlend;
float angularSpeedYImpulseBlend;
float angularSpeedImpulseScale;
float turboBoost;
float turbo2Boost;
uint turboDuration;
uint turbo2Duration;
float rubberBallElasticity;
float jumpImpulseVal;
float glidingGravityCoef;
uint gearCount;
uint minGear;
float absorbingValKi;
float absorbingValKa;
float absorbingValMin;
float absorbingValMax;
float absorbingValRest;
float debugAbsorbCoef;
float relSpeedMultCoef;
float angularSpeedClamp;
float linearSpeed2PositiveDeltaMax;
float linearFluidFrictionCoef;
float angularFluidFrictionCoef1;
float angularFluidFrictionCoef2;
float gravityCoef;
float gravityCoefAir;
float bodyFrictionCoef_Concrete;
float bodyFrictionCoef_Metal;
float bodyRestCoef_Metal;
float bodyRestCoef_Concrete;
float wheelFrictionCoef_Concrete;
float wheelRestCoef_Concrete;
float wheelFrictionCoef_Metal;
float wheelRestCoef_Metal;
bool isFakeEngine;
float absorbTension;
float twistAngle;
float m4SteerTorqueCoef;
float m4LateralFrictionTorque;
float m4LateralFrictionSquareTorque;
float m4LateralFrictionForce;
float m4LateralFrictionSquareForce;
float m4LeaveSplippingSpeed;
FuncKeysReal@ m4SteerRadiusFromSpeed;
float steerRadiusWhenSlippingCoef;
FuncKeysReal@ m4MaxFrictionForceFromSpeed;
float maxFrictionForceWhenSlippingCoef;
FuncKeysReal@ m4MaxFrictionTorqueFromSpeed;
float maxFrictionTorqueWhenSlippingCoef;
float m4SlipAngleSpeed;
float m4SteerRadiusCoefFromSlipAngle;
float m4AccelFromSlipAngle;
float field_0x1d8;
float m4SteerAngleWhenSlippingMax;
FuncKeysReal@ m5SlippingAccelCurve;
float m5SlippingAccelCurveCoef;
uint m5LateralContactSlowDownDuration;
FuncKeysReal@ m5SteerCoefFromSpeed;
FuncKeysReal@ m5SmoothInputSteerDurationFromSpeed;
float m5MaxAxialRolloverTorque;
uint m5KeepSlidingAccelDurarion;
uint m5KeepSteerSlowDownDurarion;
float m5AccelSlipCoefMax;
float waterGravity;
float waterReboundMinHSpeed;
float waterBumpMinSpeed;
FuncKeysReal@ waterReboundFromSpeedRatio;
FuncKeysReal@ waterBumpSlowDownFromSpeedRatio;
FuncKeysReal@ waterFrictionFromSpeed;
float waterAngularFriction;
float waterAngularFrictionSq;
FuncKeysReal@ modulationFromWheelCompression;
float m6InertialMass;
float m6MaxDiffBtwnPropulsionAndSpeed;
FuncKeysReal@ accelCurveRearGear;
float m6ForceEpsilon;
float m6InertialTorqueModulationX;
float m6InertialTorqueModulationZ;
float m6BrakeModulationWhenSlipping;
float m6FrictionModulationWhenSlipNBrake;
float m6BrakeMaxRear;
float m6BrakeMaxDynamicRear;
FuncKeysReal@ m6RolloverLateralFromSpeedRatio;
float m6MaxSpeed4Burnout;
float m6MinSpeed4Burnout;
FuncKeysReal@ m6BurnoutRadius;
FuncKeysReal@ m6BurnoutLateralSpeed;
float m6BurnoutLateralSpeedCoeff;
float m6BurnoutSteerCoeff;
float m6BurnoutSteerCoeff2;
float m6BurnoutSteerCoeff3;
float m6BurnoutSteerCoeff4;
float m6BurnoutCenterForceCoeff;
float m6BurnoutCenterForceCoeff2;
float m6BurnoutRadiusMax;
float m6BurnoutLateralSpeedMax;
FuncKeysReal@ m6DonutRolloverFromSpeed;
float m6MaxDiffBtwGroundNormal;
float m6MaxPosAngle4Burnout;
float m6MaxNegAngle4Burnout;
uint m6BurnoutDuration;
float m6BurnoutAccMod;
float m6BurnoutFricMod;
FuncKeysReal@ m6BurnoutRolloverFromSpeed;
uint m6AfterBurnoutDuration;
float m6AfterBurnoutAccMod;
float m6BurnoutSmokeIntensity;
float m6BurnoutSmokeVelocity;
float m6AfterBurnoutImpulse;
float m6BurnoutWheelAngularRotation;
float m6BrakeSmokeIntensity;
array<float> gearRatio;
array<float> m6maxRPM;
array<float> m6minRPM;
float m6BurnoutRpmAcc;
float m6AirRpmAcc;
float m6AirRpmDeadening;
array<float> rpmWantedOnGearUp;
array<float> rpmDelta;
array<float> rpmComputedOnGearDown;
float m6RpmLossCoefOnGearUp;
float m6RpmGainCoefOnGearDown;
float m6RpmGainOnTakeOff;
float m6RpmLossOnTakeOffFinished;
float m6SpeedLimitPositiveForTakeOffFront;
float m6SpeedLimitNegForTakeOffFront;
float m6SpeedLimitPositiveForTakeOffRear;
float m6SpeedLimitNegForTakeOffRear;
float field_0x33c;
float field_0x340;
float field_0x344;
float field_0x348;
float field_0x34c;
VehicleCarTuning::ShockModel shockModel;
VehicleCarTuning::SteerModel steerModel;
uint field_0x358;
float field_0x35c;
float field_0x360;
uint airControlDuration;
float maxAngularSpeedYAirControl;
FuncKeysReal@ airControlZCoefFromAngularSpeed;
FuncKeysReal@ visualSteerAngleFromSpeed;
float vibrationPeriodSpeedCoef;
FuncKeysReal@ brakeHeatSpeedFromFBrake;
float field_0x384;
float soundEngineVolume;
float soundSkidConcreteVolume;
float soundSkidSandVolume;
float soundImpactVolume;
float field_0x398;
float field_0x39c;
float field_0x3a0;
float field_0x3a4;
float field_0x3a8;

class VehicleCarTunings

VehicleCarTunings

Methods

uint getTuningCount() const;
uint getCurrentTuningIndex() const;
VehicleCarTuning@ const getTuningFromIndex(uint tuningIndex);
const VehicleCarTuning@ const getTuningFromIndex(uint tuningIndex) const;
void setCurrentTuningIndex(uint tuningIndex);

Fields

This class does not have fields.

class VehicleCar::SimulationWheel::RealTimeState

VehicleCar::SimulationWheel::RealTimeState

Methods

This class does not have methods.

Fields

const float damperAbsorbVal;
const float damperRelativeSpeed;
const float damperAbsorbedContact;
const Vec3 contactRelativeLocalDistance;
const float wheelRotationAngularSpeed;
const bool hasGroundContact;
const PlugSurfaceMaterialId contactMaterialId;
const bool isSliding;
const Vec3 relativeRotZAxis;
const int groundContactsCount;
const Vec3 wheelGroundContactSurfaceNormalSum;
const float wheelRotationAngle;
const float visualSteerAngle;

class VehicleCar::SimulationWheel::State

VehicleCar::SimulationWheel::State

Methods

This class does not have methods.

Fields

const float damperAbsorbVal;
const float wheelRotationAngle;
const float wheelAngle;
const PlugSurfaceMaterialId contactMaterialId;
const bool hasContact;
const bool isSliding;
const Vec3 groundContactPos;
const bool hasLateralContact;
const Vec3 lateralContactRelativeLocalDistance;

class VehicleCar::SimulationWheel

VehicleCar::SimulationWheel

Methods

This class does not have methods.

Fields

const bool steerable;
const float radius;
const Iso4 initialRestLocation;
const Iso4 location;
const Vec3 offsetFromVehicle;
const VehicleCar::SimulationWheel::RealTimeState realTimeState;
const bool hasLateralContact;
const Vec3 lateralContactRelativeLocalDistance;
const VehicleCar::SimulationWheel::State prevSyncWheelState;
const VehicleCar::SimulationWheel::State syncWheelState;
const VehicleCar::SimulationWheel::State prevAsyncWheelState;
const VehicleCar::SimulationWheel::State asyncWheelState;

class VehicleCar::VehicleCarState

VehicleCar::VehicleCarState

Methods

This class does not have methods.

Fields

const float speedForward;
const float speedSideward;
const float inputSteer;
const float inputGas;
const float inputBrake;
const bool isTurbo;
const float turboStrength;
const bool burnoutActive;
const float brakeHeat;
const float headPosForwards;
const float headPosSideways;
const Iso4 worldLocation;
const Vec3 worldSpeed;
const float rpm;
const bool hasAnyContact;
const VehicleCar::GearboxState gearboxState;
const bool hasAnyWheelContact;
const bool hasAnyBodyContact;

class VehicleCar::Engine

VehicleCar::Engine

Methods

This class does not have methods.

Fields

const float maxRpm;
const float engineBrakeFeedBackCoef;
const float engineGroundFeedBackCoef;
const float engineFrictionCoef;
const float idleRPM;
const float curRPM;
const float engineAccelerationCoef;
const float timeUntilGearChangeIsFinished;
const bool reverseGear;
const int curGear;

class VehicleMaterial

VehicleMaterial

Methods

PlugSurfaceMaterialId get_materialId() const property;

Fields

float maxSpeedCoef;
float accelerationCoef;
float brakeCoef;
float grip;
float vibrationSpeedCoef;
float vibrationMax;
float field_0x38;
float field_0x3c;
float field_0x40;

enum VehicleCar::GearboxState

enum GearboxState
{
    Normal,
    Idle,
    TakeOffFront,
    TakeOffRear,
    Burnout
}

enum VehicleCar::BurnoutState

enum BurnoutState
{
    None,
    Burnout,
    Donut,
    AfterBurnout
}

enum VehicleCar::TurboType

enum TurboType
{
    None,
    Normal,
    Roulette
}

class VehicleCar

VehicleCar

Methods

void block();
void unblock();
HmsDyna@ const get_hmsDyna() property;
const HmsDyna@ const get_hmsDyna() const property;
VehicleCarTunings@ const get_carTunings() property;
const VehicleCarTunings@ const get_carTunings() const property;
const VehicleCarTunings@ const get_carTuningsModel() const property;
uint getWheelCount() const;
const VehicleCar::SimulationWheel@ const getWheel(uint wheelIndex) const;
uint getVehicleMaterialCount() const;
VehicleMaterial@ const getVehicleMaterial(uint vehicleMaterialIndex) const;

Fields

const array<uint> vehicleMaterialsRemap;
const bool isUpdateAsync;
const float inputGas;
const float inputBrake;
const float inputSteer;
bool isLightTrailsSet;
const bool isNetworked;
const int quality;
float maxLinearSpeed;
const int gearboxState;
const VehicleCar::VehicleCarState prevSyncVehicleState;
const VehicleCar::VehicleCarState syncVehicleState;
const VehicleCar::VehicleCarState asyncVehicleState;
const VehicleCar::VehicleCarState prevAsyncVehicleState;
const VehicleCar::Engine carEngine;
const bool hasAnyContact;
const bool hasAnyBodyContact;
const bool hasAnyLateralContact;
const uint lastHasAnyLateralContactTime;
const bool isUnderWater;
const bool waterForcesApplied;
const float turningRate;
const float turboBoostFactor;
const uint lastTurboTypeChangeTime;
const uint lastTurboTime;
const VehicleCar::TurboType turboType;
const float rouletteValue01;
bool isFreeWheeling;
const bool isSliding;
const uint wheelContactAbsorbCounter;
const VehicleCar::BurnoutState burnoutState;
const Vec3 currentLocalSpeed;
const Vec3 totalCentralForceAdded;
const bool isRubberBall;

class TrackManiaLocalPlayer

TrackManiaLocalPlayer

Methods

const string get_login() const property;
const string get_language() const property;
bool transform(const string&in vehicleId);
void respawn();
void giveUp();
void triggerWaypointBlock(const GameBlock@ const block);
void scaleVehicle(const Vec3&in scale);
void setSpawnLocRotation(const Quat&in rotation);
void setSpawnLocPosition(const Vec3&in rotation);
void setRespawnLocRotation(const Quat&in rotation);
void setRespawnLocPosition(const Vec3&in rotation);
VehicleCar@ const get_vehicleCar() property;
const VehicleCar@ const get_vehicleCar() const property;
Vec3 getVehicleScale() const;
Vec3 getVehicleBBoxCenter() const;
Vec3 getVehicleBBoxHalfDiag() const;
string getCurrentVehicleId() const;

Fields

const string name;
const string description;
const uint8 id;
const Vec3 lightTrailsColor;
const uint team;
const uint prevRaceTime;
const uint raceBestTime;
const uint lapTime;
const uint lapBestTime;
const uint stuntsScore;
const uint bestStuntsScore;
const uint curCheckpoint;
const float averageRank;
const uint currentRaceRank;
const uint currentRoundRank;
const TrackManiaPlayer::RaceState raceState;
const bool readyToGoNext;
const uint tmRoundNum;
const float offsetFromBestAtCurrentCP;
const uint curCheckpointCount;
const uint curLap;
const array<TrackManiaPlayer::CheckPointTimeScore> checkpointTimeScores;
const array<TrackManiaPlayer::CheckPointTimeScore> bestCheckpointTimeScores;
const bool wishSpectator;
const bool forcedSpectator;
const uint spectatorCount;
const TrackManiaPlayer::SpectatorMode spectatorMode;
const uint respawnCount;
const Iso4 spawnLoc;
const Iso4 respawnLoc;
const int raceTime;
const uint raceStartTime;
const uint lapStartTime;
const uint minRespawns;
const uint nbCompleted;
const uint maxCompleted;
const bool isCurCheckpointRespawnable;
const uint currentTime;
const uint curLapCheckpointCount;
const bool raceFinished;
const uint displaySpeed;
const bool finishNotPassed;
const uint countdownTime;

enum TrackManiaPlayer::SpectatorMode

enum SpectatorMode
{
    Void,
    Watcher,
    LocalWatcher,
    Target
}

enum TrackManiaPlayer::RaceState

enum RaceState
{
    BeforeStart,
    Running,
    Finished,
    Eliminated
}

class TrackManiaPlayer::CheckPointTimeScore

TrackManiaPlayer::CheckPointTimeScore

Methods

CheckPointTimeScore();

Fields

uint time;
uint score;

class TrackManiaPlayer

TrackManiaPlayer

Methods

const string get_login() const property;
const string get_language() const property;
bool isLocalPlayer() const;
Iso4 getVehicleLocation() const;
TrackManiaLocalPlayer@ const getLocalPlayer();
const TrackManiaLocalPlayer@ const getLocalPlayer() const;

Fields

const string name;
const string description;
const uint8 id;
const Vec3 lightTrailsColor;
const uint team;
const uint prevRaceTime;
const uint raceBestTime;
const uint lapTime;
const uint lapBestTime;
const uint stuntsScore;
const uint bestStuntsScore;
const uint curCheckpoint;
const float averageRank;
const uint currentRaceRank;
const uint currentRoundRank;
const TrackManiaPlayer::RaceState raceState;
const bool readyToGoNext;
const uint tmRoundNum;
const float offsetFromBestAtCurrentCP;
const uint curCheckpointCount;
const uint curLap;
const array<TrackManiaPlayer::CheckPointTimeScore> checkpointTimeScores;
const array<TrackManiaPlayer::CheckPointTimeScore> bestCheckpointTimeScores;
const bool wishSpectator;
const bool forcedSpectator;
const uint spectatorCount;
const TrackManiaPlayer::SpectatorMode spectatorMode;

class PickerGame

PickerGame

Methods

GameBlock@ getBlock() const;
TrackManiaPlayer@ getPlayer() const;

Fields

bool isPickEnabled;
const Vec2 inputPos;
const Vec3 pickPos;
const Vec3 pickNormal;
const float pickDistance;

class PickerCustom

PickerCustom

Methods

void pick();
GameBlock@ getBlock() const;
TrackManiaPlayer@ getPlayer() const;
GameCamVal getCamVal() const;
void setCamVal(const GameCamVal&in camVal);

Fields

Vec2 inputPos;
const Vec3 pickPos;
const Vec3 pickNormal;
const float pickDistance;

class TrackManiaRaceNet

TrackManiaRaceNet

Methods

TrackManiaLocalPlayer@ const getPlayingPlayer() const;
bool isGameWindowFocused() const;
bool isGameWindowMinimized() const;
bool getIsCursorVisible() const;
void setIsCursorVisible(bool isCursorVisible);
Vec2 getCursorPos() const;
void setCursorPos(const Vec2&in cursorPos);
void setCursorPosX(float cursorPosX);
void setCursorPosY(float cursorPosY);
void executeParameterSet(const ParameterSet@ parameterSet);
Vec3 getGravityForce() const;
void setGravityForce(const Vec3&in gravityForce);
PickerGame@ getPlayerCameraPicker() const;
PickerCustom@ getCustomCameraPicker() const;
void sendTunnelMessage(const WritableStream&in writeStream);

Fields

GameChallenge@ const challenge;
MediaTrackerClipPlayer@ const inGameClipPlayer;
MediaTrackerClipPlayer@ const globalClipPlayer;
const array<TrackManiaPlayer@ const> players;

class TrackManiaRace

TrackManiaRace

Methods

TrackManiaLocalPlayer@ const getPlayingPlayer() const;
bool isGameWindowFocused() const;
bool isGameWindowMinimized() const;
bool getIsCursorVisible() const;
void setIsCursorVisible(bool isCursorVisible);
Vec2 getCursorPos() const;
void setCursorPos(const Vec2&in cursorPos);
void setCursorPosX(float cursorPosX);
void setCursorPosY(float cursorPosY);
void executeParameterSet(const ParameterSet@ parameterSet);
Vec3 getGravityForce() const;
void setGravityForce(const Vec3&in gravityForce);
PickerGame@ getPlayerCameraPicker() const;
PickerCustom@ getCustomCameraPicker() const;
bool isNetworkRace() const;
TrackManiaRaceNet@ getNetworkRace() const;

Fields

GameChallenge@ const challenge;
MediaTrackerClipPlayer@ const inGameClipPlayer;
MediaTrackerClipPlayer@ const globalClipPlayer;

class BindInputEvent

BindInputEvent

Methods

string getBindName() const;
bool isCancelable() const;
bool isAnalogType() const;
bool getEnabled() const;
float getAnalog() const;

Fields

This class does not have fields.

enum VehicleInputEvent::InputType

enum InputType
{
    None,
    Down,
    Up,
    Left,
    Right,
    Steer,
    Gas
}

class VehicleInputEvent

VehicleInputEvent

Methods

VehicleInputEvent::InputType getInputType() const;
bool isAnalogType() const;
bool getEnabled() const;
float getAnalog() const;
void setEnabled(bool value);
void setAnalog(float value);

Fields

This class does not have fields.

enum PhysicalContact::ContactObjectType

enum ContactObjectType
{
    Unknown,
    Block,
    Player
}

class PhysicalContact

PhysicalContact

Methods

string getObjectContactTreeId() const;
string getVehicleContactTreeId() const;
PhysicalContact::ContactObjectType getContactObjectType() const;
uint getVehicleContactPart() const;
GameBlock@ const getBlock() const;
const TrackManiaPlayer@ const getPlayer() const;

Fields

PlugSurfaceMaterialId materialId;
Vec3 contactSurfaceNormal;
Vec3 contactRelativeLocalDistance;
Vec3 contactRelativeLocalLinearSpeed;
Vec3 localReplacement;
bool applyForces;
PlugSurfaceMaterialId contactMaterialId;

class Console

Console

Methods

void info(const string&in message) const;
void warn(const string&in message) const;
void error(const string&in message) const;

Fields

This class does not have fields.

namespace Math

Functions

int abs(int i);
float abs(float f);
float sin(float f);
float asin(float f);
float cos(float f);
float acos(float f);
float tan(float f);
float atan(float f);
float atan2(float y, float x);
float exp(float f);
float pow(float x, float y);
float sqrt(float f);
float log(float f);
float log2(float f);
float log10(float f);
float floor(float f);
float ceil(float f);
float round(float f);
int min(int x, int y);
uint min(uint x, uint y);
float min(float x, float y);
double min(double x, double y);
int max(int x, int y);
uint max(uint x, uint y);
float max(float x, float y);
double max(double x, double y);
int clamp(int value, int min, int max);
uint clamp(uint value, uint min, uint max);
float clamp(float value, float min, float max);
double clamp(double value, double min, double max);
bool isNaN(float x);
bool isInfinite(float x);
uint rand(uint min, uint max);
float rand(float min, float max);
float degToRad(float deg);
float radToDeg(float rad);

Fields

/* PI number */
double PI;
/* The lower maximum value for the ``int`` type */
int INT32_MIN;
/* The upper maximum value for the ``int`` type */
int INT32_MAX;
/* The lower maxiumum value for the ``int64`` type */
int64 INT64_MIN;
/* The upper maximum value for the ``int64`` type */
int64 INT64_MAX;
/* The maximum value for the ``uint`` type */
uint UINT32_MAX;
/* The maximum value for the ``uint64`` type */
uint64 UINT64_MAX;

Clone this wiki locally