5 if (value)
return "true";
27 const int MAX = 2147483647;
28 const int MIN = -2147483648;
63 int l = len - str.
Length();
97 bool InRange(
int min,
int max,
bool inclusive_min =
true,
bool inclusive_max =
true )
99 if( ( !inclusive_min && value <= min ) || value < min )
102 if( ( !inclusive_max && value >= max ) || value > max )
111 const float MIN = FLT_MIN;
112 const float MAX = FLT_MAX;
241 float x = value[1] * v[2] - value[2] * v[1];
242 float y = value[2] * v[0] - value[0] * v[2];
243 float z = value[0] * v[1] - value[1] * v[0];
258 dir_vec[0] = p2[0] - p1[0];
259 dir_vec[1] = p2[1] - p1[1];
260 dir_vec[2] = p2[2] - p1[2];
307 return ((v1[0] * v2[0]) + (v1[1] * v2[1]) + (v1[2] * v2[2]));
322 for(
int i = 0; i < 3; i++) {
324 value[i] = value[i] - 360;
326 value[i] = value[i] + 360;
513 return (pos * cosAngle) + ((axis * pos) * sinAngle) + (axis *
vector.
Dot(axis, pos)) * (1 - cosAngle);
527 vector offsetPos = pos - point;
538 return Vector(arr[0], arr[1], arr[2]);
545 minTmp[0] =
Math.
Min(min[0],max[0]);
546 maxTmp[0] =
Math.
Max(min[0],max[0]);
547 minTmp[1] =
Math.
Min(min[1],max[1]);
548 maxTmp[1] =
Math.
Max(min[1],max[1]);
549 minTmp[2] =
Math.
Min(min[2],max[2]);
550 maxTmp[2] =
Math.
Max(min[2],max[2]);
600 int cnt = e.GetVariableCount();
603 for (
int i = 0; i < cnt; ++i)
605 if (e.GetVariableType(i) ==
int && e.GetVariableValue(null, i, val) && val == enumValue)
607 return e.GetVariableName(i);
617 string exact = enumType.EnumToString(enumType, value);
618 if (exact !=
"unknown")
624 string zeroName = enumType.EnumToString(enumType, 0);
625 if (zeroName !=
string.
Empty)
632 int remaining = value;
637 for (
int i = 0; i < 32 && remaining != 0; ++i)
640 if ((value & bit) != 0)
642 string name = enumType.EnumToString(enumType, bit);
643 if (
name !=
"unknown")
653 parts.Insert(
string.Format(
"0x%1", remaining.ToHex()));
655 if (parts.Count() == 0)
658 return string.Format(
"0x%1", value.ToHex());
661 return string.Join(
"|", parts);
672 int count = e.GetVariableCount();
675 for (
int i = 0; i < count; ++i)
677 if (e.GetVariableType(i) ==
int && e.GetVariableValue(null, i, value) && e.GetVariableName(i) == enumName)
701 return typename.EnumToString(e, enumValue);
706 return typename.EnumFlagsToString(enumType, enumValue);
717 return typename.StringToEnum(e, enumName);
728 return e.GetVariableCount();
740 e.GetVariableValue(null, idx, value);
753 e.GetVariableValue(null, e.GetVariableCount() - 1, lastValue);
PlayerSpawnPresetDiscreteItemSetSlotData name
one set for cargo
proto string ToHex()
Integer to hex (as string)
bool InRange(int min, int max, bool inclusive_min=true, bool inclusive_max=true)
Check whether integer falls into an inclusive range.
string ToStringLen(int len)
Integer to string with fixed length, padded with zeroes.
static string m_ZeroPad[ZERO_PAD_SIZE]
proto string AsciiToString()
Converts ASCII code to string.
Super root of all classes in Enforce script.
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
proto string ToString(bool simple=true)
proto void SetInstance(Class inst)
For internal usage of VM.
proto volatile Class Spawn()
Dynamic variant to 'new' keyword. It creates new instance of class.
static string EnumFlagsToString(typename enumType, int value)
proto owned string GetModule()
Get the name of the module the typename belongs to.
proto native GetVariableType(int vIdx)
proto native owned string GetVariableName(int vIdx)
proto native bool IsInherited(typename baseType)
Returns true when type is the same as 'baseType', or inherited one.
proto bool GetVariableValue(Class var, int vIdx, out void val)
proto native int GetVariableCount()
proto native owned string ToString()
Returns type name of variable as string.
static int StringToEnum(typename e, string enumName)
Return enum value from string name.
static string EnumToString(typename e, int enumValue)
Return string name of enum value.
proto vector InvMultiply4(vector mat[4])
Invert-transforms position.
proto vector Multiply3(vector mat[3])
Transforms vector.
static vector RandomDir()
Returns randomly generated unit vector.
vector GetRelAngles()
Returns relative angles between -180 and 180, not 0 to 360.
proto vector Normalized()
return normalized vector (keeps orginal vector untouched)
static proto native float DistanceSq(vector v1, vector v2)
Returns the square distance between tips of two 3D vectors.
proto native float Length()
Returns length of vector (magnitude)
static const vector Aside
proto vector Multiply4(vector mat[4])
Transforms position.
static vector RotateAroundZeroDeg(vector vec, vector axis, float angle)
Rotate a vector around 0,0,0 by an angle in degrees.
proto native float LengthSq()
Returns squared length (magnitudeSqr)
static vector ArrayToVec(float arr[])
Convert static array of floats into a vector.
static vector RotateAroundZeroRad(vector vec, vector axis, float angle)
Rotate a vector around 0,0,0 by an angle in radians.
static float Dot(vector v1, vector v2)
Returns Dot product of vector v1 and vector v2.
static const vector Forward
static vector RandomDir2D()
Returns randomly generated XZ unit vector with the Y(up) axis set to 0.
vector Cross(vector v)
Returns cross product of this vector with passed vector.
proto float Normalize()
Normalizes vector. Returns length.
static void SanitizeMinsMaxs(inout vector min, inout vector max)
Makes sure all values in MIN are lower than the MAX.
static vector Direction(vector p1, vector p2)
Returns direction vector from point p1 to point p2.
static vector RotateAroundZero(vector pos, vector axis, float cosAngle, float sinAngle)
Rotate a vector around 0,0,0.
proto void RotationMatrixFromAngles(out vector mat[3])
Creates rotation matrix from angles.
static vector RotateAroundPoint(vector point, vector pos, vector axis, float cosAngle, float sinAngle)
Rotate a vector around point.
proto vector InvMultiply3(vector mat[3])
Invert-transforms vector.
static proto native float Distance(vector v1, vector v2)
Returns the distance between tips of two 3D vectors.
proto string ToString(bool beautify=true)
Vector to string.
proto static native vector YawToVector(float yaw)
Returns vector of yaw.
proto float VectorToYaw()
Returns yaw of vector.
proto vector VectorToAngles()
Converts vector to spherical coordinates with radius = 1.
static proto native vector Lerp(vector v1, vector v2, float t)
Lerp between two vectors.
proto vector AnglesToVector()
Converts spherical coordinates (yaw, pitch, roll in degrees) to unit length vector.
vector Perpend()
Returns perpendicular vector. Perpendicular vector is computed as cross product between input vector ...
proto native vector Vector(float x, float y, float z)
Vector constructor from components.
static proto float Max(float x, float y)
Returns bigger of two given values.
static float RandomFloatInclusive(float min, float max)
Returns a random float number between and min [inclusive] and max [inclusive].
static proto float Min(float x, float y)
Returns smaller of two given values.
static proto float Cos(float angle)
Returns cosinus of angle in radians.
static proto float Sin(float angle)
Returns sinus of angle in radians.
static const float DEG2RAD
proto native int Length()
Returns length of string.
static proto string ToString(void var, bool type=false, bool name=false, bool quotes=true)
Return string representation of variable.