@tlua/gmod 1.0.1
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/README.md +28 -0
- package/__metadata.json +4 -0
- package/_globals.d.tlua +178 -0
- package/_gmod-std.d.tlua +35 -0
- package/achievementicon.d.tlua +12 -0
- package/achievements.d.tlua +162 -0
- package/ai.d.tlua +65 -0
- package/ai_schedule.d.tlua +17 -0
- package/ai_task.d.tlua +17 -0
- package/angle.d.tlua +197 -0
- package/avatarimage.d.tlua +10 -0
- package/awesomium.d.tlua +14 -0
- package/baseclass.d.tlua +42 -0
- package/bf_read.d.tlua +110 -0
- package/bit.d.tlua +121 -0
- package/button.d.tlua +13 -0
- package/cam.d.tlua +220 -0
- package/ceffectdata.d.tlua +337 -0
- package/chat.d.tlua +62 -0
- package/checkbutton.d.tlua +14 -0
- package/cleanup.d.tlua +88 -0
- package/cluaemitter.d.tlua +119 -0
- package/clualocomotion.d.tlua +383 -0
- package/cluaparticle.d.tlua +426 -0
- package/cmovedata.d.tlua +476 -0
- package/cnavarea.d.tlua +845 -0
- package/cnavladder.d.tlua +209 -0
- package/cnewparticleeffect.d.tlua +259 -0
- package/color.d.tlua +339 -0
- package/concommand.d.tlua +69 -0
- package/constraint.d.tlua +311 -0
- package/construct.d.tlua +26 -0
- package/contentheader.d.tlua +32 -0
- package/contenticon.d.tlua +86 -0
- package/contentsidebar.d.tlua +45 -0
- package/contentsidebartoolbox.d.tlua +13 -0
- package/contextbase.d.tlua +37 -0
- package/controlpanel.d.tlua +140 -0
- package/controlpresets.d.tlua +118 -0
- package/convar.d.tlua +162 -0
- package/cookie.d.tlua +60 -0
- package/coroutine.d.tlua +90 -0
- package/crecipientfilter.d.tlua +152 -0
- package/csent.d.tlua +10 -0
- package/csoundpatch.d.tlua +150 -0
- package/ctakedamageinfo.d.tlua +366 -0
- package/ctrllistbox.d.tlua +12 -0
- package/ctrlnumpad.d.tlua +73 -0
- package/cusercmd.d.tlua +320 -0
- package/custom_classes.d.tlua +65 -0
- package/custom_entity_fields.d.tlua +96 -0
- package/cvars.d.tlua +80 -0
- package/dadjustablemodelpanel.d.tlua +81 -0
- package/dalphabar.d.tlua +27 -0
- package/dbinder.d.tlua +37 -0
- package/dbubblecontainer.d.tlua +18 -0
- package/dbutton.d.tlua +88 -0
- package/dcategoryheader.d.tlua +13 -0
- package/dcategorylist.d.tlua +11 -0
- package/dcheckbox.d.tlua +46 -0
- package/dcheckboxlabel.d.tlua +90 -0
- package/dcollapsiblecategory.d.tlua +240 -0
- package/dcolorbutton.d.tlua +73 -0
- package/dcolorcombo.d.tlua +54 -0
- package/dcolorcube.d.tlua +137 -0
- package/dcolormixer.d.tlua +303 -0
- package/dcolorpalette.d.tlua +294 -0
- package/dcolumnsheet.d.tlua +49 -0
- package/dcombobox.d.tlua +161 -0
- package/ddragbase.d.tlua +151 -0
- package/ddrawer.d.tlua +72 -0
- package/debug.d.tlua +236 -0
- package/debugoverlay.d.tlua +193 -0
- package/dentityproperties.d.tlua +63 -0
- package/derma.d.tlua +119 -0
- package/dexpandbutton.d.tlua +30 -0
- package/dfilebrowser.d.tlua +228 -0
- package/dform.d.tlua +176 -0
- package/dframe.d.tlua +261 -0
- package/dgrid.d.tlua +113 -0
- package/dhorizontaldivider.d.tlua +196 -0
- package/dhorizontalscroller.d.tlua +104 -0
- package/dhscrollbar.d.tlua +109 -0
- package/dhtml.d.tlua +91 -0
- package/dhtmlcontrols.d.tlua +62 -0
- package/diconbrowser.d.tlua +113 -0
- package/diconlayout.d.tlua +190 -0
- package/dimage.d.tlua +221 -0
- package/dimagebutton.d.tlua +103 -0
- package/dkillicon.d.tlua +9 -0
- package/dlabel.d.tlua +385 -0
- package/dlabeleditable.d.tlua +51 -0
- package/dlabelurl.d.tlua +100 -0
- package/dlistbox.d.tlua +82 -0
- package/dlistboxitem.d.tlua +42 -0
- package/dlistlayout.d.tlua +14 -0
- package/dlistview.d.tlua +360 -0
- package/dlistview_column.d.tlua +135 -0
- package/dlistview_columnplain.d.tlua +11 -0
- package/dlistview_draggerbar.d.tlua +11 -0
- package/dlistview_line.d.tlua +140 -0
- package/dlistviewheaderlabel.d.tlua +11 -0
- package/dlistviewlabel.d.tlua +11 -0
- package/dlistviewline.d.tlua +11 -0
- package/dmenu.d.tlua +266 -0
- package/dmenubar.d.tlua +42 -0
- package/dmenuoption.d.tlua +135 -0
- package/dmenuoptioncvar.d.tlua +64 -0
- package/dmodelpanel.d.tlua +207 -0
- package/dmodelselect.d.tlua +20 -0
- package/dmodelselectmulti.d.tlua +19 -0
- package/dnotify.d.tlua +93 -0
- package/dnumberscratch.d.tlua +284 -0
- package/dnumberwang.d.tlua +147 -0
- package/dnumpad.d.tlua +11 -0
- package/dnumslider.d.tlua +182 -0
- package/dpanel.d.tlua +152 -0
- package/dpanellist.d.tlua +109 -0
- package/dpaneloverlay.d.tlua +65 -0
- package/dpanelselect.d.tlua +13 -0
- package/dpanpanel.d.tlua +64 -0
- package/dprogress.d.tlua +27 -0
- package/dproperties.d.tlua +52 -0
- package/dproperty_boolean.d.tlua +12 -0
- package/dproperty_combo.d.tlua +31 -0
- package/dproperty_entity.d.tlua +12 -0
- package/dproperty_float.d.tlua +12 -0
- package/dproperty_generic.d.tlua +50 -0
- package/dproperty_int.d.tlua +12 -0
- package/dproperty_vectorcolor.d.tlua +14 -0
- package/dpropertysheet.d.tlua +167 -0
- package/dragndrop.d.tlua +123 -0
- package/draw.d.tlua +162 -0
- package/drgbpicker.d.tlua +49 -0
- package/drive.d.tlua +159 -0
- package/dscrollbargrip.d.tlua +13 -0
- package/dscrollpanel.d.tlua +110 -0
- package/dshape.d.tlua +72 -0
- package/dsizetocontents.d.tlua +46 -0
- package/dslider.d.tlua +302 -0
- package/dsprite.d.tlua +84 -0
- package/dtab.d.tlua +81 -0
- package/dtextentry.d.tlua +442 -0
- package/dtilelayout.d.tlua +218 -0
- package/dtooltip.d.tlua +76 -0
- package/dtree.d.tlua +185 -0
- package/dtree_node.d.tlua +793 -0
- package/dtree_node_button.d.tlua +13 -0
- package/duplicator.d.tlua +338 -0
- package/dverticaldivider.d.tlua +223 -0
- package/dvscrollbar.d.tlua +109 -0
- package/editablepanel.d.tlua +10 -0
- package/effect.d.tlua +121 -0
- package/effects.d.tlua +77 -0
- package/engine.d.tlua +248 -0
- package/entity.d.tlua +8295 -0
- package/ents.d.tlua +267 -0
- package/enums.d.tlua +7082 -0
- package/file.d.tlua +419 -0
- package/file_class.d.tlua +7 -0
- package/fingerposer.d.tlua +12 -0
- package/fingervar.d.tlua +13 -0
- package/frame.d.tlua +11 -0
- package/frame_blend.d.tlua +105 -0
- package/game.d.tlua +482 -0
- package/gameevent.d.tlua +968 -0
- package/gamemode.d.tlua +48 -0
- package/global.d.tlua +3156 -0
- package/gm.d.tlua +3218 -0
- package/gmod.d.tlua +20 -0
- package/gmsave.d.tlua +53 -0
- package/gui.d.tlua +232 -0
- package/gwen.d.tlua +55 -0
- package/halo.d.tlua +42 -0
- package/hammer.d.tlua +17 -0
- package/hook.d.tlua +64 -0
- package/html.d.tlua +22 -0
- package/http.d.tlua +72 -0
- package/iconeditor.d.tlua +130 -0
- package/igmodaudiochannel.d.tlua +419 -0
- package/imagecheckbox.d.tlua +48 -0
- package/imaterial.d.tlua +288 -0
- package/imesh.d.tlua +70 -0
- package/index.d.tlua +277 -0
- package/input.d.tlua +252 -0
- package/invalidateinternalentitycache.d.tlua +13 -0
- package/irestore.d.tlua +94 -0
- package/isave.d.tlua +94 -0
- package/itexture.d.tlua +108 -0
- package/ivideowriter.d.tlua +53 -0
- package/jit.d.tlua +243 -0
- package/killicon.d.tlua +84 -0
- package/label.d.tlua +20 -0
- package/language.d.tlua +26 -0
- package/list.d.tlua +112 -0
- package/makeballoon.d.tlua +15 -0
- package/markup.d.tlua +38 -0
- package/markupobject.d.tlua +53 -0
- package/material.d.tlua +9 -0
- package/math.d.tlua +899 -0
- package/matproxy.d.tlua +60 -0
- package/matselect.d.tlua +106 -0
- package/menu.d.tlua +20 -0
- package/menubar.d.tlua +39 -0
- package/mesh.d.tlua +183 -0
- package/modelimage.d.tlua +12 -0
- package/motionsensor.d.tlua +115 -0
- package/navmesh.d.tlua +274 -0
- package/net.d.tlua +639 -0
- package/nextbot.d.tlua +380 -0
- package/notification.d.tlua +35 -0
- package/npc.d.tlua +1787 -0
- package/numpad.d.tlua +89 -0
- package/os.d.tlua +56 -0
- package/package.d.tlua +15 -0
- package/package.json +18 -0
- package/panel.d.tlua +3650 -0
- package/panellist.d.tlua +13 -0
- package/pathfollower.d.tlua +301 -0
- package/permissions.d.tlua +77 -0
- package/physcollide.d.tlua +40 -0
- package/physenv.d.tlua +136 -0
- package/physobj.d.tlua +799 -0
- package/pixelvis_handle_t.d.tlua +9 -0
- package/player.d.tlua +3320 -0
- package/player_manager.d.tlua +147 -0
- package/preseteditor.d.tlua +13 -0
- package/presets.d.tlua +79 -0
- package/projectedtexture.d.tlua +553 -0
- package/properties.d.tlua +65 -0
- package/propselect.d.tlua +50 -0
- package/radiobutton.d.tlua +13 -0
- package/render.d.tlua +1700 -0
- package/resource.d.tlua +73 -0
- package/richtext.d.tlua +17 -0
- package/sandbox.d.tlua +576 -0
- package/saverestore.d.tlua +148 -0
- package/schedule.d.tlua +69 -0
- package/scripted_ents.d.tlua +124 -0
- package/search.d.tlua +26 -0
- package/serverlist.d.tlua +85 -0
- package/slidebar.d.tlua +12 -0
- package/slider.d.tlua +11 -0
- package/sound.d.tlua +140 -0
- package/spawnicon.d.tlua +95 -0
- package/spawnmenu.d.tlua +286 -0
- package/spawnmenucontentpanel.d.tlua +52 -0
- package/sql.d.tlua +154 -0
- package/stack.d.tlua +57 -0
- package/steamworks.d.tlua +208 -0
- package/string.d.tlua +535 -0
- package/structures.d.tlua +4442 -0
- package/surface.d.tlua +463 -0
- package/surfaceinfo.d.tlua +70 -0
- package/system.d.tlua +134 -0
- package/table.d.tlua +533 -0
- package/task.d.tlua +92 -0
- package/team.d.tlua +195 -0
- package/textentry.d.tlua +12 -0
- package/tgaimage.d.tlua +11 -0
- package/timer.d.tlua +198 -0
- package/tool.d.tlua +466 -0
- package/ugcpublishwindow.d.tlua +83 -0
- package/umsg.d.tlua +147 -0
- package/undo.d.tlua +122 -0
- package/urllabel.d.tlua +13 -0
- package/usermessage.d.tlua +48 -0
- package/utf8.d.tlua +89 -0
- package/util.d.tlua +1087 -0
- package/vector.d.tlua +413 -0
- package/vehicle.d.tlua +472 -0
- package/vgui.d.tlua +201 -0
- package/video.d.tlua +17 -0
- package/vmatrix.d.tlua +392 -0
- package/weapon.d.tlua +913 -0
- package/weapons.d.tlua +90 -0
- package/widgets.d.tlua +29 -0
- package/workshopfilebase.d.tlua +68 -0
package/global.d.tlua
ADDED
|
@@ -0,0 +1,3156 @@
|
|
|
1
|
+
// AUTO-GENERATED tlua declarations. Do not edit by hand.
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Adds simple Get/Set accessor functions on the specified table. Can also force
|
|
5
|
+
* the value to be set to a number, bool or string.
|
|
6
|
+
* @realm shared
|
|
7
|
+
* @realm menu
|
|
8
|
+
* @source https://wiki.facepunch.com/gmod/Global.AccessorFunc
|
|
9
|
+
*/
|
|
10
|
+
declare function AccessorFunc(tab: table, key: any, name: string, force?: FORCE): void;
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Adds the specified image path to the main menu background pool. Image can be png or jpeg.
|
|
15
|
+
* @realm menu
|
|
16
|
+
* @source https://wiki.facepunch.com/gmod/Global.AddBackgroundImage
|
|
17
|
+
*/
|
|
18
|
+
declare function AddBackgroundImage(path: string): void;
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Marks a Lua file to be sent to clients when they join the server. Doesn't do anything on the client - this means you can use it in a shared file without problems.
|
|
22
|
+
*
|
|
23
|
+
* **WARNING**: If the file trying to be added is empty, an error will occur, and the file will not be sent to the client.
|
|
24
|
+
*
|
|
25
|
+
* The string cannot have whitespace.
|
|
26
|
+
*
|
|
27
|
+
*
|
|
28
|
+
* **NOTE**: This function is not needed for scripts located in these paths because they are automatically sent to clients:
|
|
29
|
+
* **lua/matproxy/**
|
|
30
|
+
* **lua/postprocess/**
|
|
31
|
+
* **lua/vgui/**
|
|
32
|
+
* **lua/skins/**
|
|
33
|
+
* **lua/autorun/**
|
|
34
|
+
* **lua/autorun/client/**
|
|
35
|
+
*
|
|
36
|
+
* You can add up to **8192** files. Each file can be up to **64KB** compressed (LZMA).
|
|
37
|
+
*
|
|
38
|
+
*
|
|
39
|
+
* @realm shared
|
|
40
|
+
* @source https://wiki.facepunch.com/gmod/Global.AddCSLuaFile
|
|
41
|
+
*/
|
|
42
|
+
declare function AddCSLuaFile(file?: string): void;
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* **INTERNAL**: Use [concommand.Add](https://wiki.facepunch.com/gmod/concommand.Add) instead.
|
|
46
|
+
* Tells the engine to register a console command. If the command was ran, the engine calls [concommand.Run](https://wiki.facepunch.com/gmod/concommand.Run).
|
|
47
|
+
* @realm shared and menu
|
|
48
|
+
* @source https://wiki.facepunch.com/gmod/Global.AddConsoleCommand
|
|
49
|
+
*/
|
|
50
|
+
declare function AddConsoleCommand(name: string, helpText: string, flags: FCVAR): void;
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Adds the specified vector to the PVS which is currently building. This allows all objects in visleafs visible from that vector to be drawn.
|
|
54
|
+
* @realm server
|
|
55
|
+
* @source https://wiki.facepunch.com/gmod/Global.AddOriginToPVS
|
|
56
|
+
*/
|
|
57
|
+
declare function AddOriginToPVS(position: Vector): void;
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* This function creates a Custom Category in the Spawnlist. Use [Global.GenerateSpawnlistFromPath](https://wiki.facepunch.com/gmod/Global.GenerateSpawnlistFromPath) if you want to create a category with the contents of a folder.
|
|
61
|
+
* **WARNING**: Using this function before [SANDBOX:PopulateContent](https://wiki.facepunch.com/gmod/SANDBOX:PopulateContent) has been called will result in an error.
|
|
62
|
+
*
|
|
63
|
+
*
|
|
64
|
+
* @realm client
|
|
65
|
+
* @source https://wiki.facepunch.com/gmod/Global.AddPropsOfParent
|
|
66
|
+
*/
|
|
67
|
+
declare function AddPropsOfParent(pnlContent: Panel, node: Panel, parentid: number, customProps: table): void;
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* This function creates a World Tip, similar to the one shown when aiming at a Thruster where it shows you its force.
|
|
71
|
+
*
|
|
72
|
+
* This function will make a World Tip that will only last 50 milliseconds (1/20th of a second), so you must call it continuously as long as you want the World Tip to be shown. It is common to call it inside a Think hook.
|
|
73
|
+
*
|
|
74
|
+
* Contrary to what the function's name implies, it is impossible to create more than one World Tip at the same time. A new World Tip will overwrite the old one, so only use this function when you know nothing else will also be using it.
|
|
75
|
+
*
|
|
76
|
+
* See [SANDBOX:PaintWorldTips](https://wiki.facepunch.com/gmod/SANDBOX:PaintWorldTips) for more information.
|
|
77
|
+
*
|
|
78
|
+
* **NOTE**: This function is only available in Sandbox and its derivatives.
|
|
79
|
+
*
|
|
80
|
+
*
|
|
81
|
+
* @realm client
|
|
82
|
+
* @source https://wiki.facepunch.com/gmod/Global.AddWorldTip
|
|
83
|
+
*/
|
|
84
|
+
declare function AddWorldTip(entindex?: number, text?: string, dieTime?: number, pos?: Vector, ent?: Entity): void;
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Defines a global entity class variable with an automatic value. In order to prevent collisions with other [Enums/CLASS](https://wiki.facepunch.com/gmod/Enums/CLASS). You should prefix your variable with CLASS_ for consistency.
|
|
88
|
+
* @realm shared and menu
|
|
89
|
+
* @source https://wiki.facepunch.com/gmod/Global.Add_NPC_Class
|
|
90
|
+
*/
|
|
91
|
+
declare function Add_NPC_Class(name: string): void;
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Loads the specified image from the `/cache` folder, used in combination with [steamworks.Download](https://wiki.facepunch.com/gmod/steamworks.Download). Most addons will provide a 512x512 png image.
|
|
95
|
+
*
|
|
96
|
+
* **NOTE**: This works with any image file with the `.cache` file extension, even outside of the `/cache` folder.
|
|
97
|
+
*
|
|
98
|
+
*
|
|
99
|
+
* @realm client and menu
|
|
100
|
+
* @source https://wiki.facepunch.com/gmod/Global.AddonMaterial
|
|
101
|
+
*/
|
|
102
|
+
declare function AddonMaterial(name: string): IMaterial;
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* Creates an [Angle](https://wiki.facepunch.com/gmod/Angle) object, representing a [Euler Angle](https://en.wikipedia.org/wiki/Euler_angles) made up of pitch, yaw, and roll components.
|
|
106
|
+
*
|
|
107
|
+
* **WARNING**: This function is relatively expensive, in terms of performance, in situations where it is being called multiple times every frame (Like a loop, for example.) This is due to the overhead associated with object creation and garbage collection.
|
|
108
|
+
* Where possible, it is generally better to store an [Angle](https://wiki.facepunch.com/gmod/Angle) in a variable and re-use that variable rather than re-creating it repeatedly.
|
|
109
|
+
* In cases where an empty [Angle](https://wiki.facepunch.com/gmod/Angle) is needed, the global variable `angle_zero` is the preferred solution instead of `Angle( 0, 0, 0 )`.
|
|
110
|
+
*
|
|
111
|
+
*
|
|
112
|
+
* @realm shared and menu
|
|
113
|
+
* @source https://wiki.facepunch.com/gmod/Global.Angle
|
|
114
|
+
*/
|
|
115
|
+
declare function Angle(pitch?: number, yaw?: number, roll?: number): Angle;
|
|
116
|
+
|
|
117
|
+
declare function Angle(angle: Angle): Angle;
|
|
118
|
+
|
|
119
|
+
declare function Angle(angleString: string): Angle;
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* Returns an angle with a randomized pitch, yaw, and roll between min(inclusive), max(exclusive).
|
|
123
|
+
* @realm shared and menu
|
|
124
|
+
* @source https://wiki.facepunch.com/gmod/Global.AngleRand
|
|
125
|
+
*/
|
|
126
|
+
declare function AngleRand(min?: number, max?: number): Angle;
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* Sends the specified Lua code to all connected clients and executes it.
|
|
130
|
+
* **NOTE**: If you need to use this function more than once, consider using [net](https://wiki.facepunch.com/gmod/net) library.
|
|
131
|
+
* Send net message and make the entire code you want to execute in [net.Receive](https://wiki.facepunch.com/gmod/net.Receive) on client.
|
|
132
|
+
*
|
|
133
|
+
* If executed **clientside**, this function won't do anything.
|
|
134
|
+
*
|
|
135
|
+
*
|
|
136
|
+
* @realm shared
|
|
137
|
+
* @source https://wiki.facepunch.com/gmod/Global.BroadcastLua
|
|
138
|
+
*/
|
|
139
|
+
declare function BroadcastLua(code: string): void;
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* Dumps the networked variables of all entities into one table and returns it.
|
|
143
|
+
* @realm shared
|
|
144
|
+
* @source https://wiki.facepunch.com/gmod/Global.BuildNetworkedVarsTable
|
|
145
|
+
*/
|
|
146
|
+
declare function BuildNetworkedVarsTable(): table;
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* **INTERNAL**: This is used internally - although you're able to use it you probably shouldn't.
|
|
150
|
+
*
|
|
151
|
+
*
|
|
152
|
+
* Used internally to check if the current server the player is on can be added to favorites or not. Does not check if the server is ALREADY in the favorites.
|
|
153
|
+
*
|
|
154
|
+
* @realm menu
|
|
155
|
+
* @source https://wiki.facepunch.com/gmod/Global.CanAddServerToFavorites
|
|
156
|
+
*/
|
|
157
|
+
declare function CanAddServerToFavorites(): boolean;
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* Aborts joining of the server you are currently joining.
|
|
161
|
+
* @realm menu
|
|
162
|
+
* @source https://wiki.facepunch.com/gmod/Global.CancelLoading
|
|
163
|
+
*/
|
|
164
|
+
declare function CancelLoading(): void;
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* Sets the active main menu background image to a random entry from the background images pool. Images are added with [Global.AddBackgroundImage](https://wiki.facepunch.com/gmod/Global.AddBackgroundImage).
|
|
168
|
+
* @realm menu
|
|
169
|
+
* @source https://wiki.facepunch.com/gmod/Global.ChangeBackground
|
|
170
|
+
*/
|
|
171
|
+
declare function ChangeBackground(currentgm: string): void;
|
|
172
|
+
|
|
173
|
+
/**
|
|
174
|
+
* Automatically called by the engine when a panel is hovered over with the mouse
|
|
175
|
+
* @realm client and menu
|
|
176
|
+
* @source https://wiki.facepunch.com/gmod/Global.ChangeTooltip
|
|
177
|
+
*/
|
|
178
|
+
declare function ChangeTooltip(panel: Panel): void;
|
|
179
|
+
|
|
180
|
+
/**
|
|
181
|
+
* Empties the pool of main menu background images.
|
|
182
|
+
* @realm menu
|
|
183
|
+
* @source https://wiki.facepunch.com/gmod/Global.ClearBackgroundImages
|
|
184
|
+
*/
|
|
185
|
+
declare function ClearBackgroundImages(): void;
|
|
186
|
+
|
|
187
|
+
/**
|
|
188
|
+
* Clears all Lua Errors with the given group id.
|
|
189
|
+
* @realm menu
|
|
190
|
+
* @source https://wiki.facepunch.com/gmod/Global.ClearLuaErrorGroup
|
|
191
|
+
*/
|
|
192
|
+
declare function ClearLuaErrorGroup(group_id: string): void;
|
|
193
|
+
|
|
194
|
+
/**
|
|
195
|
+
* Removes the given Problem from the Problems table and refreshes the Problems panel.
|
|
196
|
+
* @realm menu
|
|
197
|
+
* @source https://wiki.facepunch.com/gmod/Global.ClearProblem
|
|
198
|
+
*/
|
|
199
|
+
declare function ClearProblem(id: string): void;
|
|
200
|
+
|
|
201
|
+
/**
|
|
202
|
+
* Creates a non physical entity that only exists on the client. See also [ents.CreateClientProp](https://wiki.facepunch.com/gmod/ents.CreateClientProp) if physics is wanted.
|
|
203
|
+
*
|
|
204
|
+
* Parented clientside models will become detached if the parent entity leaves the PVS. A workaround is available on the issue tracker page linked below.
|
|
205
|
+
*
|
|
206
|
+
* Clientside entities are not garbage-collected, thus you must store a reference to the object (in a variable) and call [CSEnt:Remove](https://wiki.facepunch.com/gmod/CSEnt:Remove) manually when necessary.
|
|
207
|
+
*
|
|
208
|
+
* Clientside models will occasionally delete themselves during high server lag.
|
|
209
|
+
*
|
|
210
|
+
* @realm client
|
|
211
|
+
* @source https://wiki.facepunch.com/gmod/Global.ClientsideModel
|
|
212
|
+
*/
|
|
213
|
+
declare function ClientsideModel(model: string, renderGroup?: number): CSEnt | nil;
|
|
214
|
+
|
|
215
|
+
/**
|
|
216
|
+
* Creates a fully clientside ragdoll.
|
|
217
|
+
*
|
|
218
|
+
* **NOTE**: The ragdoll initially starts as hidden and with shadows disabled, see the example for how to enable it.
|
|
219
|
+
*
|
|
220
|
+
* There's no need to call [Entity:Spawn](https://wiki.facepunch.com/gmod/Entity:Spawn) on this entity.
|
|
221
|
+
*
|
|
222
|
+
*
|
|
223
|
+
* Clientside entities are not garbage-collected, thus you must store a reference to the object and call [CSEnt:Remove](https://wiki.facepunch.com/gmod/CSEnt:Remove) manually.
|
|
224
|
+
*
|
|
225
|
+
* @realm client
|
|
226
|
+
* @source https://wiki.facepunch.com/gmod/Global.ClientsideRagdoll
|
|
227
|
+
*/
|
|
228
|
+
declare function ClientsideRagdoll(model: string, renderGroup?: number): CSEnt;
|
|
229
|
+
|
|
230
|
+
/**
|
|
231
|
+
* Creates a scene entity based on the scene name and the entity.
|
|
232
|
+
* @realm client
|
|
233
|
+
* @source https://wiki.facepunch.com/gmod/Global.ClientsideScene
|
|
234
|
+
*/
|
|
235
|
+
declare function ClientsideScene(name: string, targetEnt: Entity): CSEnt;
|
|
236
|
+
|
|
237
|
+
/**
|
|
238
|
+
* Closes all Derma menus that have been passed to [Global.RegisterDermaMenuForClose](https://wiki.facepunch.com/gmod/Global.RegisterDermaMenuForClose) and calls [GM:CloseDermaMenus](https://wiki.facepunch.com/gmod/GM:CloseDermaMenus)
|
|
239
|
+
* @realm client and menu
|
|
240
|
+
* @source https://wiki.facepunch.com/gmod/Global.CloseDermaMenus
|
|
241
|
+
*/
|
|
242
|
+
declare function CloseDermaMenus(): void;
|
|
243
|
+
|
|
244
|
+
/**
|
|
245
|
+
* Creates a [Color](https://wiki.facepunch.com/gmod/Color).
|
|
246
|
+
* **WARNING**: This function is relatively expensive when used in rendering hooks or in operations requiring very frequent calls (like loops for example) due to object creation and garbage collection. It is better to store the color in a variable or to use the [default colors](https://wiki.facepunch.com/gmod/Global_Variables#misc) available.
|
|
247
|
+
*
|
|
248
|
+
*
|
|
249
|
+
* Here is a list of colors already cached by the game
|
|
250
|
+
*
|
|
251
|
+
* Variable | Color (RGBA) |
|
|
252
|
+
* -----|------------|
|
|
253
|
+
* | color_white | Color(255, 255, 255, 255) |
|
|
254
|
+
* | color_black | Color(0, 0, 0, 255) |
|
|
255
|
+
* | color_transparent | Color(255, 255, 255, 0) |
|
|
256
|
+
*
|
|
257
|
+
* **WARNING**: Under no circumstances should these variables be modified (by a Lerp or value modification). Some addons that use these values (e.g. color_white) will be affected by this change.
|
|
258
|
+
*
|
|
259
|
+
*
|
|
260
|
+
*
|
|
261
|
+
* @realm shared and menu
|
|
262
|
+
* @source https://wiki.facepunch.com/gmod/Global.Color
|
|
263
|
+
*/
|
|
264
|
+
declare function Color(r: number, g: number, b: number, a?: number): Color;
|
|
265
|
+
|
|
266
|
+
/**
|
|
267
|
+
* Returns a new Color with the RGB components of the given Color and the alpha
|
|
268
|
+
* value specified. The source color is not modified.
|
|
269
|
+
* @realm shared
|
|
270
|
+
* @realm menu
|
|
271
|
+
* @source https://wiki.facepunch.com/gmod/Global.ColorAlpha
|
|
272
|
+
*/
|
|
273
|
+
declare function ColorAlpha(color: Color, alpha: number): Color;
|
|
274
|
+
|
|
275
|
+
|
|
276
|
+
/**
|
|
277
|
+
* Creates a Color with randomized red, green, and blue components. If the alpha
|
|
278
|
+
* argument is true, alpha will also be randomized.
|
|
279
|
+
* @realm shared
|
|
280
|
+
* @realm menu
|
|
281
|
+
* @source https://wiki.facepunch.com/gmod/Global.ColorRand
|
|
282
|
+
*/
|
|
283
|
+
declare function ColorRand(a?: boolean): Color;
|
|
284
|
+
|
|
285
|
+
|
|
286
|
+
/**
|
|
287
|
+
* Converts a [Color](https://wiki.facepunch.com/gmod/Color) into HSL color space.
|
|
288
|
+
* @realm shared and menu
|
|
289
|
+
* @source https://wiki.facepunch.com/gmod/Global.ColorToHSL
|
|
290
|
+
*/
|
|
291
|
+
declare function ColorToHSL(color: Color): (number, number, number);
|
|
292
|
+
|
|
293
|
+
/**
|
|
294
|
+
* Converts a [Color](https://wiki.facepunch.com/gmod/Color) into HSV color space.
|
|
295
|
+
* @realm shared and menu
|
|
296
|
+
* @source https://wiki.facepunch.com/gmod/Global.ColorToHSV
|
|
297
|
+
*/
|
|
298
|
+
declare function ColorToHSV(color: Color): (number, number, number);
|
|
299
|
+
|
|
300
|
+
/**
|
|
301
|
+
* Attempts to compile the given file. If successful, returns a function that can be called to perform the actual execution of the script.
|
|
302
|
+
* @realm shared
|
|
303
|
+
* @source https://wiki.facepunch.com/gmod/Global.CompileFile
|
|
304
|
+
*/
|
|
305
|
+
declare function CompileFile(path: string, showError?: boolean): function;
|
|
306
|
+
|
|
307
|
+
/**
|
|
308
|
+
* This function will compile the code argument as lua code and return a function that will execute that code.
|
|
309
|
+
*
|
|
310
|
+
* Please note that this function will not automatically execute the given code after compiling it.
|
|
311
|
+
*
|
|
312
|
+
* @realm shared
|
|
313
|
+
* @source https://wiki.facepunch.com/gmod/Global.CompileString
|
|
314
|
+
*/
|
|
315
|
+
declare function CompileString(code: string, identifier: string, handleError?: boolean): function;
|
|
316
|
+
|
|
317
|
+
/**
|
|
318
|
+
* Returns whether a [ConVar](https://wiki.facepunch.com/gmod/ConVar) with the given name exists or not
|
|
319
|
+
* @realm shared and menu
|
|
320
|
+
* @source https://wiki.facepunch.com/gmod/Global.ConVarExists
|
|
321
|
+
*/
|
|
322
|
+
declare function ConVarExists(name: string): boolean;
|
|
323
|
+
|
|
324
|
+
/**
|
|
325
|
+
* Makes a clientside-only console variable
|
|
326
|
+
*
|
|
327
|
+
* **NOTE**: This function is a wrapper of [Global.CreateConVar](https://wiki.facepunch.com/gmod/Global.CreateConVar), with the difference being that FCVAR_ARCHIVE and FCVAR_USERINFO are added automatically when **shouldsave** and **userinfo** are true, respectively.
|
|
328
|
+
*
|
|
329
|
+
*
|
|
330
|
+
* Although this function is shared, it should only be used clientside.
|
|
331
|
+
*
|
|
332
|
+
* @realm shared and menu
|
|
333
|
+
* @source https://wiki.facepunch.com/gmod/Global.CreateClientConVar
|
|
334
|
+
*/
|
|
335
|
+
declare function CreateClientConVar(name: string, _default: string | number, shouldsave?: boolean, userinfo?: boolean, helptext?: string, min?: number, max?: number): ConVar;
|
|
336
|
+
|
|
337
|
+
/**
|
|
338
|
+
* Custom override: CreateConVar accepts string or number as the default value.
|
|
339
|
+
* The wiki documents the parameter as string, but numbers are automatically
|
|
340
|
+
* converted by Lua and are commonly used in practice.
|
|
341
|
+
* @realm shared
|
|
342
|
+
* @realm menu
|
|
343
|
+
* @source https://wiki.facepunch.com/gmod/Global.CreateConVar
|
|
344
|
+
*/
|
|
345
|
+
declare function CreateConVar(name: string, value: string | number, flags?: FCVAR | number[], helptext?: string, min?: number, max?: number): ConVar;
|
|
346
|
+
|
|
347
|
+
|
|
348
|
+
/**
|
|
349
|
+
* Creates a ContextMenu.
|
|
350
|
+
* **INTERNAL**: This is used internally - although you're able to use it you probably shouldn't.
|
|
351
|
+
*
|
|
352
|
+
*
|
|
353
|
+
* @realm client
|
|
354
|
+
* @source https://wiki.facepunch.com/gmod/Global.CreateContextMenu
|
|
355
|
+
*/
|
|
356
|
+
declare function CreateContextMenu(): void;
|
|
357
|
+
|
|
358
|
+
/**
|
|
359
|
+
* Creates a new material with the specified name and shader.
|
|
360
|
+
*
|
|
361
|
+
* Materials created with this function can be used in [Entity:SetMaterial](https://wiki.facepunch.com/gmod/Entity:SetMaterial) and [Entity:SetSubMaterial](https://wiki.facepunch.com/gmod/Entity:SetSubMaterial) by prepending a `!` to their material name argument.
|
|
362
|
+
*
|
|
363
|
+
* This will not create a new material if another material object with the same name already exists. All Materials created by this functions are cleaned up on map shutdown.
|
|
364
|
+
*
|
|
365
|
+
* **NOTE**: This does not work with [patch materials](https://developer.valvesoftware.com/wiki/Patch).
|
|
366
|
+
*
|
|
367
|
+
*
|
|
368
|
+
* .pngs must be loaded with [Global.Material](https://wiki.facepunch.com/gmod/Global.Material) before being used with this function.
|
|
369
|
+
*
|
|
370
|
+
*
|
|
371
|
+
* @realm client and menu
|
|
372
|
+
* @source https://wiki.facepunch.com/gmod/Global.CreateMaterial
|
|
373
|
+
*/
|
|
374
|
+
declare function CreateMaterial(name: string, shaderName: string, materialData: table): IMaterial;
|
|
375
|
+
|
|
376
|
+
/**
|
|
377
|
+
* Creates a new Preset from the given JSON string.
|
|
378
|
+
*
|
|
379
|
+
* @realm menu
|
|
380
|
+
* @source https://wiki.facepunch.com/gmod/Global.CreateNewAddonPreset
|
|
381
|
+
*/
|
|
382
|
+
declare function CreateNewAddonPreset(data: string): void;
|
|
383
|
+
|
|
384
|
+
/**
|
|
385
|
+
* Creates a new particle system. See also [Entity:CreateParticleEffect](https://wiki.facepunch.com/gmod/Entity:CreateParticleEffect), [Global.ParticleEffectAttach](https://wiki.facepunch.com/gmod/Global.ParticleEffectAttach) and [Global.CreateParticleSystemNoEntity](https://wiki.facepunch.com/gmod/Global.CreateParticleSystemNoEntity).
|
|
386
|
+
*
|
|
387
|
+
* **NOTE**: The particle effect must be precached with [Global.PrecacheParticleSystem](https://wiki.facepunch.com/gmod/Global.PrecacheParticleSystem) and the file its from must be added via [game.AddParticles](https://wiki.facepunch.com/gmod/game.AddParticles) before it can be used!
|
|
388
|
+
*
|
|
389
|
+
*
|
|
390
|
+
* @realm client
|
|
391
|
+
* @source https://wiki.facepunch.com/gmod/Global.CreateParticleSystem
|
|
392
|
+
*/
|
|
393
|
+
declare function CreateParticleSystem(ent: Entity, effect: string, partAtt: number, entAtt?: number, offset?: Vector): CNewParticleEffect;
|
|
394
|
+
|
|
395
|
+
/**
|
|
396
|
+
* Creates a new particle system, and sets control points 0 and 1 to given position, as well as optionally orientation of CP0 to the given angles. See also [Global.CreateParticleSystem](https://wiki.facepunch.com/gmod/Global.CreateParticleSystem)
|
|
397
|
+
*
|
|
398
|
+
* **NOTE**: The particle effect must be precached with [Global.PrecacheParticleSystem](https://wiki.facepunch.com/gmod/Global.PrecacheParticleSystem) and the file its from must be added via [game.AddParticles](https://wiki.facepunch.com/gmod/game.AddParticles) before it can be used!
|
|
399
|
+
*
|
|
400
|
+
*
|
|
401
|
+
* @realm client
|
|
402
|
+
* @source https://wiki.facepunch.com/gmod/Global.CreateParticleSystemNoEntity
|
|
403
|
+
*/
|
|
404
|
+
declare function CreateParticleSystemNoEntity(effect: string, pos: Vector, ang?: Angle): CNewParticleEffect;
|
|
405
|
+
|
|
406
|
+
/**
|
|
407
|
+
* Creates a new [PhysCollide](https://wiki.facepunch.com/gmod/PhysCollide) from the given bounds.
|
|
408
|
+
*
|
|
409
|
+
* This fails to create planes or points - no components of the mins or maxs can be the same.
|
|
410
|
+
*
|
|
411
|
+
* @realm shared
|
|
412
|
+
* @source https://wiki.facepunch.com/gmod/Global.CreatePhysCollideBox
|
|
413
|
+
*/
|
|
414
|
+
declare function CreatePhysCollideBox(mins: Vector, maxs: Vector): PhysCollide;
|
|
415
|
+
|
|
416
|
+
/**
|
|
417
|
+
* Creates [PhysCollide](https://wiki.facepunch.com/gmod/PhysCollide) objects for every physics object the model has. The model must be precached with [util.PrecacheModel](https://wiki.facepunch.com/gmod/util.PrecacheModel) before being used with this function.
|
|
418
|
+
* @realm shared
|
|
419
|
+
* @source https://wiki.facepunch.com/gmod/Global.CreatePhysCollidesFromModel
|
|
420
|
+
*/
|
|
421
|
+
declare function CreatePhysCollidesFromModel(modelName: string): PhysCollide[];
|
|
422
|
+
|
|
423
|
+
/**
|
|
424
|
+
* Returns a sound parented to the specified entity.
|
|
425
|
+
*
|
|
426
|
+
* **NOTE**: You can only create one CSoundPatch per audio file, per entity at the same time.
|
|
427
|
+
*
|
|
428
|
+
* **NOTE**: Valid sample rates: **11025 Hz, 22050 Hz and 44100 Hz**, otherwise you may see this kind of message:
|
|
429
|
+
*
|
|
430
|
+
* `Unsupported 32-bit wave file your_sound.wav` and
|
|
431
|
+
* `Invalid sample rate (48000) for sound 'your_sound.wav'`
|
|
432
|
+
*
|
|
433
|
+
*
|
|
434
|
+
* @realm shared
|
|
435
|
+
* @source https://wiki.facepunch.com/gmod/Global.CreateSound
|
|
436
|
+
*/
|
|
437
|
+
declare function CreateSound(targetEnt: Entity, soundName: string, filter?: CRecipientFilter): CSoundPatch;
|
|
438
|
+
|
|
439
|
+
/**
|
|
440
|
+
* Creates and returns a new [DSprite](https://wiki.facepunch.com/gmod/DSprite) element with the supplied material.
|
|
441
|
+
* @realm client
|
|
442
|
+
* @source https://wiki.facepunch.com/gmod/Global.CreateSprite
|
|
443
|
+
*/
|
|
444
|
+
declare function CreateSprite(material: IMaterial): Panel;
|
|
445
|
+
|
|
446
|
+
/**
|
|
447
|
+
* Returns the uptime of the server in seconds (to at least 4 decimal places)
|
|
448
|
+
*
|
|
449
|
+
* This is a synchronised value and affected by various factors such as host_timescale (or [game.GetTimeScale](https://wiki.facepunch.com/gmod/game.GetTimeScale)) and the server being paused - either by `sv_pausable` or all players disconnecting.
|
|
450
|
+
*
|
|
451
|
+
* You should use this function for timing in-game events but not for real-world events.
|
|
452
|
+
*
|
|
453
|
+
* See also: [Global.RealTime](https://wiki.facepunch.com/gmod/Global.RealTime), [Global.SysTime](https://wiki.facepunch.com/gmod/Global.SysTime)
|
|
454
|
+
*
|
|
455
|
+
* @realm shared and menu
|
|
456
|
+
* @source https://wiki.facepunch.com/gmod/Global.CurTime
|
|
457
|
+
*/
|
|
458
|
+
declare function CurTime(): number;
|
|
459
|
+
|
|
460
|
+
/**
|
|
461
|
+
* Generates and provides a local variable `BaseClass` that can be used to call the original version of a class functions after modifying it.
|
|
462
|
+
*
|
|
463
|
+
* This is a preprocessor keyword that is directly replaced with the following text:
|
|
464
|
+
* ```lua
|
|
465
|
+
* local BaseClass = baseclass.Get
|
|
466
|
+
* ```
|
|
467
|
+
*
|
|
468
|
+
* Because this is a simple preprocessor keyword and not a function, it will cause problems if not used properly
|
|
469
|
+
*
|
|
470
|
+
* See [baseclass.Get](https://wiki.facepunch.com/gmod/baseclass.Get) for more information.
|
|
471
|
+
* **WARNING**: The preprocessor is not smart enough to know when substitution doesn't make sense, such as: table keys and strings.
|
|
472
|
+
*
|
|
473
|
+
* Running `print("DEFINE_BASECLASS")` is the same as `print("local BaseClass = baseclass.Get")`
|
|
474
|
+
*
|
|
475
|
+
*
|
|
476
|
+
* For more information, including usage examples, see the [BaseClasses](https://wiki.facepunch.com/gmod/BaseClasses) reference page.
|
|
477
|
+
*
|
|
478
|
+
*
|
|
479
|
+
* @realm shared and menu
|
|
480
|
+
* @source https://wiki.facepunch.com/gmod/Global.DEFINE_BASECLASS
|
|
481
|
+
*/
|
|
482
|
+
declare function DEFINE_BASECLASS(value: string): void;
|
|
483
|
+
|
|
484
|
+
/**
|
|
485
|
+
* A hacky method used to fix some bugs regarding DoF. What this basically does it force all `C_BaseAnimating` entities to have the translucent [rendergroup](https://wiki.facepunch.com/gmod/Enums/RENDERGROUP), even if they use opaque or two-pass models.
|
|
486
|
+
*
|
|
487
|
+
* This is specifically to do with [GM:NeedsDepthPass](https://wiki.facepunch.com/gmod/GM:NeedsDepthPass)
|
|
488
|
+
*
|
|
489
|
+
* **INTERNAL**: This is used internally - although you're able to use it you probably shouldn't.
|
|
490
|
+
*
|
|
491
|
+
*
|
|
492
|
+
* @realm client
|
|
493
|
+
* @source https://wiki.facepunch.com/gmod/Global.DOFModeHack
|
|
494
|
+
*/
|
|
495
|
+
declare function DOFModeHack(enable: boolean): void;
|
|
496
|
+
|
|
497
|
+
/**
|
|
498
|
+
* Cancels current DOF post-process effect started with [Global.DOF_Start](https://wiki.facepunch.com/gmod/Global.DOF_Start)
|
|
499
|
+
* @realm client
|
|
500
|
+
* @source https://wiki.facepunch.com/gmod/Global.DOF_Kill
|
|
501
|
+
*/
|
|
502
|
+
declare function DOF_Kill(): void;
|
|
503
|
+
|
|
504
|
+
/**
|
|
505
|
+
* Cancels any existing DOF post-process effects.
|
|
506
|
+
* Begins the DOF post-process effect.
|
|
507
|
+
*
|
|
508
|
+
* @realm client
|
|
509
|
+
* @source https://wiki.facepunch.com/gmod/Global.DOF_Start
|
|
510
|
+
*/
|
|
511
|
+
declare function DOF_Start(): void;
|
|
512
|
+
|
|
513
|
+
/**
|
|
514
|
+
* Calls all NetworkVarNotify functions of the given entity with the given new value, but doesn't change the real value.
|
|
515
|
+
* internally uses [Entity:CallDTVarProxies](https://wiki.facepunch.com/gmod/Entity:CallDTVarProxies)
|
|
516
|
+
* @realm shared
|
|
517
|
+
* @source https://wiki.facepunch.com/gmod/Global.DTVar_ReceiveProxyGL
|
|
518
|
+
*/
|
|
519
|
+
declare function DTVar_ReceiveProxyGL(entity: Entity, Type: string, index: number, newValue: any): void;
|
|
520
|
+
|
|
521
|
+
/**
|
|
522
|
+
* Returns an [CTakeDamageInfo](https://wiki.facepunch.com/gmod/CTakeDamageInfo) object.
|
|
523
|
+
*
|
|
524
|
+
* This does not create a unique object, but instead returns a shared reference. That means you cannot use two or more of these objects at once.
|
|
525
|
+
*
|
|
526
|
+
* @realm shared
|
|
527
|
+
* @source https://wiki.facepunch.com/gmod/Global.DamageInfo
|
|
528
|
+
*/
|
|
529
|
+
declare function DamageInfo(): CTakeDamageInfo;
|
|
530
|
+
|
|
531
|
+
/**
|
|
532
|
+
* Writes text to the right hand side of the screen, like the old error system. Messages disappear after a couple of seconds.
|
|
533
|
+
* @realm shared and menu
|
|
534
|
+
* @source https://wiki.facepunch.com/gmod/Global.DebugInfo
|
|
535
|
+
*/
|
|
536
|
+
declare function DebugInfo(slot: number, info: string): void;
|
|
537
|
+
|
|
538
|
+
/**
|
|
539
|
+
* Deletes the given Preset.
|
|
540
|
+
*
|
|
541
|
+
* @realm menu
|
|
542
|
+
* @source https://wiki.facepunch.com/gmod/Global.DeleteAddonPreset
|
|
543
|
+
*/
|
|
544
|
+
declare function DeleteAddonPreset(name: string): void;
|
|
545
|
+
|
|
546
|
+
/**
|
|
547
|
+
* Loads and registers the specified gamemode, setting the GM table's DerivedFrom field to the value provided, if the table exists. The DerivedFrom field is used post-gamemode-load as the "derived" parameter for [gamemode.Register](https://wiki.facepunch.com/gmod/gamemode.Register). See [Gamemode_Creation#derivinggamemodes](https://wiki.facepunch.com/gmod/Gamemode_Creation#derivinggamemodes) for more information about deriving gamemodes.
|
|
548
|
+
* @realm shared
|
|
549
|
+
* @source https://wiki.facepunch.com/gmod/Global.DeriveGamemode
|
|
550
|
+
*/
|
|
551
|
+
declare function DeriveGamemode(base: string): void;
|
|
552
|
+
|
|
553
|
+
/**
|
|
554
|
+
* Creates a DMenu and closes any current menus.
|
|
555
|
+
* @realm client
|
|
556
|
+
* @realm menu
|
|
557
|
+
* @source https://wiki.facepunch.com/gmod/Global.DermaMenu
|
|
558
|
+
*/
|
|
559
|
+
declare function DermaMenu(keepOpen?: boolean, parent?: Panel): DMenu;
|
|
560
|
+
|
|
561
|
+
|
|
562
|
+
/**
|
|
563
|
+
* Creates a new derma animation.
|
|
564
|
+
* @realm client and menu
|
|
565
|
+
* @source https://wiki.facepunch.com/gmod/Global.Derma_Anim
|
|
566
|
+
*/
|
|
567
|
+
declare function Derma_Anim(name: string, panel: Panel, func: (pnl: Panel, anim: table, delta: number, data: any) => void): table;
|
|
568
|
+
|
|
569
|
+
/**
|
|
570
|
+
* Draws background blur around the given panel.
|
|
571
|
+
* **NOTE**: Calling this on the same [Panel](https://wiki.facepunch.com/gmod/Panel) multiple times makes the blur darker.
|
|
572
|
+
*
|
|
573
|
+
*
|
|
574
|
+
* @realm client and menu
|
|
575
|
+
* @source https://wiki.facepunch.com/gmod/Global.Derma_DrawBackgroundBlur
|
|
576
|
+
*/
|
|
577
|
+
declare function Derma_DrawBackgroundBlur(panel: Panel, startTime: number): void;
|
|
578
|
+
|
|
579
|
+
/**
|
|
580
|
+
* Creates panel method that calls the supplied Derma skin hook via [derma.SkinHook](https://wiki.facepunch.com/gmod/derma.SkinHook)
|
|
581
|
+
* @realm client and menu
|
|
582
|
+
* @source https://wiki.facepunch.com/gmod/Global.Derma_Hook
|
|
583
|
+
*/
|
|
584
|
+
declare function Derma_Hook(panel: Panel, functionName: string, hookName: string, typeName: string): void;
|
|
585
|
+
|
|
586
|
+
/**
|
|
587
|
+
* Makes the panel (usually an input of sorts) respond to changes in console variables by adding next functions to the panel:
|
|
588
|
+
* * [Panel:SetConVar](https://wiki.facepunch.com/gmod/Panel:SetConVar)
|
|
589
|
+
* * [Panel:ConVarChanged](https://wiki.facepunch.com/gmod/Panel:ConVarChanged)
|
|
590
|
+
* * [Panel:ConVarStringThink](https://wiki.facepunch.com/gmod/Panel:ConVarStringThink)
|
|
591
|
+
* * [Panel:ConVarNumberThink](https://wiki.facepunch.com/gmod/Panel:ConVarNumberThink)
|
|
592
|
+
*
|
|
593
|
+
* The console variable value is saved in the `m_strConVar` property of the panel.
|
|
594
|
+
*
|
|
595
|
+
* The panel should call
|
|
596
|
+
* [Panel:ConVarStringThink](https://wiki.facepunch.com/gmod/Panel:ConVarStringThink) or
|
|
597
|
+
* [Panel:ConVarNumberThink](https://wiki.facepunch.com/gmod/Panel:ConVarNumberThink)
|
|
598
|
+
* in its [PANEL:Think](https://wiki.facepunch.com/gmod/PANEL:Think) hook and should call [Panel:ConVarChanged](https://wiki.facepunch.com/gmod/Panel:ConVarChanged) when the panel's value has changed.
|
|
599
|
+
*
|
|
600
|
+
* @realm client and menu
|
|
601
|
+
* @source https://wiki.facepunch.com/gmod/Global.Derma_Install_Convar_Functions
|
|
602
|
+
*/
|
|
603
|
+
declare function Derma_Install_Convar_Functions(target: Panel): void;
|
|
604
|
+
|
|
605
|
+
/**
|
|
606
|
+
* Creates a derma window to display information
|
|
607
|
+
* @realm client and menu
|
|
608
|
+
* @source https://wiki.facepunch.com/gmod/Global.Derma_Message
|
|
609
|
+
*/
|
|
610
|
+
declare function Derma_Message(Text: string, Title: string, Button: string): Panel;
|
|
611
|
+
|
|
612
|
+
/**
|
|
613
|
+
* Shows a message box in the middle of the screen, with up to 4 buttons they can press.
|
|
614
|
+
* @realm client and menu
|
|
615
|
+
* @source https://wiki.facepunch.com/gmod/Global.Derma_Query
|
|
616
|
+
*/
|
|
617
|
+
declare function Derma_Query(text?: string, title?: string, btn1text?: string, btn1func?: function, btn2text?: string, btn2func?: function, btn3text?: string, btn3func?: function, btn4text?: string, btn4func?: function): Panel;
|
|
618
|
+
|
|
619
|
+
/**
|
|
620
|
+
* Creates a derma window asking players to input a string.
|
|
621
|
+
* @realm client and menu
|
|
622
|
+
* @source https://wiki.facepunch.com/gmod/Global.Derma_StringRequest
|
|
623
|
+
*/
|
|
624
|
+
declare function Derma_StringRequest(title: string, subtitle: string, _default: string, confirm: (text: string) => void, cancel?: (text: string) => void, confirmText?: string, cancelText?: string): Panel;
|
|
625
|
+
|
|
626
|
+
/**
|
|
627
|
+
* Sets whether rendering should be limited to being inside a panel or not. Needs to be used inside one of the [2d rendering hooks](https://wiki.facepunch.com/gmod/2d_rendering_hooks)
|
|
628
|
+
*
|
|
629
|
+
* See also [Panel:NoClipping](https://wiki.facepunch.com/gmod/Panel:NoClipping).
|
|
630
|
+
*
|
|
631
|
+
* @realm client and menu
|
|
632
|
+
* @source https://wiki.facepunch.com/gmod/Global.DisableClipping
|
|
633
|
+
*/
|
|
634
|
+
declare function DisableClipping(disable: boolean): boolean;
|
|
635
|
+
|
|
636
|
+
/**
|
|
637
|
+
* Stops searching for new servers in the given category
|
|
638
|
+
* @realm menu
|
|
639
|
+
* @source https://wiki.facepunch.com/gmod/Global.DoStopServers
|
|
640
|
+
*/
|
|
641
|
+
declare function DoStopServers(category: string): void;
|
|
642
|
+
|
|
643
|
+
/**
|
|
644
|
+
* **INTERNAL**: This is used internally - although you're able to use it you probably shouldn't.
|
|
645
|
+
* Draws the currently active main menu background image and handles transitioning between background images.
|
|
646
|
+
*
|
|
647
|
+
* This is called by default in the menu panel's Paint hook.
|
|
648
|
+
*
|
|
649
|
+
* @realm menu
|
|
650
|
+
* @source https://wiki.facepunch.com/gmod/Global.DrawBackground
|
|
651
|
+
*/
|
|
652
|
+
declare function DrawBackground(): void;
|
|
653
|
+
|
|
654
|
+
/**
|
|
655
|
+
* Draws the bloom shader, which creates a glowing effect from bright objects.
|
|
656
|
+
* @realm client
|
|
657
|
+
* @source https://wiki.facepunch.com/gmod/Global.DrawBloom
|
|
658
|
+
*/
|
|
659
|
+
declare function DrawBloom(Darken: number, Multiply: number, SizeX: number, SizeY: number, Passes: number, ColorMultiply: number, Red: number, Green: number, Blue: number): void;
|
|
660
|
+
|
|
661
|
+
/**
|
|
662
|
+
* Draws the Bokeh Depth Of Field effect .
|
|
663
|
+
* @realm client
|
|
664
|
+
* @source https://wiki.facepunch.com/gmod/Global.DrawBokehDOF
|
|
665
|
+
*/
|
|
666
|
+
declare function DrawBokehDOF(intensity: number, distance: number, focus: number): void;
|
|
667
|
+
|
|
668
|
+
/**
|
|
669
|
+
* Draws the Color Modify shader, which can be used to adjust colors on screen.
|
|
670
|
+
* @realm client
|
|
671
|
+
* @source https://wiki.facepunch.com/gmod/Global.DrawColorModify
|
|
672
|
+
*/
|
|
673
|
+
declare function DrawColorModify(modifyParameters: table): void;
|
|
674
|
+
|
|
675
|
+
/**
|
|
676
|
+
* Draws a material overlay on the screen.
|
|
677
|
+
* @realm client
|
|
678
|
+
* @source https://wiki.facepunch.com/gmod/Global.DrawMaterialOverlay
|
|
679
|
+
*/
|
|
680
|
+
declare function DrawMaterialOverlay(Material: string, RefractAmount: number): void;
|
|
681
|
+
|
|
682
|
+
/**
|
|
683
|
+
* Creates a motion blur effect by drawing your screen multiple times.
|
|
684
|
+
* @realm client
|
|
685
|
+
* @source https://wiki.facepunch.com/gmod/Global.DrawMotionBlur
|
|
686
|
+
*/
|
|
687
|
+
declare function DrawMotionBlur(AddAlpha: number, DrawAlpha: number, Delay: number): void;
|
|
688
|
+
|
|
689
|
+
/**
|
|
690
|
+
* Draws the sharpen shader, which creates more contrast.
|
|
691
|
+
* @realm client
|
|
692
|
+
* @source https://wiki.facepunch.com/gmod/Global.DrawSharpen
|
|
693
|
+
*/
|
|
694
|
+
declare function DrawSharpen(Contrast: number, Distance: number): void;
|
|
695
|
+
|
|
696
|
+
/**
|
|
697
|
+
* Draws the sobel shader, which detects edges and draws a black border.
|
|
698
|
+
* @realm client
|
|
699
|
+
* @source https://wiki.facepunch.com/gmod/Global.DrawSobel
|
|
700
|
+
*/
|
|
701
|
+
declare function DrawSobel(Threshold: number): void;
|
|
702
|
+
|
|
703
|
+
/**
|
|
704
|
+
* Renders the post-processing effect of beams of light originating from the map's sun. Utilises the `pp/sunbeams` material.
|
|
705
|
+
* @realm client
|
|
706
|
+
* @source https://wiki.facepunch.com/gmod/Global.DrawSunbeams
|
|
707
|
+
*/
|
|
708
|
+
declare function DrawSunbeams(darken: number, multiplier: number, sunSize: number, sunX: number, sunY: number): void;
|
|
709
|
+
|
|
710
|
+
/**
|
|
711
|
+
* Draws the texturize shader, which replaces each pixel on your screen with a different part of the texture depending on its brightness. See [g_texturize](https://wiki.facepunch.com/gmod/Shaders/g_texturize) for information on making the texture.
|
|
712
|
+
* @realm client
|
|
713
|
+
* @source https://wiki.facepunch.com/gmod/Global.DrawTexturize
|
|
714
|
+
*/
|
|
715
|
+
declare function DrawTexturize(Scale: number, BaseTexture: number): void;
|
|
716
|
+
|
|
717
|
+
/**
|
|
718
|
+
* Draws the toy town shader, which blurs the top and bottom of your screen. This can make very large objects look like toys, hence the name.
|
|
719
|
+
* @realm client
|
|
720
|
+
* @source https://wiki.facepunch.com/gmod/Global.DrawToyTown
|
|
721
|
+
*/
|
|
722
|
+
declare function DrawToyTown(Passes: number, Height: number): void;
|
|
723
|
+
|
|
724
|
+
/**
|
|
725
|
+
* Drops the specified entity if it is being held by any player with Gravity Gun, Physics Gun or `+use` pickup.
|
|
726
|
+
*
|
|
727
|
+
* See also [Player:DropObject](https://wiki.facepunch.com/gmod/Player:DropObject) and [Entity:ForcePlayerDrop](https://wiki.facepunch.com/gmod/Entity:ForcePlayerDrop).
|
|
728
|
+
*
|
|
729
|
+
* @realm server
|
|
730
|
+
* @source https://wiki.facepunch.com/gmod/Global.DropEntityIfHeld
|
|
731
|
+
* @deprecated You really should be using Entity:ForcePlayerDrop, which does the same thing.
|
|
732
|
+
*/
|
|
733
|
+
declare function DropEntityIfHeld(ent: Entity): void;
|
|
734
|
+
|
|
735
|
+
/**
|
|
736
|
+
* Creates or replaces a dynamic light with the given id.
|
|
737
|
+
*
|
|
738
|
+
* **NOTE**: Only 32 dlights and 64 elights can be active at once.
|
|
739
|
+
*
|
|
740
|
+
* **WARNING**: It is not safe to hold a reference to this object after creation since its data can be replaced by another dlight at any time.
|
|
741
|
+
*
|
|
742
|
+
* Dynamic lights affect the world (brushwork, static props) and entities (dynamic props, etc.) differently.
|
|
743
|
+
*
|
|
744
|
+
* @realm client
|
|
745
|
+
* @source https://wiki.facepunch.com/gmod/Global.DynamicLight
|
|
746
|
+
*/
|
|
747
|
+
declare function DynamicLight(index: number, elight?: boolean): table;
|
|
748
|
+
|
|
749
|
+
/**
|
|
750
|
+
* Creates a dynamic Material from the given materialPath
|
|
751
|
+
* **WARNING**: This function should never be used in a Rendering Hook because it creates a new dynamic material every time and can fill up your vram.
|
|
752
|
+
*
|
|
753
|
+
*
|
|
754
|
+
* @realm menu
|
|
755
|
+
* @source https://wiki.facepunch.com/gmod/Global.DynamicMaterial
|
|
756
|
+
*/
|
|
757
|
+
declare function DynamicMaterial(materialPath: string, flags?: string): IMaterial;
|
|
758
|
+
|
|
759
|
+
/**
|
|
760
|
+
* Returns a [CEffectData](https://wiki.facepunch.com/gmod/CEffectData) object to be used with [util.Effect](https://wiki.facepunch.com/gmod/util.Effect).
|
|
761
|
+
*
|
|
762
|
+
* This does not create a unique object, but instead returns a shared reference. That means you cannot use two or more of these objects at once.
|
|
763
|
+
*
|
|
764
|
+
* As a result any values previously set (Origin, Magnitude, Scale etc) will carry over to all future calls of this function, and may unexpectedly affect effects created via [util.Effect](https://wiki.facepunch.com/gmod/util.Effect).
|
|
765
|
+
*
|
|
766
|
+
*
|
|
767
|
+
*
|
|
768
|
+
* @realm shared
|
|
769
|
+
* @source https://wiki.facepunch.com/gmod/Global.EffectData
|
|
770
|
+
*/
|
|
771
|
+
declare function EffectData(): CEffectData;
|
|
772
|
+
|
|
773
|
+
/**
|
|
774
|
+
* An [eagerly evaluated](https://en.wikipedia.org/wiki/Eager_evaluation) [ternary operator](https://en.wikipedia.org/wiki/%3F:), or, in layman's terms, a compact "if then else" statement.
|
|
775
|
+
*
|
|
776
|
+
* In most cases, you should just use Lua's ["pseudo" ternary operator](https://en.wikipedia.org/wiki/%3F:#Lua), like this:
|
|
777
|
+
*
|
|
778
|
+
* ```
|
|
779
|
+
* local myCondition = true
|
|
780
|
+
* local consequent = "myCondition is true"
|
|
781
|
+
* local alternative = "myCondition is false"
|
|
782
|
+
*
|
|
783
|
+
* print(myCondition and consequent or alternative)
|
|
784
|
+
* ```
|
|
785
|
+
*
|
|
786
|
+
* In the above example, due to [short-circuit evaluation](https://en.wikipedia.org/wiki/Short-circuit_evaluation), `consequent` would be "skipped" and ignored (not evaluated) by Lua due to `myCondition` being `true`, and only `alternative` would be evaluated. However, when using `Either`, both `consequent` and `alternative` would be evaluated. A practical example of this can be found at the bottom of the page.
|
|
787
|
+
*
|
|
788
|
+
* # Falsey values
|
|
789
|
+
*
|
|
790
|
+
* If `consequent` is "falsey" (Lua considers both `false` and `nil` as false), this will not work. For example:
|
|
791
|
+
*
|
|
792
|
+
* ```
|
|
793
|
+
* local X = true
|
|
794
|
+
* local Y = false
|
|
795
|
+
* local Z = "myCondition is false"
|
|
796
|
+
*
|
|
797
|
+
* print(X and Y or Z)
|
|
798
|
+
* ```
|
|
799
|
+
*
|
|
800
|
+
* This will actually print the value of `Z`.
|
|
801
|
+
*
|
|
802
|
+
* In the above case, and other very rare cases, you may find `Either` useful.
|
|
803
|
+
*
|
|
804
|
+
*
|
|
805
|
+
* @realm shared and menu
|
|
806
|
+
* @source https://wiki.facepunch.com/gmod/Global.Either
|
|
807
|
+
*/
|
|
808
|
+
declare function Either(condition: any, truevar: any, falsevar: any): any;
|
|
809
|
+
|
|
810
|
+
/**
|
|
811
|
+
* Plays a sentence from `scripts/sentences.txt`
|
|
812
|
+
* @realm shared
|
|
813
|
+
* @source https://wiki.facepunch.com/gmod/Global.EmitSentence
|
|
814
|
+
*/
|
|
815
|
+
declare function EmitSentence(soundName: string, position: Vector, entity: number, channel?: number, volume?: number, soundLevel?: number, soundFlags?: number, pitch?: number, DSP?: number): void;
|
|
816
|
+
|
|
817
|
+
/**
|
|
818
|
+
* Emits the specified sound at the specified position. See also [Entity:EmitSound](https://wiki.facepunch.com/gmod/Entity:EmitSound) if you wish to play sounds on a specific entity.
|
|
819
|
+
*
|
|
820
|
+
* **NOTE**: Valid 16 bit sample rates: **11025 Hz, 22050 Hz and 44100 Hz**, otherwise you may see this kind of message:
|
|
821
|
+
*
|
|
822
|
+
* `Unsupported 32-bit wave file your_sound.wav` and
|
|
823
|
+
* `Invalid sample rate (48000) for sound 'your_sound.wav'`
|
|
824
|
+
*
|
|
825
|
+
*
|
|
826
|
+
*
|
|
827
|
+
* @realm shared
|
|
828
|
+
* @source https://wiki.facepunch.com/gmod/Global.EmitSound
|
|
829
|
+
*/
|
|
830
|
+
declare function EmitSound(soundName: string, position: Vector, entity?: number, channel?: CHAN, volume?: number, soundLevel?: SNDLVL, soundFlags?: SND, pitch?: number, dsp?: number, filter?: CRecipientFilter): void;
|
|
831
|
+
|
|
832
|
+
/**
|
|
833
|
+
* Removes the currently active tool tip from the screen.
|
|
834
|
+
* @realm client and menu
|
|
835
|
+
* @source https://wiki.facepunch.com/gmod/Global.EndTooltip
|
|
836
|
+
*/
|
|
837
|
+
declare function EndTooltip(panel: Panel): void;
|
|
838
|
+
|
|
839
|
+
/**
|
|
840
|
+
* Returns the entity with the matching [Entity:EntIndex](https://wiki.facepunch.com/gmod/Entity:EntIndex).
|
|
841
|
+
*
|
|
842
|
+
* Indices `1` through [game.MaxPlayers](https://wiki.facepunch.com/gmod/game.MaxPlayers)() are always reserved for players.
|
|
843
|
+
*
|
|
844
|
+
* **NOTE**: In examples on this wiki, `Entity( 1 )` is used when a player entity is needed (see ). In singleplayer and listen servers, `Entity( 1 )` will always be the first player. In dedicated servers, however, `Entity( 1 )` won't always be a valid player if there is no one currently on the server.
|
|
845
|
+
*
|
|
846
|
+
*
|
|
847
|
+
* @realm shared
|
|
848
|
+
* @source https://wiki.facepunch.com/gmod/Global.Entity
|
|
849
|
+
*/
|
|
850
|
+
declare function Entity(entityIndex: number): Entity;
|
|
851
|
+
|
|
852
|
+
/**
|
|
853
|
+
* Throws an error. This is currently an alias of [Global.ErrorNoHalt](https://wiki.facepunch.com/gmod/Global.ErrorNoHalt) despite it once throwing a halting error like [error](https://wiki.facepunch.com/gmod/Global.error(lowercase)) without the stack trace appended.
|
|
854
|
+
*
|
|
855
|
+
* This function throws a non-halting error instead of a halting error.
|
|
856
|
+
*
|
|
857
|
+
* @realm shared and menu
|
|
858
|
+
* @source https://wiki.facepunch.com/gmod/Global.Error
|
|
859
|
+
*/
|
|
860
|
+
declare function Error(...: any): void;
|
|
861
|
+
|
|
862
|
+
/**
|
|
863
|
+
* Throws a Lua error but does not break out of the current call stack.
|
|
864
|
+
* This function will not print a stack trace like a normal error would.
|
|
865
|
+
* Essentially similar if not equivalent to [Global.Msg](https://wiki.facepunch.com/gmod/Global.Msg).
|
|
866
|
+
*
|
|
867
|
+
* @realm shared and menu
|
|
868
|
+
* @source https://wiki.facepunch.com/gmod/Global.ErrorNoHalt
|
|
869
|
+
*/
|
|
870
|
+
declare function ErrorNoHalt(...: any): void;
|
|
871
|
+
|
|
872
|
+
/**
|
|
873
|
+
* Throws a Lua error but does not break out of the current call stack.
|
|
874
|
+
*
|
|
875
|
+
* This function will print a stack trace like a normal error would.
|
|
876
|
+
*
|
|
877
|
+
* @realm shared and menu
|
|
878
|
+
* @source https://wiki.facepunch.com/gmod/Global.ErrorNoHaltWithStack
|
|
879
|
+
*/
|
|
880
|
+
declare function ErrorNoHaltWithStack(...: any): void;
|
|
881
|
+
|
|
882
|
+
/**
|
|
883
|
+
* Returns the angles of the current render context as calculated by [GM:CalcView](https://wiki.facepunch.com/gmod/GM:CalcView).
|
|
884
|
+
*
|
|
885
|
+
* This function is only reliable inside rendering hooks.
|
|
886
|
+
*
|
|
887
|
+
* @realm client
|
|
888
|
+
* @source https://wiki.facepunch.com/gmod/Global.EyeAngles
|
|
889
|
+
*/
|
|
890
|
+
declare function EyeAngles(): Angle;
|
|
891
|
+
|
|
892
|
+
/**
|
|
893
|
+
* Returns the origin of the current render context as calculated by [GM:CalcView](https://wiki.facepunch.com/gmod/GM:CalcView).
|
|
894
|
+
*
|
|
895
|
+
* This function is only reliable inside rendering hooks.
|
|
896
|
+
*
|
|
897
|
+
* @realm client
|
|
898
|
+
* @source https://wiki.facepunch.com/gmod/Global.EyePos
|
|
899
|
+
*/
|
|
900
|
+
declare function EyePos(): Vector;
|
|
901
|
+
|
|
902
|
+
/**
|
|
903
|
+
* Returns the normal vector of the current render context as calculated by [GM:CalcView](https://wiki.facepunch.com/gmod/GM:CalcView), similar to [Global.EyeAngles](https://wiki.facepunch.com/gmod/Global.EyeAngles).
|
|
904
|
+
*
|
|
905
|
+
* This function is only reliable inside rendering hooks.
|
|
906
|
+
*
|
|
907
|
+
* @realm client
|
|
908
|
+
* @source https://wiki.facepunch.com/gmod/Global.EyeVector
|
|
909
|
+
*/
|
|
910
|
+
declare function EyeVector(): Vector;
|
|
911
|
+
|
|
912
|
+
/**
|
|
913
|
+
* Returns the meta table for the class with the matching name. Custom meta tables
|
|
914
|
+
* should be registered via Global.RegisterMetaTable.
|
|
915
|
+
*
|
|
916
|
+
* The wiki captured the meta name as a string-literal type parameter (`` `T` ``)
|
|
917
|
+
* to select the exact meta table type; tlua cannot derive a type from a string
|
|
918
|
+
* value, so this degrades to a caller-supplied generic result.
|
|
919
|
+
* @realm shared
|
|
920
|
+
* @realm menu
|
|
921
|
+
* @source https://wiki.facepunch.com/gmod/Global.FindMetaTable
|
|
922
|
+
*/
|
|
923
|
+
declare function FindMetaTable<T extends table>(metaName: string): T;
|
|
924
|
+
|
|
925
|
+
|
|
926
|
+
/**
|
|
927
|
+
* Returns the tool-tip text and tool-tip-panel (if any) of the given panel as well as itself
|
|
928
|
+
* @realm client and menu
|
|
929
|
+
* @source https://wiki.facepunch.com/gmod/Global.FindTooltip
|
|
930
|
+
*/
|
|
931
|
+
declare function FindTooltip(panel: Panel): (string, Panel, Panel);
|
|
932
|
+
|
|
933
|
+
/**
|
|
934
|
+
* Refreshes all Addon Conflicts and Fires a Problem. Internally uses [Global.FireProblem](https://wiki.facepunch.com/gmod/Global.FireProblem)
|
|
935
|
+
* @realm menu
|
|
936
|
+
* @source https://wiki.facepunch.com/gmod/Global.FireAddonConflicts
|
|
937
|
+
*/
|
|
938
|
+
declare function FireAddonConflicts(): void;
|
|
939
|
+
|
|
940
|
+
/**
|
|
941
|
+
* Creates a problem from the given definition.
|
|
942
|
+
*
|
|
943
|
+
* **NOTE**: Existing problems with the same Id will be replaced / overridden.
|
|
944
|
+
*
|
|
945
|
+
*
|
|
946
|
+
*
|
|
947
|
+
* @realm menu
|
|
948
|
+
* @source https://wiki.facepunch.com/gmod/Global.FireProblem
|
|
949
|
+
*/
|
|
950
|
+
declare function FireProblem(problem: Problem): void;
|
|
951
|
+
|
|
952
|
+
/**
|
|
953
|
+
* **INTERNAL**: Internally uses [Global.FireProblem](https://wiki.facepunch.com/gmod/Global.FireProblem) to create / fire the Problem.
|
|
954
|
+
*
|
|
955
|
+
* This function is called from the engine to notify the player about a problem in a more user friendly way compared to a console message.
|
|
956
|
+
*
|
|
957
|
+
* @realm menu
|
|
958
|
+
* @source https://wiki.facepunch.com/gmod/Global.FireProblemFromEngine
|
|
959
|
+
*/
|
|
960
|
+
declare function FireProblemFromEngine(id: string, severity: number, params: string): void;
|
|
961
|
+
|
|
962
|
+
/**
|
|
963
|
+
* Formats the specified values into the string given. Same as [string.format](https://wiki.facepunch.com/gmod/string.format).
|
|
964
|
+
* @realm shared and menu
|
|
965
|
+
* @source https://wiki.facepunch.com/gmod/Global.Format
|
|
966
|
+
*/
|
|
967
|
+
declare function Format(format: string, ...: any): string;
|
|
968
|
+
|
|
969
|
+
/**
|
|
970
|
+
* Returns the number of frames rendered since the game was launched.
|
|
971
|
+
*
|
|
972
|
+
* @realm shared
|
|
973
|
+
* @source https://wiki.facepunch.com/gmod/Global.FrameNumber
|
|
974
|
+
*/
|
|
975
|
+
declare function FrameNumber(): number;
|
|
976
|
+
|
|
977
|
+
/**
|
|
978
|
+
* Returns the [Global.CurTime](https://wiki.facepunch.com/gmod/Global.CurTime)-based time in seconds it took to render the last frame.
|
|
979
|
+
*
|
|
980
|
+
* This should be used for frame/tick based timing, such as movement prediction or animations.
|
|
981
|
+
*
|
|
982
|
+
* For real-time-based frame time that isn't affected by `host_timescale`, use [Global.RealFrameTime](https://wiki.facepunch.com/gmod/Global.RealFrameTime). RealFrameTime is more suited for things like GUIs or HUDs.
|
|
983
|
+
*
|
|
984
|
+
* @realm shared and menu
|
|
985
|
+
* @source https://wiki.facepunch.com/gmod/Global.FrameTime
|
|
986
|
+
*/
|
|
987
|
+
declare function FrameTime(): number;
|
|
988
|
+
|
|
989
|
+
/**
|
|
990
|
+
* **INTERNAL**: This is used internally - although you're able to use it you probably shouldn't.
|
|
991
|
+
*
|
|
992
|
+
* Opens the given URL in a [HTML](https://wiki.facepunch.com/gmod/HTML) panel.
|
|
993
|
+
*
|
|
994
|
+
* @realm menu
|
|
995
|
+
* @source https://wiki.facepunch.com/gmod/Global.GMOD_OpenURLNoOverlay
|
|
996
|
+
*/
|
|
997
|
+
declare function GMOD_OpenURLNoOverlay(url: string): void;
|
|
998
|
+
|
|
999
|
+
/**
|
|
1000
|
+
* Callback function for when the client has joined a server. This function shows the server's loading URL by default.
|
|
1001
|
+
* @realm menu
|
|
1002
|
+
* @source https://wiki.facepunch.com/gmod/Global.GameDetails
|
|
1003
|
+
*/
|
|
1004
|
+
declare function GameDetails(servername: string, serverurl: string, mapname: string, maxplayers: number, steamid: string, gamemode: string): void;
|
|
1005
|
+
|
|
1006
|
+
/**
|
|
1007
|
+
* **INTERNAL**: This is used internally - although you're able to use it you probably shouldn't.
|
|
1008
|
+
*
|
|
1009
|
+
*
|
|
1010
|
+
* Gets miscellaneous information from Facepunches API.
|
|
1011
|
+
*
|
|
1012
|
+
* @realm menu
|
|
1013
|
+
* @source https://wiki.facepunch.com/gmod/Global.GetAPIManifest
|
|
1014
|
+
*/
|
|
1015
|
+
declare function GetAPIManifest(callback: (data: string) => void): void;
|
|
1016
|
+
|
|
1017
|
+
/**
|
|
1018
|
+
* Returns if the game was started with either -noaddons or -noworkshop
|
|
1019
|
+
* @realm menu
|
|
1020
|
+
* @source https://wiki.facepunch.com/gmod/Global.GetAddonStatus
|
|
1021
|
+
*/
|
|
1022
|
+
declare function GetAddonStatus(): (boolean, boolean);
|
|
1023
|
+
|
|
1024
|
+
/**
|
|
1025
|
+
* Gets the [ConVar](https://wiki.facepunch.com/gmod/ConVar) with the specified name.
|
|
1026
|
+
*
|
|
1027
|
+
* **NOTE**: This function uses [Global.GetConVar_Internal](https://wiki.facepunch.com/gmod/Global.GetConVar_Internal) internally, but caches the result in Lua for quicker lookups.
|
|
1028
|
+
*
|
|
1029
|
+
*
|
|
1030
|
+
*
|
|
1031
|
+
* @realm shared and menu
|
|
1032
|
+
* @source https://wiki.facepunch.com/gmod/Global.GetConVar
|
|
1033
|
+
*/
|
|
1034
|
+
declare function GetConVar(name: string): ConVar;
|
|
1035
|
+
|
|
1036
|
+
/**
|
|
1037
|
+
* Returns the numeric value [ConVar](https://wiki.facepunch.com/gmod/ConVar) (converted from the ConVar's string value) with the specified name.
|
|
1038
|
+
*
|
|
1039
|
+
* This function will return `0` if the ConVar does not exist. Use [cvars.Number](https://wiki.facepunch.com/gmod/cvars.Number) to specify your own default.
|
|
1040
|
+
*
|
|
1041
|
+
* Will return the value of [game.MaxPlayers](https://wiki.facepunch.com/gmod/game.MaxPlayers) if `maxplayers` is specified as the ConVar name, even though `maxplayers` is not a ConVar. (it is a console **command**) You should be using aforementioned Lua function instead for that case.
|
|
1042
|
+
*
|
|
1043
|
+
* In performance intensive places such as think and rendering callbacks/hooks, it is advised to use [ConVar:GetFloat](https://wiki.facepunch.com/gmod/ConVar:GetFloat) on a [ConVar](https://wiki.facepunch.com/gmod/ConVar) object directly, which be retrieved via [Global.GetConVar](https://wiki.facepunch.com/gmod/Global.GetConVar), or from existing [Global.CreateConVar](https://wiki.facepunch.com/gmod/Global.CreateConVar) call.
|
|
1044
|
+
*
|
|
1045
|
+
* @realm shared and menu
|
|
1046
|
+
* @source https://wiki.facepunch.com/gmod/Global.GetConVarNumber
|
|
1047
|
+
*/
|
|
1048
|
+
declare function GetConVarNumber(name: string): number;
|
|
1049
|
+
|
|
1050
|
+
/**
|
|
1051
|
+
* Returns the string value [ConVar](https://wiki.facepunch.com/gmod/ConVar) with the specified name.
|
|
1052
|
+
*
|
|
1053
|
+
* This function will return an empty string if the ConVar does not exist. Use [cvars.String](https://wiki.facepunch.com/gmod/cvars.String) to specify your own default.
|
|
1054
|
+
*
|
|
1055
|
+
* Will return the value of [game.MaxPlayers](https://wiki.facepunch.com/gmod/game.MaxPlayers) (as a string) if `maxplayers` is specified as the ConVar name, even though `maxplayers` is not a ConVar. (it is a console **command**) You should be using aforementioned Lua function instead for that case.
|
|
1056
|
+
*
|
|
1057
|
+
* In performance intensive places such as think and rendering callbacks/hooks, it is advised to use [ConVar:GetString](https://wiki.facepunch.com/gmod/ConVar:GetString) on a [ConVar](https://wiki.facepunch.com/gmod/ConVar) object directly, which be retrieved via [Global.GetConVar](https://wiki.facepunch.com/gmod/Global.GetConVar), or from existing [Global.CreateConVar](https://wiki.facepunch.com/gmod/Global.CreateConVar) call.
|
|
1058
|
+
*
|
|
1059
|
+
* @realm shared and menu
|
|
1060
|
+
* @source https://wiki.facepunch.com/gmod/Global.GetConVarString
|
|
1061
|
+
*/
|
|
1062
|
+
declare function GetConVarString(name: string): string;
|
|
1063
|
+
|
|
1064
|
+
/**
|
|
1065
|
+
* **INTERNAL**: This is used internally - although you're able to use it you probably shouldn't.
|
|
1066
|
+
*
|
|
1067
|
+
* **WARNING**: This function is very slow and not recommended. See [Global.GetConVar](https://wiki.facepunch.com/gmod/Global.GetConVar) for an example on how to properly store the return of what you're using so you can avoid using this function as much as possible.
|
|
1068
|
+
*
|
|
1069
|
+
* Gets the ConVar with the specified name. This function doesn't cache the convar.
|
|
1070
|
+
*
|
|
1071
|
+
* @realm shared and menu
|
|
1072
|
+
* @source https://wiki.facepunch.com/gmod/Global.GetConVar_Internal
|
|
1073
|
+
*/
|
|
1074
|
+
declare function GetConVar_Internal(name: string): ConVar;
|
|
1075
|
+
|
|
1076
|
+
/**
|
|
1077
|
+
* Returns the default loading screen URL (asset://garrysmod/html/loading.html)
|
|
1078
|
+
* @realm menu
|
|
1079
|
+
* @source https://wiki.facepunch.com/gmod/Global.GetDefaultLoadingHTML
|
|
1080
|
+
*/
|
|
1081
|
+
declare function GetDefaultLoadingHTML(): string;
|
|
1082
|
+
|
|
1083
|
+
/**
|
|
1084
|
+
* Retrieves data about the demo with the specified filename. Similar to [Global.GetSaveFileDetails](https://wiki.facepunch.com/gmod/Global.GetSaveFileDetails).
|
|
1085
|
+
* @realm menu
|
|
1086
|
+
* @source https://wiki.facepunch.com/gmod/Global.GetDemoFileDetails
|
|
1087
|
+
*/
|
|
1088
|
+
declare function GetDemoFileDetails(filename: string): table;
|
|
1089
|
+
|
|
1090
|
+
/**
|
|
1091
|
+
* Returns a table with the names of files needed from the server you are currently joining.
|
|
1092
|
+
* @realm menu
|
|
1093
|
+
* @source https://wiki.facepunch.com/gmod/Global.GetDownloadables
|
|
1094
|
+
*/
|
|
1095
|
+
declare function GetDownloadables(): string[];
|
|
1096
|
+
|
|
1097
|
+
/**
|
|
1098
|
+
* Returns an angle that is shared between the server and all clients.
|
|
1099
|
+
* @realm shared
|
|
1100
|
+
* @source https://wiki.facepunch.com/gmod/Global.GetGlobal2Angle
|
|
1101
|
+
*/
|
|
1102
|
+
declare function GetGlobal2Angle(index: string, _default?: Angle): Angle;
|
|
1103
|
+
|
|
1104
|
+
/**
|
|
1105
|
+
* Returns a boolean that is shared between the server and all clients.
|
|
1106
|
+
* @realm shared
|
|
1107
|
+
* @source https://wiki.facepunch.com/gmod/Global.GetGlobal2Bool
|
|
1108
|
+
*/
|
|
1109
|
+
declare function GetGlobal2Bool(index: string, _default?: boolean): boolean;
|
|
1110
|
+
|
|
1111
|
+
/**
|
|
1112
|
+
* Returns an entity that is shared between the server and all clients.
|
|
1113
|
+
* @realm shared
|
|
1114
|
+
* @source https://wiki.facepunch.com/gmod/Global.GetGlobal2Entity
|
|
1115
|
+
*/
|
|
1116
|
+
declare function GetGlobal2Entity(index: string, _default?: Entity): Entity;
|
|
1117
|
+
|
|
1118
|
+
/**
|
|
1119
|
+
* Returns a float that is shared between the server and all clients.
|
|
1120
|
+
* @realm shared
|
|
1121
|
+
* @source https://wiki.facepunch.com/gmod/Global.GetGlobal2Float
|
|
1122
|
+
*/
|
|
1123
|
+
declare function GetGlobal2Float(index: string, _default?: number): number;
|
|
1124
|
+
|
|
1125
|
+
/**
|
|
1126
|
+
* Returns an integer that is shared between the server and all clients.
|
|
1127
|
+
*
|
|
1128
|
+
* **WARNING**: The integer has a 32 bit limit. Use [Global.GetGlobalInt](https://wiki.facepunch.com/gmod/Global.GetGlobalInt) for a higher limit
|
|
1129
|
+
*
|
|
1130
|
+
*
|
|
1131
|
+
* @realm shared
|
|
1132
|
+
* @source https://wiki.facepunch.com/gmod/Global.GetGlobal2Int
|
|
1133
|
+
*/
|
|
1134
|
+
declare function GetGlobal2Int(index: string, _default?: number): number;
|
|
1135
|
+
|
|
1136
|
+
/**
|
|
1137
|
+
* Returns a string that is shared between the server and all clients.
|
|
1138
|
+
* @realm shared
|
|
1139
|
+
* @source https://wiki.facepunch.com/gmod/Global.GetGlobal2String
|
|
1140
|
+
*/
|
|
1141
|
+
declare function GetGlobal2String(index: string, _default?: string): string;
|
|
1142
|
+
|
|
1143
|
+
/**
|
|
1144
|
+
* Returns a value that is shared between the server and all clients.
|
|
1145
|
+
*
|
|
1146
|
+
* @realm shared
|
|
1147
|
+
* @source https://wiki.facepunch.com/gmod/Global.GetGlobal2Var
|
|
1148
|
+
*/
|
|
1149
|
+
declare function GetGlobal2Var(index: string, _default?: any): any;
|
|
1150
|
+
|
|
1151
|
+
/**
|
|
1152
|
+
* Returns a vector that is shared between the server and all clients.
|
|
1153
|
+
* @realm shared
|
|
1154
|
+
* @source https://wiki.facepunch.com/gmod/Global.GetGlobal2Vector
|
|
1155
|
+
*/
|
|
1156
|
+
declare function GetGlobal2Vector(Index: string, Default: Vector): Vector;
|
|
1157
|
+
|
|
1158
|
+
/**
|
|
1159
|
+
* Returns an angle that is shared between the server and all clients.
|
|
1160
|
+
* @realm shared
|
|
1161
|
+
* @source https://wiki.facepunch.com/gmod/Global.GetGlobalAngle
|
|
1162
|
+
*/
|
|
1163
|
+
declare function GetGlobalAngle(index: string, _default: Angle): Angle;
|
|
1164
|
+
|
|
1165
|
+
/**
|
|
1166
|
+
* Returns a boolean that is shared between the server and all clients.
|
|
1167
|
+
* @realm shared
|
|
1168
|
+
* @source https://wiki.facepunch.com/gmod/Global.GetGlobalBool
|
|
1169
|
+
*/
|
|
1170
|
+
declare function GetGlobalBool(index: string, _default?: boolean): boolean;
|
|
1171
|
+
|
|
1172
|
+
/**
|
|
1173
|
+
* Returns an entity that is shared between the server and all clients.
|
|
1174
|
+
* @realm shared
|
|
1175
|
+
* @source https://wiki.facepunch.com/gmod/Global.GetGlobalEntity
|
|
1176
|
+
*/
|
|
1177
|
+
declare function GetGlobalEntity(index: string, _default?: Entity): Entity;
|
|
1178
|
+
|
|
1179
|
+
/**
|
|
1180
|
+
* Returns a float that is shared between the server and all clients.
|
|
1181
|
+
* @realm shared
|
|
1182
|
+
* @source https://wiki.facepunch.com/gmod/Global.GetGlobalFloat
|
|
1183
|
+
*/
|
|
1184
|
+
declare function GetGlobalFloat(index: string, _default?: number): number;
|
|
1185
|
+
|
|
1186
|
+
/**
|
|
1187
|
+
* Returns an integer that is shared between the server and all clients.
|
|
1188
|
+
*
|
|
1189
|
+
* This function will not round decimal values as it actually networks a float internally.
|
|
1190
|
+
*
|
|
1191
|
+
* @realm shared
|
|
1192
|
+
* @source https://wiki.facepunch.com/gmod/Global.GetGlobalInt
|
|
1193
|
+
*/
|
|
1194
|
+
declare function GetGlobalInt(index: string, _default?: number): number;
|
|
1195
|
+
|
|
1196
|
+
/**
|
|
1197
|
+
* Returns a string that is shared between the server and all clients.
|
|
1198
|
+
* @realm shared
|
|
1199
|
+
* @source https://wiki.facepunch.com/gmod/Global.GetGlobalString
|
|
1200
|
+
*/
|
|
1201
|
+
declare function GetGlobalString(index: string, _default?: string): string;
|
|
1202
|
+
|
|
1203
|
+
/**
|
|
1204
|
+
* Returns a value that is shared between the server and all clients.
|
|
1205
|
+
*
|
|
1206
|
+
* @realm shared
|
|
1207
|
+
* @source https://wiki.facepunch.com/gmod/Global.GetGlobalVar
|
|
1208
|
+
*/
|
|
1209
|
+
declare function GetGlobalVar(index: string, _default?: any): any;
|
|
1210
|
+
|
|
1211
|
+
/**
|
|
1212
|
+
* Returns a vector that is shared between the server and all clients.
|
|
1213
|
+
* @realm shared
|
|
1214
|
+
* @source https://wiki.facepunch.com/gmod/Global.GetGlobalVector
|
|
1215
|
+
*/
|
|
1216
|
+
declare function GetGlobalVector(Index: string, Default: Vector): Vector;
|
|
1217
|
+
|
|
1218
|
+
/**
|
|
1219
|
+
* Returns the panel that is used as a wrapper for the HUD. If you want your panel to be hidden when the main menu is opened, parent it to this. Child panels will also have their controls disabled.
|
|
1220
|
+
*
|
|
1221
|
+
* See also [vgui.GetWorldPanel](https://wiki.facepunch.com/gmod/vgui.GetWorldPanel)
|
|
1222
|
+
*
|
|
1223
|
+
* @realm client
|
|
1224
|
+
* @source https://wiki.facepunch.com/gmod/Global.GetHUDPanel
|
|
1225
|
+
*/
|
|
1226
|
+
declare function GetHUDPanel(): Panel;
|
|
1227
|
+
|
|
1228
|
+
/**
|
|
1229
|
+
* Returns the name of the current server.
|
|
1230
|
+
*
|
|
1231
|
+
* **NOTE**: GetHostName returns information from [ConVar](https://wiki.facepunch.com/gmod/ConVars_In_Garrysmod#cvarlistdump) hostname
|
|
1232
|
+
*
|
|
1233
|
+
*
|
|
1234
|
+
* @realm shared
|
|
1235
|
+
* @source https://wiki.facepunch.com/gmod/Global.GetHostName
|
|
1236
|
+
*/
|
|
1237
|
+
declare function GetHostName(): string;
|
|
1238
|
+
|
|
1239
|
+
/**
|
|
1240
|
+
* Returns the loading screen panel and creates it if it doesn't exist.
|
|
1241
|
+
* @realm menu
|
|
1242
|
+
* @source https://wiki.facepunch.com/gmod/Global.GetLoadPanel
|
|
1243
|
+
*/
|
|
1244
|
+
declare function GetLoadPanel(): Panel;
|
|
1245
|
+
|
|
1246
|
+
/**
|
|
1247
|
+
* Returns the current status of the server join progress.
|
|
1248
|
+
* @realm menu
|
|
1249
|
+
* @source https://wiki.facepunch.com/gmod/Global.GetLoadStatus
|
|
1250
|
+
*/
|
|
1251
|
+
declare function GetLoadStatus(): string;
|
|
1252
|
+
|
|
1253
|
+
/**
|
|
1254
|
+
* Returns a table with the names of all maps and categories that you have on your client.
|
|
1255
|
+
* @realm menu
|
|
1256
|
+
* @source https://wiki.facepunch.com/gmod/Global.GetMapList
|
|
1257
|
+
*/
|
|
1258
|
+
declare function GetMapList(): table;
|
|
1259
|
+
|
|
1260
|
+
/**
|
|
1261
|
+
* Returns the menu overlay panel, a container for panels like the error panel created in [GM:OnLuaError](https://wiki.facepunch.com/gmod/GM:OnLuaError).
|
|
1262
|
+
* @realm menu
|
|
1263
|
+
* @source https://wiki.facepunch.com/gmod/Global.GetOverlayPanel
|
|
1264
|
+
*/
|
|
1265
|
+
declare function GetOverlayPanel(): Panel;
|
|
1266
|
+
|
|
1267
|
+
/**
|
|
1268
|
+
* **INTERNAL**: This is used internally - although you're able to use it you probably shouldn't.
|
|
1269
|
+
*
|
|
1270
|
+
* Updates the PlayerList for the Currently Viewed Server. Internally uses [serverlist.PlayerList](https://wiki.facepunch.com/gmod/serverlist.PlayerList) to retrieve the PlayerList.
|
|
1271
|
+
*
|
|
1272
|
+
* @realm menu
|
|
1273
|
+
* @source https://wiki.facepunch.com/gmod/Global.GetPlayerList
|
|
1274
|
+
*/
|
|
1275
|
+
declare function GetPlayerList(serverip: string): void;
|
|
1276
|
+
|
|
1277
|
+
/**
|
|
1278
|
+
* Returns the player whose movement commands are currently being processed. The player this returns can safely have [Player:GetCurrentCommand](https://wiki.facepunch.com/gmod/Player:GetCurrentCommand)() called on them. See [Prediction](https://wiki.facepunch.com/gmod/Prediction).
|
|
1279
|
+
* @realm shared
|
|
1280
|
+
* @source https://wiki.facepunch.com/gmod/Global.GetPredictionPlayer
|
|
1281
|
+
*/
|
|
1282
|
+
declare function GetPredictionPlayer(): Player;
|
|
1283
|
+
|
|
1284
|
+
/**
|
|
1285
|
+
* Creates or gets the rendertarget with the given name.
|
|
1286
|
+
*
|
|
1287
|
+
* See [Global.GetRenderTargetEx](https://wiki.facepunch.com/gmod/Global.GetRenderTargetEx) for an advanced version of this function with more options.
|
|
1288
|
+
*
|
|
1289
|
+
* This crashes when used on a cubemap texture.
|
|
1290
|
+
* **WARNING**: Rendertargets are not garbage-collected, which means they will remain in memory until you disconnect. So make sure to avoid creating new ones unecessarily and re-use as many of your existing rendertargets as possible to avoid filling up all your memory.
|
|
1291
|
+
*
|
|
1292
|
+
* **WARNING**: Drawing rendertargets on themself can produce odd and unexpected results.
|
|
1293
|
+
*
|
|
1294
|
+
* **NOTE**: Calling this function is equivalent to
|
|
1295
|
+
* ```lua
|
|
1296
|
+
* GetRenderTargetEx(name,
|
|
1297
|
+
* width, height,
|
|
1298
|
+
* RT_SIZE_NO_CHANGE,
|
|
1299
|
+
* MATERIAL_RT_DEPTH_SEPARATE,
|
|
1300
|
+
* bit.bor(2, 256),
|
|
1301
|
+
* 0,
|
|
1302
|
+
* IMAGE_FORMAT_BGRA8888
|
|
1303
|
+
* )
|
|
1304
|
+
* ```
|
|
1305
|
+
*
|
|
1306
|
+
*
|
|
1307
|
+
* @realm client
|
|
1308
|
+
* @source https://wiki.facepunch.com/gmod/Global.GetRenderTarget
|
|
1309
|
+
*/
|
|
1310
|
+
declare function GetRenderTarget(name: string, width: number, height: number): ITexture;
|
|
1311
|
+
|
|
1312
|
+
/**
|
|
1313
|
+
* Gets (or creates if it does not exist) the rendertarget with the given name, this function allows to adjust the creation of a rendertarget more than [Global.GetRenderTarget](https://wiki.facepunch.com/gmod/Global.GetRenderTarget).
|
|
1314
|
+
*
|
|
1315
|
+
* See also [render.PushRenderTarget](https://wiki.facepunch.com/gmod/render.PushRenderTarget) and [render.SetRenderTarget](https://wiki.facepunch.com/gmod/render.SetRenderTarget).
|
|
1316
|
+
*
|
|
1317
|
+
*
|
|
1318
|
+
*
|
|
1319
|
+
* @realm client
|
|
1320
|
+
* @source https://wiki.facepunch.com/gmod/Global.GetRenderTargetEx
|
|
1321
|
+
*/
|
|
1322
|
+
declare function GetRenderTargetEx(name: string, width: number, height: number, sizeMode: RT_SIZE, depthMode: MATERIAL_RT_DEPTH, textureFlags: TEXTUREFLAGS, rtFlags: CREATERENDERTARGETFLAGS, imageFormat: number): ITexture;
|
|
1323
|
+
|
|
1324
|
+
/**
|
|
1325
|
+
* Retrieves data about the save with the specified filename. Similar to [Global.GetDemoFileDetails](https://wiki.facepunch.com/gmod/Global.GetDemoFileDetails).
|
|
1326
|
+
* @realm menu
|
|
1327
|
+
* @source https://wiki.facepunch.com/gmod/Global.GetSaveFileDetails
|
|
1328
|
+
*/
|
|
1329
|
+
declare function GetSaveFileDetails(filename: string): table;
|
|
1330
|
+
|
|
1331
|
+
/**
|
|
1332
|
+
* **INTERNAL**: This is used internally - although you're able to use it you probably shouldn't.
|
|
1333
|
+
*
|
|
1334
|
+
* Starts Searching for Servers in the given Category. Can be stopped with [Global.DoStopServers](https://wiki.facepunch.com/gmod/Global.DoStopServers).
|
|
1335
|
+
* Internally uses [serverlist.Query](https://wiki.facepunch.com/gmod/serverlist.Query) to search for Servers.
|
|
1336
|
+
*
|
|
1337
|
+
* @realm menu
|
|
1338
|
+
* @source https://wiki.facepunch.com/gmod/Global.GetServers
|
|
1339
|
+
*/
|
|
1340
|
+
declare function GetServers(category: string, id: number): void;
|
|
1341
|
+
|
|
1342
|
+
/**
|
|
1343
|
+
* Returns if the client is timing out, and time since last ping from the server. Similar to the server side [Player:IsTimingOut](https://wiki.facepunch.com/gmod/Player:IsTimingOut).
|
|
1344
|
+
*
|
|
1345
|
+
* @realm client
|
|
1346
|
+
* @source https://wiki.facepunch.com/gmod/Global.GetTimeoutInfo
|
|
1347
|
+
*/
|
|
1348
|
+
declare function GetTimeoutInfo(): (boolean, number);
|
|
1349
|
+
|
|
1350
|
+
/**
|
|
1351
|
+
* Returns the entity the client is using to see from (such as the player itself, the camera, or another entity).
|
|
1352
|
+
* @realm client
|
|
1353
|
+
* @source https://wiki.facepunch.com/gmod/Global.GetViewEntity
|
|
1354
|
+
*/
|
|
1355
|
+
declare function GetViewEntity(): Entity;
|
|
1356
|
+
|
|
1357
|
+
/**
|
|
1358
|
+
* Converts a color from [HSL color space](https://en.wikipedia.org/wiki/HSL_and_HSV) into RGB color space and returns a [Color](https://wiki.facepunch.com/gmod/Color).
|
|
1359
|
+
*
|
|
1360
|
+
* @realm shared and menu
|
|
1361
|
+
* @source https://wiki.facepunch.com/gmod/Global.HSLToColor
|
|
1362
|
+
*/
|
|
1363
|
+
declare function HSLToColor(hue: number, saturation: number, lightness: number): Color;
|
|
1364
|
+
|
|
1365
|
+
/**
|
|
1366
|
+
* Converts a color from [HSV color space](https://en.wikipedia.org/wiki/HSL_and_HSV) into RGB color space and returns a [Color](https://wiki.facepunch.com/gmod/Color).
|
|
1367
|
+
*
|
|
1368
|
+
* @realm shared and menu
|
|
1369
|
+
* @source https://wiki.facepunch.com/gmod/Global.HSVToColor
|
|
1370
|
+
*/
|
|
1371
|
+
declare function HSVToColor(hue: number, saturation: number, value: number): Color;
|
|
1372
|
+
|
|
1373
|
+
/**
|
|
1374
|
+
* Launches an asynchronous http request with the given parameters. Cannot send or
|
|
1375
|
+
* receive multiple headers with the same name. Returns `true` if a request is
|
|
1376
|
+
* queued, `false` if it could not be queued.
|
|
1377
|
+
* @realm shared
|
|
1378
|
+
* @realm menu
|
|
1379
|
+
* @source https://wiki.facepunch.com/gmod/Global.HTTP
|
|
1380
|
+
*/
|
|
1381
|
+
declare function HTTP(parameters: HTTPRequestWithParameters): boolean;
|
|
1382
|
+
declare function HTTP(parameters: HTTPRequestWithoutParameters): boolean;
|
|
1383
|
+
declare function HTTP(parameters: HTTPRequest): boolean;
|
|
1384
|
+
|
|
1385
|
+
|
|
1386
|
+
/**
|
|
1387
|
+
* Converts a color from [HWB color space](https://en.wikipedia.org/wiki/HWB_color_model) (Hue-Whiteness-Blackness) into RGB color space and returns a [Color](https://wiki.facepunch.com/gmod/Color).
|
|
1388
|
+
*
|
|
1389
|
+
* @realm shared and menu
|
|
1390
|
+
* @source https://wiki.facepunch.com/gmod/Global.HWBToColor
|
|
1391
|
+
*/
|
|
1392
|
+
declare function HWBToColor(hue: number, whiteness: number, blackness: number): Color;
|
|
1393
|
+
|
|
1394
|
+
/**
|
|
1395
|
+
* Converts a hexadecimal representation of a color to [Color](https://wiki.facepunch.com/gmod/Color) object.
|
|
1396
|
+
*
|
|
1397
|
+
* @realm shared and menu
|
|
1398
|
+
* @source https://wiki.facepunch.com/gmod/Global.HexToColor
|
|
1399
|
+
*/
|
|
1400
|
+
declare function HexToColor(hue: string): Color;
|
|
1401
|
+
|
|
1402
|
+
/**
|
|
1403
|
+
* This function works exactly the same as [Global.include](https://wiki.facepunch.com/gmod/Global.include) both clientside and serverside.
|
|
1404
|
+
*
|
|
1405
|
+
* The only difference is that on the serverside it also calls [Global.AddCSLuaFile](https://wiki.facepunch.com/gmod/Global.AddCSLuaFile) on the filename, so that it gets sent to the client.
|
|
1406
|
+
*
|
|
1407
|
+
* @realm shared and menu
|
|
1408
|
+
* @source https://wiki.facepunch.com/gmod/Global.IncludeCS
|
|
1409
|
+
* @deprecated To send the target file to the client simply call AddCSLuaFile() in the target file itself.
|
|
1410
|
+
*/
|
|
1411
|
+
declare function IncludeCS(filename: string): (...any);
|
|
1412
|
+
|
|
1413
|
+
/**
|
|
1414
|
+
* Returns whether the given value is a Color.
|
|
1415
|
+
* @realm shared
|
|
1416
|
+
* @realm menu
|
|
1417
|
+
* @source https://wiki.facepunch.com/gmod/Global.IsColor
|
|
1418
|
+
*/
|
|
1419
|
+
declare function IsColor(value: any): value is Color;
|
|
1420
|
+
|
|
1421
|
+
|
|
1422
|
+
/**
|
|
1423
|
+
* Determines whether or not the provided console command will be blocked if it's ran through Lua functions, such as [Global.RunConsoleCommand](https://wiki.facepunch.com/gmod/Global.RunConsoleCommand) or [Player:ConCommand](https://wiki.facepunch.com/gmod/Player:ConCommand).
|
|
1424
|
+
*
|
|
1425
|
+
* For more info on blocked console commands, check out [Blocked ConCommands](https://wiki.facepunch.com/gmod/Blocked_ConCommands).
|
|
1426
|
+
* **INTERNAL**: This is used internally - although you're able to use it you probably shouldn't.
|
|
1427
|
+
*
|
|
1428
|
+
*
|
|
1429
|
+
* @realm shared and menu
|
|
1430
|
+
* @source https://wiki.facepunch.com/gmod/Global.IsConCommandBlocked
|
|
1431
|
+
*/
|
|
1432
|
+
declare function IsConCommandBlocked(name: string): boolean;
|
|
1433
|
+
|
|
1434
|
+
/**
|
|
1435
|
+
* Returns if the given NPC class name is an enemy. Returns `true` if the entity name is one of the following:
|
|
1436
|
+
* * `monster_alien_grunt`
|
|
1437
|
+
* * `monster_nihilanth`
|
|
1438
|
+
* * `monster_tentacle`
|
|
1439
|
+
* * `monster_alien_slave`
|
|
1440
|
+
* * `monster_bigmomma`
|
|
1441
|
+
* * `monster_bullchicken`
|
|
1442
|
+
* * `monster_gargantua`
|
|
1443
|
+
* * `monster_human_assassin`
|
|
1444
|
+
* * `monster_babycrab`
|
|
1445
|
+
* * `monster_human_grunt`
|
|
1446
|
+
* * `monster_cockroach`
|
|
1447
|
+
* * `monster_houndeye`
|
|
1448
|
+
* * `monster_zombie`
|
|
1449
|
+
* * `monster_headcrab`
|
|
1450
|
+
* * `monster_alien_controller`
|
|
1451
|
+
* * `monster_turret`
|
|
1452
|
+
* * `monster_miniturret`
|
|
1453
|
+
* * `monster_sentry`
|
|
1454
|
+
* * `npc_antlion`
|
|
1455
|
+
* * `npc_antlionguard`
|
|
1456
|
+
* * `npc_antlionguardian`
|
|
1457
|
+
* * `npc_barnacle`
|
|
1458
|
+
* * `npc_breen`
|
|
1459
|
+
* * `npc_clawscanner`
|
|
1460
|
+
* * `npc_combine_s`
|
|
1461
|
+
* * `npc_cscanner`
|
|
1462
|
+
* * `npc_fastzombie`
|
|
1463
|
+
* * `npc_fastzombie_torso`
|
|
1464
|
+
* * `npc_headcrab`
|
|
1465
|
+
* * `npc_headcrab_fast`
|
|
1466
|
+
* * `npc_headcrab_poison`
|
|
1467
|
+
* * `npc_hunter`
|
|
1468
|
+
* * `npc_metropolice`
|
|
1469
|
+
* * `npc_manhack`
|
|
1470
|
+
* * `npc_poisonzombie`
|
|
1471
|
+
* * `npc_strider`
|
|
1472
|
+
* * `npc_stalker`
|
|
1473
|
+
* * `npc_zombie`
|
|
1474
|
+
* * `npc_zombie_torso`
|
|
1475
|
+
* * `npc_zombine`
|
|
1476
|
+
* * `npc_combine_camera`
|
|
1477
|
+
* * `npc_turret_ceiling`
|
|
1478
|
+
* * `npc_combinedropship`
|
|
1479
|
+
* * `npc_combinegunship`
|
|
1480
|
+
* * `npc_helicopter`
|
|
1481
|
+
* * `npc_turret_floor`
|
|
1482
|
+
* * `npc_antlion_worker`
|
|
1483
|
+
* * `npc_headcrab_black`
|
|
1484
|
+
*
|
|
1485
|
+
* @realm shared and menu
|
|
1486
|
+
* @source https://wiki.facepunch.com/gmod/Global.IsEnemyEntityName
|
|
1487
|
+
*/
|
|
1488
|
+
declare function IsEnemyEntityName(className: string): boolean;
|
|
1489
|
+
|
|
1490
|
+
/**
|
|
1491
|
+
* Identical to [Global.isentity](https://wiki.facepunch.com/gmod/Global.isentity). Returns if the passed object is an [Entity](https://wiki.facepunch.com/gmod/Entity).
|
|
1492
|
+
* @realm shared and menu
|
|
1493
|
+
* @source https://wiki.facepunch.com/gmod/Global.IsEntity(legacy)
|
|
1494
|
+
* @deprecated Use the function Global.isentity instead.
|
|
1495
|
+
*/
|
|
1496
|
+
declare function IsEntity(variable: any): boolean;
|
|
1497
|
+
|
|
1498
|
+
/**
|
|
1499
|
+
* Returns if the passed object is an [Entity](https://wiki.facepunch.com/gmod/Entity).
|
|
1500
|
+
* @realm shared and menu
|
|
1501
|
+
* @source https://wiki.facepunch.com/gmod/Global.IsEntity
|
|
1502
|
+
*/
|
|
1503
|
+
declare function isentity(variable: any): boolean;
|
|
1504
|
+
|
|
1505
|
+
/**
|
|
1506
|
+
* Returns if this is the first time this hook was predicted.
|
|
1507
|
+
*
|
|
1508
|
+
* This is useful for one-time logic in your SWEPs PrimaryAttack, SecondaryAttack and Reload and other (to prevent those hooks from being called rapidly in succession). It's also useful in a Move hook for when the client predicts movement.
|
|
1509
|
+
*
|
|
1510
|
+
* Visit [Prediction](https://wiki.facepunch.com/gmod/Prediction) for more information about this behavior.
|
|
1511
|
+
*
|
|
1512
|
+
* **NOTE**: This is already used internally for [Entity:EmitSound](https://wiki.facepunch.com/gmod/Entity:EmitSound), [Weapon:SendWeaponAnim](https://wiki.facepunch.com/gmod/Weapon:SendWeaponAnim) and [Entity:FireBullets](https://wiki.facepunch.com/gmod/Entity:FireBullets), but NOT in [util.Effect](https://wiki.facepunch.com/gmod/util.Effect).
|
|
1513
|
+
*
|
|
1514
|
+
*
|
|
1515
|
+
* @realm shared
|
|
1516
|
+
* @source https://wiki.facepunch.com/gmod/Global.IsFirstTimePredicted
|
|
1517
|
+
*/
|
|
1518
|
+
declare function IsFirstTimePredicted(): boolean;
|
|
1519
|
+
|
|
1520
|
+
/**
|
|
1521
|
+
* Returns if the given NPC class name is a friend. Returns `true` if the entity name is one of the following:
|
|
1522
|
+
* * `monster_scientist`
|
|
1523
|
+
* * `monster_barney`
|
|
1524
|
+
* * `npc_alyx`
|
|
1525
|
+
* * `npc_barney`
|
|
1526
|
+
* * `npc_citizen`
|
|
1527
|
+
* * `npc_dog`
|
|
1528
|
+
* * `npc_eli`
|
|
1529
|
+
* * `npc_fisherman`
|
|
1530
|
+
* * `npc_gman`
|
|
1531
|
+
* * `npc_kleiner`
|
|
1532
|
+
* * `npc_magnusson`
|
|
1533
|
+
* * `npc_monk`
|
|
1534
|
+
* * `npc_mossman`
|
|
1535
|
+
* * `npc_odessa`
|
|
1536
|
+
* * `npc_vortigaunt`
|
|
1537
|
+
*
|
|
1538
|
+
* @realm shared and menu
|
|
1539
|
+
* @source https://wiki.facepunch.com/gmod/Global.IsFriendEntityName
|
|
1540
|
+
*/
|
|
1541
|
+
declare function IsFriendEntityName(className: string): boolean;
|
|
1542
|
+
|
|
1543
|
+
/**
|
|
1544
|
+
* Returns true if the client is currently playing either a singleplayer or multiplayer game.
|
|
1545
|
+
* @realm menu
|
|
1546
|
+
* @source https://wiki.facepunch.com/gmod/Global.IsInGame
|
|
1547
|
+
*/
|
|
1548
|
+
declare function IsInGame(): boolean;
|
|
1549
|
+
|
|
1550
|
+
/**
|
|
1551
|
+
* Returns true when the loading panel is active.
|
|
1552
|
+
* @realm menu
|
|
1553
|
+
* @source https://wiki.facepunch.com/gmod/Global.IsInLoading
|
|
1554
|
+
*/
|
|
1555
|
+
declare function IsInLoading(): boolean;
|
|
1556
|
+
|
|
1557
|
+
/**
|
|
1558
|
+
* Checks whether or not a game is currently mounted. Uses data given by [engine.GetGames](https://wiki.facepunch.com/gmod/engine.GetGames).
|
|
1559
|
+
* @realm shared and menu
|
|
1560
|
+
* @source https://wiki.facepunch.com/gmod/Global.IsMounted
|
|
1561
|
+
*/
|
|
1562
|
+
declare function IsMounted(game: string): boolean;
|
|
1563
|
+
|
|
1564
|
+
/**
|
|
1565
|
+
* Checks if the given server data is blacklisted or not.
|
|
1566
|
+
* @realm menu
|
|
1567
|
+
* @source https://wiki.facepunch.com/gmod/Global.IsServerBlacklisted
|
|
1568
|
+
*/
|
|
1569
|
+
declare function IsServerBlacklisted(address: string, hostname: string, description: string, gm: string, map: string): string;
|
|
1570
|
+
|
|
1571
|
+
/**
|
|
1572
|
+
* Returns whether or not every element within a table is a valid entity
|
|
1573
|
+
* @realm shared and menu
|
|
1574
|
+
* @source https://wiki.facepunch.com/gmod/Global.IsTableOfEntitiesValid
|
|
1575
|
+
*/
|
|
1576
|
+
declare function IsTableOfEntitiesValid(table: table): boolean;
|
|
1577
|
+
|
|
1578
|
+
/**
|
|
1579
|
+
* Returns whether or not a model is useless by checking that the file path is that of a proper model.
|
|
1580
|
+
*
|
|
1581
|
+
* If the string ".mdl" is not found in the model name, the function will return true.
|
|
1582
|
+
*
|
|
1583
|
+
* The function will also return true if any of the following strings are found in the given model name:
|
|
1584
|
+
* * "_gesture"
|
|
1585
|
+
* * "_anim"
|
|
1586
|
+
* * "_gst"
|
|
1587
|
+
* * "_pst"
|
|
1588
|
+
* * "_shd"
|
|
1589
|
+
* * "_ss"
|
|
1590
|
+
* * "_posture"
|
|
1591
|
+
* * "_anm"
|
|
1592
|
+
* * "ghostanim"
|
|
1593
|
+
* * "_paths"
|
|
1594
|
+
* * "_shared"
|
|
1595
|
+
* * "anim_"
|
|
1596
|
+
* * "gestures_"
|
|
1597
|
+
* * "shared_ragdoll_"
|
|
1598
|
+
*
|
|
1599
|
+
* @realm shared and menu
|
|
1600
|
+
* @source https://wiki.facepunch.com/gmod/Global.IsUselessModel
|
|
1601
|
+
*/
|
|
1602
|
+
declare function IsUselessModel(modelName: string): boolean;
|
|
1603
|
+
|
|
1604
|
+
/**
|
|
1605
|
+
* Returns whether an object is valid or not. (Such as [entities](https://wiki.facepunch.com/gmod/Entity), [Panel](https://wiki.facepunch.com/gmod/Panel)s, custom [table](https://wiki.facepunch.com/gmod/table) objects and more).
|
|
1606
|
+
*
|
|
1607
|
+
* Checks that an object is not [nil](https://wiki.facepunch.com/gmod/nil), has an `IsValid` method and if this method returns `true`. If the object has no `IsValid` method, it will return `false`.
|
|
1608
|
+
*
|
|
1609
|
+
* **NOTE**: If you are sure that the object you are about to check is not `nil` and has the `IsValid` method, it would be faster to call it directly rather than using `IsValid`.
|
|
1610
|
+
*
|
|
1611
|
+
* **NOTE**: Due to vehicles being technically valid the moment they're spawned, also use [Vehicle:IsValidVehicle](https://wiki.facepunch.com/gmod/Vehicle:IsValidVehicle) to make sure they're fully initialized.
|
|
1612
|
+
*
|
|
1613
|
+
* **WARNING**: Putting a number in the argument will cause an error.
|
|
1614
|
+
*
|
|
1615
|
+
*
|
|
1616
|
+
* @realm shared and menu
|
|
1617
|
+
* @source https://wiki.facepunch.com/gmod/Global.IsValid
|
|
1618
|
+
*/
|
|
1619
|
+
declare function IsValid(toBeValidated: any): boolean;
|
|
1620
|
+
|
|
1621
|
+
/**
|
|
1622
|
+
* Adds JavaScript function 'language.Update' to an HTML panel as a method to call Lua's [language.GetPhrase](https://wiki.facepunch.com/gmod/language.GetPhrase) function.
|
|
1623
|
+
* @realm client and menu
|
|
1624
|
+
* @source https://wiki.facepunch.com/gmod/Global.JS_Language
|
|
1625
|
+
*/
|
|
1626
|
+
declare function JS_Language(htmlPanel: Panel): void;
|
|
1627
|
+
|
|
1628
|
+
/**
|
|
1629
|
+
* Adds JavaScript function 'util.MotionSensorAvailable' to an HTML panel as a method to call Lua's [motionsensor.IsAvailable](https://wiki.facepunch.com/gmod/motionsensor.IsAvailable) function.
|
|
1630
|
+
* @realm client and menu
|
|
1631
|
+
* @source https://wiki.facepunch.com/gmod/Global.JS_Utility
|
|
1632
|
+
*/
|
|
1633
|
+
declare function JS_Utility(htmlPanel: Panel): void;
|
|
1634
|
+
|
|
1635
|
+
/**
|
|
1636
|
+
* Adds workshop related JavaScript functions to an HTML panel, used by the "Dupes" and "Saves" tabs in the spawnmenu.
|
|
1637
|
+
* @realm client and menu
|
|
1638
|
+
* @source https://wiki.facepunch.com/gmod/Global.JS_Workshop
|
|
1639
|
+
*/
|
|
1640
|
+
declare function JS_Workshop(htmlPanel: Panel): void;
|
|
1641
|
+
|
|
1642
|
+
/**
|
|
1643
|
+
* Joins the server with the specified IP.
|
|
1644
|
+
* @realm menu
|
|
1645
|
+
* @source https://wiki.facepunch.com/gmod/Global.JoinServer
|
|
1646
|
+
*/
|
|
1647
|
+
declare function JoinServer(IP: string): void;
|
|
1648
|
+
|
|
1649
|
+
/**
|
|
1650
|
+
* Convenience function that creates a [DLabel](https://wiki.facepunch.com/gmod/DLabel), sets the text, and returns it
|
|
1651
|
+
* @realm client and menu
|
|
1652
|
+
* @source https://wiki.facepunch.com/gmod/Global.Label
|
|
1653
|
+
*/
|
|
1654
|
+
declare function Label(text: string, parent?: Panel): Panel;
|
|
1655
|
+
|
|
1656
|
+
/**
|
|
1657
|
+
* Callback function for when the client's language changes. Called by the engine.
|
|
1658
|
+
* @realm menu
|
|
1659
|
+
* @source https://wiki.facepunch.com/gmod/Global.LanguageChanged
|
|
1660
|
+
*/
|
|
1661
|
+
declare function LanguageChanged(lang: string): void;
|
|
1662
|
+
|
|
1663
|
+
/**
|
|
1664
|
+
* Performs a linear interpolation from the start number to the end number.
|
|
1665
|
+
*
|
|
1666
|
+
* This function provides a very efficient and easy way to smooth out movements.
|
|
1667
|
+
*
|
|
1668
|
+
* See also [math.ease](https://wiki.facepunch.com/gmod/math.ease) for functions that allow to have non linear animations using linear interpolation.
|
|
1669
|
+
*
|
|
1670
|
+
* **NOTE**: This function is not meant to be used with constant value in the first argument if you're dealing with animation! Use a value that changes over time. See example for **proper** usage of Lerp for animations.
|
|
1671
|
+
*
|
|
1672
|
+
*
|
|
1673
|
+
* @realm shared and menu
|
|
1674
|
+
* @source https://wiki.facepunch.com/gmod/Global.Lerp
|
|
1675
|
+
*/
|
|
1676
|
+
declare function Lerp(t: number, from: number, to: number): number;
|
|
1677
|
+
|
|
1678
|
+
/**
|
|
1679
|
+
* Returns point between first and second angle using given fraction and linear interpolation
|
|
1680
|
+
* **NOTE**: This function is not meant to be used with constant value in the first argument, if you're dealing with animation! Use a value that changes over time
|
|
1681
|
+
*
|
|
1682
|
+
* @realm shared and menu
|
|
1683
|
+
* @source https://wiki.facepunch.com/gmod/Global.LerpAngle
|
|
1684
|
+
*/
|
|
1685
|
+
declare function LerpAngle(ratio: number, angleStart: Angle, angleEnd: Angle): Angle;
|
|
1686
|
+
|
|
1687
|
+
/**
|
|
1688
|
+
* Linear interpolation between two vectors. It is commonly used to smooth movement between two vectors
|
|
1689
|
+
* **NOTE**: This function is not meant to be used with constant value in the first argument, if you're dealing with animation! Use a value that changes over time
|
|
1690
|
+
*
|
|
1691
|
+
* @realm shared and menu
|
|
1692
|
+
* @source https://wiki.facepunch.com/gmod/Global.LerpVector
|
|
1693
|
+
*/
|
|
1694
|
+
declare function LerpVector(fraction: number, from: Vector, to: Vector): Vector;
|
|
1695
|
+
|
|
1696
|
+
/**
|
|
1697
|
+
* **INTERNAL**: This is used internally - although you're able to use it you probably shouldn't.
|
|
1698
|
+
*
|
|
1699
|
+
* Loads all Addon Presets and updates the Preset list.
|
|
1700
|
+
*
|
|
1701
|
+
* @realm menu
|
|
1702
|
+
* @source https://wiki.facepunch.com/gmod/Global.ListAddonPresets
|
|
1703
|
+
*/
|
|
1704
|
+
declare function ListAddonPresets(): void;
|
|
1705
|
+
|
|
1706
|
+
/**
|
|
1707
|
+
* Returns the contents of `addonpresets.txt` located in the `garrysmod/settings` folder. By default, this file stores your addon presets as JSON.
|
|
1708
|
+
*
|
|
1709
|
+
* You can use [Global.SaveAddonPresets](https://wiki.facepunch.com/gmod/Global.SaveAddonPresets) to modify this file.
|
|
1710
|
+
*
|
|
1711
|
+
* @realm menu
|
|
1712
|
+
* @source https://wiki.facepunch.com/gmod/Global.LoadAddonPresets
|
|
1713
|
+
*/
|
|
1714
|
+
declare function LoadAddonPresets(): string;
|
|
1715
|
+
|
|
1716
|
+
/**
|
|
1717
|
+
* **INTERNAL**: This is used internally - although you're able to use it you probably shouldn't.
|
|
1718
|
+
* This function is used to get the last map and category to which the map belongs from the cookie saved with [Global.SaveLastMap](https://wiki.facepunch.com/gmod/Global.SaveLastMap).
|
|
1719
|
+
* @realm menu
|
|
1720
|
+
* @source https://wiki.facepunch.com/gmod/Global.LoadLastMap
|
|
1721
|
+
*/
|
|
1722
|
+
declare function LoadLastMap(): void;
|
|
1723
|
+
|
|
1724
|
+
/**
|
|
1725
|
+
* **INTERNAL**: This is used internally - although you're able to use it you probably shouldn't.
|
|
1726
|
+
*
|
|
1727
|
+
* Updates the News List
|
|
1728
|
+
*
|
|
1729
|
+
* @realm menu
|
|
1730
|
+
* @source https://wiki.facepunch.com/gmod/Global.LoadNewsList
|
|
1731
|
+
*/
|
|
1732
|
+
declare function LoadNewsList(): void;
|
|
1733
|
+
|
|
1734
|
+
/**
|
|
1735
|
+
* **INTERNAL**: This is used internally - although you're able to use it you probably shouldn't.
|
|
1736
|
+
*
|
|
1737
|
+
*
|
|
1738
|
+
* Loads all preset settings for the [presets](https://wiki.facepunch.com/gmod/presets) and returns them in a table
|
|
1739
|
+
* @realm client
|
|
1740
|
+
* @source https://wiki.facepunch.com/gmod/Global.LoadPresets
|
|
1741
|
+
*/
|
|
1742
|
+
declare function LoadPresets(): table;
|
|
1743
|
+
|
|
1744
|
+
/**
|
|
1745
|
+
* Returns the player object of the current client.
|
|
1746
|
+
*
|
|
1747
|
+
* **NOTE**: LocalPlayer() will return NULL until all entities have been initialized. See [GM:InitPostEntity](https://wiki.facepunch.com/gmod/GM:InitPostEntity).
|
|
1748
|
+
*
|
|
1749
|
+
*
|
|
1750
|
+
* @realm client
|
|
1751
|
+
* @source https://wiki.facepunch.com/gmod/Global.LocalPlayer
|
|
1752
|
+
*/
|
|
1753
|
+
declare function LocalPlayer(): Player;
|
|
1754
|
+
|
|
1755
|
+
/**
|
|
1756
|
+
* Translates a vector and angle from a local coordinate system into a global coordinate system.
|
|
1757
|
+
*
|
|
1758
|
+
* For the reverse of this function see [Global.WorldToLocal](https://wiki.facepunch.com/gmod/Global.WorldToLocal).
|
|
1759
|
+
*
|
|
1760
|
+
* For working with an entity's local space vectors/angles you might consider using [Entity:LocalToWorld](https://wiki.facepunch.com/gmod/Entity:LocalToWorld)/[Entity:LocalToWorldAngles](https://wiki.facepunch.com/gmod/Entity:LocalToWorldAngles) instead.
|
|
1761
|
+
*
|
|
1762
|
+
* @realm shared
|
|
1763
|
+
* @source https://wiki.facepunch.com/gmod/Global.LocalToWorld
|
|
1764
|
+
*/
|
|
1765
|
+
declare function LocalToWorld(localPos: Vector, localAng: Angle, originPos: Vector, originAngle: Angle): (Vector, Angle);
|
|
1766
|
+
|
|
1767
|
+
/**
|
|
1768
|
+
* Returns a localization for the given token, if none is found it will return the default (second) parameter.
|
|
1769
|
+
*
|
|
1770
|
+
*
|
|
1771
|
+
*
|
|
1772
|
+
* @realm client and menu
|
|
1773
|
+
* @source https://wiki.facepunch.com/gmod/Global.Localize
|
|
1774
|
+
* @deprecated Use language.GetPhrase instead.
|
|
1775
|
+
*/
|
|
1776
|
+
declare function Localize(localizationToken: string, _default: string): string;
|
|
1777
|
+
|
|
1778
|
+
/**
|
|
1779
|
+
* Returns the main view angles, as they were at the start of the latest main view render.
|
|
1780
|
+
*
|
|
1781
|
+
* This is a good alternative to [Global.EyeAngles](https://wiki.facepunch.com/gmod/Global.EyeAngles) which is affected by other rendering operations, including [render.RenderView](https://wiki.facepunch.com/gmod/render.RenderView).
|
|
1782
|
+
*
|
|
1783
|
+
* @realm client
|
|
1784
|
+
* @source https://wiki.facepunch.com/gmod/Global.MainEyeAngles
|
|
1785
|
+
*/
|
|
1786
|
+
declare function MainEyeAngles(): Angle;
|
|
1787
|
+
|
|
1788
|
+
/**
|
|
1789
|
+
* Returns the origin of the main view, as it was at the start of the latest main view render.
|
|
1790
|
+
*
|
|
1791
|
+
* This is a good alternative to [Global.EyePos](https://wiki.facepunch.com/gmod/Global.EyePos) which is affected by other rendering operations, including [render.RenderView](https://wiki.facepunch.com/gmod/render.RenderView).
|
|
1792
|
+
*
|
|
1793
|
+
* @realm client
|
|
1794
|
+
* @source https://wiki.facepunch.com/gmod/Global.MainEyePos
|
|
1795
|
+
*/
|
|
1796
|
+
declare function MainEyePos(): Vector;
|
|
1797
|
+
|
|
1798
|
+
/**
|
|
1799
|
+
* Either returns the material with the given name, or loads the material interpreting the first argument as the path.
|
|
1800
|
+
*
|
|
1801
|
+
* ## .png, .jpg and other image formats
|
|
1802
|
+
*
|
|
1803
|
+
* This function is capable to loading `.png` or `.jpg` images, generating a texture and material for them on the fly.
|
|
1804
|
+
*
|
|
1805
|
+
* PNG, JPEG, GIF, and TGA files will work, but only if they have the `.png` or `.jpg` file extensions (even if the actual image format doesn't match the file extension)
|
|
1806
|
+
*
|
|
1807
|
+
* Use [Global.AddonMaterial](https://wiki.facepunch.com/gmod/Global.AddonMaterial) for image files with the `.cache` file extension. (from [steamworks.Download](https://wiki.facepunch.com/gmod/steamworks.Download))
|
|
1808
|
+
*
|
|
1809
|
+
* While images are no longer scaled to Power of 2 (sizes of 8, 16, 32, 64, 128, etc.) sizes since February 2019, it is still a good practice for things like icons, etc.
|
|
1810
|
+
*
|
|
1811
|
+
* **WARNING**: Server-side, this function can consistently return an invalid material (with '__error') depending on the file type loaded.
|
|
1812
|
+
*
|
|
1813
|
+
*
|
|
1814
|
+
* **WARNING**: This function is very expensive when used in rendering hooks or in operations requiring very frequent calls. It is a good idea to cache the material in a variable (like in the examples).
|
|
1815
|
+
*
|
|
1816
|
+
*
|
|
1817
|
+
* @realm shared and menu
|
|
1818
|
+
* @source https://wiki.facepunch.com/gmod/Global.Material
|
|
1819
|
+
*/
|
|
1820
|
+
declare function Material(materialName: string, pngParameters?: string): (IMaterial, number);
|
|
1821
|
+
|
|
1822
|
+
/**
|
|
1823
|
+
* Returns a [VMatrix](https://wiki.facepunch.com/gmod/VMatrix) object, a 4x4 matrix.
|
|
1824
|
+
* @realm shared
|
|
1825
|
+
* @source https://wiki.facepunch.com/gmod/Global.Matrix
|
|
1826
|
+
*/
|
|
1827
|
+
declare function Matrix(data?: table): VMatrix;
|
|
1828
|
+
|
|
1829
|
+
/**
|
|
1830
|
+
* **INTERNAL**: Internally uses [steamworks.FileInfo](https://wiki.facepunch.com/gmod/steamworks.FileInfo) to fetch the data.
|
|
1831
|
+
*
|
|
1832
|
+
* This function retrieves the Addon data and passes it onto JS(JavaScript)
|
|
1833
|
+
*
|
|
1834
|
+
* @realm menu
|
|
1835
|
+
* @source https://wiki.facepunch.com/gmod/Global.MenuGetAddonData
|
|
1836
|
+
*/
|
|
1837
|
+
declare function MenuGetAddonData(workshopItemID: string): void;
|
|
1838
|
+
|
|
1839
|
+
/**
|
|
1840
|
+
* Returns a new static mesh object.
|
|
1841
|
+
* @realm client
|
|
1842
|
+
* @source https://wiki.facepunch.com/gmod/Global.Mesh
|
|
1843
|
+
*/
|
|
1844
|
+
declare function Mesh(mat?: IMaterial, boneWeights?: number): IMesh;
|
|
1845
|
+
|
|
1846
|
+
/**
|
|
1847
|
+
* Runs [util.PrecacheModel](https://wiki.facepunch.com/gmod/util.PrecacheModel) and returns the string.
|
|
1848
|
+
* @realm shared and menu
|
|
1849
|
+
* @source https://wiki.facepunch.com/gmod/Global.Model
|
|
1850
|
+
*/
|
|
1851
|
+
declare function Model(model: string): string;
|
|
1852
|
+
|
|
1853
|
+
/**
|
|
1854
|
+
* Writes every given argument to the console. Limitations of [Global.print](https://wiki.facepunch.com/gmod/Global.print) apply.
|
|
1855
|
+
*
|
|
1856
|
+
* Automatically attempts to convert each argument to a string. (See [Global.tostring](https://wiki.facepunch.com/gmod/Global.tostring))
|
|
1857
|
+
*
|
|
1858
|
+
* Unlike [Global.print](https://wiki.facepunch.com/gmod/Global.print), arguments are not separated by anything. They are simply concatenated.
|
|
1859
|
+
*
|
|
1860
|
+
* Additionally, a newline isn't added automatically to the end, so subsequent Msg or print operations will continue the same line of text in the console. See [Global.MsgN](https://wiki.facepunch.com/gmod/Global.MsgN) for a version that does add a newline.
|
|
1861
|
+
*
|
|
1862
|
+
* The text is blue on the server, orange on the client, and green on the menu:
|
|
1863
|
+
*
|
|
1864
|
+
* @realm shared and menu
|
|
1865
|
+
* @source https://wiki.facepunch.com/gmod/Global.Msg
|
|
1866
|
+
*/
|
|
1867
|
+
declare function Msg(...: any): void;
|
|
1868
|
+
|
|
1869
|
+
/**
|
|
1870
|
+
* Works exactly like [Global.Msg](https://wiki.facepunch.com/gmod/Global.Msg) except that, if called on the server, will print to all players consoles plus the server console. Limitations of [Global.print](https://wiki.facepunch.com/gmod/Global.print) apply.
|
|
1871
|
+
* @realm shared
|
|
1872
|
+
* @source https://wiki.facepunch.com/gmod/Global.MsgAll
|
|
1873
|
+
*/
|
|
1874
|
+
declare function MsgAll(...: any): void;
|
|
1875
|
+
|
|
1876
|
+
/**
|
|
1877
|
+
* Just like [Global.Msg](https://wiki.facepunch.com/gmod/Global.Msg), except it can also print colored text, just like [chat.AddText](https://wiki.facepunch.com/gmod/chat.AddText).
|
|
1878
|
+
* @realm shared and menu
|
|
1879
|
+
* @source https://wiki.facepunch.com/gmod/Global.MsgC
|
|
1880
|
+
*/
|
|
1881
|
+
declare function MsgC(...: any): void;
|
|
1882
|
+
|
|
1883
|
+
/**
|
|
1884
|
+
* Same as [Global.print](https://wiki.facepunch.com/gmod/Global.print), except it concatinates the arguments without inserting any whitespace in between them.
|
|
1885
|
+
*
|
|
1886
|
+
* See also [Global.Msg](https://wiki.facepunch.com/gmod/Global.Msg), which doesn't add a newline (`"\n"`) at the end.
|
|
1887
|
+
*
|
|
1888
|
+
* @realm shared and menu
|
|
1889
|
+
* @source https://wiki.facepunch.com/gmod/Global.MsgN
|
|
1890
|
+
*/
|
|
1891
|
+
declare function MsgN(...: any): void;
|
|
1892
|
+
|
|
1893
|
+
/**
|
|
1894
|
+
* Returns named color defined in `resource/ClientScheme.res`.
|
|
1895
|
+
* @realm client
|
|
1896
|
+
* @source https://wiki.facepunch.com/gmod/Global.NamedColor
|
|
1897
|
+
*/
|
|
1898
|
+
declare function NamedColor(name: string): Color;
|
|
1899
|
+
|
|
1900
|
+
/**
|
|
1901
|
+
* Returns the number of files needed from the server you are currently joining.
|
|
1902
|
+
* @realm menu
|
|
1903
|
+
* @source https://wiki.facepunch.com/gmod/Global.NumDownloadables
|
|
1904
|
+
*/
|
|
1905
|
+
declare function NumDownloadables(): number;
|
|
1906
|
+
|
|
1907
|
+
/**
|
|
1908
|
+
* Returns the amount of skins the specified model has if the model has ever been loaded before, without loading the model directly.
|
|
1909
|
+
*
|
|
1910
|
+
* See also [Entity:SkinCount](https://wiki.facepunch.com/gmod/Entity:SkinCount) if you have an entity.
|
|
1911
|
+
*
|
|
1912
|
+
* @realm client
|
|
1913
|
+
* @source https://wiki.facepunch.com/gmod/Global.NumModelSkins
|
|
1914
|
+
*/
|
|
1915
|
+
declare function NumModelSkins(modelName: string): number;
|
|
1916
|
+
|
|
1917
|
+
/**
|
|
1918
|
+
* **INTERNAL**: This is used internally - although you're able to use it you probably shouldn't.
|
|
1919
|
+
* Called by the engine when a model has been loaded. Caches model information with the [sql](https://wiki.facepunch.com/gmod/sql).
|
|
1920
|
+
* @realm client
|
|
1921
|
+
* @source https://wiki.facepunch.com/gmod/Global.OnModelLoaded
|
|
1922
|
+
*/
|
|
1923
|
+
declare function OnModelLoaded(modelName: string, numPostParams: number, numSeq: number, numAttachments: number, numBoneControllers: number, numSkins: number, size: number): void;
|
|
1924
|
+
|
|
1925
|
+
/**
|
|
1926
|
+
* Opens a folder with the given name in the garrysmod folder using the operating system's file browser.
|
|
1927
|
+
*
|
|
1928
|
+
* This does not work on OSX or Linux.
|
|
1929
|
+
*
|
|
1930
|
+
* @realm menu
|
|
1931
|
+
* @source https://wiki.facepunch.com/gmod/Global.OpenFolder
|
|
1932
|
+
*/
|
|
1933
|
+
declare function OpenFolder(folder: string): void;
|
|
1934
|
+
|
|
1935
|
+
/**
|
|
1936
|
+
* Opens the Problems Panel.
|
|
1937
|
+
* @realm menu
|
|
1938
|
+
* @source https://wiki.facepunch.com/gmod/Global.OpenProblemsPanel
|
|
1939
|
+
*/
|
|
1940
|
+
declare function OpenProblemsPanel(): void;
|
|
1941
|
+
|
|
1942
|
+
/**
|
|
1943
|
+
* Modifies the given vectors so that all of vector2's axis are larger than vector1's by switching them around. Also known as ordering vectors.
|
|
1944
|
+
*
|
|
1945
|
+
* **NOTE**: This function will irreversibly modify the given vectors
|
|
1946
|
+
*
|
|
1947
|
+
*
|
|
1948
|
+
* @realm shared and menu
|
|
1949
|
+
* @source https://wiki.facepunch.com/gmod/Global.OrderVectors
|
|
1950
|
+
*/
|
|
1951
|
+
declare function OrderVectors(vector1: Vector, vector2: Vector): void;
|
|
1952
|
+
|
|
1953
|
+
/**
|
|
1954
|
+
* Calls [game.AddParticles](https://wiki.facepunch.com/gmod/game.AddParticles) and returns given string.
|
|
1955
|
+
* @realm shared and menu
|
|
1956
|
+
* @source https://wiki.facepunch.com/gmod/Global.Particle
|
|
1957
|
+
*/
|
|
1958
|
+
declare function Particle(file: string): string;
|
|
1959
|
+
|
|
1960
|
+
/**
|
|
1961
|
+
* Creates a particle effect. See also [Global.CreateParticleSystem](https://wiki.facepunch.com/gmod/Global.CreateParticleSystem).
|
|
1962
|
+
*
|
|
1963
|
+
* **NOTE**: The particle effect must be precached **serverside** with [Global.PrecacheParticleSystem](https://wiki.facepunch.com/gmod/Global.PrecacheParticleSystem) and the file its from must be added via [game.AddParticles](https://wiki.facepunch.com/gmod/game.AddParticles) before it can be used!
|
|
1964
|
+
*
|
|
1965
|
+
*
|
|
1966
|
+
* @realm shared
|
|
1967
|
+
* @source https://wiki.facepunch.com/gmod/Global.ParticleEffect
|
|
1968
|
+
*/
|
|
1969
|
+
declare function ParticleEffect(particleName: string, position: Vector, angles: Angle, parent?: Entity): void;
|
|
1970
|
+
|
|
1971
|
+
/**
|
|
1972
|
+
* Creates a particle effect with specialized parameters. See also [Entity:CreateParticleEffect](https://wiki.facepunch.com/gmod/Entity:CreateParticleEffect) and [Global.CreateParticleSystem](https://wiki.facepunch.com/gmod/Global.CreateParticleSystem).
|
|
1973
|
+
*
|
|
1974
|
+
* **NOTE**: The particle effect must be precached **serverside** with [Global.PrecacheParticleSystem](https://wiki.facepunch.com/gmod/Global.PrecacheParticleSystem) and the file its from must be added via [game.AddParticles](https://wiki.facepunch.com/gmod/game.AddParticles) before it can be used!
|
|
1975
|
+
*
|
|
1976
|
+
*
|
|
1977
|
+
* @realm shared
|
|
1978
|
+
* @source https://wiki.facepunch.com/gmod/Global.ParticleEffectAttach
|
|
1979
|
+
*/
|
|
1980
|
+
declare function ParticleEffectAttach(particleName: string, attachType: number, entity: Entity, attachmentID: number): void;
|
|
1981
|
+
|
|
1982
|
+
/**
|
|
1983
|
+
* Creates a new [CLuaEmitter](https://wiki.facepunch.com/gmod/CLuaEmitter).
|
|
1984
|
+
*
|
|
1985
|
+
* **NOTE**: Do not forget to delete the emitter with [CLuaEmitter:Finish](https://wiki.facepunch.com/gmod/CLuaEmitter:Finish) once you are done with it
|
|
1986
|
+
*
|
|
1987
|
+
* **WARNING**: There is a limit of 4097 emitters that can be active at once, exceeding this limit will throw a non-halting error in console!
|
|
1988
|
+
*
|
|
1989
|
+
*
|
|
1990
|
+
* @realm client
|
|
1991
|
+
* @source https://wiki.facepunch.com/gmod/Global.ParticleEmitter
|
|
1992
|
+
*/
|
|
1993
|
+
declare function ParticleEmitter(position: Vector, use3D?: boolean): CLuaEmitter;
|
|
1994
|
+
|
|
1995
|
+
/**
|
|
1996
|
+
* Creates a path for the bot to follow using one of two types (`Follow` or `Chase`)
|
|
1997
|
+
*
|
|
1998
|
+
* `Follow` is a general purpose path. Best used for static or infrequently updated locations. The path will only be updated once [PathFollower:Update](https://wiki.facepunch.com/gmod/PathFollower:Update) is called. This needs to be done manually (typically inside the bots `BehaveThread` coroutine.
|
|
1999
|
+
*
|
|
2000
|
+
* `Chase` is a specifically optimized for chasing a moving entity. Paths of this type will use [PathFollower:Chase](https://wiki.facepunch.com/gmod/PathFollower:Chase)
|
|
2001
|
+
*
|
|
2002
|
+
*
|
|
2003
|
+
*
|
|
2004
|
+
* @realm server
|
|
2005
|
+
* @source https://wiki.facepunch.com/gmod/Global.Path
|
|
2006
|
+
*/
|
|
2007
|
+
declare function Path(type: string): PathFollower;
|
|
2008
|
+
|
|
2009
|
+
/**
|
|
2010
|
+
* Returns the player with the matching [Player:UserID](https://wiki.facepunch.com/gmod/Player:UserID).
|
|
2011
|
+
*
|
|
2012
|
+
* For a function that returns a player based on their [Entity:EntIndex](https://wiki.facepunch.com/gmod/Entity:EntIndex), see [Global.Entity](https://wiki.facepunch.com/gmod/Global.Entity).
|
|
2013
|
+
*
|
|
2014
|
+
*
|
|
2015
|
+
* For a function that returns a player based on their connection ID, see [player.GetByID](https://wiki.facepunch.com/gmod/player.GetByID).
|
|
2016
|
+
*
|
|
2017
|
+
* @realm shared
|
|
2018
|
+
* @source https://wiki.facepunch.com/gmod/Global.Player
|
|
2019
|
+
*/
|
|
2020
|
+
declare function Player(playerIndex: number): Player;
|
|
2021
|
+
|
|
2022
|
+
/**
|
|
2023
|
+
* Moves the given model to the given position and calculates appropriate camera parameters for rendering the model to an icon.
|
|
2024
|
+
*
|
|
2025
|
+
* The output table interacts nicely with [Panel:RebuildSpawnIconEx](https://wiki.facepunch.com/gmod/Panel:RebuildSpawnIconEx) with a few key renames.
|
|
2026
|
+
*
|
|
2027
|
+
* @realm client
|
|
2028
|
+
* @source https://wiki.facepunch.com/gmod/Global.PositionSpawnIcon
|
|
2029
|
+
*/
|
|
2030
|
+
declare function PositionSpawnIcon(model: Entity, position: Vector, noAngles: boolean): table;
|
|
2031
|
+
|
|
2032
|
+
/**
|
|
2033
|
+
* Precaches a particle system with the specified name. The particle system must come from a file that is loaded with [game.AddParticles](https://wiki.facepunch.com/gmod/game.AddParticles) beforehand.
|
|
2034
|
+
*
|
|
2035
|
+
* When used on the server, it automatically precaches the particle on client.
|
|
2036
|
+
*
|
|
2037
|
+
* **WARNING**: There is a limit of 4096 precached particles on the server. So only precache particles that are actually going to be used.
|
|
2038
|
+
*
|
|
2039
|
+
*
|
|
2040
|
+
* @realm shared
|
|
2041
|
+
* @source https://wiki.facepunch.com/gmod/Global.PrecacheParticleSystem
|
|
2042
|
+
*/
|
|
2043
|
+
declare function PrecacheParticleSystem(particleSystemName: string): void;
|
|
2044
|
+
|
|
2045
|
+
/**
|
|
2046
|
+
* Precaches a scene file.
|
|
2047
|
+
* @realm server
|
|
2048
|
+
* @source https://wiki.facepunch.com/gmod/Global.PrecacheScene
|
|
2049
|
+
*/
|
|
2050
|
+
declare function PrecacheScene(scene: string): void;
|
|
2051
|
+
|
|
2052
|
+
/**
|
|
2053
|
+
* Load and precache a custom sentence file.
|
|
2054
|
+
* @realm shared
|
|
2055
|
+
* @source https://wiki.facepunch.com/gmod/Global.PrecacheSentenceFile
|
|
2056
|
+
*/
|
|
2057
|
+
declare function PrecacheSentenceFile(filename: string): void;
|
|
2058
|
+
|
|
2059
|
+
/**
|
|
2060
|
+
* Precache a sentence group in a sentences.txt definition file.
|
|
2061
|
+
* @realm server
|
|
2062
|
+
* @source https://wiki.facepunch.com/gmod/Global.PrecacheSentenceGroup
|
|
2063
|
+
*/
|
|
2064
|
+
declare function PrecacheSentenceGroup(group: string): void;
|
|
2065
|
+
|
|
2066
|
+
/**
|
|
2067
|
+
* Displays a message in the chat, console, or center of screen of every player.
|
|
2068
|
+
*
|
|
2069
|
+
* This uses the archaic user message system ([umsg](https://wiki.facepunch.com/gmod/umsg)) and hence is limited to 255 characters.
|
|
2070
|
+
*
|
|
2071
|
+
* @realm server
|
|
2072
|
+
* @source https://wiki.facepunch.com/gmod/Global.PrintMessage
|
|
2073
|
+
*/
|
|
2074
|
+
declare function PrintMessage(type: number, message: string): void;
|
|
2075
|
+
|
|
2076
|
+
/**
|
|
2077
|
+
* Recursively prints the contents of a table to the console.
|
|
2078
|
+
*
|
|
2079
|
+
* The table keys will be sorted alphabetically or numerically when printed to the console.
|
|
2080
|
+
*
|
|
2081
|
+
* @realm shared and menu
|
|
2082
|
+
* @source https://wiki.facepunch.com/gmod/Global.PrintTable
|
|
2083
|
+
*/
|
|
2084
|
+
declare function PrintTable(tableToPrint: table, indent?: number, done?: table): void;
|
|
2085
|
+
|
|
2086
|
+
/**
|
|
2087
|
+
* Creates a new [ProjectedTexture](https://wiki.facepunch.com/gmod/ProjectedTexture).
|
|
2088
|
+
* @realm client
|
|
2089
|
+
* @source https://wiki.facepunch.com/gmod/Global.ProjectedTexture
|
|
2090
|
+
*/
|
|
2091
|
+
declare function ProjectedTexture(): ProjectedTexture;
|
|
2092
|
+
|
|
2093
|
+
/**
|
|
2094
|
+
* Runs a function without stopping the whole script on error.
|
|
2095
|
+
*
|
|
2096
|
+
* This function is similar to [Global.pcall](https://wiki.facepunch.com/gmod/Global.pcall) and [Global.xpcall](https://wiki.facepunch.com/gmod/Global.xpcall) except the errors are still printed and sent to the error handler (i.e. sent to server console if clientside and [GM:OnLuaError](https://wiki.facepunch.com/gmod/GM:OnLuaError) called).
|
|
2097
|
+
*
|
|
2098
|
+
* @realm shared
|
|
2099
|
+
* @source https://wiki.facepunch.com/gmod/Global.ProtectedCall
|
|
2100
|
+
*/
|
|
2101
|
+
declare function ProtectedCall(func: function, ...: any): boolean;
|
|
2102
|
+
|
|
2103
|
+
/**
|
|
2104
|
+
* Returns an iterator function that can be used to loop through a table in random order
|
|
2105
|
+
* @realm shared and menu
|
|
2106
|
+
* @source https://wiki.facepunch.com/gmod/Global.RandomPairs
|
|
2107
|
+
*/
|
|
2108
|
+
declare function RandomPairs(table: table, descending?: boolean): function;
|
|
2109
|
+
|
|
2110
|
+
/**
|
|
2111
|
+
* Returns the real frame-time which is unaffected by host_timescale. To be used for GUI effects (for example)
|
|
2112
|
+
* **NOTE**: The returned number is clamped between `0` and `0.1`.
|
|
2113
|
+
*
|
|
2114
|
+
*
|
|
2115
|
+
* @realm client
|
|
2116
|
+
* @source https://wiki.facepunch.com/gmod/Global.RealFrameTime
|
|
2117
|
+
*/
|
|
2118
|
+
declare function RealFrameTime(): number;
|
|
2119
|
+
|
|
2120
|
+
/**
|
|
2121
|
+
* Returns the uptime of the game/server in seconds (to at least **4** decimal places). This value updates itself once every time the realm thinks. For servers, this is the server tickrate. For clients, this is once per frame.
|
|
2122
|
+
*
|
|
2123
|
+
* **NOTE**: This is **not** synchronised or affected by the game.
|
|
2124
|
+
*
|
|
2125
|
+
* This will be affected by precision loss if the uptime is more than 30+(?) days, and effectively cease to be functional after 50+(?) days.
|
|
2126
|
+
*
|
|
2127
|
+
* Changing the map will **not** fix it like it does with [Global.CurTime](https://wiki.facepunch.com/gmod/Global.CurTime). A server restart is necessary.
|
|
2128
|
+
*
|
|
2129
|
+
*
|
|
2130
|
+
* You should use this function (or [Global.SysTime](https://wiki.facepunch.com/gmod/Global.SysTime)) for timing real-world events such as user interaction, but not for timing game events such as animations.
|
|
2131
|
+
*
|
|
2132
|
+
* See also: [Global.CurTime](https://wiki.facepunch.com/gmod/Global.CurTime), [Global.SysTime](https://wiki.facepunch.com/gmod/Global.SysTime)
|
|
2133
|
+
*
|
|
2134
|
+
* @realm shared
|
|
2135
|
+
* @source https://wiki.facepunch.com/gmod/Global.RealTime
|
|
2136
|
+
*/
|
|
2137
|
+
declare function RealTime(): number;
|
|
2138
|
+
|
|
2139
|
+
/**
|
|
2140
|
+
* Creates a new [CRecipientFilter](https://wiki.facepunch.com/gmod/CRecipientFilter).
|
|
2141
|
+
* @realm server
|
|
2142
|
+
* @source https://wiki.facepunch.com/gmod/Global.RecipientFilter
|
|
2143
|
+
*/
|
|
2144
|
+
declare function RecipientFilter(unreliable?: boolean): CRecipientFilter;
|
|
2145
|
+
|
|
2146
|
+
/**
|
|
2147
|
+
* **INTERNAL**: This is used internally - although you're able to use it you probably shouldn't.
|
|
2148
|
+
*
|
|
2149
|
+
* Adds a frame to the currently recording demo.
|
|
2150
|
+
*
|
|
2151
|
+
* @realm menu
|
|
2152
|
+
* @source https://wiki.facepunch.com/gmod/Global.RecordDemoFrame
|
|
2153
|
+
*/
|
|
2154
|
+
declare function RecordDemoFrame(): void;
|
|
2155
|
+
|
|
2156
|
+
/**
|
|
2157
|
+
* Refreshes all Addon Conflicts after 1 Second. Internally uses [Global.FireAddonConflicts](https://wiki.facepunch.com/gmod/Global.FireAddonConflicts)
|
|
2158
|
+
* @realm menu
|
|
2159
|
+
* @source https://wiki.facepunch.com/gmod/Global.RefreshAddonConflicts
|
|
2160
|
+
*/
|
|
2161
|
+
declare function RefreshAddonConflicts(): void;
|
|
2162
|
+
|
|
2163
|
+
/**
|
|
2164
|
+
* Registers a Derma element to be closed the next time [Global.CloseDermaMenus](https://wiki.facepunch.com/gmod/Global.CloseDermaMenus) is called
|
|
2165
|
+
* @realm client and menu
|
|
2166
|
+
* @source https://wiki.facepunch.com/gmod/Global.RegisterDermaMenuForClose
|
|
2167
|
+
*/
|
|
2168
|
+
declare function RegisterDermaMenuForClose(menu: Panel): void;
|
|
2169
|
+
|
|
2170
|
+
/**
|
|
2171
|
+
* Registers a given table as a metatable. It can then be accessed by other code/addons via [Global.FindMetaTable](https://wiki.facepunch.com/gmod/Global.FindMetaTable).
|
|
2172
|
+
*
|
|
2173
|
+
* @realm shared and menu
|
|
2174
|
+
* @source https://wiki.facepunch.com/gmod/Global.RegisterMetaTable
|
|
2175
|
+
*/
|
|
2176
|
+
declare function RegisterMetaTable(metaName: string, metaTable: table): void;
|
|
2177
|
+
|
|
2178
|
+
/**
|
|
2179
|
+
* Saves position of your cursor on screen. You can restore it by using [Global.RestoreCursorPosition](https://wiki.facepunch.com/gmod/Global.RestoreCursorPosition). This is used internally by the spawn menu/context menu
|
|
2180
|
+
*
|
|
2181
|
+
* @realm client and menu
|
|
2182
|
+
* @source https://wiki.facepunch.com/gmod/Global.RememberCursorPosition
|
|
2183
|
+
*/
|
|
2184
|
+
declare function RememberCursorPosition(): void;
|
|
2185
|
+
|
|
2186
|
+
/**
|
|
2187
|
+
* Does the removing of the tooltip panel. Called by [Global.EndTooltip](https://wiki.facepunch.com/gmod/Global.EndTooltip).
|
|
2188
|
+
* @realm client and menu
|
|
2189
|
+
* @source https://wiki.facepunch.com/gmod/Global.RemoveTooltip
|
|
2190
|
+
*/
|
|
2191
|
+
declare function RemoveTooltip(): void;
|
|
2192
|
+
|
|
2193
|
+
/**
|
|
2194
|
+
* Returns the angle that the clients view is being rendered at. Returns `angles` from the return value of [render.GetViewSetup](https://wiki.facepunch.com/gmod/render.GetViewSetup).
|
|
2195
|
+
*
|
|
2196
|
+
* See also [Global.EyeAngles](https://wiki.facepunch.com/gmod/Global.EyeAngles).
|
|
2197
|
+
*
|
|
2198
|
+
* @realm client
|
|
2199
|
+
* @source https://wiki.facepunch.com/gmod/Global.RenderAngles
|
|
2200
|
+
*/
|
|
2201
|
+
declare function RenderAngles(): Angle;
|
|
2202
|
+
|
|
2203
|
+
/**
|
|
2204
|
+
* Renders a Depth of Field effect
|
|
2205
|
+
* @realm client
|
|
2206
|
+
* @source https://wiki.facepunch.com/gmod/Global.RenderDoF
|
|
2207
|
+
*/
|
|
2208
|
+
declare function RenderDoF(origin: Vector, angle: Angle, usableFocusPoint: Vector, angleSize: number, radialSteps: number, passes: number, spin: boolean, inView: table, fov: number): void;
|
|
2209
|
+
|
|
2210
|
+
/**
|
|
2211
|
+
* Renders the stereoscopic post-process effect
|
|
2212
|
+
* @realm client
|
|
2213
|
+
* @source https://wiki.facepunch.com/gmod/Global.RenderStereoscopy
|
|
2214
|
+
*/
|
|
2215
|
+
declare function RenderStereoscopy(viewOrigin: Vector, viewAngles: Angle): void;
|
|
2216
|
+
|
|
2217
|
+
/**
|
|
2218
|
+
* Renders the Super Depth of Field post-process effect
|
|
2219
|
+
* @realm client
|
|
2220
|
+
* @source https://wiki.facepunch.com/gmod/Global.RenderSuperDoF
|
|
2221
|
+
*/
|
|
2222
|
+
declare function RenderSuperDoF(viewOrigin: Vector, viewAngles: Angle, viewFOV: number): void;
|
|
2223
|
+
|
|
2224
|
+
/**
|
|
2225
|
+
* **INTERNAL**: Called by [permissions.AskToConnect](https://wiki.facepunch.com/gmod/permissions.AskToConnect)
|
|
2226
|
+
*
|
|
2227
|
+
* If the server has the permission "connect" granted, it will instantly connect you to the server.
|
|
2228
|
+
* If the permission is not granted it will, it opens a confirmation window to connect to the server.
|
|
2229
|
+
*
|
|
2230
|
+
*
|
|
2231
|
+
* @realm menu
|
|
2232
|
+
* @source https://wiki.facepunch.com/gmod/Global.RequestConnectToServer
|
|
2233
|
+
*/
|
|
2234
|
+
declare function RequestConnectToServer(serverip: string): void;
|
|
2235
|
+
|
|
2236
|
+
/**
|
|
2237
|
+
* **INTERNAL**: This is used internally - although you're able to use it you probably shouldn't.
|
|
2238
|
+
*
|
|
2239
|
+
* Opens a confirmation window to open the url.
|
|
2240
|
+
*
|
|
2241
|
+
*
|
|
2242
|
+
* @realm menu
|
|
2243
|
+
* @source https://wiki.facepunch.com/gmod/Global.RequestOpenURL
|
|
2244
|
+
*/
|
|
2245
|
+
declare function RequestOpenURL(url: string): void;
|
|
2246
|
+
|
|
2247
|
+
/**
|
|
2248
|
+
* **INTERNAL**: This is used internally - although you're able to use it you probably shouldn't.
|
|
2249
|
+
*
|
|
2250
|
+
* Opens a confirmation window to grant the requested permission.
|
|
2251
|
+
*
|
|
2252
|
+
*
|
|
2253
|
+
* @realm menu
|
|
2254
|
+
* @source https://wiki.facepunch.com/gmod/Global.RequestPermission
|
|
2255
|
+
*/
|
|
2256
|
+
declare function RequestPermission(permission: string): void;
|
|
2257
|
+
|
|
2258
|
+
/**
|
|
2259
|
+
* Restores position of your cursor on screen. You can save it by using [Global.RememberCursorPosition](https://wiki.facepunch.com/gmod/Global.RememberCursorPosition).
|
|
2260
|
+
* @realm client and menu
|
|
2261
|
+
* @source https://wiki.facepunch.com/gmod/Global.RestoreCursorPosition
|
|
2262
|
+
*/
|
|
2263
|
+
declare function RestoreCursorPosition(): void;
|
|
2264
|
+
|
|
2265
|
+
/**
|
|
2266
|
+
* Executes the given console command with the parameters.
|
|
2267
|
+
*
|
|
2268
|
+
* **NOTE**: Some commands/convars are blocked from being ran/changed using this function, usually to prevent harm/annoyance to clients. For a list of blocked commands, see [Blocked ConCommands](https://wiki.facepunch.com/gmod/Blocked_ConCommands).
|
|
2269
|
+
*
|
|
2270
|
+
*
|
|
2271
|
+
* @realm shared and menu
|
|
2272
|
+
* @source https://wiki.facepunch.com/gmod/Global.RunConsoleCommand
|
|
2273
|
+
*/
|
|
2274
|
+
declare function RunConsoleCommand(command: string, ...: any): void;
|
|
2275
|
+
|
|
2276
|
+
/**
|
|
2277
|
+
* Runs a menu command. Equivalent to [Global.RunConsoleCommand](https://wiki.facepunch.com/gmod/Global.RunConsoleCommand)`( "gamemenucommand", command )` unless the command starts with the `"engine"` keyword in which case it is equivalent to [Global.RunConsoleCommand](https://wiki.facepunch.com/gmod/Global.RunConsoleCommand)`( command )`.
|
|
2278
|
+
* **WARNING**: Invoking engine commands no longer works, prints out `Not running engine cmd 'concommand'`
|
|
2279
|
+
*
|
|
2280
|
+
*
|
|
2281
|
+
* @realm menu
|
|
2282
|
+
* @source https://wiki.facepunch.com/gmod/Global.RunGameUICommand
|
|
2283
|
+
*/
|
|
2284
|
+
declare function RunGameUICommand(command: string): void;
|
|
2285
|
+
|
|
2286
|
+
/**
|
|
2287
|
+
* Evaluates and executes the given code, will throw an error on failure.
|
|
2288
|
+
* **NOTE**: Local variables are not passed to the given code.
|
|
2289
|
+
*
|
|
2290
|
+
*
|
|
2291
|
+
* @realm shared and menu
|
|
2292
|
+
* @source https://wiki.facepunch.com/gmod/Global.RunString
|
|
2293
|
+
*/
|
|
2294
|
+
declare function RunString(code: string, identifier?: string, handleError?: boolean): string;
|
|
2295
|
+
|
|
2296
|
+
/**
|
|
2297
|
+
* Alias of [Global.RunString](https://wiki.facepunch.com/gmod/Global.RunString).
|
|
2298
|
+
*
|
|
2299
|
+
*
|
|
2300
|
+
*
|
|
2301
|
+
* @realm shared and menu
|
|
2302
|
+
* @source https://wiki.facepunch.com/gmod/Global.RunStringEx
|
|
2303
|
+
* @deprecated Use Global.RunString instead.
|
|
2304
|
+
*/
|
|
2305
|
+
declare function RunStringEx(code: string, identifier?: string, handleError?: boolean): string;
|
|
2306
|
+
|
|
2307
|
+
/**
|
|
2308
|
+
* Returns the input value in an escaped form so that it can safely be used inside of queries. The returned value is surrounded by quotes unless `noQuotes` is true. Alias of [sql.SQLStr](https://wiki.facepunch.com/gmod/sql.SQLStr).
|
|
2309
|
+
*
|
|
2310
|
+
* **WARNING**: Do not use this function with external database engines such as `MySQL`. `MySQL` and `SQLite` use different escape sequences that are incompatible with each other! Escaping strings with inadequate functions is dangerous and will lead to SQL injection vulnerabilities.
|
|
2311
|
+
*
|
|
2312
|
+
*
|
|
2313
|
+
* @realm shared and menu
|
|
2314
|
+
* @source https://wiki.facepunch.com/gmod/Global.SQLStr
|
|
2315
|
+
*/
|
|
2316
|
+
declare function SQLStr(input: string, noQuotes?: boolean): string;
|
|
2317
|
+
|
|
2318
|
+
/**
|
|
2319
|
+
* Returns a number based on the Size argument and your screen's width. Alias of [Global.ScreenScale](https://wiki.facepunch.com/gmod/Global.ScreenScale).
|
|
2320
|
+
*
|
|
2321
|
+
* @realm client
|
|
2322
|
+
* @source https://wiki.facepunch.com/gmod/Global.SScale
|
|
2323
|
+
* @deprecated You should be using Global.ScreenScale instead.
|
|
2324
|
+
*/
|
|
2325
|
+
declare function SScale(Size: number): void;
|
|
2326
|
+
|
|
2327
|
+
/**
|
|
2328
|
+
* Returns the ordinal suffix of a given number.
|
|
2329
|
+
* @realm shared and menu
|
|
2330
|
+
* @source https://wiki.facepunch.com/gmod/Global.STNDRD
|
|
2331
|
+
*/
|
|
2332
|
+
declare function STNDRD(number: number): string;
|
|
2333
|
+
|
|
2334
|
+
/**
|
|
2335
|
+
* Removes the given entity unless it is a player or the world entity.
|
|
2336
|
+
* @realm shared and menu
|
|
2337
|
+
* @source https://wiki.facepunch.com/gmod/Global.SafeRemoveEntity
|
|
2338
|
+
*/
|
|
2339
|
+
declare function SafeRemoveEntity(ent: Entity): void;
|
|
2340
|
+
|
|
2341
|
+
/**
|
|
2342
|
+
* Removes entity after delay using [Global.SafeRemoveEntity](https://wiki.facepunch.com/gmod/Global.SafeRemoveEntity).
|
|
2343
|
+
* @realm shared and menu
|
|
2344
|
+
* @source https://wiki.facepunch.com/gmod/Global.SafeRemoveEntityDelayed
|
|
2345
|
+
*/
|
|
2346
|
+
declare function SafeRemoveEntityDelayed(entity: Entity, delay: number): void;
|
|
2347
|
+
|
|
2348
|
+
/**
|
|
2349
|
+
* Sets the content of `addonpresets.txt` located in the `garrysmod/settings` folder. By default, this file stores your addon presets as JSON.
|
|
2350
|
+
*
|
|
2351
|
+
* You can use [Global.LoadAddonPresets](https://wiki.facepunch.com/gmod/Global.LoadAddonPresets) to retrieve the data in this file.
|
|
2352
|
+
*
|
|
2353
|
+
* @realm menu
|
|
2354
|
+
* @source https://wiki.facepunch.com/gmod/Global.SaveAddonPresets
|
|
2355
|
+
*/
|
|
2356
|
+
declare function SaveAddonPresets(JSON: string): void;
|
|
2357
|
+
|
|
2358
|
+
/**
|
|
2359
|
+
* **INTERNAL**: This is used internally - although you're able to use it you probably shouldn't.
|
|
2360
|
+
*
|
|
2361
|
+
* Hides the News List when set to true.
|
|
2362
|
+
* **NOTE**: If you call this don't forget to call [Global.LoadNewsList](https://wiki.facepunch.com/gmod/Global.LoadNewsList) to update the News List.
|
|
2363
|
+
*
|
|
2364
|
+
*
|
|
2365
|
+
* @realm menu
|
|
2366
|
+
* @source https://wiki.facepunch.com/gmod/Global.SaveHideNews
|
|
2367
|
+
*/
|
|
2368
|
+
declare function SaveHideNews(hide: boolean): void;
|
|
2369
|
+
|
|
2370
|
+
/**
|
|
2371
|
+
* **INTERNAL**: This is used internally - although you're able to use it you probably shouldn't.
|
|
2372
|
+
*
|
|
2373
|
+
* This function is used to save the last map and category to which the map belongs as a .
|
|
2374
|
+
*
|
|
2375
|
+
* @realm menu
|
|
2376
|
+
* @source https://wiki.facepunch.com/gmod/Global.SaveLastMap
|
|
2377
|
+
*/
|
|
2378
|
+
declare function SaveLastMap(map: string, category: string): void;
|
|
2379
|
+
|
|
2380
|
+
/**
|
|
2381
|
+
* **INTERNAL**: This is used internally - although you're able to use it you probably shouldn't.
|
|
2382
|
+
*
|
|
2383
|
+
*
|
|
2384
|
+
* Overwrites all presets with the supplied table. Used by the [presets](https://wiki.facepunch.com/gmod/presets) for preset saving
|
|
2385
|
+
* @realm client
|
|
2386
|
+
* @source https://wiki.facepunch.com/gmod/Global.SavePresets
|
|
2387
|
+
*/
|
|
2388
|
+
declare function SavePresets(presets: table): void;
|
|
2389
|
+
|
|
2390
|
+
/**
|
|
2391
|
+
* Gets the height of the game's window (in pixels).
|
|
2392
|
+
* **NOTE**: ScrH() returns the height from the current viewport, this can be changed via [render.SetViewPort](https://wiki.facepunch.com/gmod/render.SetViewPort), inside Render Targets and cam.Start contexts.
|
|
2393
|
+
*
|
|
2394
|
+
*
|
|
2395
|
+
* @realm client and menu
|
|
2396
|
+
* @source https://wiki.facepunch.com/gmod/Global.ScrH
|
|
2397
|
+
*/
|
|
2398
|
+
declare function ScrH(): number;
|
|
2399
|
+
|
|
2400
|
+
/**
|
|
2401
|
+
* Gets the width of the game's window (in pixels).
|
|
2402
|
+
* **NOTE**: ScrW() returns the width from the current viewport, this can be changed via [render.SetViewPort](https://wiki.facepunch.com/gmod/render.SetViewPort), inside Render Targets and cam.Start contexts.
|
|
2403
|
+
*
|
|
2404
|
+
*
|
|
2405
|
+
* @realm client and menu
|
|
2406
|
+
* @source https://wiki.facepunch.com/gmod/Global.ScrW
|
|
2407
|
+
*/
|
|
2408
|
+
declare function ScrW(): number;
|
|
2409
|
+
|
|
2410
|
+
/**
|
|
2411
|
+
* Returns a number based on the `size` argument and the players' screen width. This is used to scale user interface (UI) elements to be consistently sized and positioned across all screen resolutions.
|
|
2412
|
+
*
|
|
2413
|
+
* The width is scaled in relation to `640x480` resolution, and does **not** take into account non the aspect ratio. See example below for how to adjust for that.
|
|
2414
|
+
*
|
|
2415
|
+
* This function can also be used for scaling font sizes.
|
|
2416
|
+
*
|
|
2417
|
+
* See [Global.ScreenScaleH](https://wiki.facepunch.com/gmod/Global.ScreenScaleH) for a function that scales from height.
|
|
2418
|
+
*
|
|
2419
|
+
* @realm client
|
|
2420
|
+
* @source https://wiki.facepunch.com/gmod/Global.ScreenScale
|
|
2421
|
+
*/
|
|
2422
|
+
declare function ScreenScale(size: number): number;
|
|
2423
|
+
|
|
2424
|
+
/**
|
|
2425
|
+
* Returns a number based on the `size` argument and players' screen height. The height is scaled in relation to `640x480` resolution. This function is primarily used for scaling font sizes.
|
|
2426
|
+
*
|
|
2427
|
+
* See [Global.ScreenScale](https://wiki.facepunch.com/gmod/Global.ScreenScale) for a function that scales from width.
|
|
2428
|
+
*
|
|
2429
|
+
*
|
|
2430
|
+
* @realm client
|
|
2431
|
+
* @source https://wiki.facepunch.com/gmod/Global.ScreenScaleH
|
|
2432
|
+
*/
|
|
2433
|
+
declare function ScreenScaleH(size: number): number;
|
|
2434
|
+
|
|
2435
|
+
/**
|
|
2436
|
+
* Send a usermessage
|
|
2437
|
+
*
|
|
2438
|
+
*
|
|
2439
|
+
* **NOTE**: This does nothing clientside.
|
|
2440
|
+
*
|
|
2441
|
+
*
|
|
2442
|
+
* @realm shared
|
|
2443
|
+
* @source https://wiki.facepunch.com/gmod/Global.SendUserMessage
|
|
2444
|
+
* @deprecated This uses the umsg internally, which has been deprecated. Use the net instead.
|
|
2445
|
+
*/
|
|
2446
|
+
declare function SendUserMessage(name: string, recipients: any, ...: any): void;
|
|
2447
|
+
|
|
2448
|
+
/**
|
|
2449
|
+
* Returns approximate duration of a sentence by name. See [Global.EmitSentence](https://wiki.facepunch.com/gmod/Global.EmitSentence).
|
|
2450
|
+
* @realm shared
|
|
2451
|
+
* @source https://wiki.facepunch.com/gmod/Global.SentenceDuration
|
|
2452
|
+
*/
|
|
2453
|
+
declare function SentenceDuration(name: string): number;
|
|
2454
|
+
|
|
2455
|
+
/**
|
|
2456
|
+
* Prints `ServerLog: PARAM` without a newline, to the server log and console.
|
|
2457
|
+
*
|
|
2458
|
+
* As of June 2022, if `sv_logecho` is set to `0` (defaults to `1`) the message will not print to console and will only be written to the server's log file.
|
|
2459
|
+
*
|
|
2460
|
+
* @realm server
|
|
2461
|
+
* @source https://wiki.facepunch.com/gmod/Global.ServerLog
|
|
2462
|
+
*/
|
|
2463
|
+
declare function ServerLog(parameter: string): void;
|
|
2464
|
+
|
|
2465
|
+
/**
|
|
2466
|
+
* Adds the given string to the computers clipboard, which can then be pasted in or outside of GMod with Ctrl + V.
|
|
2467
|
+
* @realm client and menu
|
|
2468
|
+
* @source https://wiki.facepunch.com/gmod/Global.SetClipboardText
|
|
2469
|
+
*/
|
|
2470
|
+
declare function SetClipboardText(text: string): void;
|
|
2471
|
+
|
|
2472
|
+
/**
|
|
2473
|
+
* Defines an angle to be automatically networked to clients
|
|
2474
|
+
*
|
|
2475
|
+
* **NOTE**: Running this function clientside will only set it clientside for the client it is called on!
|
|
2476
|
+
*
|
|
2477
|
+
*
|
|
2478
|
+
* @realm shared
|
|
2479
|
+
* @source https://wiki.facepunch.com/gmod/Global.SetGlobal2Angle
|
|
2480
|
+
*/
|
|
2481
|
+
declare function SetGlobal2Angle(index: any, angle: Angle): void;
|
|
2482
|
+
|
|
2483
|
+
/**
|
|
2484
|
+
* Defined a boolean to be automatically networked to clients
|
|
2485
|
+
*
|
|
2486
|
+
* **NOTE**: Running this function clientside will only set it clientside for the client it is called on!
|
|
2487
|
+
*
|
|
2488
|
+
*
|
|
2489
|
+
* @realm shared
|
|
2490
|
+
* @source https://wiki.facepunch.com/gmod/Global.SetGlobal2Bool
|
|
2491
|
+
*/
|
|
2492
|
+
declare function SetGlobal2Bool(index: any, bool: boolean): void;
|
|
2493
|
+
|
|
2494
|
+
/**
|
|
2495
|
+
* Defines an entity to be automatically networked to clients
|
|
2496
|
+
*
|
|
2497
|
+
* **NOTE**: Running this function clientside will only set it clientside for the client it is called on!
|
|
2498
|
+
*
|
|
2499
|
+
*
|
|
2500
|
+
* @realm shared
|
|
2501
|
+
* @source https://wiki.facepunch.com/gmod/Global.SetGlobal2Entity
|
|
2502
|
+
*/
|
|
2503
|
+
declare function SetGlobal2Entity(index: any, ent: Entity): void;
|
|
2504
|
+
|
|
2505
|
+
/**
|
|
2506
|
+
* Defines a floating point number to be automatically networked to clients
|
|
2507
|
+
*
|
|
2508
|
+
* **WARNING**: This function has a floating point precision error. Use [Global.SetGlobalFloat](https://wiki.facepunch.com/gmod/Global.SetGlobalFloat) instead
|
|
2509
|
+
*
|
|
2510
|
+
* **NOTE**: Running this function clientside will only set it clientside for the client it is called on!
|
|
2511
|
+
*
|
|
2512
|
+
*
|
|
2513
|
+
* @realm shared
|
|
2514
|
+
* @source https://wiki.facepunch.com/gmod/Global.SetGlobal2Float
|
|
2515
|
+
*/
|
|
2516
|
+
declare function SetGlobal2Float(index: any, float: number): void;
|
|
2517
|
+
|
|
2518
|
+
/**
|
|
2519
|
+
* Sets an integer that is shared between the server and all clients.
|
|
2520
|
+
* **WARNING**: The integer has a 32 bit limit. Use [Global.SetGlobalInt](https://wiki.facepunch.com/gmod/Global.SetGlobalInt) instead
|
|
2521
|
+
*
|
|
2522
|
+
* **NOTE**: Running this function clientside will only set it clientside for the client it is called on!
|
|
2523
|
+
*
|
|
2524
|
+
* @realm shared
|
|
2525
|
+
* @source https://wiki.facepunch.com/gmod/Global.SetGlobal2Int
|
|
2526
|
+
*/
|
|
2527
|
+
declare function SetGlobal2Int(index: string, value: number): void;
|
|
2528
|
+
|
|
2529
|
+
/**
|
|
2530
|
+
* Defines a string with a maximum of 511 characters to be automatically networked to clients
|
|
2531
|
+
*
|
|
2532
|
+
* **NOTE**: Running this function clientside will only set it clientside for the client it is called on!
|
|
2533
|
+
*
|
|
2534
|
+
*
|
|
2535
|
+
* @realm shared
|
|
2536
|
+
* @source https://wiki.facepunch.com/gmod/Global.SetGlobal2String
|
|
2537
|
+
*/
|
|
2538
|
+
declare function SetGlobal2String(index: any, string: string): void;
|
|
2539
|
+
|
|
2540
|
+
/**
|
|
2541
|
+
* Defines a variable to be automatically networked to clients
|
|
2542
|
+
*
|
|
2543
|
+
*
|
|
2544
|
+
* | Allowed Types |
|
|
2545
|
+
* | --------------- |
|
|
2546
|
+
* | Angle |
|
|
2547
|
+
* | Boolean |
|
|
2548
|
+
* | Entity |
|
|
2549
|
+
* | Float |
|
|
2550
|
+
* | Int |
|
|
2551
|
+
* | String |
|
|
2552
|
+
* | Vector |
|
|
2553
|
+
* **WARNING**: Trying to network a type that is not listed above will result in a nil value!
|
|
2554
|
+
*
|
|
2555
|
+
* **NOTE**: Running this function clientside will only set it clientside for the client it is called on!
|
|
2556
|
+
*
|
|
2557
|
+
*
|
|
2558
|
+
* @realm shared
|
|
2559
|
+
* @source https://wiki.facepunch.com/gmod/Global.SetGlobal2Var
|
|
2560
|
+
*/
|
|
2561
|
+
declare function SetGlobal2Var(index: any, value: any): void;
|
|
2562
|
+
|
|
2563
|
+
/**
|
|
2564
|
+
* Defines a vector to be automatically networked to clients
|
|
2565
|
+
*
|
|
2566
|
+
* **NOTE**: Running this function clientside will only set it clientside for the client it is called on!
|
|
2567
|
+
*
|
|
2568
|
+
*
|
|
2569
|
+
* @realm shared
|
|
2570
|
+
* @source https://wiki.facepunch.com/gmod/Global.SetGlobal2Vector
|
|
2571
|
+
*/
|
|
2572
|
+
declare function SetGlobal2Vector(index: any, vec: Vector): void;
|
|
2573
|
+
|
|
2574
|
+
/**
|
|
2575
|
+
* Defines an angle to be automatically networked to clients
|
|
2576
|
+
*
|
|
2577
|
+
* **WARNING**: There's a 4095 slots Network limit. If you need more, consider using the [net](https://wiki.facepunch.com/gmod/net) library or [Global.SetGlobal2Angle](https://wiki.facepunch.com/gmod/Global.SetGlobal2Angle). You should also consider the fact that you have way too many variables. You can learn more about this limit here: [Networking_Usage](https://wiki.facepunch.com/gmod/Networking_Usage)
|
|
2578
|
+
*
|
|
2579
|
+
* **NOTE**: Running this function clientside will only set it clientside for the client it is called on!
|
|
2580
|
+
*
|
|
2581
|
+
*
|
|
2582
|
+
* @realm shared
|
|
2583
|
+
* @source https://wiki.facepunch.com/gmod/Global.SetGlobalAngle
|
|
2584
|
+
*/
|
|
2585
|
+
declare function SetGlobalAngle(index: any, angle: Angle): void;
|
|
2586
|
+
|
|
2587
|
+
/**
|
|
2588
|
+
* Defined a boolean to be automatically networked to clients
|
|
2589
|
+
*
|
|
2590
|
+
* **WARNING**: There's a 4095 slots Network limit. If you need more, consider using the [net](https://wiki.facepunch.com/gmod/net) library or [Global.SetGlobal2Bool](https://wiki.facepunch.com/gmod/Global.SetGlobal2Bool). You should also consider the fact that you have way too many variables. You can learn more about this limit here: [Networking_Usage](https://wiki.facepunch.com/gmod/Networking_Usage)
|
|
2591
|
+
*
|
|
2592
|
+
* **NOTE**: Running this function clientside will only set it clientside for the client it is called on!
|
|
2593
|
+
*
|
|
2594
|
+
*
|
|
2595
|
+
* @realm shared
|
|
2596
|
+
* @source https://wiki.facepunch.com/gmod/Global.SetGlobalBool
|
|
2597
|
+
*/
|
|
2598
|
+
declare function SetGlobalBool(index: any, bool: boolean): void;
|
|
2599
|
+
|
|
2600
|
+
/**
|
|
2601
|
+
* Defines an entity to be automatically networked to clients
|
|
2602
|
+
*
|
|
2603
|
+
* **WARNING**: There's a 4095 slots Network limit. If you need more, consider using the [net](https://wiki.facepunch.com/gmod/net) library or [Global.SetGlobal2Entity](https://wiki.facepunch.com/gmod/Global.SetGlobal2Entity). You should also consider the fact that you have way too many variables. You can learn more about this limit here: [Networking_Usage](https://wiki.facepunch.com/gmod/Networking_Usage)
|
|
2604
|
+
*
|
|
2605
|
+
* **NOTE**: Running this function clientside will only set it clientside for the client it is called on!
|
|
2606
|
+
*
|
|
2607
|
+
*
|
|
2608
|
+
* @realm shared
|
|
2609
|
+
* @source https://wiki.facepunch.com/gmod/Global.SetGlobalEntity
|
|
2610
|
+
*/
|
|
2611
|
+
declare function SetGlobalEntity(index: any, ent: Entity): void;
|
|
2612
|
+
|
|
2613
|
+
/**
|
|
2614
|
+
* Defines a floating point number to be automatically networked to clients
|
|
2615
|
+
*
|
|
2616
|
+
* **WARNING**: There's a 4095 slots Network limit. If you need more, consider using the [net](https://wiki.facepunch.com/gmod/net) library or [Global.SetGlobal2Float](https://wiki.facepunch.com/gmod/Global.SetGlobal2Float). You should also consider the fact that you have way too many variables. You can learn more about this limit here: [Networking_Usage](https://wiki.facepunch.com/gmod/Networking_Usage)
|
|
2617
|
+
*
|
|
2618
|
+
* **NOTE**: Running this function clientside will only set it clientside for the client it is called on!
|
|
2619
|
+
*
|
|
2620
|
+
*
|
|
2621
|
+
* @realm shared
|
|
2622
|
+
* @source https://wiki.facepunch.com/gmod/Global.SetGlobalFloat
|
|
2623
|
+
*/
|
|
2624
|
+
declare function SetGlobalFloat(index: any, float: number): void;
|
|
2625
|
+
|
|
2626
|
+
/**
|
|
2627
|
+
* Sets an integer that is shared between the server and all clients.
|
|
2628
|
+
*
|
|
2629
|
+
* **WARNING**: There's a 4095 slots Network limit. If you need more, consider using the [net](https://wiki.facepunch.com/gmod/net) library or [Global.SetGlobal2Int](https://wiki.facepunch.com/gmod/Global.SetGlobal2Int). You should also consider the fact that you have way too many variables. You can learn more about this limit here: [Networking_Usage](https://wiki.facepunch.com/gmod/Networking_Usage)
|
|
2630
|
+
*
|
|
2631
|
+
* **NOTE**: Running this function clientside will only set it clientside for the client it is called on!
|
|
2632
|
+
*
|
|
2633
|
+
* This function will not round decimal values as it actually networks a 64 bit float internally.
|
|
2634
|
+
*
|
|
2635
|
+
* @realm shared
|
|
2636
|
+
* @source https://wiki.facepunch.com/gmod/Global.SetGlobalInt
|
|
2637
|
+
*/
|
|
2638
|
+
declare function SetGlobalInt(index: string, value: number): void;
|
|
2639
|
+
|
|
2640
|
+
/**
|
|
2641
|
+
* Defines a string with a maximum of 199 characters to be automatically networked to clients
|
|
2642
|
+
*
|
|
2643
|
+
* **WARNING**: There's a 4095 slots Network limit. If you need more, consider using the [net](https://wiki.facepunch.com/gmod/net) library or [Global.SetGlobal2String](https://wiki.facepunch.com/gmod/Global.SetGlobal2String). You should also consider the fact that you have way too many variables. You can learn more about this limit here: [Networking_Usage](https://wiki.facepunch.com/gmod/Networking_Usage)
|
|
2644
|
+
*
|
|
2645
|
+
* **NOTE**: If you want to have a higher characters limit use [Global.SetGlobal2String](https://wiki.facepunch.com/gmod/Global.SetGlobal2String)
|
|
2646
|
+
*
|
|
2647
|
+
* **NOTE**: Running this function clientside will only set it clientside for the client it is called on!
|
|
2648
|
+
*
|
|
2649
|
+
*
|
|
2650
|
+
* @realm shared
|
|
2651
|
+
* @source https://wiki.facepunch.com/gmod/Global.SetGlobalString
|
|
2652
|
+
*/
|
|
2653
|
+
declare function SetGlobalString(index: any, string: string): void;
|
|
2654
|
+
|
|
2655
|
+
/**
|
|
2656
|
+
* Defines a variable to be automatically networked to clients
|
|
2657
|
+
*
|
|
2658
|
+
*
|
|
2659
|
+
* | Allowed Types |
|
|
2660
|
+
* | --------------- |
|
|
2661
|
+
* | Angle |
|
|
2662
|
+
* | Boolean |
|
|
2663
|
+
* | Entity |
|
|
2664
|
+
* | Float |
|
|
2665
|
+
* | Int |
|
|
2666
|
+
* | String |
|
|
2667
|
+
* | Vector |
|
|
2668
|
+
* **WARNING**: Trying to network a type that is not listed above will result in an error!
|
|
2669
|
+
* There's a 4095 slots Network limit. If you need more, consider using the [net](https://wiki.facepunch.com/gmod/net) library or [Global.SetGlobal2Var](https://wiki.facepunch.com/gmod/Global.SetGlobal2Var). You should also consider the fact that you have way too many variables. You can learn more about this limit here: [Networking_Usage](https://wiki.facepunch.com/gmod/Networking_Usage)
|
|
2670
|
+
*
|
|
2671
|
+
*
|
|
2672
|
+
* **NOTE**: Running this function clientside will only set it clientside for the client it is called on!
|
|
2673
|
+
*
|
|
2674
|
+
*
|
|
2675
|
+
* @realm shared
|
|
2676
|
+
* @source https://wiki.facepunch.com/gmod/Global.SetGlobalVar
|
|
2677
|
+
*/
|
|
2678
|
+
declare function SetGlobalVar(index: any, value: any): void;
|
|
2679
|
+
|
|
2680
|
+
/**
|
|
2681
|
+
* Defines a vector to be automatically networked to clients
|
|
2682
|
+
* **WARNING**: There's a 4095 slots Network limit. If you need more, consider using the [net](https://wiki.facepunch.com/gmod/net) library or [Global.SetGlobal2Vector](https://wiki.facepunch.com/gmod/Global.SetGlobal2Vector). You should also consider the fact that you have way too many variables. You can learn more about this limit here: [Networking_Usage](https://wiki.facepunch.com/gmod/Networking_Usage)
|
|
2683
|
+
*
|
|
2684
|
+
* **NOTE**: Running this function clientside will only set it clientside for the client it is called on!
|
|
2685
|
+
*
|
|
2686
|
+
*
|
|
2687
|
+
* @realm shared
|
|
2688
|
+
* @source https://wiki.facepunch.com/gmod/Global.SetGlobalVector
|
|
2689
|
+
*/
|
|
2690
|
+
declare function SetGlobalVector(index: any, vec: Vector): void;
|
|
2691
|
+
|
|
2692
|
+
/**
|
|
2693
|
+
* Called by the engine to set which [constraint system](https://developer.valvesoftware.com/wiki/Phys_constraintsystem) the next created constraints should use.
|
|
2694
|
+
* @realm shared
|
|
2695
|
+
* @source https://wiki.facepunch.com/gmod/Global.SetPhysConstraintSystem
|
|
2696
|
+
*/
|
|
2697
|
+
declare function SetPhysConstraintSystem(constraintSystem: Entity): void;
|
|
2698
|
+
|
|
2699
|
+
/**
|
|
2700
|
+
* This function can be used in a for loop instead of [Global.pairs](https://wiki.facepunch.com/gmod/Global.pairs). It sorts all **keys** alphabetically.
|
|
2701
|
+
*
|
|
2702
|
+
* For sorting by specific **value member**, use [Global.SortedPairsByMemberValue](https://wiki.facepunch.com/gmod/Global.SortedPairsByMemberValue).
|
|
2703
|
+
*
|
|
2704
|
+
*
|
|
2705
|
+
* For sorting by **value**, use [Global.SortedPairsByValue](https://wiki.facepunch.com/gmod/Global.SortedPairsByValue).
|
|
2706
|
+
*
|
|
2707
|
+
* @realm shared and menu
|
|
2708
|
+
* @source https://wiki.facepunch.com/gmod/Global.SortedPairs
|
|
2709
|
+
*/
|
|
2710
|
+
declare function SortedPairs(table: table, desc?: boolean): (function, table);
|
|
2711
|
+
|
|
2712
|
+
/**
|
|
2713
|
+
* Returns an iterator function that can be used to loop through a table in order of member values, when the values of the table are also tables and contain that member.
|
|
2714
|
+
*
|
|
2715
|
+
* To sort by **value**, use [Global.SortedPairsByValue](https://wiki.facepunch.com/gmod/Global.SortedPairsByValue).
|
|
2716
|
+
*
|
|
2717
|
+
*
|
|
2718
|
+
* To sort by **keys**, use [Global.SortedPairs](https://wiki.facepunch.com/gmod/Global.SortedPairs).
|
|
2719
|
+
*
|
|
2720
|
+
* @realm shared and menu
|
|
2721
|
+
* @source https://wiki.facepunch.com/gmod/Global.SortedPairsByMemberValue
|
|
2722
|
+
*/
|
|
2723
|
+
declare function SortedPairsByMemberValue(table: table, memberKey: any, descending?: boolean): (function, table);
|
|
2724
|
+
|
|
2725
|
+
/**
|
|
2726
|
+
* Returns an iterator function that can be used to loop through a table in order of its **values**.
|
|
2727
|
+
*
|
|
2728
|
+
* To sort by specific **value member**, use [Global.SortedPairsByMemberValue](https://wiki.facepunch.com/gmod/Global.SortedPairsByMemberValue).
|
|
2729
|
+
*
|
|
2730
|
+
*
|
|
2731
|
+
* To sort by **keys**, use [Global.SortedPairs](https://wiki.facepunch.com/gmod/Global.SortedPairs).
|
|
2732
|
+
*
|
|
2733
|
+
* @realm shared and menu
|
|
2734
|
+
* @source https://wiki.facepunch.com/gmod/Global.SortedPairsByValue
|
|
2735
|
+
*/
|
|
2736
|
+
declare function SortedPairsByValue(table: table, descending?: boolean): (function, table);
|
|
2737
|
+
|
|
2738
|
+
/**
|
|
2739
|
+
* Runs [util.PrecacheSound](https://wiki.facepunch.com/gmod/util.PrecacheSound) and returns the string.
|
|
2740
|
+
*
|
|
2741
|
+
* [util.PrecacheSound](https://wiki.facepunch.com/gmod/util.PrecacheSound) does nothing and therefore so does this function.
|
|
2742
|
+
*
|
|
2743
|
+
* @realm shared and menu
|
|
2744
|
+
* @source https://wiki.facepunch.com/gmod/Global.Sound
|
|
2745
|
+
*/
|
|
2746
|
+
declare function Sound(soundPath: string): string;
|
|
2747
|
+
|
|
2748
|
+
/**
|
|
2749
|
+
* Returns the approximate duration of the specified sound in seconds, for `.wav` and `.mp3` sounds.
|
|
2750
|
+
* This function only works on mp3 files if the file is encoded with constant bitrate.
|
|
2751
|
+
* **NOTE**: This function will not work with sound files prepended with a [sound character](https://developer.valvesoftware.com/wiki/Soundscripts#Sound_Characters).
|
|
2752
|
+
*
|
|
2753
|
+
*
|
|
2754
|
+
* @realm shared
|
|
2755
|
+
* @source https://wiki.facepunch.com/gmod/Global.SoundDuration
|
|
2756
|
+
*/
|
|
2757
|
+
declare function SoundDuration(soundName: string): number;
|
|
2758
|
+
|
|
2759
|
+
/**
|
|
2760
|
+
* Suppress any networking from the server to the specified player. Set this to [NULL](https://wiki.facepunch.com/gmod/NULL) to stop suppressing network events.
|
|
2761
|
+
*
|
|
2762
|
+
* This is automatically called by the engine before/after a player fires their weapon, reloads, or causes any other similar shared-predicted event to occur.
|
|
2763
|
+
* @realm server
|
|
2764
|
+
* @source https://wiki.facepunch.com/gmod/Global.SuppressHostEvents
|
|
2765
|
+
*/
|
|
2766
|
+
declare function SuppressHostEvents(suppressPlayer: Player): void;
|
|
2767
|
+
|
|
2768
|
+
/**
|
|
2769
|
+
* Returns a highly accurate time in seconds since the start up, ideal for benchmarking. Unlike [Global.RealTime](https://wiki.facepunch.com/gmod/Global.RealTime), this value will be updated any time the function is called, allowing for sub-think precision.
|
|
2770
|
+
* @realm shared and menu
|
|
2771
|
+
* @source https://wiki.facepunch.com/gmod/Global.SysTime
|
|
2772
|
+
*/
|
|
2773
|
+
declare function SysTime(): number;
|
|
2774
|
+
|
|
2775
|
+
/**
|
|
2776
|
+
* Returns a TauntCamera object
|
|
2777
|
+
* @realm shared
|
|
2778
|
+
* @source https://wiki.facepunch.com/gmod/Global.TauntCamera
|
|
2779
|
+
*/
|
|
2780
|
+
declare function TauntCamera(): table;
|
|
2781
|
+
|
|
2782
|
+
/**
|
|
2783
|
+
* Clears focus from any text entries player may have focused.
|
|
2784
|
+
* @realm client and menu
|
|
2785
|
+
* @source https://wiki.facepunch.com/gmod/Global.TextEntryLoseFocus
|
|
2786
|
+
*/
|
|
2787
|
+
declare function TextEntryLoseFocus(): void;
|
|
2788
|
+
|
|
2789
|
+
/**
|
|
2790
|
+
* Returns a cosine value that fluctuates based on the current time
|
|
2791
|
+
* @realm shared and menu
|
|
2792
|
+
* @source https://wiki.facepunch.com/gmod/Global.TimedCos
|
|
2793
|
+
*/
|
|
2794
|
+
declare function TimedCos(frequency: number, min: number, max: number, offset: number): number;
|
|
2795
|
+
|
|
2796
|
+
/**
|
|
2797
|
+
* Returns a sine value that fluctuates based on [Global.CurTime](https://wiki.facepunch.com/gmod/Global.CurTime). The value returned will be between the start value plus/minus the range value.
|
|
2798
|
+
*
|
|
2799
|
+
* The range arguments don't work as intended. The existing (bugged) behavior is documented below.
|
|
2800
|
+
*
|
|
2801
|
+
* @realm shared and menu
|
|
2802
|
+
* @source https://wiki.facepunch.com/gmod/Global.TimedSin
|
|
2803
|
+
*/
|
|
2804
|
+
declare function TimedSin(frequency: number, origin: number, max: number, offset: number): number;
|
|
2805
|
+
|
|
2806
|
+
/**
|
|
2807
|
+
* Toggles whether or not the named map is favorited in the new game list.
|
|
2808
|
+
* @realm menu
|
|
2809
|
+
* @source https://wiki.facepunch.com/gmod/Global.ToggleFavourite
|
|
2810
|
+
*/
|
|
2811
|
+
declare function ToggleFavourite(map: string): void;
|
|
2812
|
+
|
|
2813
|
+
/**
|
|
2814
|
+
* **INTERNAL**: This is used internally - although you're able to use it you probably shouldn't.
|
|
2815
|
+
*
|
|
2816
|
+
* Returns "Lua Cache File" if the given file name is in a certain string table, nothing otherwise.
|
|
2817
|
+
*
|
|
2818
|
+
* @realm menu
|
|
2819
|
+
* @source https://wiki.facepunch.com/gmod/Global.TranslateDownloadableName
|
|
2820
|
+
*/
|
|
2821
|
+
declare function TranslateDownloadableName(filename: string): string;
|
|
2822
|
+
|
|
2823
|
+
/**
|
|
2824
|
+
* Gets the associated type ID of the variable. Unlike [Global.type](https://wiki.facepunch.com/gmod/Global.type), this does not work with [no value](https://wiki.facepunch.com/gmod/no_value) - an argument must be provided.
|
|
2825
|
+
*
|
|
2826
|
+
* **WARNING**: This will return `TYPE_TABLE` for [Color](https://wiki.facepunch.com/gmod/Color) objects.
|
|
2827
|
+
*
|
|
2828
|
+
* All subclasses of [Entity](https://wiki.facepunch.com/gmod/Entity) will return `TYPE_ENTITY`.
|
|
2829
|
+
*
|
|
2830
|
+
*
|
|
2831
|
+
* This returns garbage for _LOADLIB objects.
|
|
2832
|
+
* This returns `TYPE_NIL` for [proto](https://wiki.facepunch.com/gmod/proto)s.
|
|
2833
|
+
*
|
|
2834
|
+
* @realm shared
|
|
2835
|
+
* @source https://wiki.facepunch.com/gmod/Global.TypeID
|
|
2836
|
+
*/
|
|
2837
|
+
declare function TypeID(variable: any): number;
|
|
2838
|
+
|
|
2839
|
+
/**
|
|
2840
|
+
* This function is an alias of [Global.IsUselessModel](https://wiki.facepunch.com/gmod/Global.IsUselessModel).
|
|
2841
|
+
*
|
|
2842
|
+
* Returns whether or not a model is useless by checking that the file path is that of a proper model.
|
|
2843
|
+
*
|
|
2844
|
+
* If the string ".mdl" is not found in the model name, the function will return true.
|
|
2845
|
+
*
|
|
2846
|
+
* The function will also return true if any of the following strings are found in the given model name:
|
|
2847
|
+
* * "_gesture"
|
|
2848
|
+
* * "_anim"
|
|
2849
|
+
* * "_gst"
|
|
2850
|
+
* * "_pst"
|
|
2851
|
+
* * "_shd"
|
|
2852
|
+
* * "_ss"
|
|
2853
|
+
* * "_posture"
|
|
2854
|
+
* * "_anm"
|
|
2855
|
+
* * "ghostanim"
|
|
2856
|
+
* * "_paths"
|
|
2857
|
+
* * "_shared"
|
|
2858
|
+
* * "anim_"
|
|
2859
|
+
* * "gestures_"
|
|
2860
|
+
* * "shared_ragdoll_"
|
|
2861
|
+
*
|
|
2862
|
+
* @realm shared and menu
|
|
2863
|
+
* @source https://wiki.facepunch.com/gmod/Global.UTIL_IsUselessModel
|
|
2864
|
+
* @deprecated You should use Global.IsUselessModel instead.
|
|
2865
|
+
*/
|
|
2866
|
+
declare function UTIL_IsUselessModel(modelName: string): boolean;
|
|
2867
|
+
|
|
2868
|
+
/**
|
|
2869
|
+
* Returns the current asynchronous in-game time. This will not be synced with the players current clock allowing you to get [Global.CurTime](https://wiki.facepunch.com/gmod/Global.CurTime) without interference from [Prediction](https://wiki.facepunch.com/gmod/Prediction).
|
|
2870
|
+
* @realm shared and menu
|
|
2871
|
+
* @source https://wiki.facepunch.com/gmod/Global.UnPredictedCurTime
|
|
2872
|
+
*/
|
|
2873
|
+
declare function UnPredictedCurTime(): number;
|
|
2874
|
+
|
|
2875
|
+
/**
|
|
2876
|
+
* **INTERNAL**: This is used internally - although you're able to use it you probably shouldn't.
|
|
2877
|
+
*
|
|
2878
|
+
* This function retrieves the values from [Global.GetAddonStatus](https://wiki.facepunch.com/gmod/Global.GetAddonStatus) and passes them to JS(JavaScript).
|
|
2879
|
+
*
|
|
2880
|
+
* @realm menu
|
|
2881
|
+
* @source https://wiki.facepunch.com/gmod/Global.UpdateAddonDisabledState
|
|
2882
|
+
*/
|
|
2883
|
+
declare function UpdateAddonDisabledState(): void;
|
|
2884
|
+
|
|
2885
|
+
/**
|
|
2886
|
+
* **INTERNAL**: This is used internally - although you're able to use it you probably shouldn't.
|
|
2887
|
+
*
|
|
2888
|
+
* This function is called by [Global.UpdateMapList](https://wiki.facepunch.com/gmod/Global.UpdateMapList) to pass the AddonMaps to JS to be used for the Search.
|
|
2889
|
+
*
|
|
2890
|
+
* @realm menu
|
|
2891
|
+
* @source https://wiki.facepunch.com/gmod/Global.UpdateAddonMapList
|
|
2892
|
+
*/
|
|
2893
|
+
declare function UpdateAddonMapList(): void;
|
|
2894
|
+
|
|
2895
|
+
/**
|
|
2896
|
+
* **INTERNAL**: This is used internally - although you're able to use it you probably shouldn't.
|
|
2897
|
+
*
|
|
2898
|
+
* Updates the Gamelist.
|
|
2899
|
+
*
|
|
2900
|
+
* @realm menu
|
|
2901
|
+
* @source https://wiki.facepunch.com/gmod/Global.UpdateGames
|
|
2902
|
+
*/
|
|
2903
|
+
declare function UpdateGames(): void;
|
|
2904
|
+
|
|
2905
|
+
/**
|
|
2906
|
+
* **INTERNAL**: This is used internally - although you're able to use it you probably shouldn't.
|
|
2907
|
+
*
|
|
2908
|
+
* This function searches for all available languages and passes them to JS(JavaScript). JS then updates the Language list with the given languages.
|
|
2909
|
+
*
|
|
2910
|
+
* @realm menu
|
|
2911
|
+
* @source https://wiki.facepunch.com/gmod/Global.UpdateLanguages
|
|
2912
|
+
*/
|
|
2913
|
+
declare function UpdateLanguages(): void;
|
|
2914
|
+
|
|
2915
|
+
/**
|
|
2916
|
+
* Runs JavaScript on the loading screen panel ([Global.GetLoadPanel](https://wiki.facepunch.com/gmod/Global.GetLoadPanel)).
|
|
2917
|
+
* @realm menu
|
|
2918
|
+
* @source https://wiki.facepunch.com/gmod/Global.UpdateLoadPanel
|
|
2919
|
+
*/
|
|
2920
|
+
declare function UpdateLoadPanel(javascript: string): void;
|
|
2921
|
+
|
|
2922
|
+
/**
|
|
2923
|
+
* **INTERNAL**: Called from JS when starting a new game
|
|
2924
|
+
*
|
|
2925
|
+
* This function updates the Map List
|
|
2926
|
+
*
|
|
2927
|
+
* @realm menu
|
|
2928
|
+
* @source https://wiki.facepunch.com/gmod/Global.UpdateMapList
|
|
2929
|
+
*/
|
|
2930
|
+
declare function UpdateMapList(): void;
|
|
2931
|
+
|
|
2932
|
+
/**
|
|
2933
|
+
* **INTERNAL**: Called from JS when starting a new game
|
|
2934
|
+
*
|
|
2935
|
+
* Updates the Server Settings when called.
|
|
2936
|
+
*
|
|
2937
|
+
* @realm menu
|
|
2938
|
+
* @source https://wiki.facepunch.com/gmod/Global.UpdateServerSettings
|
|
2939
|
+
*/
|
|
2940
|
+
declare function UpdateServerSettings(): void;
|
|
2941
|
+
|
|
2942
|
+
/**
|
|
2943
|
+
* **INTERNAL**: This is used internally - although you're able to use it you probably shouldn't.
|
|
2944
|
+
*
|
|
2945
|
+
* Updates the Addons list.
|
|
2946
|
+
*
|
|
2947
|
+
* @realm menu
|
|
2948
|
+
* @source https://wiki.facepunch.com/gmod/Global.UpdateSubscribedAddons
|
|
2949
|
+
*/
|
|
2950
|
+
declare function UpdateSubscribedAddons(): void;
|
|
2951
|
+
|
|
2952
|
+
/**
|
|
2953
|
+
* Identical to [Global.SysTime](https://wiki.facepunch.com/gmod/Global.SysTime). On Windows, will be the previous value of [Global.SysTime](https://wiki.facepunch.com/gmod/Global.SysTime).
|
|
2954
|
+
* @realm shared and menu
|
|
2955
|
+
* @source https://wiki.facepunch.com/gmod/Global.VGUIFrameTime
|
|
2956
|
+
* @deprecated Use the function Global.SysTime instead.
|
|
2957
|
+
*/
|
|
2958
|
+
declare function VGUIFrameTime(): void;
|
|
2959
|
+
|
|
2960
|
+
/**
|
|
2961
|
+
* Creates and returns a [DShape](https://wiki.facepunch.com/gmod/DShape) rectangle GUI element with the given dimensions.
|
|
2962
|
+
* @realm client
|
|
2963
|
+
* @source https://wiki.facepunch.com/gmod/Global.VGUIRect
|
|
2964
|
+
*/
|
|
2965
|
+
declare function VGUIRect(x: number, y: number, w: number, h: number): Panel;
|
|
2966
|
+
|
|
2967
|
+
/**
|
|
2968
|
+
* Returns if a panel is safe to use.
|
|
2969
|
+
*
|
|
2970
|
+
* @realm client and menu
|
|
2971
|
+
* @source https://wiki.facepunch.com/gmod/Global.ValidPanel
|
|
2972
|
+
* @deprecated You should use Global.IsValid instead
|
|
2973
|
+
*/
|
|
2974
|
+
declare function ValidPanel(panel: Panel): void;
|
|
2975
|
+
|
|
2976
|
+
/**
|
|
2977
|
+
* Creates a [Vector](https://wiki.facepunch.com/gmod/Vector) object.
|
|
2978
|
+
* **WARNING**: Creating Vectors is relatively expensive when used in often running hooks or in operations requiring very frequent calls (like loops for example) due to object creation and garbage collection. It is better to store the vector in a variable or to use the [default vectors](https://wiki.facepunch.com/gmod/Global_Variables#misc) available. See [Vector:Add](https://wiki.facepunch.com/gmod/Vector:Add).
|
|
2979
|
+
*
|
|
2980
|
+
*
|
|
2981
|
+
* @realm shared and menu
|
|
2982
|
+
* @source https://wiki.facepunch.com/gmod/Global.Vector
|
|
2983
|
+
*/
|
|
2984
|
+
declare function Vector(x?: number, y?: number, z?: number): Vector;
|
|
2985
|
+
|
|
2986
|
+
declare function Vector(vector: Vector): Vector;
|
|
2987
|
+
|
|
2988
|
+
declare function Vector(vectorString: string): Vector;
|
|
2989
|
+
|
|
2990
|
+
/**
|
|
2991
|
+
* Returns a random vector whose components are each between min(inclusive), max(exclusive).
|
|
2992
|
+
* @realm shared and menu
|
|
2993
|
+
* @source https://wiki.facepunch.com/gmod/Global.VectorRand
|
|
2994
|
+
*/
|
|
2995
|
+
declare function VectorRand(min?: number, max?: number): Vector;
|
|
2996
|
+
|
|
2997
|
+
/**
|
|
2998
|
+
* **INTERNAL**: Used by the **vgui_visualizelayout** convar
|
|
2999
|
+
*
|
|
3000
|
+
* Briefly displays layout details of the given panel on-screen
|
|
3001
|
+
* @realm client and menu
|
|
3002
|
+
* @source https://wiki.facepunch.com/gmod/Global.VisualizeLayout
|
|
3003
|
+
*/
|
|
3004
|
+
declare function VisualizeLayout(panel: Panel): void;
|
|
3005
|
+
|
|
3006
|
+
/**
|
|
3007
|
+
* **INTERNAL**: This is used internally - although you're able to use it you probably shouldn't.
|
|
3008
|
+
* Returns a new WorkshopFileBase element
|
|
3009
|
+
* @realm client and menu
|
|
3010
|
+
* @source https://wiki.facepunch.com/gmod/Global.WorkshopFileBase
|
|
3011
|
+
*/
|
|
3012
|
+
declare function WorkshopFileBase(namespace: string, requiredTags: table): table;
|
|
3013
|
+
|
|
3014
|
+
/**
|
|
3015
|
+
* Translates a worldspace vector and angle into a specific coordinate system.
|
|
3016
|
+
* @realm shared
|
|
3017
|
+
* @source https://wiki.facepunch.com/gmod/Global.WorldToLocal
|
|
3018
|
+
*/
|
|
3019
|
+
declare function WorldToLocal(position: Vector, angle: Angle, newSystemOrigin: Vector, newSystemAngles: Angle): (Vector, Angle);
|
|
3020
|
+
|
|
3021
|
+
/**
|
|
3022
|
+
* Throws a Lua error and breaks out of the current call stack.
|
|
3023
|
+
*
|
|
3024
|
+
*
|
|
3025
|
+
* @realm shared and menu
|
|
3026
|
+
* @source https://wiki.facepunch.com/gmod/Global.error(lowercase)
|
|
3027
|
+
*/
|
|
3028
|
+
declare function error(message: string, errorLevel?: number): void;
|
|
3029
|
+
|
|
3030
|
+
/**
|
|
3031
|
+
* Returns the current floored dynamic memory usage of Lua in kilobytes.
|
|
3032
|
+
* @realm shared and menu
|
|
3033
|
+
* @source https://wiki.facepunch.com/gmod/Global.gcinfo
|
|
3034
|
+
* @deprecated This function was deprecated in Lua 5.1 and is removed in Lua 5.2. Use Global.collectgarbage( "count" ) instead.
|
|
3035
|
+
*/
|
|
3036
|
+
declare function gcinfo(): number;
|
|
3037
|
+
|
|
3038
|
+
/**
|
|
3039
|
+
* Executes a Lua script.
|
|
3040
|
+
*
|
|
3041
|
+
* This function will try to load local client file if `sv_allowcslua` is **1**.
|
|
3042
|
+
*
|
|
3043
|
+
* **WARNING**: The file you are attempting to include **MUST NOT** be empty or the include will fail. Files over a certain size (64KB compressed) may fail clientside as well.
|
|
3044
|
+
*
|
|
3045
|
+
* If the file you are including is clientside or shared, it **must** be [Global.AddCSLuaFile](https://wiki.facepunch.com/gmod/Global.AddCSLuaFile)'d or this function will error saying the file doesn't exist.
|
|
3046
|
+
*
|
|
3047
|
+
*
|
|
3048
|
+
* @realm shared and menu
|
|
3049
|
+
* @source https://wiki.facepunch.com/gmod/Global.include
|
|
3050
|
+
*/
|
|
3051
|
+
declare function include(fileName: string): (...any);
|
|
3052
|
+
|
|
3053
|
+
/**
|
|
3054
|
+
* Returns whether the given value is an Angle.
|
|
3055
|
+
* @realm shared
|
|
3056
|
+
* @realm menu
|
|
3057
|
+
* @source https://wiki.facepunch.com/gmod/Global.isangle
|
|
3058
|
+
*/
|
|
3059
|
+
declare function isangle(value: any): value is Angle;
|
|
3060
|
+
|
|
3061
|
+
|
|
3062
|
+
/**
|
|
3063
|
+
* Returns whether the given value is a boolean.
|
|
3064
|
+
* @realm shared
|
|
3065
|
+
* @realm menu
|
|
3066
|
+
* @source https://wiki.facepunch.com/gmod/Global.isbool
|
|
3067
|
+
*/
|
|
3068
|
+
declare function isbool(value: any): value is boolean;
|
|
3069
|
+
|
|
3070
|
+
|
|
3071
|
+
/**
|
|
3072
|
+
* Returns whether the given value is a function.
|
|
3073
|
+
* @realm shared
|
|
3074
|
+
* @realm menu
|
|
3075
|
+
* @source https://wiki.facepunch.com/gmod/Global.isfunction
|
|
3076
|
+
*/
|
|
3077
|
+
declare function isfunction(value: any): value is function;
|
|
3078
|
+
|
|
3079
|
+
|
|
3080
|
+
/**
|
|
3081
|
+
* Returns whether the given value is a VMatrix.
|
|
3082
|
+
* @realm shared
|
|
3083
|
+
* @realm menu
|
|
3084
|
+
* @source https://wiki.facepunch.com/gmod/Global.ismatrix
|
|
3085
|
+
*/
|
|
3086
|
+
declare function ismatrix(value: any): value is VMatrix;
|
|
3087
|
+
|
|
3088
|
+
|
|
3089
|
+
/**
|
|
3090
|
+
* Returns whether the given value is a number.
|
|
3091
|
+
* @realm shared
|
|
3092
|
+
* @realm menu
|
|
3093
|
+
* @source https://wiki.facepunch.com/gmod/Global.isnumber
|
|
3094
|
+
*/
|
|
3095
|
+
declare function isnumber(value: any): value is number;
|
|
3096
|
+
|
|
3097
|
+
|
|
3098
|
+
/**
|
|
3099
|
+
* Returns whether the given value is a Panel.
|
|
3100
|
+
* @realm shared
|
|
3101
|
+
* @realm menu
|
|
3102
|
+
* @source https://wiki.facepunch.com/gmod/Global.ispanel
|
|
3103
|
+
*/
|
|
3104
|
+
declare function ispanel(value: any): value is Panel;
|
|
3105
|
+
|
|
3106
|
+
|
|
3107
|
+
/**
|
|
3108
|
+
* Returns whether the given value is a string.
|
|
3109
|
+
* @realm shared
|
|
3110
|
+
* @realm menu
|
|
3111
|
+
* @source https://wiki.facepunch.com/gmod/Global.isstring
|
|
3112
|
+
*/
|
|
3113
|
+
declare function isstring(value: any): value is string;
|
|
3114
|
+
|
|
3115
|
+
|
|
3116
|
+
/**
|
|
3117
|
+
* Returns whether the given value is a table.
|
|
3118
|
+
* @realm shared
|
|
3119
|
+
* @realm menu
|
|
3120
|
+
* @source https://wiki.facepunch.com/gmod/Global.istable
|
|
3121
|
+
*/
|
|
3122
|
+
declare function istable(value: any): value is table;
|
|
3123
|
+
|
|
3124
|
+
|
|
3125
|
+
/**
|
|
3126
|
+
* Returns whether the given value is a Vector.
|
|
3127
|
+
* @realm shared
|
|
3128
|
+
* @realm menu
|
|
3129
|
+
* @source https://wiki.facepunch.com/gmod/Global.isvector
|
|
3130
|
+
*/
|
|
3131
|
+
declare function isvector(value: any): value is Vector;
|
|
3132
|
+
|
|
3133
|
+
|
|
3134
|
+
/**
|
|
3135
|
+
* First tries to load a binary module with the given name, if unsuccessful, it tries to load a Lua module with the given name.
|
|
3136
|
+
*
|
|
3137
|
+
* Running this function with [Global.pcall](https://wiki.facepunch.com/gmod/Global.pcall) or [Global.xpcall](https://wiki.facepunch.com/gmod/Global.xpcall) will still print an error that counts towards sv_kickerrornum.
|
|
3138
|
+
* **NOTE**: This function will try to load local client file if `sv_allowcslua` is set to `1`
|
|
3139
|
+
*
|
|
3140
|
+
* **NOTE**: Binary modules can't be installed as part of an addon and have to be put directly into ``garrysmod/lua/bin/`` to be detected.
|
|
3141
|
+
* This is a safety measure, because modules can be malicious and harm the system.
|
|
3142
|
+
*
|
|
3143
|
+
*
|
|
3144
|
+
*
|
|
3145
|
+
* @realm shared and menu
|
|
3146
|
+
* @source https://wiki.facepunch.com/gmod/Global.require
|
|
3147
|
+
*/
|
|
3148
|
+
declare function require(name: string): void;
|
|
3149
|
+
|
|
3150
|
+
/**
|
|
3151
|
+
* Attempts to return an appropriate boolean for the given value
|
|
3152
|
+
* @realm shared and menu
|
|
3153
|
+
* @source https://wiki.facepunch.com/gmod/Global.tobool
|
|
3154
|
+
*/
|
|
3155
|
+
declare function tobool(input: any): boolean;
|
|
3156
|
+
|