hammer

Classes

angelscript
api, strata, hammer

This page outlines the various Strata Hammer AngelScript classes. BoundBox # class BoundBox { void GetBoundsCenter(Vector&out center) const; bool ContainsPoint(const Vector&in point) const; void GetBoundsSize(Vector&out size) const; const Vector maxs; const Vector mins; } CMapClass # class CMapClass { } CMapGroup # class CMapGroup { CMapGroup@ CMapGroup(); void AddChild(CMapClass@ child); void CalcBounds(bool full); void GetBoundsSize(Vector&out size); void TransMove(const Vector&in delta); void TransRotate(const Vector&in refPoint, const QAngle&in angle); void TransScale(const Vector&in refPoint, const Vector&in scale); CMapClass@ opImplCast(); } CMapSolid # class CMapSolid { CMapSolid@ CMapSolid(); void AddFace(const CMapFace&in face); void InitializeTextureAxes(TextureAlignment align, uint initTexFlags); void CalcBounds(bool full); void GetBoundsSize(Vector&out size); void TransMove(const Vector&in delta); void TransRotate(const Vector&in refPoint, const QAngle&in angle); void TransScale(const Vector&in refPoint, const Vector&in scale); CMapClass@ opImplCast(); } Material # class Material { } Render # class Render { void BeginLocalTransfrom(const VMatrix&in, bool transform); void EndLocalTransfrom(); void SetTextColor(uint8 r, uint8 g, uint8 b, uint8 a); void SetDrawColor(uint8 r, uint8 g, uint8 b); void SetDrawColor(const Color&in color); void GetDrawColor(Color&out color); void BindMaterial(Material@ material); void PushRenderMode(RenderMode mode); void PopRenderMode(); void DrawLine(const Vector&in start, const Vector&in end); void DrawBoxExt(const Vector&in center, float extend, bool fill); void DrawPlane(const Vector&in p0, const Vector&in p1, const Vector&in p2, const Vector&in p3, bool fill); void RenderWireframeBox(const Vector&in mins, const Vector&in maxs, uint8 r, uint8 g, uint8 b); void RenderBox(const Vector&in mins, const Vector&in maxs, uint8 r, uint8 g, uint8 b); void RenderArrow(const Vector&in start, const Vector&in end, uint8 r, uint8 g, uint8 b); void RenderCone(const Vector&in base, const Vector&in tip, float radius, int slices, uint8 r, uint8 g, uint8 b); void RenderSphere(const Vector&in center, float radius, int theta, int phi, uint8 r, uint8 g, uint8 b); void RenderWireframeSphere(const Vector&in center, float radius, int theta, int phi, uint8 r, uint8 g, uint8 b); const bool lightingPreview; const float gridDistance; const float gridSize; const bool inLocalTransformMode; } ScriptSolid # interface ScriptSolid { GUIData[]@ GetGuiData() const; void GuiUpdated(const dictionary@ dict); CMapClass@ CreateMapSolid(const BoundBox@ box, TextureAlignment align); void DrawPreview(Render@ render, const BoundBox@ box); } array<class T> # class array<class T> { T[]@ array(int&in); T[]@ array(int&in, uint length); T[]@ array(int&in, uint length, const T&in value); T[]@ $list(int&in type, int&in list) { repeat T }; T& operator[](uint index); const T& operator[](uint index) const; T[]& operator=(const T[]&in); void insertAt(uint index, const T&in value); void insertAt(uint index, const T[]&inout arr); void insertLast(const T&in value); void removeAt(uint index); void removeLast(); void removeRange(uint start, uint count); uint length() const; void reserve(uint length); void resize(uint length); void sortAsc(); void sortAsc(uint startAt, uint count); void sortDesc(); void sortDesc(uint startAt, uint count); void reverse(); int find(const T&in value) const; int find(uint startAt, const T&in value) const; int findByRef(const T&in value) const; int findByRef(uint startAt, const T&in value) const; bool operator==(const T[]&in) const; bool isEmpty() const; void sort(array::less&in, uint startAt = 0, uint count = uint ( - 1 )); callback bool less(const T&in a, const T&in b); } dictionary # class dictionary { dictionary@ dictionary(); dictionary@ $list(int&in) { repeat { string, ? ...

