scripting and a bunch of rendering fixes

This commit is contained in:
sshumakov3
2021-09-02 02:07:56 +03:00
parent c22a76e55a
commit 9d960b2422
88 changed files with 9210 additions and 125 deletions

101
scripts/docs/README.md Normal file
View File

@@ -0,0 +1,101 @@
# Scripting
[API Documentation](api/modules.md)
This version of Noggit has support for scriptable brushes, meaning you can use the Lua programming language (version 5.1) to customize your own workflow.
Script brushes should be placed in the `scripts` subdirectory in your Noggit installation. Script brushes can be loaded inside Noggit from the scripting tool (book icon) in the menu to the left.
**Warning**: Scripts are created by third party developers and are not maintained by Noggit. Scripts downloaded from the internet might contain malicious code.
## Hello World
This example illustrates a simple working script brush that you can load in the scripting tool.
```lua
-- We create a new script brush that becomes
local my_brush = brush("My Brush")
-- We register an event for when this brush clicks on the ground
function my_brush:on_left_click(evt)
print("Hello world!")
end
```
## Script Parameters
Script brushes can register custom settings that the user can configure without editing the script.
```lua
local parameter_brush = brush("Parameter Brush")
-- Editable string
local string_param = parameter_brush:add_string_tag("Parameter Name","default value")
-- Integer between 1 and 50, default value of 5
local int_param = parameter_brush:add_int_tag("Int Tag",1,50,5)
-- Real between 0.0005 and 1, default value of 0.001 and at most 5 decimal points.
local real_param = parameter_brush:add_real_tag("Real Tag",0.0005,1.0,0.001,5)
-- Checkbox
local bool_param = parameter_brush:add_bool_tag("Bool Tag",false)
function parameter_brush:on_left_click(evt)
-- We can now access the tag values from the brush event
print("String: " .. string_param:get())
print("Bool: " .. bool_param:get())
print("Int: " .. int_param:get())
print("Real: " .. real_param:get())
-- And we can access the special radius settings from the event parameter
print("Outer brush radius:" .. evt:outer_radius())
print("Inner brush radius" .. evt:inner_radius())
end
```
## Selections
Most noggit operations involve some kind of selection using the Noggit API.
The following code illustrates how we can iterate various data in Noggit:
```lua
local selection_brush = brush("Selection Brush")
function selection_brush:on_left_click(evt)
-- Creates a square selection at the clicked position
-- containing the entire outer brush circle
local sel = select_origin(evt:pos(), evt:outer_radius())
-- iterate selected chunks
for i,chunk in pairs(sel:chunks()) do
-- do something to the chunk here
end
-- iterate selected vertices
for i,vert in pairs(sel:verts()) do
-- do something to the vertex here
end
-- iterate selected texture units
for i,tex in pairs(sel:tex()) do
-- do something to the texture unit here
end
-- iterate selected models (m2 and wmo)
for i,model in pairs(sel:model()) do
-- do something to the model here
end
end
```
## Noggit API
To see all the predefined functions you can call from scripts, see the [API documentation](api/modules.md).
### File System Permissions
The functions [image::save](api/classes/image####save) and [write_file](api/modules.md####write_file) can be used to write to the users file systems. By default, when a script tries to call either of these functions the user will be prompted with a popup to confirm they wish to write to that file. If they answer no, an exception will be thrown and stop execution of the script, and if they answer yes the file will be written, and can be written to again without asking until Noggit is restarted.
This default behavior can be disabled in the Noggit settings under `Allow scripts to write to any file`.

View File

@@ -0,0 +1,309 @@
# Class: chunk
Represents a chunk in the world
## Table of contents
### Constructors
- [constructor](chunk.md#constructor)
### Methods
- [add\_texture](chunk.md#add_texture)
- [apply](chunk.md#apply)
- [apply\_all](chunk.md#apply_all)
- [apply\_heightmap](chunk.md#apply_heightmap)
- [apply\_textures](chunk.md#apply_textures)
- [apply\_vertex\_color](chunk.md#apply_vertex_color)
- [clear\_colors](chunk.md#clear_colors)
- [clear\_textures](chunk.md#clear_textures)
- [get\_area\_id](chunk.md#get_area_id)
- [get\_effect](chunk.md#get_effect)
- [get\_tex](chunk.md#get_tex)
- [get\_texture](chunk.md#get_texture)
- [get\_texture\_count](chunk.md#get_texture_count)
- [get\_vert](chunk.md#get_vert)
- [remove\_texture](chunk.md#remove_texture)
- [set\_area\_id](chunk.md#set_area_id)
- [set\_effect](chunk.md#set_effect)
- [set\_hole](chunk.md#set_hole)
- [set\_impassable](chunk.md#set_impassable)
- [to\_selection](chunk.md#to_selection)
## Constructors
### constructor
\+ **new chunk**(): [*chunk*](chunk.md)
**Returns:** [*chunk*](chunk.md)
## Methods
### add\_texture
**add_texture**(`texture`: *string*, `effect`: *number*): *number*
Adds a new texture at the current topmost layer.
**`note`** A chunk can hold at most 4 texture layers.
#### Parameters:
Name | Type | Description |
:------ | :------ | :------ |
`texture` | *string* | |
`effect` | *number* | effect id to add - -2 (default): does not change effect - -1: clears current effect index - 0+: change to this effect index |
**Returns:** *number*
texture index added to
___
### apply
**apply**(): *void*
Same as apply_all
**Returns:** *void*
___
### apply\_all
**apply_all**(): *void*
Applies all changes in this chunk
**Returns:** *void*
___
### apply\_heightmap
**apply_heightmap**(): *void*
Applies all changes to the heightmap in this chunk
**Returns:** *void*
___
### apply\_textures
**apply_textures**(): *void*
Applies all changes to texture alphamaps in this chunk
**Returns:** *void*
___
### apply\_vertex\_color
**apply_vertex_color**(): *void*
Applies all changes to vertex colors in this chunk
**Returns:** *void*
___
### clear\_colors
**clear_colors**(): *void*
Removes all vertex colors in this chunk
**Returns:** *void*
___
### clear\_textures
**clear_textures**(): *void*
Removes all texture layers in this chunk
**Returns:** *void*
___
### get\_area\_id
**get_area_id**(): *number*
Returns the area id of a chunk
**Returns:** *number*
___
### get\_effect
**get_effect**(`layer`: *number*): *number*
Returns the effect id at a texture layer
#### Parameters:
Name | Type |
:------ | :------ |
`layer` | *number* |
**Returns:** *number*
___
### get\_tex
**get_tex**(`index`: *number*): [*tex*](tex.md)
Returns a texel by index in this chunk
#### Parameters:
Name | Type | Description |
:------ | :------ | :------ |
`index` | *number* | valid in range [0-4095] |
**Returns:** [*tex*](tex.md)
___
### get\_texture
**get_texture**(`index`: *number*): *string*
Returns the name of the texture at the specified layer.
#### Parameters:
Name | Type |
:------ | :------ |
`index` | *number* |
**Returns:** *string*
___
### get\_texture\_count
**get_texture_count**(): *number*
Returns the amount of textures on this chunk
**Returns:** *number*
___
### get\_vert
**get_vert**(`index`: *number*): [*vert*](vert.md)
Returns a vertex by index in this chunk
#### Parameters:
Name | Type | Description |
:------ | :------ | :------ |
`index` | *number* | valid in range [0-144] |
**Returns:** [*vert*](vert.md)
___
### remove\_texture
**remove_texture**(`index`: *number*): *void*
Removes a texture layer from this chunk
and decreases the texture ids of all higher layers by 1
#### Parameters:
Name | Type |
:------ | :------ |
`index` | *number* |
**Returns:** *void*
___
### set\_area\_id
**set_area_id**(`value`: *number*): *void*
Changes the area id of a chunk
#### Parameters:
Name | Type |
:------ | :------ |
`value` | *number* |
**Returns:** *void*
___
### set\_effect
**set_effect**(`layer`: *number*, `effect`: *number*): *any*
Changes the effect id at a texture layer
#### Parameters:
Name | Type | Description |
:------ | :------ | :------ |
`layer` | *number* | |
`effect` | *number* | effect id to set (-1 to remove effects) |
**Returns:** *any*
___
### set\_hole
**set_hole**(`hole`: *boolean*): *void*
Creates or removes a hole in this chunk
#### Parameters:
Name | Type |
:------ | :------ |
`hole` | *boolean* |
**Returns:** *void*
___
### set\_impassable
**set_impassable**(`impassable`: *boolean*): *void*
Sets whether this chunk should be impassable for players or not
#### Parameters:
Name | Type |
:------ | :------ |
`impassable` | *boolean* |
**Returns:** *void*
___
### to\_selection
**to_selection**(): [*selection*](selection.md)
Returns a selection spanning this chunk
**`note`** - iterating will include border vert/texels
**Returns:** [*selection*](selection.md)

View File

@@ -0,0 +1,209 @@
# Class: image
Represents a bitmap image
images can be created from create_image or load_png
## Table of contents
### Constructors
- [constructor](image.md#constructor)
### Methods
- [get\_alpha](image.md#get_alpha)
- [get\_blue](image.md#get_blue)
- [get\_green](image.md#get_green)
- [get\_pixel](image.md#get_pixel)
- [get\_red](image.md#get_red)
- [gradient\_scale](image.md#gradient_scale)
- [height](image.md#height)
- [save](image.md#save)
- [set\_pixel](image.md#set_pixel)
- [set\_pixel\_floats](image.md#set_pixel_floats)
- [width](image.md#width)
## Constructors
### constructor
\+ **new image**(): [*image*](image.md)
**Returns:** [*image*](image.md)
## Methods
### get\_alpha
**get_alpha**(`x`: *number*, `y`: *number*): *number*
Returns the alpha channel (between 0-1) at an image coordinate
#### Parameters:
Name | Type |
:------ | :------ |
`x` | *number* |
`y` | *number* |
**Returns:** *number*
___
### get\_blue
**get_blue**(`x`: *number*, `y`: *number*): *number*
Returns the blue channel (between 0-1) at an image coordinate
#### Parameters:
Name | Type |
:------ | :------ |
`x` | *number* |
`y` | *number* |
**Returns:** *number*
___
### get\_green
**get_green**(`x`: *number*, `y`: *number*): *number*
Returns the green channel (between 0-1) at an image coordinate
#### Parameters:
Name | Type |
:------ | :------ |
`x` | *number* |
`y` | *number* |
**Returns:** *number*
___
### get\_pixel
**get_pixel**(`x`: *number*, `y`: *number*): *number*
Returns the pixel value at a coordinate
#### Parameters:
Name | Type |
:------ | :------ |
`x` | *number* |
`y` | *number* |
**Returns:** *number*
___
### get\_red
**get_red**(`x`: *number*, `y`: *number*): *number*
Returns the red channel (between 0-1) at an image coordinate
#### Parameters:
Name | Type |
:------ | :------ |
`x` | *number* |
`y` | *number* |
**Returns:** *number*
___
### gradient\_scale
**gradient_scale**(`rel`: *number*): *number*
Returns the pixel value at a relative horizontal coordinate
#### Parameters:
Name | Type | Description |
:------ | :------ | :------ |
`rel` | *number* | horizontal relative position (between 0-1) |
**Returns:** *number*
___
### height
**height**(): *number*
Returns the height of this image
**Returns:** *number*
___
### save
**save**(`filename`: *string*): *any*
Saves this image to a file
#### Parameters:
Name | Type |
:------ | :------ |
`filename` | *string* |
**Returns:** *any*
___
### set\_pixel
**set_pixel**(`x`: *number*, `y`: *number*, `value`: *number*): *void*
Sets the pixel value at an image coordinate
#### Parameters:
Name | Type |
:------ | :------ |
`x` | *number* |
`y` | *number* |
`value` | *number* |
**Returns:** *void*
___
### set\_pixel\_floats
**set_pixel_floats**(`x`: *number*, `y`: *number*, `r`: *number*, `g`: *number*, `b`: *number*, `a`: *number*): *void*
Sets the pixel value at an image coordinate
#### Parameters:
Name | Type | Description |
:------ | :------ | :------ |
`x` | *number* | |
`y` | *number* | |
`r` | *number* | should be between 0-1 |
`g` | *number* | should be between 0-1 |
`b` | *number* | should be between 0-1 |
`a` | *number* | should be between 0-1 |
**Returns:** *void*
___
### width
**width**(): *number*
Returns the width of this image
**Returns:** *number*

View File

@@ -0,0 +1,149 @@
# Class: model
Represents a model in the world. Can represent both an m2 and wmo model.
## Table of contents
### Constructors
- [constructor](model.md#constructor)
### Methods
- [get\_filename](model.md#get_filename)
- [get\_pos](model.md#get_pos)
- [get\_rot](model.md#get_rot)
- [get\_scale](model.md#get_scale)
- [get\_uid](model.md#get_uid)
- [has\_filename](model.md#has_filename)
- [remove](model.md#remove)
- [replace](model.md#replace)
- [set\_pos](model.md#set_pos)
- [set\_rot](model.md#set_rot)
- [set\_scale](model.md#set_scale)
## Constructors
### constructor
\+ **new model**(): [*model*](model.md)
**Returns:** [*model*](model.md)
## Methods
### get\_filename
**get_filename**(): *string*
**Returns:** *string*
___
### get\_pos
**get_pos**(): [*vector\_3d*](vector_3d.md)
**Returns:** [*vector\_3d*](vector_3d.md)
___
### get\_rot
**get_rot**(): [*vector\_3d*](vector_3d.md)
**Returns:** [*vector\_3d*](vector_3d.md)
___
### get\_scale
**get_scale**(): *number*
**Returns:** *number*
___
### get\_uid
**get_uid**(): *number*
**Returns:** *number*
___
### has\_filename
**has_filename**(`name`: *string*): *boolean*
#### Parameters:
Name | Type |
:------ | :------ |
`name` | *string* |
**Returns:** *boolean*
___
### remove
**remove**(): *void*
**Returns:** *void*
___
### replace
**replace**(`filename`: *string*): *any*
#### Parameters:
Name | Type |
:------ | :------ |
`filename` | *string* |
**Returns:** *any*
___
### set\_pos
**set_pos**(`pos`: [*vector\_3d*](vector_3d.md)): *void*
#### Parameters:
Name | Type |
:------ | :------ |
`pos` | [*vector\_3d*](vector_3d.md) |
**Returns:** *void*
___
### set\_rot
**set_rot**(`pos`: [*vector\_3d*](vector_3d.md)): *void*
#### Parameters:
Name | Type |
:------ | :------ |
`pos` | [*vector\_3d*](vector_3d.md) |
**Returns:** *void*
___
### set\_scale
**set_scale**(`scale`: *number*): *void*
#### Parameters:
Name | Type |
:------ | :------ |
`scale` | *number* |
**Returns:** *void*

View File

@@ -0,0 +1,96 @@
# Class: noisemap
Represents a map of floats values, typically use with a
noise generator.
## Table of contents
### Constructors
- [constructor](noisemap.md#constructor)
### Methods
- [get](noisemap.md#get)
- [height](noisemap.md#height)
- [is\_highest](noisemap.md#is_highest)
- [set](noisemap.md#set)
- [width](noisemap.md#width)
## Constructors
### constructor
\+ **new noisemap**(): [*noisemap*](noisemap.md)
**Returns:** [*noisemap*](noisemap.md)
## Methods
### get
**get**(`pos`: [*vector\_3d*](vector_3d.md)): *number*
Returns the float value at a specific 3d position.
**`note`** The 'y' value of pos is ignored by this operation.
#### Parameters:
Name | Type |
:------ | :------ |
`pos` | [*vector\_3d*](vector_3d.md) |
**Returns:** *number*
___
### height
**height**(): *number*
**Returns:** *number*
___
### is\_highest
**is_highest**(`pos`: [*vector\_3d*](vector_3d.md), `check_radius`: *number*): *boolean*
Returns true if the float value at a 3d position
is the highest position within a given range.
This is typically used for object placement.
#### Parameters:
Name | Type |
:------ | :------ |
`pos` | [*vector\_3d*](vector_3d.md) |
`check_radius` | *number* |
**Returns:** *boolean*
___
### set
**set**(`x`: *number*, `y`: *number*, `value`: *number*): *void*
#### Parameters:
Name | Type |
:------ | :------ |
`x` | *number* |
`y` | *number* |
`value` | *number* |
**Returns:** *void*
___
### width
**width**(): *number*
**Returns:** *number*

View File

@@ -0,0 +1,41 @@
# Class: procedures\_class
Contains some general-purpose procedures that don't fit anywhere else.
Access these functions through the global singleton "procedures".
## Table of contents
### Constructors
- [constructor](procedures_class.md#constructor)
### Methods
- [paint\_texture](procedures_class.md#paint_texture)
## Constructors
### constructor
\+ **new procedures_class**(): [*procedures\_class*](procedures_class.md)
**Returns:** [*procedures\_class*](procedures_class.md)
## Methods
### paint\_texture
**paint_texture**(`sel`: [*selection*](selection.md), `img`: [*image*](image.md), `layer`: *number*, `pressure`: *number*, `angle`: *number*): *any*
#### Parameters:
Name | Type |
:------ | :------ |
`sel` | [*selection*](selection.md) |
`img` | [*image*](image.md) |
`layer` | *number* |
`pressure` | *number* |
`angle` | *number* |
**Returns:** *any*

View File

@@ -0,0 +1,52 @@
# Class: random
Represents a random generator and its state.
## Table of contents
### Constructors
- [constructor](random.md#constructor)
### Methods
- [integer](random.md#integer)
- [real](random.md#real)
## Constructors
### constructor
\+ **new random**(): [*random*](random.md)
**Returns:** [*random*](random.md)
## Methods
### integer
**integer**(`low`: *number*, `high`: *number*): *number*
#### Parameters:
Name | Type |
:------ | :------ |
`low` | *number* |
`high` | *number* |
**Returns:** *number*
___
### real
**real**(`low`: *number*, `high`: *number*): *number*
#### Parameters:
Name | Type |
:------ | :------ |
`low` | *number* |
`high` | *number* |
**Returns:** *number*

View File

@@ -0,0 +1,233 @@
# Class: script\_brush
Represents a script brush in the script window.
## Table of contents
### Constructors
- [constructor](script_brush.md#constructor)
### Properties
- [on\_left\_click](script_brush.md#on_left_click)
- [on\_left\_hold](script_brush.md#on_left_hold)
- [on\_left\_release](script_brush.md#on_left_release)
- [on\_right\_click](script_brush.md#on_right_click)
- [on\_right\_hold](script_brush.md#on_right_hold)
- [on\_right\_release](script_brush.md#on_right_release)
### Methods
- [add\_bool\_tag](script_brush.md#add_bool_tag)
- [add\_description](script_brush.md#add_description)
- [add\_int\_tag](script_brush.md#add_int_tag)
- [add\_null\_tag](script_brush.md#add_null_tag)
- [add\_real\_tag](script_brush.md#add_real_tag)
- [add\_string\_list\_tag](script_brush.md#add_string_list_tag)
- [add\_string\_tag](script_brush.md#add_string_tag)
- [get\_name](script_brush.md#get_name)
- [set\_name](script_brush.md#set_name)
## Constructors
### constructor
\+ **new script_brush**(): [*script\_brush*](script_brush.md)
**Returns:** [*script\_brush*](script_brush.md)
## Properties
### on\_left\_click
**on\_left\_click**: [*callback*](../modules.md#callback)<(`brush`: [*script\_brush*](script_brush.md), `event`: [*script\_brush\_event*](script_brush_event.md)) => *void*\>
The function to call when the user left clicks
the world with this brush
___
### on\_left\_hold
**on\_left\_hold**: [*callback*](../modules.md#callback)<(`brush`: [*script\_brush*](script_brush.md), `event`: [*script\_brush\_event*](script_brush_event.md)) => *void*\>
The funciton to call when the user holds the left mouse button
in the world with this brush
___
### on\_left\_release
**on\_left\_release**: [*callback*](../modules.md#callback)<(`brush`: [*script\_brush*](script_brush.md), `event`: [*script\_brush\_event*](script_brush_event.md)) => *void*\>
The function to call when the user releases the left moues button
in the world with this brush
___
### on\_right\_click
**on\_right\_click**: [*callback*](../modules.md#callback)<(`brush`: [*script\_brush*](script_brush.md), `event`: [*script\_brush\_event*](script_brush_event.md)) => *void*\>
The function to call when the user right clicks
the world with this brush
___
### on\_right\_hold
**on\_right\_hold**: [*callback*](../modules.md#callback)<(`brush`: [*script\_brush*](script_brush.md), `event`: [*script\_brush\_event*](script_brush_event.md)) => *void*\>
The funciton to call when the user holds the right mouse button
in the world with this brush
___
### on\_right\_release
**on\_right\_release**: [*callback*](../modules.md#callback)<(`brush`: [*script\_brush*](script_brush.md), `event`: [*script\_brush\_event*](script_brush_event.md)) => *void*\>
The function to call when the user releases the right mouse button
in the world with this brush
## Methods
### add\_bool\_tag
**add_bool_tag**(`item`: *string*, `def`: *boolean*): [*tag*](tag.md)<boolean\>
Adds a bool tag to the settings panel
#### Parameters:
Name | Type |
:------ | :------ |
`item` | *string* |
`def` | *boolean* |
**Returns:** [*tag*](tag.md)<boolean\>
___
### add\_description
**add_description**(`text`: *string*): *any*
Adds a description row to the brush window
#### Parameters:
Name | Type |
:------ | :------ |
`text` | *string* |
**Returns:** *any*
___
### add\_int\_tag
**add_int_tag**(`item`: *string*, `low`: *number*, `high`: *number*, `def`: *number*): [*tag*](tag.md)<number\>
Adds an integer tag to the settings panel
#### Parameters:
Name | Type |
:------ | :------ |
`item` | *string* |
`low` | *number* |
`high` | *number* |
`def` | *number* |
**Returns:** [*tag*](tag.md)<number\>
___
### add\_null\_tag
**add_null_tag**(): *any*
Adds an empty tag, typically used to create empty lines in the settings panel
**Returns:** *any*
___
### add\_real\_tag
**add_real_tag**(`item`: *string*, `low`: *number*, `high`: *number*, `def`: *number*): [*tag*](tag.md)<number\>
Adds a real (i.e. float) tag to the settings panel
#### Parameters:
Name | Type |
:------ | :------ |
`item` | *string* |
`low` | *number* |
`high` | *number* |
`def` | *number* |
**Returns:** [*tag*](tag.md)<number\>
___
### add\_string\_list\_tag
**add_string_list_tag**(`item`: *string*, ...`values`: *string*[]): [*tag*](tag.md)<string\>
Adds a dropdown menu to the settings panel
#### Parameters:
Name | Type |
:------ | :------ |
`item` | *string* |
`...values` | *string*[] |
**Returns:** [*tag*](tag.md)<string\>
___
### add\_string\_tag
**add_string_tag**(`item`: *string*, `def`: *string*): [*tag*](tag.md)<string\>
Adds a string tag to the settings panel
#### Parameters:
Name | Type |
:------ | :------ |
`item` | *string* |
`def` | *string* |
**Returns:** [*tag*](tag.md)<string\>
___
### get\_name
**get_name**(): *string*
Returns the current name of this script brush
**Returns:** *string*
___
### set\_name
**set_name**(`name`: *string*): *void*
Changes the name of this script brush
#### Parameters:
Name | Type |
:------ | :------ |
`name` | *string* |
**Returns:** *void*

View File

@@ -0,0 +1,99 @@
# Class: script\_brush\_event
Represents the event context passed to brush click events.
## Table of contents
### Constructors
- [constructor](script_brush_event.md#constructor)
### Methods
- [dt](script_brush_event.md#dt)
- [inner\_radius](script_brush_event.md#inner_radius)
- [outer\_radius](script_brush_event.md#outer_radius)
- [pos](script_brush_event.md#pos)
- [set\_inner\_radius](script_brush_event.md#set_inner_radius)
- [set\_outer\_radius](script_brush_event.md#set_outer_radius)
## Constructors
### constructor
\+ **new script_brush_event**(): [*script\_brush\_event*](script_brush_event.md)
**Returns:** [*script\_brush\_event*](script_brush_event.md)
## Methods
### dt
**dt**(): *number*
Returns the delta-time since the last update frame
**Returns:** *number*
___
### inner\_radius
**inner_radius**(): *number*
Returns the current inner radius configured in the settings panel
**Returns:** *number*
___
### outer\_radius
**outer_radius**(): *number*
Returns the current outer radius configured in the settings panel
**Returns:** *number*
___
### pos
**pos**(): [*vector\_3d*](vector_3d.md)
Returns world position of this click event.
i.e. the world position where the user clicked, held or released a mouse button
**Returns:** [*vector\_3d*](vector_3d.md)
___
### set\_inner\_radius
**set_inner_radius**(`value`: *number*): *any*
Sets the outer radius in the settings panel for this brush
#### Parameters:
Name | Type | Description |
:------ | :------ | :------ |
`value` | *number* | should be between 0-1 |
**Returns:** *any*
___
### set\_outer\_radius
**set_outer_radius**(`value`: *number*): *any*
Sets the outer radius in the settings panel for this brush
#### Parameters:
Name | Type |
:------ | :------ |
`value` | *number* |
**Returns:** *any*

View File

@@ -0,0 +1,143 @@
# Class: selection
Represents a rectangular selection in the world and provides
iterators for heightmap vertices, texture units, chunks and models within it.
## Table of contents
### Constructors
- [constructor](selection.md#constructor)
### Methods
- [apply](selection.md#apply)
- [center](selection.md#center)
- [chunks](selection.md#chunks)
- [make\_noise](selection.md#make_noise)
- [max](selection.md#max)
- [min](selection.md#min)
- [models](selection.md#models)
- [size](selection.md#size)
- [tex](selection.md#tex)
- [verts](selection.md#verts)
## Constructors
### constructor
\+ **new selection**(): [*selection*](selection.md)
**Returns:** [*selection*](selection.md)
## Methods
### apply
**apply**(): *void*
Applies all changes made inside this selection.
You almost always want to call this function when you're done
with a selection.
**Returns:** *void*
___
### center
**center**(): [*vector\_3d*](vector_3d.md)
Returns the center point of this selection
**Returns:** [*vector\_3d*](vector_3d.md)
___
### chunks
**chunks**(): [*chunk*](chunk.md)[]
Creates and returns an iterator for all chunks inside this selection
**Returns:** [*chunk*](chunk.md)[]
___
### make\_noise
**make_noise**(`frequency`: *number*, `algorithm`: *string*, `seed`: *string*): [*noisemap*](noisemap.md)
Creates a noisemap matching the location of this selection
#### Parameters:
Name | Type |
:------ | :------ |
`frequency` | *number* |
`algorithm` | *string* |
`seed` | *string* |
**Returns:** [*noisemap*](noisemap.md)
___
### max
**max**(): [*vector\_3d*](vector_3d.md)
Returns the highest point of this selection
**Returns:** [*vector\_3d*](vector_3d.md)
___
### min
**min**(): [*vector\_3d*](vector_3d.md)
Returns the smallest point of this selection
**Returns:** [*vector\_3d*](vector_3d.md)
___
### models
**models**(): [*model*](model.md)[]
Creates and returns an iterator for all models inside this selection
**Returns:** [*model*](model.md)[]
___
### size
**size**(): [*vector\_3d*](vector_3d.md)
Returns a vector representing the size of this selection on each axis.
**`note`** for iterators, only x and z values are respected. y (height) is ignored.
**Returns:** [*vector\_3d*](vector_3d.md)
___
### tex
**tex**(): [*tex*](tex.md)[]
Creates and returns an iterator for all texture units inside this selection
**Returns:** [*tex*](tex.md)[]
___
### verts
**verts**(): [*vert*](vert.md)[]
Creates and returns an iterator for all vertices inside this selection
**Returns:** [*vert*](vert.md)[]

View File

@@ -0,0 +1,43 @@
# Class: tag<T\>
Represents a settings tag that can be accessed at any time by a script.
## Type parameters
Name |
:------ |
`T` |
## Table of contents
### Constructors
- [constructor](tag.md#constructor)
### Methods
- [get](tag.md#get)
## Constructors
### constructor
\+ **new tag**<T\>(): [*tag*](tag.md)<T\>
#### Type parameters:
Name |
:------ |
`T` |
**Returns:** [*tag*](tag.md)<T\>
## Methods
### get
**get**(): T
Returns the current value of this tag in the settings panel.
**Returns:** T

View File

@@ -0,0 +1,64 @@
# Class: tex
Represents a single texture unit in the worlds texture layers.
A texture unit represents the smallest area where it's possible to
affect textures alpha layers. This is much smaller than the areas made
up by heightmap vertices.
## Table of contents
### Constructors
- [constructor](tex.md#constructor)
### Methods
- [get\_alpha](tex.md#get_alpha)
- [get\_pos\_2d](tex.md#get_pos_2d)
- [set\_alpha](tex.md#set_alpha)
## Constructors
### constructor
\+ **new tex**(): [*tex*](tex.md)
**Returns:** [*tex*](tex.md)
## Methods
### get\_alpha
**get_alpha**(`index`: *number*): *number*
#### Parameters:
Name | Type |
:------ | :------ |
`index` | *number* |
**Returns:** *number*
___
### get\_pos\_2d
**get_pos_2d**(): [*vector\_3d*](vector_3d.md)
**Returns:** [*vector\_3d*](vector_3d.md)
___
### set\_alpha
**set_alpha**(`index`: *number*, `alpha`: *number*): *void*
#### Parameters:
Name | Type |
:------ | :------ |
`index` | *number* |
`alpha` | *number* |
**Returns:** *void*

View File

@@ -0,0 +1,42 @@
# Class: vector\_3d
Represents a 3-dimensional vector.
Most functions do not use the 'y' (height) value at all
## Table of contents
### Constructors
- [constructor](vector_3d.md#constructor)
### Properties
- [x](vector_3d.md#x)
- [y](vector_3d.md#y)
- [z](vector_3d.md#z)
## Constructors
### constructor
\+ **new vector_3d**(): [*vector\_3d*](vector_3d.md)
**Returns:** [*vector\_3d*](vector_3d.md)
## Properties
### x
**x**: *number*
___
### y
**y**: *number*
___
### z
**z**: *number*

View File

@@ -0,0 +1,190 @@
# Class: vert
Represents a single heightmap vertex in the world.
Changes to this vertex takes visible effect in Noggit after you call
"apply" on the chunk or selection that contains it.
## Table of contents
### Constructors
- [constructor](vert.md#constructor)
### Methods
- [add\_height](vert.md#add_height)
- [get\_alpha](vert.md#get_alpha)
- [get\_pos](vert.md#get_pos)
- [is\_water\_aligned](vert.md#is_water_aligned)
- [set\_alpha](vert.md#set_alpha)
- [set\_color](vert.md#set_color)
- [set\_height](vert.md#set_height)
- [set\_hole](vert.md#set_hole)
- [set\_water](vert.md#set_water)
- [sub\_height](vert.md#sub_height)
## Constructors
### constructor
\+ **new vert**(): [*vert*](vert.md)
**Returns:** [*vert*](vert.md)
## Methods
### add\_height
**add_height**(`y`: *number*): *any*
#### Parameters:
Name | Type |
:------ | :------ |
`y` | *number* |
**Returns:** *any*
___
### get\_alpha
**get_alpha**(`index`: *number*): *any*
Returns the average alpha of all texture units closest to this vertex.
#### Parameters:
Name | Type |
:------ | :------ |
`index` | *number* |
**Returns:** *any*
___
### get\_pos
**get_pos**(): [*vector\_3d*](vector_3d.md)
Returns the full position of this vertex
**Returns:** [*vector\_3d*](vector_3d.md)
___
### is\_water\_aligned
**is_water_aligned**(): *boolean*
Returns true if this vertex is aligned with water tiles.
**Returns:** *boolean*
___
### set\_alpha
**set_alpha**(`index`: *number*, `alpha`: *number*): *void*
Sets a texture alpha layer of all texture units closest to this vertex.
#### Parameters:
Name | Type |
:------ | :------ |
`index` | *number* |
`alpha` | *number* |
**Returns:** *void*
___
### set\_color
**set_color**(`red`: *number*, `green`: *number*, `blue`: *number*): *void*
Changes the vertex color that this vertex blends with the
underlying texture. Values generally range between 0-1, but can
also go higher.
#### Parameters:
Name | Type | Description |
:------ | :------ | :------ |
`red` | *number* | How much red should be used (default: 1) |
`green` | *number* | How much green should be used (default: 1) |
`blue` | *number* | How much blue should be used (default: 1) |
**Returns:** *void*
___
### set\_height
**set_height**(`y`: *number*): *any*
Changes the height of this vertex
#### Parameters:
Name | Type |
:------ | :------ |
`y` | *number* |
**Returns:** *any*
___
### set\_hole
**set_hole**(`has_hole`: *boolean*): *void*
Sets whether this vertex should be a hole, but only if the
vertex is aligned with hole tiles. If the vertex is not aligned
with a hole tile, this function does nothing.
#### Parameters:
Name | Type |
:------ | :------ |
`has_hole` | *boolean* |
**Returns:** *void*
___
### set\_water
**set_water**(`type`: *number*, `height`: *number*): *void*
Changes the water type on this vertex, but only if the vertex is
aligned with water tiles. If the vertex is not aligned
with a water tile, this function does nothing.
**`note`** The C++ function backing this operation is very slow for the moment.
use with care.
#### Parameters:
Name | Type |
:------ | :------ |
`type` | *number* |
`height` | *number* |
**Returns:** *void*
___
### sub\_height
**sub_height**(`y`: *number*): *any*
#### Parameters:
Name | Type |
:------ | :------ |
`y` | *number* |
**Returns:** *any*

932
scripts/docs/api/modules.md Normal file
View File

@@ -0,0 +1,932 @@
#
## Table of contents
### Classes
- [chunk](classes/chunk.md)
- [image](classes/image.md)
- [model](classes/model.md)
- [noisemap](classes/noisemap.md)
- [procedures\_class](classes/procedures_class.md)
- [random](classes/random.md)
- [script\_brush](classes/script_brush.md)
- [script\_brush\_event](classes/script_brush_event.md)
- [selection](classes/selection.md)
- [tag](classes/tag.md)
- [tex](classes/tex.md)
- [vector\_3d](classes/vector_3d.md)
- [vert](classes/vert.md)
### Type aliases
- [brush\_callback](modules.md#brush_callback)
- [callback](modules.md#callback)
- [nil](modules.md#nil)
### Variables
- [procedures](modules.md#procedures)
### Functions
- [abs](modules.md#abs)
- [acos](modules.md#acos)
- [acosh](modules.md#acosh)
- [add\_m2](modules.md#add_m2)
- [add\_wmo](modules.md#add_wmo)
- [append\_file](modules.md#append_file)
- [asin](modules.md#asin)
- [asinh](modules.md#asinh)
- [atan](modules.md#atan)
- [atanh](modules.md#atanh)
- [brush](modules.md#brush)
- [cam\_pitch](modules.md#cam_pitch)
- [cam\_yaw](modules.md#cam_yaw)
- [camera\_pos](modules.md#camera_pos)
- [cbrt](modules.md#cbrt)
- [ceil](modules.md#ceil)
- [cos](modules.md#cos)
- [cosh](modules.md#cosh)
- [create\_image](modules.md#create_image)
- [dist\_2d](modules.md#dist_2d)
- [dist\_2d\_compare](modules.md#dist_2d_compare)
- [exp](modules.md#exp)
- [floor](modules.md#floor)
- [get\_area\_id](modules.md#get_area_id)
- [get\_chunk](modules.md#get_chunk)
- [get\_map\_id](modules.md#get_map_id)
- [holding\_alt](modules.md#holding_alt)
- [holding\_ctrl](modules.md#holding_ctrl)
- [holding\_left\_mouse](modules.md#holding_left_mouse)
- [holding\_right\_mouse](modules.md#holding_right_mouse)
- [holding\_shift](modules.md#holding_shift)
- [holding\_space](modules.md#holding_space)
- [lerp](modules.md#lerp)
- [load\_png](modules.md#load_png)
- [log](modules.md#log)
- [log10](modules.md#log10)
- [make\_noise](modules.md#make_noise)
- [path\_exists](modules.md#path_exists)
- [pow](modules.md#pow)
- [print](modules.md#print)
- [random\_from\_seed](modules.md#random_from_seed)
- [random\_from\_time](modules.md#random_from_time)
- [read\_file](modules.md#read_file)
- [rotate\_2d](modules.md#rotate_2d)
- [round](modules.md#round)
- [select\_between](modules.md#select_between)
- [select\_origin](modules.md#select_origin)
- [sin](modules.md#sin)
- [sinh](modules.md#sinh)
- [sqrt](modules.md#sqrt)
- [tan](modules.md#tan)
- [tanh](modules.md#tanh)
- [vec](modules.md#vec)
- [write\_file](modules.md#write_file)
## Type aliases
### brush\_callback
Ƭ **brush\_callback**: [*callback*](modules.md#callback)<(`brush`: [*script\_brush*](classes/script_brush.md), `event`: [*script\_brush\_event*](classes/script_brush_event.md)) => *void*\>
The type of callback used for brush events.
**`note`** In lua, the first argument becomes "self" argument if using colon notation
___
### callback
Ƭ **callback**<T\>: T \| [*nil*](modules.md#nil)
Callback functions are unassigned by default, but may be assigned to
by the user
#### Type parameters:
Name |
:------ |
`T` |
___
### nil
Ƭ **nil**: *undefined*
This is the documentation for the Noggit scripting API.
Functions not connected to a class are global and can be called from
anywhere in a script.
## Variables
### procedures
`Const` **procedures**: [*procedures\_class*](classes/procedures_class.md)
singleton
## Functions
### abs
**abs**(`arg`: *number*): *any*
#### Parameters:
Name | Type |
:------ | :------ |
`arg` | *number* |
**Returns:** *any*
___
### acos
**acos**(`a`: *number*): *any*
#### Parameters:
Name | Type |
:------ | :------ |
`a` | *number* |
**Returns:** *any*
___
### acosh
**acosh**(`a`: *number*): *any*
#### Parameters:
Name | Type |
:------ | :------ |
`a` | *number* |
**Returns:** *any*
___
### add\_m2
**add_m2**(`filename`: *string*, `pos`: [*vector\_3d*](classes/vector_3d.md), `scale`: *number*, `rotation`: [*vector\_3d*](classes/vector_3d.md)): *void*
Spawns an m2 model in the world.
#### Parameters:
Name | Type |
:------ | :------ |
`filename` | *string* |
`pos` | [*vector\_3d*](classes/vector_3d.md) |
`scale` | *number* |
`rotation` | [*vector\_3d*](classes/vector_3d.md) |
**Returns:** *void*
___
### add\_wmo
**add_wmo**(`filename`: *string*, `pos`: [*vector\_3d*](classes/vector_3d.md), `rot`: [*vector\_3d*](classes/vector_3d.md)): *void*
Spawns a wmo model in the world.
**`note`** wmo models cannot be scaled.
#### Parameters:
Name | Type |
:------ | :------ |
`filename` | *string* |
`pos` | [*vector\_3d*](classes/vector_3d.md) |
`rot` | [*vector\_3d*](classes/vector_3d.md) |
**Returns:** *void*
___
### append\_file
**append_file**(`file`: *string*, `content`: *string*): *void*
Appends text to a file
**`note`** This operation REQUIRES explicit permission from the user,
or it will throw an error.
#### Parameters:
Name | Type |
:------ | :------ |
`file` | *string* |
`content` | *string* |
**Returns:** *void*
___
### asin
**asin**(`a`: *number*): *any*
#### Parameters:
Name | Type |
:------ | :------ |
`a` | *number* |
**Returns:** *any*
___
### asinh
**asinh**(`a`: *number*): *any*
#### Parameters:
Name | Type |
:------ | :------ |
`a` | *number* |
**Returns:** *any*
___
### atan
**atan**(`a`: *number*): *any*
#### Parameters:
Name | Type |
:------ | :------ |
`a` | *number* |
**Returns:** *any*
___
### atanh
**atanh**(`a`: *number*): *any*
#### Parameters:
Name | Type |
:------ | :------ |
`a` | *number* |
**Returns:** *any*
___
### brush
**brush**(`name`: *string*): [*script\_brush*](classes/script_brush.md)
Creates a new script brush
#### Parameters:
Name | Type |
:------ | :------ |
`name` | *string* |
**Returns:** [*script\_brush*](classes/script_brush.md)
___
### cam\_pitch
**cam_pitch**(): *number*
Returns the cameras pitch rotation (the one you almost NEVER want)
**Returns:** *number*
___
### cam\_yaw
**cam_yaw**(): *number*
Returns the cameras yaw rotation (the one you almost ALWAYS want)
**Returns:** *number*
___
### camera\_pos
**camera_pos**(): [*vector\_3d*](classes/vector_3d.md)
Returns the current camera position
**Returns:** [*vector\_3d*](classes/vector_3d.md)
___
### cbrt
**cbrt**(`a`: *number*): *any*
#### Parameters:
Name | Type |
:------ | :------ |
`a` | *number* |
**Returns:** *any*
___
### ceil
**ceil**(`a`: *number*): *any*
#### Parameters:
Name | Type |
:------ | :------ |
`a` | *number* |
**Returns:** *any*
___
### cos
**cos**(`a`: *number*): *any*
#### Parameters:
Name | Type |
:------ | :------ |
`a` | *number* |
**Returns:** *any*
___
### cosh
**cosh**(`a`: *number*): *any*
#### Parameters:
Name | Type |
:------ | :------ |
`a` | *number* |
**Returns:** *any*
___
### create\_image
**create_image**(`width`: *number*, `height`: *number*): [*image*](classes/image.md)
Creates a new blank image
#### Parameters:
Name | Type |
:------ | :------ |
`width` | *number* |
`height` | *number* |
**Returns:** [*image*](classes/image.md)
___
### dist\_2d
**dist_2d**(`from`: [*vector\_3d*](classes/vector_3d.md), `to`: [*vector\_3d*](classes/vector_3d.md)): *any*
Returns the 2d distance (ignoring y) between two vectors
#### Parameters:
Name | Type |
:------ | :------ |
`from` | [*vector\_3d*](classes/vector_3d.md) |
`to` | [*vector\_3d*](classes/vector_3d.md) |
**Returns:** *any*
___
### dist\_2d\_compare
**dist_2d_compare**(`from`: [*vector\_3d*](classes/vector_3d.md), `to`: [*vector\_3d*](classes/vector_3d.md), `dist`: *number*): *number*
Compares the 2d distance (ignoring y value) between two vectors to a given distance.
This operation is significantly faster than manually comparing to the result of dist_2d
#### Parameters:
Name | Type |
:------ | :------ |
`from` | [*vector\_3d*](classes/vector_3d.md) |
`to` | [*vector\_3d*](classes/vector_3d.md) |
`dist` | *number* |
**Returns:** *number*
___
### exp
**exp**(`a`: *number*): *any*
#### Parameters:
Name | Type |
:------ | :------ |
`a` | *number* |
**Returns:** *any*
___
### floor
**floor**(`a`: *number*): *any*
#### Parameters:
Name | Type |
:------ | :------ |
`a` | *number* |
**Returns:** *any*
___
### get\_area\_id
**get_area_id**(`pos`: [*vector\_3d*](classes/vector_3d.md)): *number*
Returns the area id at a specific position.
The 'y' value is ignored for this operation.
#### Parameters:
Name | Type |
:------ | :------ |
`pos` | [*vector\_3d*](classes/vector_3d.md) |
**Returns:** *number*
___
### get\_chunk
**get_chunk**(`position`: [*vector\_3d*](classes/vector_3d.md)): [*chunk*](classes/chunk.md)
Returns the chunk at a given position.
The tile at the position must be loaded into memory for the
operation to be successful.
#### Parameters:
Name | Type |
:------ | :------ |
`position` | [*vector\_3d*](classes/vector_3d.md) |
**Returns:** [*chunk*](classes/chunk.md)
___
### get\_map\_id
**get_map_id**(): *number*
Returns the id of the currently open map
**Returns:** *number*
___
### holding\_alt
**holding_alt**(): *boolean*
Returns true if the user is currently pressing the alt key
**Returns:** *boolean*
___
### holding\_ctrl
**holding_ctrl**(): *boolean*
Returns true if the user is currently pressing the ctrl key
**Returns:** *boolean*
___
### holding\_left\_mouse
**holding_left_mouse**(): *boolean*
Returns true if the user is currently pressing the left mouse button
**Returns:** *boolean*
___
### holding\_right\_mouse
**holding_right_mouse**(): *boolean*
Returns true if the user is currently pressing the right mouse button
**Returns:** *boolean*
___
### holding\_shift
**holding_shift**(): *boolean*
Returns true if the user is currently pressing the shift key
**Returns:** *boolean*
___
### holding\_space
**holding_space**(): *boolean*
Returns true if the user is currently pressing the spacebar
**Returns:** *boolean*
___
### lerp
**lerp**(`from`: *number*, `to`: *number*, `ratio`: *number*): *number*
Returns the value at some percentage between two values.
#### Parameters:
Name | Type | Description |
:------ | :------ | :------ |
`from` | *number* | the minimum range value |
`to` | *number* | the maximum range value |
`ratio` | *number* | the percentage to take (typically between 0-1) |
**Returns:** *number*
___
### load\_png
**load_png**(`path`: *string*): [*image*](classes/image.md)
Loads a png file into an in-memory image.
#### Parameters:
Name | Type |
:------ | :------ |
`path` | *string* |
**Returns:** [*image*](classes/image.md)
___
### log
**log**(`a`: *number*): *any*
#### Parameters:
Name | Type |
:------ | :------ |
`a` | *number* |
**Returns:** *any*
___
### log10
**log10**(`a`: *number*): *any*
#### Parameters:
Name | Type |
:------ | :------ |
`a` | *number* |
**Returns:** *any*
___
### make\_noise
**make_noise**(`start_x`: *number*, `start_y`: *number*, `width`: *number*, `height`: *number*, `frequency`: *number*, `algorithm`: *string*, `seed`: *string*): *any*
Creates a new noisemap
#### Parameters:
Name | Type |
:------ | :------ |
`start_x` | *number* |
`start_y` | *number* |
`width` | *number* |
`height` | *number* |
`frequency` | *number* |
`algorithm` | *string* |
`seed` | *string* |
**Returns:** *any*
___
### path\_exists
**path_exists**(`path`: *string*): *boolean*
Returns true if a pathname exists already
#### Parameters:
Name | Type |
:------ | :------ |
`path` | *string* |
**Returns:** *boolean*
___
### pow
**pow**(`a1`: *number*, `a2`: *number*): *any*
#### Parameters:
Name | Type |
:------ | :------ |
`a1` | *number* |
`a2` | *number* |
**Returns:** *any*
___
### print
**print**(): *void*
**Returns:** *void*
**print**(...`args`: *any*[]): *any*
Prints out a message to the script window.
(sometimes, with errors, print messages will be suppressed)
#### Parameters:
Name | Type |
:------ | :------ |
`...args` | *any*[] |
**Returns:** *any*
___
### random\_from\_seed
**random_from_seed**(`seed`: *string*): [*random*](classes/random.md)
Creates a new random generator from a specific seed.
#### Parameters:
Name | Type |
:------ | :------ |
`seed` | *string* |
**Returns:** [*random*](classes/random.md)
___
### random\_from\_time
**random_from_time**(): [*random*](classes/random.md)
Creates a new random generator from the current system time.
**Returns:** [*random*](classes/random.md)
___
### read\_file
**read_file**(`file`: *string*): *string*
Reads a file from the file system.
**`note`** This operation does NOT require explicit permission from the user.
#### Parameters:
Name | Type |
:------ | :------ |
`file` | *string* |
**Returns:** *string*
___
### rotate\_2d
**rotate_2d**(`point`: [*vector\_3d*](classes/vector_3d.md), `origin`: [*vector\_3d*](classes/vector_3d.md), `angle`: *number*): [*vector\_3d*](classes/vector_3d.md)
Returns a 3d point around an origin, ignoring the y value.
#### Parameters:
Name | Type |
:------ | :------ |
`point` | [*vector\_3d*](classes/vector_3d.md) |
`origin` | [*vector\_3d*](classes/vector_3d.md) |
`angle` | *number* |
**Returns:** [*vector\_3d*](classes/vector_3d.md)
___
### round
**round**(`a`: *number*): *any*
#### Parameters:
Name | Type |
:------ | :------ |
`a` | *number* |
**Returns:** *any*
___
### select\_between
**select_between**(`point1`: [*vector\_3d*](classes/vector_3d.md), `point2`: [*vector\_3d*](classes/vector_3d.md)): [*selection*](classes/selection.md)
Makes and returns a rectangular selection between two points.
#### Parameters:
Name | Type |
:------ | :------ |
`point1` | [*vector\_3d*](classes/vector_3d.md) |
`point2` | [*vector\_3d*](classes/vector_3d.md) |
**Returns:** [*selection*](classes/selection.md)
___
### select\_origin
**select_origin**(`origin`: [*vector\_3d*](classes/vector_3d.md), `xRadius`: *number*, `zRadius`: *number*): [*selection*](classes/selection.md)
Makes and returns a rectangular selection around an origin point
#### Parameters:
Name | Type | Description |
:------ | :------ | :------ |
`origin` | [*vector\_3d*](classes/vector_3d.md) | The center point of the selection |
`xRadius` | *number* | |
`zRadius` | *number* | |
**Returns:** [*selection*](classes/selection.md)
selection
___
### sin
**sin**(`a`: *number*): *any*
#### Parameters:
Name | Type |
:------ | :------ |
`a` | *number* |
**Returns:** *any*
___
### sinh
**sinh**(`a`: *number*): *any*
#### Parameters:
Name | Type |
:------ | :------ |
`a` | *number* |
**Returns:** *any*
___
### sqrt
**sqrt**(`arg`: *number*): *any*
#### Parameters:
Name | Type |
:------ | :------ |
`arg` | *number* |
**Returns:** *any*
___
### tan
**tan**(`a`: *number*): *any*
#### Parameters:
Name | Type |
:------ | :------ |
`a` | *number* |
**Returns:** *any*
___
### tanh
**tanh**(`a`: *number*): *any*
#### Parameters:
Name | Type |
:------ | :------ |
`a` | *number* |
**Returns:** *any*
___
### vec
**vec**(`x`: *number*, `y`: *number*, `z`: *number*): [*vector\_3d*](classes/vector_3d.md)
Creates a new vector from its components
#### Parameters:
Name | Type |
:------ | :------ |
`x` | *number* |
`y` | *number* |
`z` | *number* |
**Returns:** [*vector\_3d*](classes/vector_3d.md)
___
### write\_file
**write_file**(`file`: *string*, `content`: *string*): *void*
Writes text to a file
**`note`** This operation REQUIRES explicit permission from the user,
or it will throw an error.
#### Parameters:
Name | Type |
:------ | :------ |
`file` | *string* |
`content` | *string* |
**Returns:** *void*