Skip to content

xray16/lib

Enumerations

EnumerationDescription
EConfigClassIdEnumeration of class identifiers used in LTX configurations linking.
EGameDifficultyEnum with number representation of game difficulties.
EGameObjectClassC++ declared class identifiers from client side. Matches class names in C++ counterpart.
EGameTypePossible game types supported by engine.
EScriptClassIdScript class IDs for linking of serve-client side implementation. Later can be got from game object.

Functions

FunctionDescription
abortPrint the current stack and raise a formatted Lua error.
addVectorsAdd two vectors.
angleDiffCalculate the absolute angle difference between two vectors.
angleToDirectionConvert an angle vector to a normalized direction vector.
areSame2dVectorsCheck whether two 2D vectors have exactly equal coordinates.
areSameVectorsCheck whether two 3D vectors have exactly equal coordinates.
areSameVectorsByPrecisionCheck whether two 3D vectors are equal within a tolerance.
assertAssertion function to ensure provided condition is truthy. Raises a formatted error when the condition is falsy.
assertDefinedAssertion function to ensure provided value is not nil.
assertNonEmptyStringAssertion function to ensure provided value is a non-empty string.
betweenGet math random between provided boundaries. Works with floating point numbers in contrast to default math.random lua library.
callstackPrint callstack for debugging purposes.
chanceGet math random based chance to happen by base of provided parameter. By default, calculates 'rate' of 100.
clampClamp a number to inclusive bounds.
containsSubstringCheck whether a string contains a case-insensitive Lua pattern.
copyVectorCopy a vector.
create2dVectorCreate a 2D vector.
createArtefactClassIds-
createClassIdsCreate and synchronize list of class identifiers in game engine. Used to synchronize dynamic identifiers lists for further checks against game objects.
createEmpty2dVectorCreate a 2D vector with all coordinates set to zero.
createEmptyVectorCreate a 3D vector with all coordinates set to zero.
createMonsterClassIds-
createStalkerClassIds-
createTimeCreate and initialize an X-Ray CTime value.
createVectorCreate a 3D vector.
createWeaponClassIds-
decamelizeConvert camelCase or PascalCase text to separated lowercase text.
degreeToRadianConvert degrees to radians.
deserializeTime-
distanceBetween2dCalculate distance between two vectors on the XZ plane.
executeConsoleCommandExecute console command and concatenate provided parameters for propagation.
externDeclare a global variable and extern it for game engine usage. Declared values can be found in _G / global Lua scope.
gameTimeToString-
getConsoleFloatCommandExecute command to get floating point number value.
getDistanceBetweenGet distance for objects based on game vectors.
getDistanceBetweenSqrGet squared distance for objects based on game vectors.
getExternGet a Lua global / externed value.
getObjectPositioning-
getPatrolFlag-
globalTimeToString-
graphDistanceGet graph distance between two vertices.
graphDistanceSqrGet squared graph distance between two vertices.
hoursToWeatherPeriodTransform hour to weather period section label.
isDistanceBetweenObjectsGreaterOrEqualCheck distance between objects.
isDistanceBetweenObjectsLessOrEqualCheck distance between objects.
isGameVertexFromLevelCheck whether a game vertex belongs to a level.
isInTimeIntervalCheck whether current time interval is between desired values.
isObjectAtTerminalWaypointCheck if object standing on terminal patrol waypoint. Verifies that object is on one of terminal waypoints.
isObjectAtWaypoint-
isObjectInZoneCheck whether object is inside another zone object.
isValidAccessibleVertexCheck whether an object can access a game vertex.
isWideScreenCheck whether the game is in wide-screen mode right now.
pickRandomPick one of parameters.
radianToDegreeConvert radians to degrees.
rangeCreate a numeric range.
readTimeFromPacketRead time object from net packet.
roundRound a number to the nearest integer.
roundWithPrecisionRound a number to a decimal precision.
serializeTime-
setCurrentTimeSet current time in level. Creates idle state with multiplied time factor.
setObjectLookAtAnotherObjectPoint one object's sight direction at another object's current position.
subVectorsSubtract one vector from another.
toLogValue-
toTimeDigitAdd part of time digit to a data string.
updateClassIdsSynchronize and update current class identifiers list.
vectorCrossCalculate the cross product of two vectors.
vectorRotateYRotate a vector around the Y axis.
vectorToStringConvert a vector to the engine debug string format.
waitLock script execution based on real time.
waitGameLock script execution based on game time.
writeTimeToPacketSave time object into net packet.
yawCalculate the yaw angle between two vectors on the XZ plane.
yawDegreeCalculate the yaw angle between two vectors on the XZ plane.
yawDegree3dCalculate the angle between two vectors in 3D space.