Enums

angelscript
api, strata, hammer

This page outlines the various Strata Hammer AngelScript enums. GuiElement # enum GuiElement { Label = 0, TextBox = 1 << 0, Divider = 1 << 1 } InitTexFlags # enum InitTexFlags { INIT_TEXTURE_FORCE = 1, INIT_TEXTURE_AXES = 2, INIT_TEXTURE_ROTATION = 4, INIT_TEXTURE_SHIFT = 8, INIT_TEXTURE_SCALE = 16, INIT_TEXTURE_ALL = 30 } PrimitiveType # enum PrimitiveType { MATERIAL_LINES = 1, MATERIAL_TRIANGLES = 2, MATERIAL_LINE_LOOP = 5, MATERIAL_POLYGON = 6, MATERIAL_QUADS = 7 } RenderMode # enum RenderMode { RENDER_MODE_WIREFRAME = 4, RENDER_MODE_FLAT = 5, RENDER_MODE_TRANSLUCENT_FLAT = 9, RENDER_MODE_TEXTURED = 10, RENDER_MODE_TEXTURED_SHADED = 14 } TextureAlignment # enum TextureAlignment { TEXTURE_ALIGN_NONE = 0, TEXTURE_ALIGN_WORLD = 1 << 0, TEXTURE_ALIGN_FACE = 1 << 1 }

Global Functions

angelscript
api, strata, hammer

This page outlines the various Strata Hammer AngelScript global functions. Global Functions # FindMaterial # Material@ FindMaterial(const string&in name) GetDefaultTextureName # string GetDefaultTextureName() abs # float abs(float) acos # float acos(float) asin # float asin(float) atan # float atan(float) atan2 # float atan2(float, float) ceil # float ceil(float) closeTo # bool closeTo(float, float, float = 0.00001f) bool closeTo(double, double, double = 0.0000000001) cos # float cos(float) cosh # float cosh(float) floor # float floor(float) fpFromIEEE # float fpFromIEEE(uint) double fpFromIEEE(uint64) fpToIEEE # uint fpToIEEE(float) uint64 fpToIEEE(double) fraction # float fraction(float) getExceptionInfo # string getExceptionInfo() join # string join(const string[]&in, const string&in) log # float log(float) log10 # float log10(float) pow # float pow(float, float) print # void print(const string&in) rint # float rint(float) sin # float sin(float) sinh # float sinh(float) sqrt # float sqrt(float) tan # float tan(float) tanh # float tanh(float) throw # void throw(const string&in)

Global Properties

angelscript
api, strata, hammer

This page outlines the various Strata Hammer AngelScript global properties. Global Properties # vec3_angle # const QAngle vec3_angle vec3_invalid # const Vector vec3_invalid vec3_origin # const Vector vec3_origin vec4_origin # const Vector4D vec4_origin

Value Types

angelscript
api, strata, hammer

