@tlua/gmod 1.0.4 → 1.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/types/achievements.d.tlua +15 -45
- package/types/ai.d.tlua +5 -15
- package/types/angle.d.tlua +18 -54
- package/types/baseclass.d.tlua +2 -4
- package/types/bf_read.d.tlua +11 -32
- package/types/bit.d.tlua +11 -33
- package/types/cam.d.tlua +16 -48
- package/types/ceffectdata.d.tlua +32 -95
- package/types/chat.d.tlua +5 -15
- package/types/cleanup.d.tlua +7 -21
- package/types/cluaemitter.d.tlua +12 -35
- package/types/clualocomotion.d.tlua +40 -119
- package/types/cluaparticle.d.tlua +44 -131
- package/types/cmovedata.d.tlua +47 -140
- package/types/cnavarea.d.tlua +77 -230
- package/types/cnavladder.d.tlua +22 -65
- package/types/cnewparticleeffect.d.tlua +26 -77
- package/types/color.d.tlua +28 -84
- package/types/concommand.d.tlua +4 -12
- package/types/constraint.d.tlua +28 -84
- package/types/construct.d.tlua +1 -3
- package/types/contentheader.d.tlua +3 -6
- package/types/contenticon.d.tlua +9 -24
- package/types/contentsidebar.d.tlua +4 -9
- package/types/contextbase.d.tlua +4 -9
- package/types/controlpanel.d.tlua +18 -40
- package/types/controlpresets.d.tlua +13 -36
- package/types/convar.d.tlua +16 -47
- package/types/cookie.d.tlua +3 -9
- package/types/coroutine.d.tlua +7 -21
- package/types/crecipientfilter.d.tlua +16 -47
- package/types/csoundpatch.d.tlua +14 -41
- package/types/ctakedamageinfo.d.tlua +33 -98
- package/types/ctrlnumpad.d.tlua +6 -17
- package/types/cusercmd.d.tlua +27 -80
- package/types/cvars.d.tlua +6 -18
- package/types/dadjustablemodelpanel.d.tlua +7 -18
- package/types/dalphabar.d.tlua +3 -6
- package/types/dbinder.d.tlua +4 -9
- package/types/dbubblecontainer.d.tlua +2 -3
- package/types/dbutton.d.tlua +8 -21
- package/types/dcheckbox.d.tlua +5 -12
- package/types/dcheckboxlabel.d.tlua +9 -27
- package/types/dcollapsiblecategory.d.tlua +23 -66
- package/types/dcolorbutton.d.tlua +7 -18
- package/types/dcolorcombo.d.tlua +5 -12
- package/types/dcolorcube.d.tlua +13 -36
- package/types/dcolormixer.d.tlua +27 -78
- package/types/dcolorpalette.d.tlua +23 -66
- package/types/dcolumnsheet.d.tlua +5 -12
- package/types/dcombobox.d.tlua +17 -48
- package/types/ddragbase.d.tlua +13 -36
- package/types/ddrawer.d.tlua +8 -21
- package/types/debug.d.tlua +44 -76
- package/types/debugoverlay.d.tlua +11 -33
- package/types/dentityproperties.d.tlua +5 -12
- package/types/derma.d.tlua +10 -30
- package/types/dexpandbutton.d.tlua +3 -6
- package/types/dfilebrowser.d.tlua +20 -60
- package/types/dform.d.tlua +18 -51
- package/types/dframe.d.tlua +24 -72
- package/types/dgrid.d.tlua +11 -30
- package/types/dhorizontaldivider.d.tlua +20 -57
- package/types/dhorizontalscroller.d.tlua +11 -30
- package/types/dhscrollbar.d.tlua +11 -30
- package/types/dhtml.d.tlua +8 -21
- package/types/dhtmlcontrols.d.tlua +5 -15
- package/types/diconbrowser.d.tlua +11 -30
- package/types/diconlayout.d.tlua +18 -51
- package/types/dimage.d.tlua +20 -55
- package/types/dimagebutton.d.tlua +9 -27
- package/types/dlabel.d.tlua +33 -96
- package/types/dlabeleditable.d.tlua +5 -12
- package/types/dlabelurl.d.tlua +10 -27
- package/types/dlistbox.d.tlua +8 -21
- package/types/dlistboxitem.d.tlua +4 -9
- package/types/dlistview.d.tlua +34 -99
- package/types/dlistview_column.d.tlua +14 -39
- package/types/dlistview_line.d.tlua +13 -36
- package/types/dmenu.d.tlua +28 -75
- package/types/dmenubar.d.tlua +6 -11
- package/types/dmenuoption.d.tlua +13 -36
- package/types/dmenuoptioncvar.d.tlua +6 -15
- package/types/dmodelpanel.d.tlua +22 -63
- package/types/dmodelselect.d.tlua +2 -3
- package/types/dmodelselectmulti.d.tlua +2 -3
- package/types/dnotify.d.tlua +10 -27
- package/types/dnumberscratch.d.tlua +26 -75
- package/types/dnumberwang.d.tlua +16 -45
- package/types/dnumslider.d.tlua +17 -51
- package/types/dpanel.d.tlua +14 -39
- package/types/dpanellist.d.tlua +11 -33
- package/types/dpaneloverlay.d.tlua +7 -18
- package/types/dpanpanel.d.tlua +6 -15
- package/types/dprogress.d.tlua +3 -6
- package/types/dproperties.d.tlua +4 -9
- package/types/dproperty_combo.d.tlua +3 -6
- package/types/dproperty_generic.d.tlua +5 -12
- package/types/dpropertysheet.d.tlua +26 -56
- package/types/dragndrop.d.tlua +10 -30
- package/types/draw.d.tlua +11 -31
- package/types/drgbpicker.d.tlua +4 -9
- package/types/drive.d.tlua +18 -41
- package/types/dscrollpanel.d.tlua +10 -30
- package/types/dshape.d.tlua +7 -18
- package/types/dsizetocontents.d.tlua +5 -12
- package/types/dslider.d.tlua +28 -81
- package/types/dsprite.d.tlua +9 -24
- package/types/dtab.d.tlua +8 -21
- package/types/dtextentry.d.tlua +43 -126
- package/types/dtilelayout.d.tlua +21 -60
- package/types/dtooltip.d.tlua +6 -15
- package/types/dtree.d.tlua +16 -45
- package/types/dtree_node.d.tlua +68 -201
- package/types/duplicator.d.tlua +30 -88
- package/types/dverticaldivider.d.tlua +23 -66
- package/types/dvscrollbar.d.tlua +11 -30
- package/types/effect.d.tlua +4 -9
- package/types/effects.d.tlua +6 -18
- package/types/engine.d.tlua +21 -63
- package/types/entity.d.tlua +676 -1962
- package/types/ents.d.tlua +23 -61
- package/types/file.d.tlua +39 -117
- package/types/frame_blend.d.tlua +7 -21
- package/types/game.d.tlua +39 -117
- package/types/gameevent.d.tlua +4 -8
- package/types/gamemode.d.tlua +3 -7
- package/types/gm.d.tlua +267 -800
- package/types/gmsave.d.tlua +4 -12
- package/types/gui.d.tlua +21 -63
- package/types/gwen.d.tlua +3 -9
- package/types/halo.d.tlua +2 -6
- package/types/hook.d.tlua +4 -12
- package/types/http.d.tlua +1 -3
- package/types/iconeditor.d.tlua +11 -30
- package/types/igmodaudiochannel.d.tlua +41 -122
- package/types/imagecheckbox.d.tlua +4 -9
- package/types/imaterial.d.tlua +26 -77
- package/types/imesh.d.tlua +5 -14
- package/types/input.d.tlua +24 -68
- package/types/irestore.d.tlua +9 -26
- package/types/isave.d.tlua +9 -26
- package/types/itexture.d.tlua +10 -29
- package/types/ivideowriter.d.tlua +5 -14
- package/types/jit.d.tlua +21 -53
- package/types/killicon.d.tlua +7 -21
- package/types/language.d.tlua +1 -3
- package/types/list.d.tlua +8 -24
- package/types/markup.d.tlua +2 -6
- package/types/markupobject.d.tlua +5 -14
- package/types/math.d.tlua +277 -447
- package/types/matproxy.d.tlua +3 -9
- package/types/matselect.d.tlua +11 -30
- package/types/menubar.d.tlua +2 -6
- package/types/mesh.d.tlua +19 -57
- package/types/motionsensor.d.tlua +10 -30
- package/types/navmesh.d.tlua +26 -78
- package/types/net.d.tlua +52 -154
- package/types/nextbot.d.tlua +46 -116
- package/types/notification.d.tlua +2 -6
- package/types/npc.d.tlua +182 -543
- package/types/numpad.d.tlua +7 -21
- package/types/os.d.tlua +4 -10
- package/types/panel.d.tlua +333 -991
- package/types/pathfollower.d.tlua +31 -92
- package/types/permissions.d.tlua +6 -18
- package/types/physcollide.d.tlua +3 -8
- package/types/physenv.d.tlua +11 -33
- package/types/physobj.d.tlua +78 -233
- package/types/player.d.tlua +302 -880
- package/types/player_manager.d.tlua +13 -39
- package/types/presets.d.tlua +6 -18
- package/types/projectedtexture.d.tlua +48 -143
- package/types/properties.d.tlua +5 -15
- package/types/propselect.d.tlua +5 -12
- package/types/render.d.tlua +142 -426
- package/types/resource.d.tlua +2 -6
- package/types/sandbox.d.tlua +54 -159
- package/types/saverestore.d.tlua +12 -36
- package/types/schedule.d.tlua +6 -17
- package/types/scripted_ents.d.tlua +11 -29
- package/types/search.d.tlua +1 -3
- package/types/serverlist.d.tlua +7 -21
- package/types/sound.d.tlua +10 -30
- package/types/spawnicon.d.tlua +8 -21
- package/types/spawnmenu.d.tlua +24 -70
- package/types/spawnmenucontentpanel.d.tlua +5 -12
- package/types/sql.d.tlua +9 -27
- package/types/stack.d.tlua +5 -14
- package/types/steamworks.d.tlua +18 -54
- package/types/string.d.tlua +49 -141
- package/types/surface.d.tlua +34 -102
- package/types/surfaceinfo.d.tlua +5 -14
- package/types/system.d.tlua +10 -30
- package/types/table.d.tlua +47 -137
- package/types/task.d.tlua +9 -26
- package/types/team.d.tlua +19 -57
- package/types/timer.d.tlua +14 -42
- package/types/tool.d.tlua +46 -131
- package/types/ugcpublishwindow.d.tlua +9 -24
- package/types/umsg.d.tlua +12 -36
- package/types/undo.d.tlua +10 -30
- package/types/usermessage.d.tlua +2 -6
- package/types/utf8.d.tlua +7 -21
- package/types/util.d.tlua +94 -274
- package/types/vector.d.tlua +36 -108
- package/types/vehicle.d.tlua +52 -149
- package/types/vgui.d.tlua +18 -46
- package/types/vmatrix.d.tlua +35 -105
- package/types/weapon.d.tlua +85 -248
- package/types/weapons.d.tlua +6 -16
- package/types/widgets.d.tlua +1 -3
- package/types/workshopfilebase.d.tlua +5 -14
package/types/math.d.tlua
CHANGED
|
@@ -40,31 +40,18 @@
|
|
|
40
40
|
*/
|
|
41
41
|
interface MathLib {
|
|
42
42
|
ease: MatheaseLib;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* The math library is a standard Lua library that provides functions for manipulating numbers. In Garry's Mod several additional math functions have been added.
|
|
47
|
-
* @source https://wiki.facepunch.com/gmod/math
|
|
48
|
-
*/
|
|
49
|
-
interface MathLib {
|
|
50
43
|
/**
|
|
51
44
|
* Calculates the difference between two angles.
|
|
52
45
|
* @realm shared and menu
|
|
53
46
|
* @source https://wiki.facepunch.com/gmod/math.AngleDifference
|
|
54
47
|
*/
|
|
55
48
|
AngleDifference(a: number, b: number): number;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
interface MathLib {
|
|
59
49
|
/**
|
|
60
50
|
* Gradually approaches the target value by the specified amount.
|
|
61
51
|
* @realm shared and menu
|
|
62
52
|
* @source https://wiki.facepunch.com/gmod/math.Approach
|
|
63
53
|
*/
|
|
64
54
|
Approach(current: number, target: number, change: number): number;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
interface MathLib {
|
|
68
55
|
/**
|
|
69
56
|
* Increments an angle towards another by specified rate.
|
|
70
57
|
*
|
|
@@ -75,45 +62,30 @@ interface MathLib {
|
|
|
75
62
|
* @source https://wiki.facepunch.com/gmod/math.ApproachAngle
|
|
76
63
|
*/
|
|
77
64
|
ApproachAngle(currentAngle: number, targetAngle: number, rate: number): number;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
interface MathLib {
|
|
81
65
|
/**
|
|
82
66
|
* Basic code for Bézier-Spline algorithm.
|
|
83
67
|
* @realm shared and menu
|
|
84
68
|
* @source https://wiki.facepunch.com/gmod/math.BSplinePoint
|
|
85
69
|
*/
|
|
86
70
|
BSplinePoint(fraction: number, points: table, fractionMax: number): Vector;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
interface MathLib {
|
|
90
71
|
/**
|
|
91
72
|
* Converts a binary string into a number.
|
|
92
73
|
* @realm shared and menu
|
|
93
74
|
* @source https://wiki.facepunch.com/gmod/math.BinToInt
|
|
94
75
|
*/
|
|
95
76
|
BinToInt(string: string): number;
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
interface MathLib {
|
|
99
77
|
/**
|
|
100
78
|
* Cubic Hermite spline algorithm.
|
|
101
79
|
* @realm shared and menu
|
|
102
80
|
* @source https://wiki.facepunch.com/gmod/math.CHSpline
|
|
103
81
|
*/
|
|
104
82
|
CHSpline(frac: number, point0: Vector, tan0: Vector, point1: Vector, tan1: Vector): Vector;
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
interface MathLib {
|
|
108
83
|
/**
|
|
109
84
|
* Clamps a number between a minimum and maximum value.
|
|
110
85
|
* @realm shared and menu
|
|
111
86
|
* @source https://wiki.facepunch.com/gmod/math.Clamp
|
|
112
87
|
*/
|
|
113
88
|
Clamp(input: number, min: number, max: number): number;
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
interface MathLib {
|
|
117
89
|
/**
|
|
118
90
|
* Lerp point between 4 control points with cubic bezier.
|
|
119
91
|
*
|
|
@@ -123,9 +95,6 @@ interface MathLib {
|
|
|
123
95
|
* @source https://wiki.facepunch.com/gmod/math.CubicBezier
|
|
124
96
|
*/
|
|
125
97
|
CubicBezier(frac: number, p0: Vector, p1: Vector, p2: Vector, p3: Vector): Vector;
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
interface MathLib {
|
|
129
98
|
/**
|
|
130
99
|
* Returns the difference between two points in 2D space. Alias of [math.Distance](https://wiki.facepunch.com/gmod/math.Distance).
|
|
131
100
|
*
|
|
@@ -134,18 +103,12 @@ interface MathLib {
|
|
|
134
103
|
* @deprecated You should use math.Distance instead
|
|
135
104
|
*/
|
|
136
105
|
Dist(x1: number, y1: number, x2: number, y2: number): number;
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
interface MathLib {
|
|
140
106
|
/**
|
|
141
107
|
* Returns the difference between two points in 2D space.
|
|
142
108
|
* @realm shared and menu
|
|
143
109
|
* @source https://wiki.facepunch.com/gmod/math.Distance
|
|
144
110
|
*/
|
|
145
111
|
Distance(x1: number, y1: number, x2: number, y2: number): number;
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
interface MathLib {
|
|
149
112
|
/**
|
|
150
113
|
* Returns the squared difference between two points in 2D space. This is computationally faster than [math.Distance](https://wiki.facepunch.com/gmod/math.Distance).
|
|
151
114
|
*
|
|
@@ -153,36 +116,24 @@ interface MathLib {
|
|
|
153
116
|
* @source https://wiki.facepunch.com/gmod/math.DistanceSqr
|
|
154
117
|
*/
|
|
155
118
|
DistanceSqr(x1: number, y1: number, x2: number, y2: number): number;
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
interface MathLib {
|
|
159
119
|
/**
|
|
160
120
|
* Calculates the progress of a value fraction, taking in to account given easing fractions
|
|
161
121
|
* @realm shared and menu
|
|
162
122
|
* @source https://wiki.facepunch.com/gmod/math.EaseInOut
|
|
163
123
|
*/
|
|
164
124
|
EaseInOut(progress: number, easeIn?: number, easeOut?: number): number;
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
interface MathLib {
|
|
168
125
|
/**
|
|
169
126
|
* Simple function that calculates [factorial](https://en.wikipedia.org/wiki/Factorial) of a whole number.
|
|
170
127
|
* @realm shared and menu
|
|
171
128
|
* @source https://wiki.facepunch.com/gmod/math.Factorial
|
|
172
129
|
*/
|
|
173
130
|
Factorial(val_in: number): number;
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
interface MathLib {
|
|
177
131
|
/**
|
|
178
132
|
* Converts an integer to a binary (base-2) string.
|
|
179
133
|
* @realm shared and menu
|
|
180
134
|
* @source https://wiki.facepunch.com/gmod/math.IntToBin
|
|
181
135
|
*/
|
|
182
136
|
IntToBin(int: number): string;
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
interface MathLib {
|
|
186
137
|
/**
|
|
187
138
|
* Checks if two floating point numbers are nearly equal.
|
|
188
139
|
*
|
|
@@ -193,18 +144,12 @@ interface MathLib {
|
|
|
193
144
|
* @source https://wiki.facepunch.com/gmod/math.IsNearlyEqual
|
|
194
145
|
*/
|
|
195
146
|
IsNearlyEqual(a: number, b: number, tolerance?: number): boolean;
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
interface MathLib {
|
|
199
147
|
/**
|
|
200
148
|
* Normalizes angle, so it returns value between -180 and 180.
|
|
201
149
|
* @realm shared and menu
|
|
202
150
|
* @source https://wiki.facepunch.com/gmod/math.NormalizeAngle
|
|
203
151
|
*/
|
|
204
152
|
NormalizeAngle(angle: number): number;
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
interface MathLib {
|
|
208
153
|
/**
|
|
209
154
|
* Lerp point between 3 control points with quadratic bezier.
|
|
210
155
|
*
|
|
@@ -214,9 +159,6 @@ interface MathLib {
|
|
|
214
159
|
* @source https://wiki.facepunch.com/gmod/math.QuadraticBezier
|
|
215
160
|
*/
|
|
216
161
|
QuadraticBezier(frac: number, p0: Vector, p1: Vector, p2: Vector): Vector;
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
interface MathLib {
|
|
220
162
|
/**
|
|
221
163
|
* Returns a random float between min and max.
|
|
222
164
|
*
|
|
@@ -226,27 +168,18 @@ interface MathLib {
|
|
|
226
168
|
* @source https://wiki.facepunch.com/gmod/math.Rand
|
|
227
169
|
*/
|
|
228
170
|
Rand(min: number, max: number): number;
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
interface MathLib {
|
|
232
171
|
/**
|
|
233
172
|
* Remaps the value from one range to another
|
|
234
173
|
* @realm shared and menu
|
|
235
174
|
* @source https://wiki.facepunch.com/gmod/math.Remap
|
|
236
175
|
*/
|
|
237
176
|
Remap(value: number, inMin: number, inMax: number, outMin: number, outMax: number): number;
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
interface MathLib {
|
|
241
177
|
/**
|
|
242
178
|
* Rounds the given value to the nearest whole number or to the given decimal places.
|
|
243
179
|
* @realm shared and menu
|
|
244
180
|
* @source https://wiki.facepunch.com/gmod/math.Round
|
|
245
181
|
*/
|
|
246
182
|
Round(value: number, decimals?: number): number;
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
interface MathLib {
|
|
250
183
|
/**
|
|
251
184
|
* Returns the mathematical negative/positive sign of the input number.
|
|
252
185
|
*
|
|
@@ -254,72 +187,48 @@ interface MathLib {
|
|
|
254
187
|
* @source https://wiki.facepunch.com/gmod/math.Sign
|
|
255
188
|
*/
|
|
256
189
|
Sign(value: number): number;
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
interface MathLib {
|
|
260
190
|
/**
|
|
261
191
|
* Snaps a number to the closest multiplicative of given number. See also [Angle:SnapTo](https://wiki.facepunch.com/gmod/Angle:SnapTo).
|
|
262
192
|
* @realm shared and menu
|
|
263
193
|
* @source https://wiki.facepunch.com/gmod/math.SnapTo
|
|
264
194
|
*/
|
|
265
195
|
SnapTo(input: number, snapTo: number): number;
|
|
266
|
-
}
|
|
267
|
-
|
|
268
|
-
interface MathLib {
|
|
269
196
|
/**
|
|
270
197
|
* Returns the fraction of where the current time is relative to the start and end times
|
|
271
198
|
* @realm shared and menu
|
|
272
199
|
* @source https://wiki.facepunch.com/gmod/math.TimeFraction
|
|
273
200
|
*/
|
|
274
201
|
TimeFraction(start: number, _end: number, current: number): number;
|
|
275
|
-
}
|
|
276
|
-
|
|
277
|
-
interface MathLib {
|
|
278
202
|
/**
|
|
279
203
|
* Trim unwanted decimal places.
|
|
280
204
|
* @realm shared and menu
|
|
281
205
|
* @source https://wiki.facepunch.com/gmod/math.Truncate
|
|
282
206
|
*/
|
|
283
207
|
Truncate(num: number, digits?: number): number;
|
|
284
|
-
}
|
|
285
|
-
|
|
286
|
-
interface MathLib {
|
|
287
208
|
/**
|
|
288
209
|
* Calculates the absolute value of a number (effectively removes any negative sign).
|
|
289
210
|
* @realm shared and menu
|
|
290
211
|
* @source https://wiki.facepunch.com/gmod/math.abs
|
|
291
212
|
*/
|
|
292
213
|
abs(x: number): number;
|
|
293
|
-
}
|
|
294
|
-
|
|
295
|
-
interface MathLib {
|
|
296
214
|
/**
|
|
297
215
|
* Returns the [arccosine](https://en.wikipedia.org/wiki/Arccosine) of the given number.
|
|
298
216
|
* @realm shared and menu
|
|
299
217
|
* @source https://wiki.facepunch.com/gmod/math.acos
|
|
300
218
|
*/
|
|
301
219
|
acos(cos: number): number;
|
|
302
|
-
}
|
|
303
|
-
|
|
304
|
-
interface MathLib {
|
|
305
220
|
/**
|
|
306
221
|
* Returns the [arcsine](https://en.wikipedia.org/wiki/Inverse_trigonometric_functions) of the given number.
|
|
307
222
|
* @realm shared and menu
|
|
308
223
|
* @source https://wiki.facepunch.com/gmod/math.asin
|
|
309
224
|
*/
|
|
310
225
|
asin(normal: number): number;
|
|
311
|
-
}
|
|
312
|
-
|
|
313
|
-
interface MathLib {
|
|
314
226
|
/**
|
|
315
227
|
* Returns the [arctangent](https://en.wikipedia.org/wiki/Inverse_trigonometric_functions) of the given number.
|
|
316
228
|
* @realm shared and menu
|
|
317
229
|
* @source https://wiki.facepunch.com/gmod/math.atan
|
|
318
230
|
*/
|
|
319
231
|
atan(normal: number): number;
|
|
320
|
-
}
|
|
321
|
-
|
|
322
|
-
interface MathLib {
|
|
323
232
|
/**
|
|
324
233
|
* functions like [math.atan](https://wiki.facepunch.com/gmod/math.atan)(y / x), except it also takes into account the quadrant of the angle and so doesn't have a limited range of output.
|
|
325
234
|
*
|
|
@@ -330,9 +239,6 @@ interface MathLib {
|
|
|
330
239
|
* @source https://wiki.facepunch.com/gmod/math.atan2
|
|
331
240
|
*/
|
|
332
241
|
atan2(y: number, x: number): number;
|
|
333
|
-
}
|
|
334
|
-
|
|
335
|
-
interface MathLib {
|
|
336
242
|
/**
|
|
337
243
|
* **INTERNAL**: Use [math.BSplinePoint](https://wiki.facepunch.com/gmod/math.BSplinePoint) instead.
|
|
338
244
|
*
|
|
@@ -343,9 +249,6 @@ interface MathLib {
|
|
|
343
249
|
* @source https://wiki.facepunch.com/gmod/math.calcBSplineN
|
|
344
250
|
*/
|
|
345
251
|
calcBSplineN(i: number, k: number, t: number, tinc: number): number;
|
|
346
|
-
}
|
|
347
|
-
|
|
348
|
-
interface MathLib {
|
|
349
252
|
/**
|
|
350
253
|
* Ceils or rounds a number up.
|
|
351
254
|
*
|
|
@@ -354,234 +257,356 @@ interface MathLib {
|
|
|
354
257
|
* @source https://wiki.facepunch.com/gmod/math.ceil
|
|
355
258
|
*/
|
|
356
259
|
ceil(number: number): number;
|
|
357
|
-
}
|
|
358
|
-
|
|
359
|
-
interface MathLib {
|
|
360
260
|
/**
|
|
361
261
|
* Returns the [cosine](https://en.wikipedia.org/wiki/Trigonometric_functions#cos) of given angle.
|
|
362
262
|
* @realm shared and menu
|
|
363
263
|
* @source https://wiki.facepunch.com/gmod/math.cos
|
|
364
264
|
*/
|
|
365
265
|
cos(number: number): number;
|
|
366
|
-
}
|
|
367
|
-
|
|
368
|
-
interface MathLib {
|
|
369
266
|
/**
|
|
370
267
|
* Returns the [hyperbolic cosine](https://en.wikipedia.org/wiki/Cosh_(mathematical_function)) of the given angle.
|
|
371
268
|
* @realm shared and menu
|
|
372
269
|
* @source https://wiki.facepunch.com/gmod/math.cosh
|
|
373
270
|
*/
|
|
374
271
|
cosh(number: number): number;
|
|
375
|
-
}
|
|
376
|
-
|
|
377
|
-
interface MathLib {
|
|
378
272
|
/**
|
|
379
273
|
* Converts radians to degrees.
|
|
380
274
|
* @realm shared and menu
|
|
381
275
|
* @source https://wiki.facepunch.com/gmod/math.deg
|
|
382
276
|
*/
|
|
383
277
|
deg(radians: number): number;
|
|
384
|
-
}
|
|
385
|
-
|
|
386
|
-
interface MatheaseLib {
|
|
387
278
|
/**
|
|
388
|
-
*
|
|
389
|
-
* **NOTE**: This doesn't work properly when used with [Global.Lerp](https://wiki.facepunch.com/gmod/Global.Lerp) as it clamps the fraction between 0 and 1. Using your own version of [Global.Lerp](https://wiki.facepunch.com/gmod/Global.Lerp) that is unclamped would be necessary instead.
|
|
390
|
-
*
|
|
391
|
-
*
|
|
279
|
+
* Returns e to the power of the input.
|
|
392
280
|
* @realm shared and menu
|
|
393
|
-
* @source https://wiki.facepunch.com/gmod/math.
|
|
281
|
+
* @source https://wiki.facepunch.com/gmod/math.exp
|
|
394
282
|
*/
|
|
395
|
-
|
|
396
|
-
}
|
|
397
|
-
|
|
398
|
-
interface MatheaseLib {
|
|
283
|
+
exp(exponent: number): number;
|
|
399
284
|
/**
|
|
400
|
-
*
|
|
401
|
-
* **NOTE**: This doesn't work properly when used with [Global.Lerp](https://wiki.facepunch.com/gmod/Global.Lerp) as it clamps the fraction between 0 and 1. Using your own version of [Global.Lerp](https://wiki.facepunch.com/gmod/Global.Lerp) that is unclamped would be necessary instead.
|
|
402
|
-
*
|
|
285
|
+
* Floors or rounds a number down.
|
|
403
286
|
*
|
|
287
|
+
* See [math.ceil](https://wiki.facepunch.com/gmod/math.ceil) for the inverse of this function.
|
|
404
288
|
* @realm shared and menu
|
|
405
|
-
* @source https://wiki.facepunch.com/gmod/math.
|
|
406
|
-
*/
|
|
407
|
-
InBounce(fraction: number): number;
|
|
408
|
-
}
|
|
409
|
-
|
|
410
|
-
interface MatheaseLib {
|
|
411
|
-
/**
|
|
412
|
-
* Eases in using a circular function.
|
|
413
|
-
* @realm shared and menu
|
|
414
|
-
* @source https://wiki.facepunch.com/gmod/math.ease.InCirc
|
|
289
|
+
* @source https://wiki.facepunch.com/gmod/math.floor
|
|
415
290
|
*/
|
|
416
|
-
|
|
417
|
-
}
|
|
418
|
-
|
|
419
|
-
interface MatheaseLib {
|
|
291
|
+
floor(number: number): number;
|
|
420
292
|
/**
|
|
421
|
-
*
|
|
293
|
+
* Returns the modulus of the specified values.
|
|
294
|
+
*
|
|
295
|
+
* While this is similar to the `%` operator, **it will return a negative value if the first argument is negative**, whereas the % operator will return a **positive** value **even if the first operand is negative**.
|
|
296
|
+
*
|
|
297
|
+
* This function is also slower than the `%` operator.
|
|
298
|
+
*
|
|
422
299
|
* @realm shared and menu
|
|
423
|
-
* @source https://wiki.facepunch.com/gmod/math.
|
|
300
|
+
* @source https://wiki.facepunch.com/gmod/math.fmod
|
|
424
301
|
*/
|
|
425
|
-
|
|
426
|
-
}
|
|
427
|
-
|
|
428
|
-
interface MatheaseLib {
|
|
302
|
+
fmod(base: number, modulator: number): number;
|
|
429
303
|
/**
|
|
430
|
-
*
|
|
431
|
-
*
|
|
304
|
+
* **Lua reference description**: Returns `m` and `e` such that `x = m2e`, `e` is an integer and the absolute value of `m` is in the range ((0.5, 1) (or zero when x is zero).
|
|
305
|
+
*
|
|
306
|
+
* Used to split the number value into a normalized fraction and an exponent. Two values are returned: the first is a multiplier in the range `1/2` (**inclusive**) to `1` (**exclusive**) and the second is an integer exponent.
|
|
432
307
|
*
|
|
308
|
+
* The result is such that `x = m*2^e`.
|
|
433
309
|
*
|
|
434
310
|
* @realm shared and menu
|
|
435
|
-
* @source https://wiki.facepunch.com/gmod/math.
|
|
311
|
+
* @source https://wiki.facepunch.com/gmod/math.frexp
|
|
436
312
|
*/
|
|
437
|
-
|
|
438
|
-
}
|
|
439
|
-
|
|
440
|
-
interface MatheaseLib {
|
|
313
|
+
frexp(x: number): (number, number);
|
|
441
314
|
/**
|
|
442
|
-
*
|
|
315
|
+
* Takes a normalised number and returns the floating point representation.
|
|
316
|
+
*
|
|
317
|
+
* Effectively it returns the result of `normalizedFraction * 2.0 ^ exponent`. [math.frexp](https://wiki.facepunch.com/gmod/math.frexp) is the opposite function.
|
|
318
|
+
*
|
|
443
319
|
* @realm shared and menu
|
|
444
|
-
* @source https://wiki.facepunch.com/gmod/math.
|
|
320
|
+
* @source https://wiki.facepunch.com/gmod/math.ldexp
|
|
445
321
|
*/
|
|
446
|
-
|
|
447
|
-
}
|
|
448
|
-
|
|
449
|
-
interface MatheaseLib {
|
|
322
|
+
ldexp(normalizedFraction: number, exponent: number): number;
|
|
450
323
|
/**
|
|
451
|
-
*
|
|
452
|
-
* **NOTE**: This doesn't work properly when used with [Global.Lerp](https://wiki.facepunch.com/gmod/Global.Lerp) as it clamps the fraction between 0 and 1. Using your own version of [Global.Lerp](https://wiki.facepunch.com/gmod/Global.Lerp) that is unclamped would be necessary instead.
|
|
324
|
+
* With one argument, return the natural logarithm of x (to base e).
|
|
453
325
|
*
|
|
326
|
+
* With two arguments, return the logarithm of x to the given base, calculated as log(x)/log(base).
|
|
454
327
|
*
|
|
455
328
|
* @realm shared and menu
|
|
456
|
-
* @source https://wiki.facepunch.com/gmod/math.
|
|
329
|
+
* @source https://wiki.facepunch.com/gmod/math.log
|
|
457
330
|
*/
|
|
458
|
-
|
|
459
|
-
}
|
|
460
|
-
|
|
461
|
-
interface MatheaseLib {
|
|
331
|
+
log(x: number, base?: number): number;
|
|
462
332
|
/**
|
|
463
|
-
*
|
|
464
|
-
* **NOTE**: This doesn't work properly when used with [Global.Lerp](https://wiki.facepunch.com/gmod/Global.Lerp) as it clamps the fraction between 0 and 1. Using your own version of [Global.Lerp](https://wiki.facepunch.com/gmod/Global.Lerp) that is unclamped would be necessary instead.
|
|
465
|
-
*
|
|
466
|
-
*
|
|
333
|
+
* Returns the base-10 logarithm of x. This is usually more accurate than math.log(x, 10).
|
|
467
334
|
* @realm shared and menu
|
|
468
|
-
* @source https://wiki.facepunch.com/gmod/math.
|
|
335
|
+
* @source https://wiki.facepunch.com/gmod/math.log10
|
|
469
336
|
*/
|
|
470
|
-
|
|
471
|
-
}
|
|
472
|
-
|
|
473
|
-
interface MatheaseLib {
|
|
337
|
+
log10(x: number): number;
|
|
474
338
|
/**
|
|
475
|
-
*
|
|
339
|
+
* Returns the largest value of all arguments.
|
|
476
340
|
* @realm shared and menu
|
|
477
|
-
* @source https://wiki.facepunch.com/gmod/math.
|
|
341
|
+
* @source https://wiki.facepunch.com/gmod/math.max
|
|
478
342
|
*/
|
|
479
|
-
|
|
480
|
-
}
|
|
481
|
-
|
|
482
|
-
interface MatheaseLib {
|
|
343
|
+
max(...: any): number;
|
|
483
344
|
/**
|
|
484
|
-
*
|
|
345
|
+
* Returns the smallest value of all arguments.
|
|
485
346
|
* @realm shared and menu
|
|
486
|
-
* @source https://wiki.facepunch.com/gmod/math.
|
|
347
|
+
* @source https://wiki.facepunch.com/gmod/math.min
|
|
487
348
|
*/
|
|
488
|
-
|
|
489
|
-
}
|
|
490
|
-
|
|
491
|
-
interface MatheaseLib {
|
|
349
|
+
min(...: any): number;
|
|
492
350
|
/**
|
|
493
|
-
*
|
|
494
|
-
* **NOTE**: This doesn't work properly when used with [Global.Lerp](https://wiki.facepunch.com/gmod/Global.Lerp) as it clamps the fraction between 0 and 1. Using your own version of [Global.Lerp](https://wiki.facepunch.com/gmod/Global.Lerp) that is unclamped would be necessary instead.
|
|
495
|
-
*
|
|
351
|
+
* Returns the modulus of the specified values. Same as [math.fmod](https://wiki.facepunch.com/gmod/math.fmod).
|
|
496
352
|
*
|
|
497
353
|
* @realm shared and menu
|
|
498
|
-
* @source https://wiki.facepunch.com/gmod/math.
|
|
354
|
+
* @source https://wiki.facepunch.com/gmod/math.mod
|
|
355
|
+
* @deprecated This is removed in Lua versions later than what GMod is currently using. You should use the % operator or math.fmod instead.
|
|
499
356
|
*/
|
|
500
|
-
|
|
501
|
-
}
|
|
502
|
-
|
|
503
|
-
interface MatheaseLib {
|
|
357
|
+
mod(base: number, modulator: number): number;
|
|
504
358
|
/**
|
|
505
|
-
*
|
|
359
|
+
* Returns the integral and fractional component of the modulo operation.
|
|
506
360
|
* @realm shared and menu
|
|
507
|
-
* @source https://wiki.facepunch.com/gmod/math.
|
|
361
|
+
* @source https://wiki.facepunch.com/gmod/math.modf
|
|
508
362
|
*/
|
|
509
|
-
|
|
510
|
-
}
|
|
511
|
-
|
|
512
|
-
interface MatheaseLib {
|
|
363
|
+
modf(base: number): (number, number);
|
|
513
364
|
/**
|
|
514
|
-
*
|
|
365
|
+
* Returns x raised to the power y.
|
|
366
|
+
* In particular, math.pow(1.0, x) and math.pow(x, 0.0) always return 1.0, even when x is a zero or a [nan](https://wiki.facepunch.com/gmod/nan). If both x and y are finite, x is negative, and y is not an integer then math.pow(x, y) is undefined.
|
|
367
|
+
*
|
|
515
368
|
* @realm shared and menu
|
|
516
|
-
* @source https://wiki.facepunch.com/gmod/math.
|
|
369
|
+
* @source https://wiki.facepunch.com/gmod/math.pow
|
|
517
370
|
*/
|
|
518
|
-
|
|
519
|
-
}
|
|
520
|
-
|
|
521
|
-
interface MatheaseLib {
|
|
371
|
+
pow(x: number, y: number): number;
|
|
522
372
|
/**
|
|
523
|
-
*
|
|
373
|
+
* Converts an angle in degrees to it's equivalent in radians.
|
|
524
374
|
* @realm shared and menu
|
|
525
|
-
* @source https://wiki.facepunch.com/gmod/math.
|
|
375
|
+
* @source https://wiki.facepunch.com/gmod/math.rad
|
|
526
376
|
*/
|
|
527
|
-
|
|
377
|
+
rad(degrees: number): number;
|
|
378
|
+
/**
|
|
379
|
+
* When called without arguments, returns a uniform pseudo-random real number in the range 0 to 1 which includes 0 but excludes 1.
|
|
380
|
+
*
|
|
381
|
+
* When called with an integer number m, returns a uniform pseudo-random integer in the range 1 to m inclusive.
|
|
382
|
+
*
|
|
383
|
+
* When called with two integer numbers m and n, returns a uniform pseudo-random integer in the range m to n inclusive.
|
|
384
|
+
*
|
|
385
|
+
* See also [math.Rand](https://wiki.facepunch.com/gmod/math.Rand)
|
|
386
|
+
*
|
|
387
|
+
* @realm shared and menu
|
|
388
|
+
* @source https://wiki.facepunch.com/gmod/math.random
|
|
389
|
+
*/
|
|
390
|
+
random(m?: number, n?: number): number;
|
|
391
|
+
/**
|
|
392
|
+
* Seeds the random number generator. The same seed will guarantee the same sequence of numbers each time with [math.random](https://wiki.facepunch.com/gmod/math.random).
|
|
393
|
+
*
|
|
394
|
+
* For shared random values across predicted realms, use [util.SharedRandom](https://wiki.facepunch.com/gmod/util.SharedRandom).
|
|
395
|
+
*
|
|
396
|
+
* **WARNING**: Usage of this function affects **ALL** random numbers in the game. This means that improper use (such as setting the seed to a static value that doesn't change with time) can negatively affect other addons or the base game.
|
|
397
|
+
*
|
|
398
|
+
* It is a good idea to set the seed back to at least something like [Global.SysTime](https://wiki.facepunch.com/gmod/Global.SysTime) in those cases.
|
|
399
|
+
*
|
|
400
|
+
*
|
|
401
|
+
* @realm shared and menu
|
|
402
|
+
* @source https://wiki.facepunch.com/gmod/math.randomseed
|
|
403
|
+
*/
|
|
404
|
+
randomseed(seed: number): void;
|
|
405
|
+
/**
|
|
406
|
+
* Returns the [sine](https://en.wikipedia.org/wiki/Trigonometric_functions) of given angle.
|
|
407
|
+
* @realm shared and menu
|
|
408
|
+
* @source https://wiki.facepunch.com/gmod/math.sin
|
|
409
|
+
*/
|
|
410
|
+
sin(number: number): number;
|
|
411
|
+
/**
|
|
412
|
+
* Returns the [hyperbolic sine](https://en.wikipedia.org/wiki/Hyperbolic_functions) of the given angle.
|
|
413
|
+
* @realm shared and menu
|
|
414
|
+
* @source https://wiki.facepunch.com/gmod/math.sinh
|
|
415
|
+
*/
|
|
416
|
+
sinh(number: number): number;
|
|
417
|
+
/**
|
|
418
|
+
* Returns the square root of the number.
|
|
419
|
+
* @realm shared and menu
|
|
420
|
+
* @source https://wiki.facepunch.com/gmod/math.sqrt
|
|
421
|
+
*/
|
|
422
|
+
sqrt(value: number): number;
|
|
423
|
+
/**
|
|
424
|
+
* Returns the tangent of the given angle.
|
|
425
|
+
* @realm shared and menu
|
|
426
|
+
* @source https://wiki.facepunch.com/gmod/math.tan
|
|
427
|
+
*/
|
|
428
|
+
tan(value: number): number;
|
|
429
|
+
/**
|
|
430
|
+
* Returns the [hyperbolic tangent](https://en.wikipedia.org/wiki/Hyperbolic_functions) of the given number.
|
|
431
|
+
* @realm shared and menu
|
|
432
|
+
* @source https://wiki.facepunch.com/gmod/math.tanh
|
|
433
|
+
*/
|
|
434
|
+
tanh(number: number): number;
|
|
528
435
|
}
|
|
529
436
|
|
|
437
|
+
|
|
438
|
+
|
|
439
|
+
|
|
440
|
+
|
|
441
|
+
|
|
442
|
+
|
|
443
|
+
|
|
444
|
+
|
|
445
|
+
|
|
446
|
+
|
|
447
|
+
|
|
448
|
+
|
|
449
|
+
|
|
450
|
+
|
|
451
|
+
|
|
452
|
+
|
|
453
|
+
|
|
454
|
+
|
|
455
|
+
|
|
456
|
+
|
|
457
|
+
|
|
458
|
+
|
|
459
|
+
|
|
460
|
+
|
|
461
|
+
|
|
462
|
+
|
|
463
|
+
|
|
464
|
+
|
|
465
|
+
|
|
466
|
+
|
|
467
|
+
|
|
468
|
+
|
|
469
|
+
|
|
470
|
+
|
|
530
471
|
interface MatheaseLib {
|
|
472
|
+
/**
|
|
473
|
+
* Eases in by reversing the direction of the ease slightly before returning.
|
|
474
|
+
* **NOTE**: This doesn't work properly when used with [Global.Lerp](https://wiki.facepunch.com/gmod/Global.Lerp) as it clamps the fraction between 0 and 1. Using your own version of [Global.Lerp](https://wiki.facepunch.com/gmod/Global.Lerp) that is unclamped would be necessary instead.
|
|
475
|
+
*
|
|
476
|
+
*
|
|
477
|
+
* @realm shared and menu
|
|
478
|
+
* @source https://wiki.facepunch.com/gmod/math.ease.InBack
|
|
479
|
+
*/
|
|
480
|
+
InBack(fraction: number): number;
|
|
481
|
+
/**
|
|
482
|
+
* Eases in like a bouncy ball.
|
|
483
|
+
* **NOTE**: This doesn't work properly when used with [Global.Lerp](https://wiki.facepunch.com/gmod/Global.Lerp) as it clamps the fraction between 0 and 1. Using your own version of [Global.Lerp](https://wiki.facepunch.com/gmod/Global.Lerp) that is unclamped would be necessary instead.
|
|
484
|
+
*
|
|
485
|
+
*
|
|
486
|
+
* @realm shared and menu
|
|
487
|
+
* @source https://wiki.facepunch.com/gmod/math.ease.InBounce
|
|
488
|
+
*/
|
|
489
|
+
InBounce(fraction: number): number;
|
|
490
|
+
/**
|
|
491
|
+
* Eases in using a circular function.
|
|
492
|
+
* @realm shared and menu
|
|
493
|
+
* @source https://wiki.facepunch.com/gmod/math.ease.InCirc
|
|
494
|
+
*/
|
|
495
|
+
InCirc(fraction: number): number;
|
|
496
|
+
/**
|
|
497
|
+
* Eases in by cubing the fraction.
|
|
498
|
+
* @realm shared and menu
|
|
499
|
+
* @source https://wiki.facepunch.com/gmod/math.ease.InCubic
|
|
500
|
+
*/
|
|
501
|
+
InCubic(fraction: number): number;
|
|
502
|
+
/**
|
|
503
|
+
* Eases in like a rubber band.
|
|
504
|
+
* **NOTE**: This doesn't work properly when used with [Global.Lerp](https://wiki.facepunch.com/gmod/Global.Lerp) as it clamps the fraction between 0 and 1. Using your own version of [Global.Lerp](https://wiki.facepunch.com/gmod/Global.Lerp) that is unclamped would be necessary instead.
|
|
505
|
+
*
|
|
506
|
+
*
|
|
507
|
+
* @realm shared and menu
|
|
508
|
+
* @source https://wiki.facepunch.com/gmod/math.ease.InElastic
|
|
509
|
+
*/
|
|
510
|
+
InElastic(fraction: number): number;
|
|
511
|
+
/**
|
|
512
|
+
* Eases in using an exponential equation with a base of 2 and where the fraction is used in the exponent.
|
|
513
|
+
* @realm shared and menu
|
|
514
|
+
* @source https://wiki.facepunch.com/gmod/math.ease.InExpo
|
|
515
|
+
*/
|
|
516
|
+
InExpo(fraction: number): number;
|
|
517
|
+
/**
|
|
518
|
+
* Eases in and out by reversing the direction of the ease slightly before returning on both ends.
|
|
519
|
+
* **NOTE**: This doesn't work properly when used with [Global.Lerp](https://wiki.facepunch.com/gmod/Global.Lerp) as it clamps the fraction between 0 and 1. Using your own version of [Global.Lerp](https://wiki.facepunch.com/gmod/Global.Lerp) that is unclamped would be necessary instead.
|
|
520
|
+
*
|
|
521
|
+
*
|
|
522
|
+
* @realm shared and menu
|
|
523
|
+
* @source https://wiki.facepunch.com/gmod/math.ease.InOutBack
|
|
524
|
+
*/
|
|
525
|
+
InOutBack(fraction: number): number;
|
|
526
|
+
/**
|
|
527
|
+
* Eases in and out like a bouncy ball.
|
|
528
|
+
* **NOTE**: This doesn't work properly when used with [Global.Lerp](https://wiki.facepunch.com/gmod/Global.Lerp) as it clamps the fraction between 0 and 1. Using your own version of [Global.Lerp](https://wiki.facepunch.com/gmod/Global.Lerp) that is unclamped would be necessary instead.
|
|
529
|
+
*
|
|
530
|
+
*
|
|
531
|
+
* @realm shared and menu
|
|
532
|
+
* @source https://wiki.facepunch.com/gmod/math.ease.InOutBounce
|
|
533
|
+
*/
|
|
534
|
+
InOutBounce(fraction: number): number;
|
|
535
|
+
/**
|
|
536
|
+
* Eases in and out using a circular function.
|
|
537
|
+
* @realm shared and menu
|
|
538
|
+
* @source https://wiki.facepunch.com/gmod/math.ease.InOutCirc
|
|
539
|
+
*/
|
|
540
|
+
InOutCirc(fraction: number): number;
|
|
541
|
+
/**
|
|
542
|
+
* Eases in and out by cubing the fraction.
|
|
543
|
+
* @realm shared and menu
|
|
544
|
+
* @source https://wiki.facepunch.com/gmod/math.ease.InOutCubic
|
|
545
|
+
*/
|
|
546
|
+
InOutCubic(fraction: number): number;
|
|
547
|
+
/**
|
|
548
|
+
* Eases in and out like a rubber band.
|
|
549
|
+
* **NOTE**: This doesn't work properly when used with [Global.Lerp](https://wiki.facepunch.com/gmod/Global.Lerp) as it clamps the fraction between 0 and 1. Using your own version of [Global.Lerp](https://wiki.facepunch.com/gmod/Global.Lerp) that is unclamped would be necessary instead.
|
|
550
|
+
*
|
|
551
|
+
*
|
|
552
|
+
* @realm shared and menu
|
|
553
|
+
* @source https://wiki.facepunch.com/gmod/math.ease.InOutElastic
|
|
554
|
+
*/
|
|
555
|
+
InOutElastic(fraction: number): number;
|
|
556
|
+
/**
|
|
557
|
+
* Eases in and out using an exponential equation with a base of 2 and where the fraction is used in the exponent.
|
|
558
|
+
* @realm shared and menu
|
|
559
|
+
* @source https://wiki.facepunch.com/gmod/math.ease.InOutExpo
|
|
560
|
+
*/
|
|
561
|
+
InOutExpo(fraction: number): number;
|
|
562
|
+
/**
|
|
563
|
+
* Eases in and out by squaring the fraction.
|
|
564
|
+
* @realm shared and menu
|
|
565
|
+
* @source https://wiki.facepunch.com/gmod/math.ease.InOutQuad
|
|
566
|
+
*/
|
|
567
|
+
InOutQuad(fraction: number): number;
|
|
568
|
+
/**
|
|
569
|
+
* Eases in and out by raising the fraction to the power of 4.
|
|
570
|
+
* @realm shared and menu
|
|
571
|
+
* @source https://wiki.facepunch.com/gmod/math.ease.InOutQuart
|
|
572
|
+
*/
|
|
573
|
+
InOutQuart(fraction: number): number;
|
|
531
574
|
/**
|
|
532
575
|
* Eases in and out by raising the fraction to the power of 5.
|
|
533
576
|
* @realm shared and menu
|
|
534
577
|
* @source https://wiki.facepunch.com/gmod/math.ease.InOutQuint
|
|
535
578
|
*/
|
|
536
579
|
InOutQuint(fraction: number): number;
|
|
537
|
-
}
|
|
538
|
-
|
|
539
|
-
interface MatheaseLib {
|
|
540
580
|
/**
|
|
541
581
|
* Eases in and out using [math.sin](https://wiki.facepunch.com/gmod/math.sin).
|
|
542
582
|
* @realm shared and menu
|
|
543
583
|
* @source https://wiki.facepunch.com/gmod/math.ease.InOutSine
|
|
544
584
|
*/
|
|
545
585
|
InOutSine(fraction: number): number;
|
|
546
|
-
}
|
|
547
|
-
|
|
548
|
-
interface MatheaseLib {
|
|
549
586
|
/**
|
|
550
587
|
* Eases in by squaring the fraction.
|
|
551
588
|
* @realm shared and menu
|
|
552
589
|
* @source https://wiki.facepunch.com/gmod/math.ease.InQuad
|
|
553
590
|
*/
|
|
554
591
|
InQuad(fraction: number): number;
|
|
555
|
-
}
|
|
556
|
-
|
|
557
|
-
interface MatheaseLib {
|
|
558
592
|
/**
|
|
559
593
|
* Eases in by raising the fraction to the power of 4.
|
|
560
594
|
* @realm shared and menu
|
|
561
595
|
* @source https://wiki.facepunch.com/gmod/math.ease.InQuart
|
|
562
596
|
*/
|
|
563
597
|
InQuart(fraction: number): number;
|
|
564
|
-
}
|
|
565
|
-
|
|
566
|
-
interface MatheaseLib {
|
|
567
598
|
/**
|
|
568
599
|
* Eases in by raising the fraction to the power of 5.
|
|
569
600
|
* @realm shared and menu
|
|
570
601
|
* @source https://wiki.facepunch.com/gmod/math.ease.InQuint
|
|
571
602
|
*/
|
|
572
603
|
InQuint(fraction: number): number;
|
|
573
|
-
}
|
|
574
|
-
|
|
575
|
-
interface MatheaseLib {
|
|
576
604
|
/**
|
|
577
605
|
* Eases in using [math.sin](https://wiki.facepunch.com/gmod/math.sin).
|
|
578
606
|
* @realm shared and menu
|
|
579
607
|
* @source https://wiki.facepunch.com/gmod/math.ease.InSine
|
|
580
608
|
*/
|
|
581
609
|
InSine(fraction: number): number;
|
|
582
|
-
}
|
|
583
|
-
|
|
584
|
-
interface MatheaseLib {
|
|
585
610
|
/**
|
|
586
611
|
* Eases out by reversing the direction of the ease slightly before finishing.
|
|
587
612
|
* **NOTE**: This doesn't work properly when used with [Global.Lerp](https://wiki.facepunch.com/gmod/Global.Lerp) as it clamps the fraction between 0 and 1. Using your own version of [Global.Lerp](https://wiki.facepunch.com/gmod/Global.Lerp) that is unclamped would be necessary instead.
|
|
@@ -591,9 +616,6 @@ interface MatheaseLib {
|
|
|
591
616
|
* @source https://wiki.facepunch.com/gmod/math.ease.OutBack
|
|
592
617
|
*/
|
|
593
618
|
OutBack(fraction: number): number;
|
|
594
|
-
}
|
|
595
|
-
|
|
596
|
-
interface MatheaseLib {
|
|
597
619
|
/**
|
|
598
620
|
* Eases out like a bouncy ball.
|
|
599
621
|
* **NOTE**: This doesn't work properly when used with [Global.Lerp](https://wiki.facepunch.com/gmod/Global.Lerp) as it clamps the fraction between 0 and 1. Using your own version of [Global.Lerp](https://wiki.facepunch.com/gmod/Global.Lerp) that is unclamped would be necessary instead.
|
|
@@ -603,27 +625,18 @@ interface MatheaseLib {
|
|
|
603
625
|
* @source https://wiki.facepunch.com/gmod/math.ease.OutBounce
|
|
604
626
|
*/
|
|
605
627
|
OutBounce(fraction: number): number;
|
|
606
|
-
}
|
|
607
|
-
|
|
608
|
-
interface MatheaseLib {
|
|
609
628
|
/**
|
|
610
629
|
* Eases out using a circular function.
|
|
611
630
|
* @realm shared and menu
|
|
612
631
|
* @source https://wiki.facepunch.com/gmod/math.ease.OutCirc
|
|
613
632
|
*/
|
|
614
633
|
OutCirc(fraction: number): number;
|
|
615
|
-
}
|
|
616
|
-
|
|
617
|
-
interface MatheaseLib {
|
|
618
634
|
/**
|
|
619
635
|
* Eases out by cubing the fraction.
|
|
620
636
|
* @realm shared and menu
|
|
621
637
|
* @source https://wiki.facepunch.com/gmod/math.ease.OutCubic
|
|
622
638
|
*/
|
|
623
639
|
OutCubic(fraction: number): number;
|
|
624
|
-
}
|
|
625
|
-
|
|
626
|
-
interface MatheaseLib {
|
|
627
640
|
/**
|
|
628
641
|
* Eases out like a rubber band.
|
|
629
642
|
* **NOTE**: This doesn't work properly when used with [Global.Lerp](https://wiki.facepunch.com/gmod/Global.Lerp) as it clamps the fraction between 0 and 1. Using your own version of [Global.Lerp](https://wiki.facepunch.com/gmod/Global.Lerp) that is unclamped would be necessary instead.
|
|
@@ -633,45 +646,30 @@ interface MatheaseLib {
|
|
|
633
646
|
* @source https://wiki.facepunch.com/gmod/math.ease.OutElastic
|
|
634
647
|
*/
|
|
635
648
|
OutElastic(fraction: number): number;
|
|
636
|
-
}
|
|
637
|
-
|
|
638
|
-
interface MatheaseLib {
|
|
639
649
|
/**
|
|
640
650
|
* Eases out using an exponential equation with a base of 2 and where the fraction is used in the exponent.
|
|
641
651
|
* @realm shared and menu
|
|
642
652
|
* @source https://wiki.facepunch.com/gmod/math.ease.OutExpo
|
|
643
653
|
*/
|
|
644
654
|
OutExpo(fraction: number): number;
|
|
645
|
-
}
|
|
646
|
-
|
|
647
|
-
interface MatheaseLib {
|
|
648
655
|
/**
|
|
649
656
|
* Eases out by squaring the fraction.
|
|
650
657
|
* @realm shared and menu
|
|
651
658
|
* @source https://wiki.facepunch.com/gmod/math.ease.OutQuad
|
|
652
659
|
*/
|
|
653
660
|
OutQuad(fraction: number): number;
|
|
654
|
-
}
|
|
655
|
-
|
|
656
|
-
interface MatheaseLib {
|
|
657
661
|
/**
|
|
658
662
|
* Eases out by raising the fraction to the power of 4.
|
|
659
663
|
* @realm shared and menu
|
|
660
664
|
* @source https://wiki.facepunch.com/gmod/math.ease.OutQuart
|
|
661
665
|
*/
|
|
662
666
|
OutQuart(fraction: number): number;
|
|
663
|
-
}
|
|
664
|
-
|
|
665
|
-
interface MatheaseLib {
|
|
666
667
|
/**
|
|
667
668
|
* Eases out by raising the fraction to the power of 5.
|
|
668
669
|
* @realm shared and menu
|
|
669
670
|
* @source https://wiki.facepunch.com/gmod/math.ease.OutQuint
|
|
670
671
|
*/
|
|
671
672
|
OutQuint(fraction: number): number;
|
|
672
|
-
}
|
|
673
|
-
|
|
674
|
-
interface MatheaseLib {
|
|
675
673
|
/**
|
|
676
674
|
* Eases out using [math.sin](https://wiki.facepunch.com/gmod/math.sin).
|
|
677
675
|
* @realm shared and menu
|
|
@@ -680,220 +678,52 @@ interface MatheaseLib {
|
|
|
680
678
|
OutSine(fraction: number): number;
|
|
681
679
|
}
|
|
682
680
|
|
|
683
|
-
interface MathLib {
|
|
684
|
-
/**
|
|
685
|
-
* Returns e to the power of the input.
|
|
686
|
-
* @realm shared and menu
|
|
687
|
-
* @source https://wiki.facepunch.com/gmod/math.exp
|
|
688
|
-
*/
|
|
689
|
-
exp(exponent: number): number;
|
|
690
|
-
}
|
|
691
681
|
|
|
692
|
-
interface MathLib {
|
|
693
|
-
/**
|
|
694
|
-
* Floors or rounds a number down.
|
|
695
|
-
*
|
|
696
|
-
* See [math.ceil](https://wiki.facepunch.com/gmod/math.ceil) for the inverse of this function.
|
|
697
|
-
* @realm shared and menu
|
|
698
|
-
* @source https://wiki.facepunch.com/gmod/math.floor
|
|
699
|
-
*/
|
|
700
|
-
floor(number: number): number;
|
|
701
|
-
}
|
|
702
682
|
|
|
703
|
-
interface MathLib {
|
|
704
|
-
/**
|
|
705
|
-
* Returns the modulus of the specified values.
|
|
706
|
-
*
|
|
707
|
-
* While this is similar to the `%` operator, **it will return a negative value if the first argument is negative**, whereas the % operator will return a **positive** value **even if the first operand is negative**.
|
|
708
|
-
*
|
|
709
|
-
* This function is also slower than the `%` operator.
|
|
710
|
-
*
|
|
711
|
-
* @realm shared and menu
|
|
712
|
-
* @source https://wiki.facepunch.com/gmod/math.fmod
|
|
713
|
-
*/
|
|
714
|
-
fmod(base: number, modulator: number): number;
|
|
715
|
-
}
|
|
716
683
|
|
|
717
|
-
interface MathLib {
|
|
718
|
-
/**
|
|
719
|
-
* **Lua reference description**: Returns `m` and `e` such that `x = m2e`, `e` is an integer and the absolute value of `m` is in the range ((0.5, 1) (or zero when x is zero).
|
|
720
|
-
*
|
|
721
|
-
* Used to split the number value into a normalized fraction and an exponent. Two values are returned: the first is a multiplier in the range `1/2` (**inclusive**) to `1` (**exclusive**) and the second is an integer exponent.
|
|
722
|
-
*
|
|
723
|
-
* The result is such that `x = m*2^e`.
|
|
724
|
-
*
|
|
725
|
-
* @realm shared and menu
|
|
726
|
-
* @source https://wiki.facepunch.com/gmod/math.frexp
|
|
727
|
-
*/
|
|
728
|
-
frexp(x: number): (number, number);
|
|
729
|
-
}
|
|
730
684
|
|
|
731
|
-
interface MathLib {
|
|
732
|
-
/**
|
|
733
|
-
* Takes a normalised number and returns the floating point representation.
|
|
734
|
-
*
|
|
735
|
-
* Effectively it returns the result of `normalizedFraction * 2.0 ^ exponent`. [math.frexp](https://wiki.facepunch.com/gmod/math.frexp) is the opposite function.
|
|
736
|
-
*
|
|
737
|
-
* @realm shared and menu
|
|
738
|
-
* @source https://wiki.facepunch.com/gmod/math.ldexp
|
|
739
|
-
*/
|
|
740
|
-
ldexp(normalizedFraction: number, exponent: number): number;
|
|
741
|
-
}
|
|
742
685
|
|
|
743
|
-
interface MathLib {
|
|
744
|
-
/**
|
|
745
|
-
* With one argument, return the natural logarithm of x (to base e).
|
|
746
|
-
*
|
|
747
|
-
* With two arguments, return the logarithm of x to the given base, calculated as log(x)/log(base).
|
|
748
|
-
*
|
|
749
|
-
* @realm shared and menu
|
|
750
|
-
* @source https://wiki.facepunch.com/gmod/math.log
|
|
751
|
-
*/
|
|
752
|
-
log(x: number, base?: number): number;
|
|
753
|
-
}
|
|
754
686
|
|
|
755
|
-
interface MathLib {
|
|
756
|
-
/**
|
|
757
|
-
* Returns the base-10 logarithm of x. This is usually more accurate than math.log(x, 10).
|
|
758
|
-
* @realm shared and menu
|
|
759
|
-
* @source https://wiki.facepunch.com/gmod/math.log10
|
|
760
|
-
*/
|
|
761
|
-
log10(x: number): number;
|
|
762
|
-
}
|
|
763
687
|
|
|
764
|
-
interface MathLib {
|
|
765
|
-
/**
|
|
766
|
-
* Returns the largest value of all arguments.
|
|
767
|
-
* @realm shared and menu
|
|
768
|
-
* @source https://wiki.facepunch.com/gmod/math.max
|
|
769
|
-
*/
|
|
770
|
-
max(...: any): number;
|
|
771
|
-
}
|
|
772
688
|
|
|
773
|
-
interface MathLib {
|
|
774
|
-
/**
|
|
775
|
-
* Returns the smallest value of all arguments.
|
|
776
|
-
* @realm shared and menu
|
|
777
|
-
* @source https://wiki.facepunch.com/gmod/math.min
|
|
778
|
-
*/
|
|
779
|
-
min(...: any): number;
|
|
780
|
-
}
|
|
781
689
|
|
|
782
|
-
interface MathLib {
|
|
783
|
-
/**
|
|
784
|
-
* Returns the modulus of the specified values. Same as [math.fmod](https://wiki.facepunch.com/gmod/math.fmod).
|
|
785
|
-
*
|
|
786
|
-
* @realm shared and menu
|
|
787
|
-
* @source https://wiki.facepunch.com/gmod/math.mod
|
|
788
|
-
* @deprecated This is removed in Lua versions later than what GMod is currently using. You should use the % operator or math.fmod instead.
|
|
789
|
-
*/
|
|
790
|
-
mod(base: number, modulator: number): number;
|
|
791
|
-
}
|
|
792
690
|
|
|
793
|
-
interface MathLib {
|
|
794
|
-
/**
|
|
795
|
-
* Returns the integral and fractional component of the modulo operation.
|
|
796
|
-
* @realm shared and menu
|
|
797
|
-
* @source https://wiki.facepunch.com/gmod/math.modf
|
|
798
|
-
*/
|
|
799
|
-
modf(base: number): (number, number);
|
|
800
|
-
}
|
|
801
691
|
|
|
802
|
-
interface MathLib {
|
|
803
|
-
/**
|
|
804
|
-
* Returns x raised to the power y.
|
|
805
|
-
* In particular, math.pow(1.0, x) and math.pow(x, 0.0) always return 1.0, even when x is a zero or a [nan](https://wiki.facepunch.com/gmod/nan). If both x and y are finite, x is negative, and y is not an integer then math.pow(x, y) is undefined.
|
|
806
|
-
*
|
|
807
|
-
* @realm shared and menu
|
|
808
|
-
* @source https://wiki.facepunch.com/gmod/math.pow
|
|
809
|
-
*/
|
|
810
|
-
pow(x: number, y: number): number;
|
|
811
|
-
}
|
|
812
692
|
|
|
813
|
-
interface MathLib {
|
|
814
|
-
/**
|
|
815
|
-
* Converts an angle in degrees to it's equivalent in radians.
|
|
816
|
-
* @realm shared and menu
|
|
817
|
-
* @source https://wiki.facepunch.com/gmod/math.rad
|
|
818
|
-
*/
|
|
819
|
-
rad(degrees: number): number;
|
|
820
|
-
}
|
|
821
693
|
|
|
822
|
-
interface MathLib {
|
|
823
|
-
/**
|
|
824
|
-
* When called without arguments, returns a uniform pseudo-random real number in the range 0 to 1 which includes 0 but excludes 1.
|
|
825
|
-
*
|
|
826
|
-
* When called with an integer number m, returns a uniform pseudo-random integer in the range 1 to m inclusive.
|
|
827
|
-
*
|
|
828
|
-
* When called with two integer numbers m and n, returns a uniform pseudo-random integer in the range m to n inclusive.
|
|
829
|
-
*
|
|
830
|
-
* See also [math.Rand](https://wiki.facepunch.com/gmod/math.Rand)
|
|
831
|
-
*
|
|
832
|
-
* @realm shared and menu
|
|
833
|
-
* @source https://wiki.facepunch.com/gmod/math.random
|
|
834
|
-
*/
|
|
835
|
-
random(m?: number, n?: number): number;
|
|
836
|
-
}
|
|
837
694
|
|
|
838
|
-
interface MathLib {
|
|
839
|
-
/**
|
|
840
|
-
* Seeds the random number generator. The same seed will guarantee the same sequence of numbers each time with [math.random](https://wiki.facepunch.com/gmod/math.random).
|
|
841
|
-
*
|
|
842
|
-
* For shared random values across predicted realms, use [util.SharedRandom](https://wiki.facepunch.com/gmod/util.SharedRandom).
|
|
843
|
-
*
|
|
844
|
-
* **WARNING**: Usage of this function affects **ALL** random numbers in the game. This means that improper use (such as setting the seed to a static value that doesn't change with time) can negatively affect other addons or the base game.
|
|
845
|
-
*
|
|
846
|
-
* It is a good idea to set the seed back to at least something like [Global.SysTime](https://wiki.facepunch.com/gmod/Global.SysTime) in those cases.
|
|
847
|
-
*
|
|
848
|
-
*
|
|
849
|
-
* @realm shared and menu
|
|
850
|
-
* @source https://wiki.facepunch.com/gmod/math.randomseed
|
|
851
|
-
*/
|
|
852
|
-
randomseed(seed: number): void;
|
|
853
|
-
}
|
|
854
695
|
|
|
855
|
-
interface MathLib {
|
|
856
|
-
/**
|
|
857
|
-
* Returns the [sine](https://en.wikipedia.org/wiki/Trigonometric_functions) of given angle.
|
|
858
|
-
* @realm shared and menu
|
|
859
|
-
* @source https://wiki.facepunch.com/gmod/math.sin
|
|
860
|
-
*/
|
|
861
|
-
sin(number: number): number;
|
|
862
|
-
}
|
|
863
696
|
|
|
864
|
-
interface MathLib {
|
|
865
|
-
/**
|
|
866
|
-
* Returns the [hyperbolic sine](https://en.wikipedia.org/wiki/Hyperbolic_functions) of the given angle.
|
|
867
|
-
* @realm shared and menu
|
|
868
|
-
* @source https://wiki.facepunch.com/gmod/math.sinh
|
|
869
|
-
*/
|
|
870
|
-
sinh(number: number): number;
|
|
871
|
-
}
|
|
872
697
|
|
|
873
|
-
interface MathLib {
|
|
874
|
-
/**
|
|
875
|
-
* Returns the square root of the number.
|
|
876
|
-
* @realm shared and menu
|
|
877
|
-
* @source https://wiki.facepunch.com/gmod/math.sqrt
|
|
878
|
-
*/
|
|
879
|
-
sqrt(value: number): number;
|
|
880
|
-
}
|
|
881
698
|
|
|
882
|
-
interface MathLib {
|
|
883
|
-
/**
|
|
884
|
-
* Returns the tangent of the given angle.
|
|
885
|
-
* @realm shared and menu
|
|
886
|
-
* @source https://wiki.facepunch.com/gmod/math.tan
|
|
887
|
-
*/
|
|
888
|
-
tan(value: number): number;
|
|
889
|
-
}
|
|
890
699
|
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
700
|
+
|
|
701
|
+
|
|
702
|
+
|
|
703
|
+
|
|
704
|
+
|
|
705
|
+
|
|
706
|
+
|
|
707
|
+
|
|
708
|
+
|
|
709
|
+
|
|
710
|
+
|
|
711
|
+
|
|
712
|
+
|
|
713
|
+
|
|
714
|
+
|
|
715
|
+
|
|
716
|
+
|
|
717
|
+
|
|
718
|
+
|
|
719
|
+
|
|
720
|
+
|
|
721
|
+
|
|
722
|
+
|
|
723
|
+
|
|
724
|
+
|
|
725
|
+
|
|
726
|
+
|
|
727
|
+
|
|
728
|
+
|
|
899
729
|
|