Interfaces

InterfaceDescription
IClassIdsGroupedDefinition of grouped class IDs used in the xray engine for object checks / comparison.
IConstructorConstructor signature for a value of type T.

Type Aliases

Type AliasDescription
AnyArgsAny list of arguments.
AnyCallableAny callable without a this context.
AnyCallablesModuleModule of callables keyed by name.
AnyContextualCallableAny callable with a bound this context.
AnyObjectAny object from JS record variant.
LuaArrayLua array table indexed by number.
NillablePossible nil value in lua, both null and undefined in TS.
NullablePossible null value.
PartialRecordRecord partial to support enum implementations with subsets of available keys.
StringNillableType-casted option that extends type with "nil" values.
TCoordinateCoordinate value.
TCountCount of items.
TDirectionDirection value.
TDistanceDistance value.
TDurationDuration in milliseconds.
TGameClassIdType definition of possible game class ID string.
TGameDifficultiesDefinition of all difficulties' config.
TGameDifficultyPossible game difficulty type definition.
TIndexCollection index.
TLabelHuman-readable label / caption.
TNameNamed entity, section or key.
TNotCastedBooleanEngine-style boolean expressed as 0 / 1.
TNumberIdNumeric identifier.
TPathFilesystem or resource path.
TProbabilityProbability value.
TRateRate / ratio value.
TSectionConfiguration section name.
TSizeSize value.
TStringIdString-based identifier.
TStringifiedBooleanBoolean serialized to a string.
TStringifiedNilnil serialized to a string.
TTimestampUnix-like timestamp.

Variables

VariableDescription
ACTORConstant string for actor.
ACTOR_IDConstant representing actor ID.
DEFAULTConstant string for configuration default.
DEFAULT_SQUADConstant string for squad configuration default.
EMPTY_LUA_ARRAY-
EMPTY_LUA_TABLE-
FALSELua false string representation.
gameClassIdList of possible game type class IDs.
gameDifficultiesList of possible game difficulties.
gameDifficultiesByNumberMapping game difficulties with number-string pairs.
gameTypesList of available game modes based on bit masks.
MAX_ALIFE_IDMaximal alife object ID. Hardcoded to u16 max.
MAX_ALIFE_RANKMaximal alife object rank. Hardcoded to u16 max.
MAX_I16Maximum signed 16-bit integer.
MAX_I32Maximum signed 32-bit integer.
MAX_I8Maximum signed 8-bit integer.
MAX_LEVEL_VERTEX_IDMaximal level vertex ID. Hardcoded to u16 max.
MAX_U16Maximum unsigned 16-bit integer.
MAX_U32Maximum unsigned 32-bit integer.
MAX_U8Maximum unsigned 8-bit integer.
MIN_I32Minimum signed 32-bit integer.
MIN_I8Minimum signed 8-bit integer.
MX_VECTOR-
MY_VECTOR-
MZ_VECTOR-
NEVERNull stringified by lua.
NILLua nil string representation.
OFFConstant string for options / configurations.
ONConstant string for options / configurations.
ONE_VECTOR-
PI_DEGREERadians in one degree (PI / 180).
RADIANDegrees in one radian (180 / PI).
TRUELua true string representation.
X_VECTOR-
Y_VECTOR-
Z_VECTOR-
ZERO_VECTORShared immutable direction/axis vectors.