This page outlines the various Strata Hammer AngelScript value types. CMapFace # class CMapFace { CMapFace(); ~CMapFace(); void CreateFace(Vector[]@ points, int numPoints); } Color # class Color { Color(); Color(uint8 r, uint8 g, uint8 b); Color(uint8 r, uint8 g, uint8 b, uint8 a); void SetColor(uint8 r, uint8 g, uint8 b, uint8 a); void GetColor(uint8&out r, uint8&out g, uint8&out b, uint8&out a) const; uint8& operator[](int idx); uint8& operator[](int idx) const; uint8 r; uint8 g; uint8 b; uint8 a; uint raw; } GUIData # class GUIData { GUIData(GuiElement type, const string&in label, int64 defVal); GUIData(GuiElement type, const string&in label, double defVal); GUIData(GuiElement type, const string&in text); GUIData(GuiElement type); } MeshBuilder # class MeshBuilder { MeshBuilder(); ~MeshBuilder(); void Position(const Vector&in pos); void Normal(const Vector&in normal); void Color(uint8 r, uint8 g, uint8 b, uint8 a); void TexCoord(int i, float u, float v); void TexCoord(int i, const Vector2D&in uv); void AdvanceVertex(); void Index(uint16 index); void FastIndex2(uint16 index1, uint16 index2); void AdvanceIndex(); void Start(const string&in material, PrimitiveType type, int primitiveCount); void Start(const string&in material, PrimitiveType, int vertexCount, int indexCount); void Draw(); } QAngle # class QAngle { QAngle(); QAngle(float x, float y, float z); void Init(float x, float y, float z); void Random(float minVal, float maxVal); bool IsValid() const; void Invalidate(); float Length() const; float LengthSqr() const; float operator[](int idx) const; float& operator[](int idx); bool operator==(const QAngle&in other) const; QAngle& operator=(const QAngle&in other); QAngle& operator+=(const QAngle&in other); QAngle& operator-=(const QAngle&in other); QAngle& operator*=(float fl); QAngle& operator/=(float fl); QAngle operator-() const; QAngle operator+(const QAngle&in other) const; QAngle operator-(const QAngle&in other) const; QAngle operator*(float fl) const; QAngle operator/(float fl) const; float x; float y; float z; } VMatrix # class VMatrix { VMatrix(); VMatrix(float m00, float m01, float m02, float m03, float m10, float m11, float m12, float m13, float m20, float m21, float m22, float m23, float m30, float m31, float m32, float m33); VMatrix(const Vector&in forward, const Vector&in left, const Vector&in up); void Init(float m00, float m01, float m02, float m03, float m10, float m11, float m12, float m13, float m20, float m21, float m22, float m23, float m30, float m31, float m32, float m33); float& operator[](uint x, uint y); const float& operator[](uint x, uint y) const; void SetLeft(const Vector&in left); void SetUp(const Vector&in up); void SetForward(const Vector&in forward); void GetBasisVectors(Vector&out forward, Vector&out left, Vector&out up) const; void SetBasisVectors(const Vector&in forward, const Vector&in left, const Vector&in up); void SetTranslation(const Vector&in trans); void PreTranslate(const Vector&in trans); void PostTranslate(const Vector&in trans); Vector GetLeft() const; Vector GetUp() const; Vector GetForward() const; Vector GetTranslation() const; Vector ApplyRotation(const Vector&in vec) const; Vector VMul3x3(const Vector&in vec) const; Vector VMul3x3Transpose(const Vector&in vec) const; Vector VMul4x3(const Vector&in vec) const; Vector VMul4x3Transpose(const Vector&in vec) const; void MatrixMul(const VMatrix&in vm, VMatrix&out out) const; void Identity(); bool IsIdentity() const; void SetupMatrixOrgAngles(const Vector&in origin, const QAngle&in angles); bool InverseGeneral(VMatrix&out inverse) const; VMatrix InverseTR() const; bool IsRotationMatrix() const; Vector GetScale() const; VMatrix Scale(const Vector&in scale); VMatrix NormalizeBasisVectors() const; VMatrix Transpose() const; VMatrix Transpose3x3() const; } Vector # class Vector { Vector(); Vector(float x, float y, float z); float operator[](int idx) const; float& operator[](int idx); void Init(float x, float y, float z); bool IsValid() const; void Invalidate(); void Random(float minVal, float maxVal); void Zero(); float NormalizeInPlace(); Vector Normalized() const; void Negate(); float Length() const; float Length2D() const; float Length2DSqr() const; float LengthSqr() const; bool IsZero(float tolerance) const; bool IsLengthGreaterThan(float val) const; bool IsLengthLessThan(float val) const; bool WithinAABox(const Vector&in mins, const Vector&in maxs); float DistTo(const Vector&in other) const; float DistToSqr(const Vector&in other) const; void MulAdd(const Vector&in a, const Vector&in b, float scalar); float Dot(const Vector&in other) const; Vector Cross(const Vector&in other) const; Vector Min(const Vector&in other) const; Vector Max(const Vector&in other) const; const Vector2D& AsVector2D() const; Vector2D& AsVector2D(); bool operator==(const Vector&in other) const; Vector& operator+=(const Vector&in other); Vector& operator+=(float fl); Vector& operator-=(const Vector&in other); Vector& operator-=(float fl); Vector& operator*=(const Vector&in other); Vector& operator*=(float fl); Vector& operator/=(const Vector&in other); Vector& operator/=(float fl); Vector& operator=(const Vector&in other); Vector operator-() const; Vector operator+(const Vector&in other) const; Vector operator-(const Vector&in other) const; Vector operator*(const Vector&in other) const; Vector operator/(const Vector&in other) const; Vector operator*(float fl) const; Vector operator/(float fl) const; float x; float y; float z; } Vector2D # class Vector2D { Vector2D(); Vector2D(float x, float y); Vector2D(const Vector2D&in other); float operator[](int idx) const; float& operator[](int idx); void Init(float x, float y); bool IsValid() const; void Random(float minVal, float maxVal); void Negate(); float Length() const; float LengthSqr() const; bool IsZero(float tolerance) const; float NormalizeInPlace(); bool IsLengthGreaterThan(float val) const; bool IsLengthLessThan(float val) const; float DistTo(const Vector2D&in other) const; float DistToSqr(const Vector2D&in other) const; void MulAdd(const Vector2D&in a, const Vector2D&in b, float scalar); float Dot(const Vector2D&in other) const; Vector2D Min(const Vector2D&in other) const; Vector2D Max(const Vector2D&in other) const; bool operator==(const Vector2D&in other) const; Vector2D& operator+=(const Vector2D&in other); Vector2D& operator-=(const Vector2D&in other); Vector2D& operator*=(const Vector2D&in other); Vector2D& operator*=(float fl); Vector2D& operator/=(const Vector2D&in other); Vector2D& operator/=(float fl); Vector2D& operator=(const Vector2D&in other); Vector2D operator-() const; Vector2D operator+(const Vector2D&in other) const; Vector2D operator-(const Vector2D&in other) const; Vector2D operator*(const Vector2D&in other) const; Vector2D operator/(const Vector2D&in other) const; Vector2D operator*(float fl) const; Vector2D operator/(float fl) const; float x; float y; } Vector4D # class Vector4D { Vector4D(); Vector4D(float x, float y, float z, float w); Vector4D(const Vector4D&in other); void Init(float x, float y, float z, float w); void Init(const Vector&in vec, float w); bool IsValid() const; void Negate(); float Length() const; float LengthSqr() const; bool IsZero(float) const; float DistTo(const Vector4D&in other) const; float DistToSqr(const Vector4D&in other) const; void MulAdd(const Vector4D&in a, const Vector4D&in b, float scalar); float Dot(const Vector4D&in other) const; float operator[](int idx) const; float& operator[](int idx); const Vector& AsVector3D() const; Vector& AsVector3D(); const Vector2D& AsVector2D() const; Vector2D& AsVector2D(); void Random(float minVal, float maxVal); bool operator==(const Vector4D&in other) const; Vector4D& operator+=(const Vector4D&in other); Vector4D& operator-=(const Vector4D&in other); Vector4D& operator*=(const Vector4D&in other); Vector4D& operator*=(float fl); Vector4D& operator/=(const Vector4D&in other); Vector4D& operator/=(float fl); float x; float y; float z; float w; } dictionaryValue # class dictionaryValue { dictionaryValue(); ~dictionaryValue(); dictionaryValue& operator=(const dictionaryValue&in); dictionaryValue& operator@=(const ? ...

Example

angelscript
api, strata, hammer

This page contains various examples of how to use AngelScript to create new brush types in the Strata Hammer Editor. To use the examples create a new file inside the Momentum Mod Playtest/hammer/scripts folder (create the folder if it does not exist yet). The scripts have to be saved with the extension .as. Afterwards, the new brush types can be used by first selecting the Block Tool within Hammer and then changing the Categories combo-box in the right bar to Scriptable. ...