@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/util.d.tlua
ADDED
|
@@ -0,0 +1,1087 @@
|
|
|
1
|
+
// AUTO-GENERATED tlua declarations. Do not edit by hand.
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* This is the list of utility functions.
|
|
5
|
+
* @source https://wiki.facepunch.com/gmod/util
|
|
6
|
+
*/
|
|
7
|
+
declare util: UtilLib;
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* `util.worldpicker` is for picking an entity in the world while [GUI](https://wiki.facepunch.com/gmod/gui) is open.
|
|
11
|
+
* @source https://wiki.facepunch.com/gmod/util.worldpicker
|
|
12
|
+
*/
|
|
13
|
+
interface UtilLib {
|
|
14
|
+
worldpicker: UtilworldpickerLib;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
interface UtilLib {
|
|
18
|
+
/**
|
|
19
|
+
* Adds the specified string to a string table, which will cache it and network it to all clients automatically.
|
|
20
|
+
* Whenever you want to create a net message with [net.Start](https://wiki.facepunch.com/gmod/net.Start), you must add the name of that message as a networked string via this function.
|
|
21
|
+
*
|
|
22
|
+
* If the passed string already exists, nothing will happen and the ID of the existing item will be returned.
|
|
23
|
+
*
|
|
24
|
+
* **NOTE**: Each unique network name needs to be pooled once - do not put this function call into any other functions if you're using a constant string. Preferable place for this function is in a serverside lua file, or in a shared file with the [net.Receive](https://wiki.facepunch.com/gmod/net.Receive) function.
|
|
25
|
+
*
|
|
26
|
+
* The string table used for this function does not interfere with the engine string tables and has 4095 slots.
|
|
27
|
+
* This limit is shared among all entities, SetNW* and SetGlobal* functions. If you exceed the limit, you cannot create new variables, and you will get the following warning:
|
|
28
|
+
* ```lua
|
|
29
|
+
* Warning: Table networkstring is full, can't add [key]
|
|
30
|
+
* ```
|
|
31
|
+
* **WARNING**: Existing variables will still get updated without the warning. You can check the limit by counting up until [util.NetworkIDToString](https://wiki.facepunch.com/gmod/util.NetworkIDToString) returns nil
|
|
32
|
+
*
|
|
33
|
+
*
|
|
34
|
+
* @realm server
|
|
35
|
+
* @source https://wiki.facepunch.com/gmod/util.AddNetworkString
|
|
36
|
+
*/
|
|
37
|
+
AddNetworkString(str: string): number;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
interface UtilLib {
|
|
41
|
+
/**
|
|
42
|
+
* Function used to calculate aim vector from 2D screen position. It is used in SuperDOF calculate Distance.
|
|
43
|
+
*
|
|
44
|
+
* Essentially a generic version of [gui.ScreenToVector](https://wiki.facepunch.com/gmod/gui.ScreenToVector).
|
|
45
|
+
*
|
|
46
|
+
* @realm shared and menu
|
|
47
|
+
* @source https://wiki.facepunch.com/gmod/util.AimVector
|
|
48
|
+
*/
|
|
49
|
+
AimVector(ViewAngles: Angle, ViewFOV: number, x: number, y: number, scrWidth: number, scrHeight: number): Vector;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
interface UtilLib {
|
|
53
|
+
/**
|
|
54
|
+
* Decodes the specified string from base64.
|
|
55
|
+
* @realm shared and menu
|
|
56
|
+
* @source https://wiki.facepunch.com/gmod/util.Base64Decode
|
|
57
|
+
*/
|
|
58
|
+
Base64Decode(str: string): string;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
interface UtilLib {
|
|
62
|
+
/**
|
|
63
|
+
* Encodes the specified string to base64.
|
|
64
|
+
*
|
|
65
|
+
* **NOTE**: Unless disabled with the `inline` argument, the Base64 returned is compliant to the RFC 2045 standard. **This means it will have a line break after every 76th character.**
|
|
66
|
+
*
|
|
67
|
+
*
|
|
68
|
+
* @realm shared and menu
|
|
69
|
+
* @source https://wiki.facepunch.com/gmod/util.Base64Encode
|
|
70
|
+
*/
|
|
71
|
+
Base64Encode(str: string, inline?: boolean): string;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
interface UtilLib {
|
|
75
|
+
/**
|
|
76
|
+
* Applies explosion damage to all entities in the specified radius. Performs block checking.
|
|
77
|
+
* @realm server
|
|
78
|
+
* @source https://wiki.facepunch.com/gmod/util.BlastDamage
|
|
79
|
+
*/
|
|
80
|
+
BlastDamage(inflictor: Entity, attacker: Entity, damageOrigin: Vector, damageRadius: number, damage: number): void;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
interface UtilLib {
|
|
84
|
+
/**
|
|
85
|
+
* Applies spherical damage based on damage info to all entities in the specified radius.
|
|
86
|
+
* @realm server
|
|
87
|
+
* @source https://wiki.facepunch.com/gmod/util.BlastDamageInfo
|
|
88
|
+
*/
|
|
89
|
+
BlastDamageInfo(dmg: CTakeDamageInfo, damageOrigin: Vector, damageRadius: number): void;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
interface UtilLib {
|
|
93
|
+
/**
|
|
94
|
+
* Generates the [CRC Checksum](https://en.wikipedia.org/wiki/Cyclic_redundancy_check) of the specified string.
|
|
95
|
+
*
|
|
96
|
+
* **WARNING**: This is NOT a hashing function. It is a checksum, typically used for error detection/data corruption detection. It is possible for this function to generate "collisions", where two different strings will produce the same CRC. If you need a hashing function, use [util.SHA256](https://wiki.facepunch.com/gmod/util.SHA256).
|
|
97
|
+
*
|
|
98
|
+
*
|
|
99
|
+
* @realm shared
|
|
100
|
+
* @source https://wiki.facepunch.com/gmod/util.CRC
|
|
101
|
+
*/
|
|
102
|
+
CRC(stringToChecksum: string): string;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
interface UtilLib {
|
|
106
|
+
/**
|
|
107
|
+
* Compresses the given string using the [LZMA](https://en.wikipedia.org/wiki/LZMA) algorithm.
|
|
108
|
+
*
|
|
109
|
+
* Use with [net.WriteData](https://wiki.facepunch.com/gmod/net.WriteData) and [net.ReadData](https://wiki.facepunch.com/gmod/net.ReadData) for networking and [util.Decompress](https://wiki.facepunch.com/gmod/util.Decompress) to decompress the data.
|
|
110
|
+
*
|
|
111
|
+
* **NOTE**: The output of this function will have the uncompressed size of the data prepended to it as an 8-byte little-endian integer. [Source](https://github.com/garrynewman/bootil/blob/beb4cec8ad29533965491b767b177dc549e62d23/src/Bootil/Utility/CompressionLZMA.cpp#L56-L63)
|
|
112
|
+
*
|
|
113
|
+
* You may therefore experience issues using the output of this function **_outside of Garry's Mod_**. If you need to do this, you will need to manually strip the first 8 bytes from the compressed output, or use third-party tools such as [gmod-lzma](https://github.com/WilliamVenner/gmod-lzma-rs) to decompress the output instead.
|
|
114
|
+
*
|
|
115
|
+
*
|
|
116
|
+
* @realm shared and menu
|
|
117
|
+
* @source https://wiki.facepunch.com/gmod/util.Compress
|
|
118
|
+
*/
|
|
119
|
+
Compress(str: string): string;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
interface UtilLib {
|
|
123
|
+
/**
|
|
124
|
+
* Returns the current date formatted like '2012-10-31 18-00-00'
|
|
125
|
+
* @realm shared and menu
|
|
126
|
+
* @source https://wiki.facepunch.com/gmod/util.DateStamp
|
|
127
|
+
*/
|
|
128
|
+
DateStamp(): string;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
interface UtilLib {
|
|
132
|
+
/**
|
|
133
|
+
* Performs a trace and paints a decal to the surface hit.
|
|
134
|
+
* @realm shared
|
|
135
|
+
* @source https://wiki.facepunch.com/gmod/util.Decal
|
|
136
|
+
*/
|
|
137
|
+
Decal(name: string, start: Vector, _end: Vector, filter?: Entity | Entity[]): void;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
interface UtilLib {
|
|
141
|
+
/**
|
|
142
|
+
* Performs a trace and paints a decal to the surface hit.
|
|
143
|
+
*
|
|
144
|
+
* **NOTE**: This function has trouble spanning across multiple brushes on the map.
|
|
145
|
+
*
|
|
146
|
+
*
|
|
147
|
+
* @realm client
|
|
148
|
+
* @source https://wiki.facepunch.com/gmod/util.DecalEx
|
|
149
|
+
*/
|
|
150
|
+
DecalEx(material: IMaterial, ent: Entity, position: Vector, normal: Vector, color: Color, w: number, h: number): void;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
interface UtilLib {
|
|
154
|
+
/**
|
|
155
|
+
* Gets the full material path by the decal name. Used with [util.DecalEx](https://wiki.facepunch.com/gmod/util.DecalEx).
|
|
156
|
+
*
|
|
157
|
+
* If decal specifies multiple materials, a random one will be chosen.
|
|
158
|
+
* @realm shared
|
|
159
|
+
* @source https://wiki.facepunch.com/gmod/util.DecalMaterial
|
|
160
|
+
*/
|
|
161
|
+
DecalMaterial(decalName: string): string;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
interface UtilLib {
|
|
165
|
+
/**
|
|
166
|
+
* Decompresses the given string using [LZMA](https://en.wikipedia.org/wiki/LZMA) algorithm. Used to decompress strings previously compressed with [util.Compress](https://wiki.facepunch.com/gmod/util.Compress).
|
|
167
|
+
*
|
|
168
|
+
* **WARNING**: When reading user data, always try to specify `maxSize` argument, otherwise the server can be [decompression bombed](https://en.wikipedia.org/wiki/Zip_bomb) with bad data that will fill up all Lua memory
|
|
169
|
+
*
|
|
170
|
+
* **NOTE**: This function expects the compressed input data to have the uncompressed size of the data prepended to it as an 8-byte little-endian integer. [Source](https://github.com/garrynewman/bootil/blob/beb4cec8ad29533965491b767b177dc549e62d23/src/Bootil/Utility/CompressionLZMA.cpp#L101)
|
|
171
|
+
*
|
|
172
|
+
* If your compressed input data was compressed by [util.Compress](https://wiki.facepunch.com/gmod/util.Compress), you don't need to worry about this - the uncompressed size of the data is already prepended to its output.
|
|
173
|
+
*
|
|
174
|
+
* However, if your compressed data was produced using standard tools **_outside of Garry's Mod_**, you will need to manually prepend the length of the uncompressed data to its compressed form as an 8-byte little endian integer.
|
|
175
|
+
*
|
|
176
|
+
*
|
|
177
|
+
* @realm shared and menu
|
|
178
|
+
* @source https://wiki.facepunch.com/gmod/util.Decompress
|
|
179
|
+
*/
|
|
180
|
+
Decompress(compressedString: string, maxSize?: number): string | nil;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
interface UtilLib {
|
|
184
|
+
/**
|
|
185
|
+
* Gets the distance between a line and a point in 3d space.
|
|
186
|
+
* @realm shared
|
|
187
|
+
* @source https://wiki.facepunch.com/gmod/util.DistanceToLine
|
|
188
|
+
*/
|
|
189
|
+
DistanceToLine(lineStart: Vector, lineEnd: Vector, pointPos: Vector): (number, Vector, number);
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
interface UtilLib {
|
|
193
|
+
/**
|
|
194
|
+
* Creates an effect with the specified data.
|
|
195
|
+
*
|
|
196
|
+
* For Orange Box `.pcf` particles, see [Global.ParticleEffect](https://wiki.facepunch.com/gmod/Global.ParticleEffect), [Global.ParticleEffectAttach](https://wiki.facepunch.com/gmod/Global.ParticleEffectAttach) and [Global.CreateParticleSystem](https://wiki.facepunch.com/gmod/Global.CreateParticleSystem).
|
|
197
|
+
*
|
|
198
|
+
* **NOTE**: When dispatching an effect from the server, some values may be clamped for networking optimizations. Visit the Set accessors on [CEffectData](https://wiki.facepunch.com/gmod/CEffectData) to see which ones are affected.
|
|
199
|
+
*
|
|
200
|
+
* You will need to couple this function with [Global.IsFirstTimePredicted](https://wiki.facepunch.com/gmod/Global.IsFirstTimePredicted) if you want to use it in a [predicted hook](https://wiki.facepunch.com/gmod/Prediction).
|
|
201
|
+
*
|
|
202
|
+
*
|
|
203
|
+
* @realm shared
|
|
204
|
+
* @source https://wiki.facepunch.com/gmod/util.Effect
|
|
205
|
+
*/
|
|
206
|
+
Effect(effectName: string, effectData: CEffectData, allowOverride?: boolean, ignorePredictionOrRecipientFilter?: boolean | CRecipientFilter): void;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
interface UtilLib {
|
|
210
|
+
/**
|
|
211
|
+
* Filters given text using Steam's filtering system. The function will obey local client's Steam settings for chat filtering:
|
|
212
|
+
*
|
|
213
|
+
*
|
|
214
|
+
*
|
|
215
|
+
* **NOTE**: In some cases, especially in a chatbox, messages from some players may return an empty string if the context argument used for filtering is `TEXT_FILTER_CHAT` and [if the local player has blocked the sender of the message on Steam](https://github.com/Facepunch/garrysmod-issues/issues/5161#issuecomment-1035153941).
|
|
216
|
+
*
|
|
217
|
+
*
|
|
218
|
+
* @realm client
|
|
219
|
+
* @source https://wiki.facepunch.com/gmod/util.FilterText
|
|
220
|
+
*/
|
|
221
|
+
FilterText(str: string, context?: number, player?: Player): string;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
interface UtilLib {
|
|
225
|
+
/**
|
|
226
|
+
* Converts the full path of the given file to a relative path.
|
|
227
|
+
* You can use [util.RelativePathToFull_Menu](https://wiki.facepunch.com/gmod/util.RelativePathToFull_Menu) to convert the relative path back to the full path.
|
|
228
|
+
*
|
|
229
|
+
* @realm menu
|
|
230
|
+
* @source https://wiki.facepunch.com/gmod/util.FullPathToRelative_Menu
|
|
231
|
+
*/
|
|
232
|
+
FullPathToRelative_Menu(fullPath: string, fsPath?: string): string;
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
interface UtilLib {
|
|
236
|
+
/**
|
|
237
|
+
* Returns the ID of a custom model activity. This is useful for models that define custom ones.
|
|
238
|
+
*
|
|
239
|
+
* See [util.GetActivityNameByID](https://wiki.facepunch.com/gmod/util.GetActivityNameByID) for a function that does the opposite.
|
|
240
|
+
*
|
|
241
|
+
* @realm shared
|
|
242
|
+
* @source https://wiki.facepunch.com/gmod/util.GetActivityIDByName
|
|
243
|
+
*/
|
|
244
|
+
GetActivityIDByName(arg0: string): number;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
interface UtilLib {
|
|
248
|
+
/**
|
|
249
|
+
* Returns a name for given activity ID. This is useful for models that define custom activities.
|
|
250
|
+
*
|
|
251
|
+
* See [util.GetActivityIDByName](https://wiki.facepunch.com/gmod/util.GetActivityIDByName) for a function that does the opposite.
|
|
252
|
+
*
|
|
253
|
+
* @realm shared
|
|
254
|
+
* @source https://wiki.facepunch.com/gmod/util.GetActivityNameByID
|
|
255
|
+
*/
|
|
256
|
+
GetActivityNameByID(id: number): string;
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
interface UtilLib {
|
|
260
|
+
/**
|
|
261
|
+
* Returns the ID of a custom model animation event. This is useful for models that define custom animation events.
|
|
262
|
+
*
|
|
263
|
+
* See [util.GetAnimEventNameByID](https://wiki.facepunch.com/gmod/util.GetAnimEventNameByID) for a function that does the opposite.
|
|
264
|
+
*
|
|
265
|
+
* @realm shared
|
|
266
|
+
* @source https://wiki.facepunch.com/gmod/util.GetAnimEventIDByName
|
|
267
|
+
*/
|
|
268
|
+
GetAnimEventIDByName(arg0: string): number;
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
interface UtilLib {
|
|
272
|
+
/**
|
|
273
|
+
* Returns a name for given automatically generated numerical animation event ID. This is useful for models that define custom animation events.
|
|
274
|
+
*
|
|
275
|
+
* See [util.GetAnimEventIDByName](https://wiki.facepunch.com/gmod/util.GetAnimEventIDByName) for a function that does the opposite.
|
|
276
|
+
*
|
|
277
|
+
* @realm shared
|
|
278
|
+
* @source https://wiki.facepunch.com/gmod/util.GetAnimEventNameByID
|
|
279
|
+
*/
|
|
280
|
+
GetAnimEventNameByID(id: number): string;
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
interface UtilLib {
|
|
284
|
+
/**
|
|
285
|
+
* Returns a table containing the info about the model. The model will be loaded and cached if it was not previously.
|
|
286
|
+
*
|
|
287
|
+
* See also [util.GetModelMeshes](https://wiki.facepunch.com/gmod/util.GetModelMeshes)
|
|
288
|
+
*
|
|
289
|
+
* **NOTE**: This function will silently fail if used on models with following strings in them:
|
|
290
|
+
* * _shared
|
|
291
|
+
* * _anims
|
|
292
|
+
* * _gestures
|
|
293
|
+
* * _anim
|
|
294
|
+
* * _postures
|
|
295
|
+
* * _gst
|
|
296
|
+
* * _pst
|
|
297
|
+
* * _shd
|
|
298
|
+
* * _ss
|
|
299
|
+
* * _anm
|
|
300
|
+
* * _include
|
|
301
|
+
*
|
|
302
|
+
*
|
|
303
|
+
* @realm shared
|
|
304
|
+
* @source https://wiki.facepunch.com/gmod/util.GetModelInfo
|
|
305
|
+
*/
|
|
306
|
+
GetModelInfo(mdl: string): ModelInfo;
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
interface UtilLib {
|
|
310
|
+
/**
|
|
311
|
+
* Retrieves vertex, triangle, and bone data for the visual meshes of a given model.
|
|
312
|
+
*
|
|
313
|
+
* **NOTE**: This does not work on brush models (Models with names in the format `*number`)
|
|
314
|
+
*
|
|
315
|
+
*
|
|
316
|
+
* @realm shared
|
|
317
|
+
* @source https://wiki.facepunch.com/gmod/util.GetModelMeshes
|
|
318
|
+
*/
|
|
319
|
+
GetModelMeshes(model: string, lod?: number, bodygroupMask?: string | number, skin?: number): (ModelMeshData[], BoneBindPose[]);
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
interface UtilLib {
|
|
323
|
+
/**
|
|
324
|
+
* Gets persistent data of an offline player using their SteamID.
|
|
325
|
+
*
|
|
326
|
+
* See also [Player:GetPData](https://wiki.facepunch.com/gmod/Player:GetPData) for a more convenient version of this function for online players, [util.RemovePData](https://wiki.facepunch.com/gmod/util.RemovePData) and
|
|
327
|
+
* [util.SetPData](https://wiki.facepunch.com/gmod/util.SetPData) for the other accompanying functions.
|
|
328
|
+
*
|
|
329
|
+
* **NOTE**: This function internally uses [util.SteamIDTo64](https://wiki.facepunch.com/gmod/util.SteamIDTo64), it previously utilized [Player:UniqueID](https://wiki.facepunch.com/gmod/Player:UniqueID) which can cause collisions (two or more players sharing the same PData entry). This function now only uses the old method as a fallback if the name isn't found.
|
|
330
|
+
*
|
|
331
|
+
* @realm shared and menu
|
|
332
|
+
* @source https://wiki.facepunch.com/gmod/util.GetPData
|
|
333
|
+
*/
|
|
334
|
+
GetPData(steamID: string, name: string, _default: any): string;
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
interface UtilLib {
|
|
338
|
+
/**
|
|
339
|
+
* Creates a new PixVis handle. See [util.PixelVisible](https://wiki.facepunch.com/gmod/util.PixelVisible).
|
|
340
|
+
* @realm client
|
|
341
|
+
* @source https://wiki.facepunch.com/gmod/util.GetPixelVisibleHandle
|
|
342
|
+
*/
|
|
343
|
+
GetPixelVisibleHandle(): pixelvis_handle_t;
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
interface UtilLib {
|
|
347
|
+
/**
|
|
348
|
+
* Utility function to quickly generate a trace table that starts at the players view position, and ends `32768` units along a specified direction.
|
|
349
|
+
*
|
|
350
|
+
* For usage with [util.TraceLine](https://wiki.facepunch.com/gmod/util.TraceLine) and similar functions.
|
|
351
|
+
* @realm shared and menu
|
|
352
|
+
* @source https://wiki.facepunch.com/gmod/util.GetPlayerTrace
|
|
353
|
+
*/
|
|
354
|
+
GetPlayerTrace(ply: Player, dir?: Vector): Trace;
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
interface UtilLib {
|
|
358
|
+
/**
|
|
359
|
+
* Gets information about the sun position and obstruction or nil if there is no sun.
|
|
360
|
+
* @realm client
|
|
361
|
+
* @source https://wiki.facepunch.com/gmod/util.GetSunInfo
|
|
362
|
+
*/
|
|
363
|
+
GetSunInfo(): table;
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
interface UtilLib {
|
|
367
|
+
/**
|
|
368
|
+
* Returns data of a [surface property](https://developer.valvesoftware.com/wiki/Material_surface_properties) at given ID. New surface properties can be added via [physenv.AddSurfaceData](https://wiki.facepunch.com/gmod/physenv.AddSurfaceData).
|
|
369
|
+
* @realm shared
|
|
370
|
+
* @source https://wiki.facepunch.com/gmod/util.GetSurfaceData
|
|
371
|
+
*/
|
|
372
|
+
GetSurfaceData(id: number): SurfacePropertyData;
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
interface UtilLib {
|
|
376
|
+
/**
|
|
377
|
+
* Returns the matching surface property index for the given surface property name.
|
|
378
|
+
*
|
|
379
|
+
* See also [util.GetSurfaceData](https://wiki.facepunch.com/gmod/util.GetSurfaceData) and [util.GetSurfacePropName](https://wiki.facepunch.com/gmod/util.GetSurfacePropName) for opposite function.
|
|
380
|
+
*
|
|
381
|
+
* @realm shared
|
|
382
|
+
* @source https://wiki.facepunch.com/gmod/util.GetSurfaceIndex
|
|
383
|
+
*/
|
|
384
|
+
GetSurfaceIndex(surfaceName: string): number;
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
interface UtilLib {
|
|
388
|
+
/**
|
|
389
|
+
* Returns the name of a surface property at given ID.
|
|
390
|
+
*
|
|
391
|
+
* See also [util.GetSurfaceData](https://wiki.facepunch.com/gmod/util.GetSurfaceData) and [util.GetSurfaceIndex](https://wiki.facepunch.com/gmod/util.GetSurfaceIndex) for opposite function.
|
|
392
|
+
*
|
|
393
|
+
* @realm shared
|
|
394
|
+
* @source https://wiki.facepunch.com/gmod/util.GetSurfacePropName
|
|
395
|
+
*/
|
|
396
|
+
GetSurfacePropName(id: number): string;
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
interface UtilLib {
|
|
400
|
+
/**
|
|
401
|
+
* Returns a table of all SteamIDs that have a usergroup.
|
|
402
|
+
*
|
|
403
|
+
* **NOTE**: This returns the original usergroups table, changes done to this table are not retroactive and will only affect newly connected users
|
|
404
|
+
*
|
|
405
|
+
*
|
|
406
|
+
* **NOTE**: This returns only groups that are registered in the **settings/users.txt** file of your server.
|
|
407
|
+
*
|
|
408
|
+
* In order to get the usergroup of a connected player, please use [Player:GetUserGroup](https://wiki.facepunch.com/gmod/Player:GetUserGroup) instead.
|
|
409
|
+
*
|
|
410
|
+
*
|
|
411
|
+
* @realm server
|
|
412
|
+
* @source https://wiki.facepunch.com/gmod/util.GetUserGroups
|
|
413
|
+
*/
|
|
414
|
+
GetUserGroups(): table;
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
interface UtilLib {
|
|
418
|
+
/**
|
|
419
|
+
* Performs a Ray-OBB (Orientated Bounding Box) intersection and returns position, normal and the fraction if there was an intersection.
|
|
420
|
+
* @realm shared
|
|
421
|
+
* @source https://wiki.facepunch.com/gmod/util.IntersectRayWithOBB
|
|
422
|
+
*/
|
|
423
|
+
IntersectRayWithOBB(rayStart: Vector, rayDelta: Vector, boxOrigin: Vector, boxAngles: Angle, boxMins: Vector, boxMaxs: Vector): (Vector, Vector, number);
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
interface UtilLib {
|
|
427
|
+
/**
|
|
428
|
+
* Performs a [ray-plane intersection](https://en.wikipedia.org/wiki/Line%E2%80%93plane_intersection) and returns the hit position or nil.
|
|
429
|
+
* @realm shared
|
|
430
|
+
* @source https://wiki.facepunch.com/gmod/util.IntersectRayWithPlane
|
|
431
|
+
*/
|
|
432
|
+
IntersectRayWithPlane(rayOrigin: Vector, rayDirection: Vector, planePosition: Vector, planeNormal: Vector): Vector;
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
interface UtilLib {
|
|
436
|
+
/**
|
|
437
|
+
* Performs a ray-sphere intersection and returns the intersection positions or nil.
|
|
438
|
+
* @realm shared
|
|
439
|
+
* @source https://wiki.facepunch.com/gmod/util.IntersectRayWithSphere
|
|
440
|
+
*/
|
|
441
|
+
IntersectRayWithSphere(rayOrigin: Vector, rayDelta: Vector, spherePosition: Vector, sphereRadius: number): (number, number);
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
interface UtilLib {
|
|
445
|
+
/**
|
|
446
|
+
* Returns whether a binary module is installed and is resolvable by [Global.require](https://wiki.facepunch.com/gmod/Global.require).
|
|
447
|
+
* @realm shared and menu
|
|
448
|
+
* @source https://wiki.facepunch.com/gmod/util.IsBinaryModuleInstalled
|
|
449
|
+
*/
|
|
450
|
+
IsBinaryModuleInstalled(name: string): boolean;
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
interface UtilLib {
|
|
454
|
+
/**
|
|
455
|
+
* Performs a box-box intersection and returns whether there was an intersection or not.
|
|
456
|
+
* @realm shared
|
|
457
|
+
* @source https://wiki.facepunch.com/gmod/util.IsBoxIntersectingBox
|
|
458
|
+
*/
|
|
459
|
+
IsBoxIntersectingBox(boxMin: Vector, boxMax: Vector, box2Min: Vector, box2Max: Vector): boolean;
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
interface UtilLib {
|
|
463
|
+
/**
|
|
464
|
+
* Performs a box-sphere intersection and returns whether there was an intersection or not.
|
|
465
|
+
* @realm shared
|
|
466
|
+
* @source https://wiki.facepunch.com/gmod/util.IsBoxIntersectingSphere
|
|
467
|
+
*/
|
|
468
|
+
IsBoxIntersectingSphere(boxMin: Vector, boxMax: Vector, shpere2Position: Vector, sphere2Radius: number): boolean;
|
|
469
|
+
}
|
|
470
|
+
|
|
471
|
+
interface UtilLib {
|
|
472
|
+
/**
|
|
473
|
+
* Checks if a certain position is within the world bounds.
|
|
474
|
+
* @realm server
|
|
475
|
+
* @source https://wiki.facepunch.com/gmod/util.IsInWorld
|
|
476
|
+
*/
|
|
477
|
+
IsInWorld(position: Vector): boolean;
|
|
478
|
+
}
|
|
479
|
+
|
|
480
|
+
interface UtilLib {
|
|
481
|
+
/**
|
|
482
|
+
* Checks if the model is loaded in the game.
|
|
483
|
+
* @realm shared
|
|
484
|
+
* @source https://wiki.facepunch.com/gmod/util.IsModelLoaded
|
|
485
|
+
*/
|
|
486
|
+
IsModelLoaded(modelName: string): boolean;
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
interface UtilLib {
|
|
490
|
+
/**
|
|
491
|
+
* Performs OBB on OBB intersection test.
|
|
492
|
+
* @realm shared
|
|
493
|
+
* @source https://wiki.facepunch.com/gmod/util.IsOBBIntersectingOBB
|
|
494
|
+
*/
|
|
495
|
+
IsOBBIntersectingOBB(box1Origin: Vector, box1Angles: Angle, box1Mins: Vector, box1Maxs: Vector, box2Origin: Vector, box2Angles: Angle, box2Mins: Vector, box2Maxs: Vector, tolerance: number): boolean;
|
|
496
|
+
}
|
|
497
|
+
|
|
498
|
+
interface UtilLib {
|
|
499
|
+
/**
|
|
500
|
+
* Returns whether a point is within a cone or not.
|
|
501
|
+
* @realm shared
|
|
502
|
+
* @source https://wiki.facepunch.com/gmod/util.IsPointInCone
|
|
503
|
+
*/
|
|
504
|
+
IsPointInCone(point: Vector, coneOrigin: Vector, coneAxis: Vector, coneSine: number, coneLength: number): boolean;
|
|
505
|
+
}
|
|
506
|
+
|
|
507
|
+
interface UtilLib {
|
|
508
|
+
/**
|
|
509
|
+
* Performs a ray-ray intersection and returns whether there was an intersection or not.
|
|
510
|
+
* @realm shared
|
|
511
|
+
* @source https://wiki.facepunch.com/gmod/util.IsRayIntersectingRay
|
|
512
|
+
*/
|
|
513
|
+
IsRayIntersectingRay(ray1Start: Vector, ray1End: Vector, ray2Start: Vector, ray2End: Vector): (boolean, number, number);
|
|
514
|
+
}
|
|
515
|
+
|
|
516
|
+
interface UtilLib {
|
|
517
|
+
/**
|
|
518
|
+
* Check whether the skybox is visible from the point specified.
|
|
519
|
+
*
|
|
520
|
+
* **NOTE**: This will always return true in fullbright maps.
|
|
521
|
+
*
|
|
522
|
+
*
|
|
523
|
+
* @realm client
|
|
524
|
+
* @source https://wiki.facepunch.com/gmod/util.IsSkyboxVisibleFromPoint
|
|
525
|
+
*/
|
|
526
|
+
IsSkyboxVisibleFromPoint(position: Vector): boolean;
|
|
527
|
+
}
|
|
528
|
+
|
|
529
|
+
interface UtilLib {
|
|
530
|
+
/**
|
|
531
|
+
* Returns whether a sphere is intersecting a cone or not.
|
|
532
|
+
* @realm shared
|
|
533
|
+
* @source https://wiki.facepunch.com/gmod/util.IsSphereIntersectingCone
|
|
534
|
+
*/
|
|
535
|
+
IsSphereIntersectingCone(sphereCenter: Vector, sphereRadius: number, coneOrigin: Vector, coneAxis: Vector, coneSine: number, coneCosine: number): boolean;
|
|
536
|
+
}
|
|
537
|
+
|
|
538
|
+
interface UtilLib {
|
|
539
|
+
/**
|
|
540
|
+
* Performs a sphere-sphere intersection and returns whether there was an intersection or not.
|
|
541
|
+
* @realm shared
|
|
542
|
+
* @source https://wiki.facepunch.com/gmod/util.IsSphereIntersectingSphere
|
|
543
|
+
*/
|
|
544
|
+
IsSphereIntersectingSphere(sphere1Position: Vector, sphere1Radius: number, sphere2Position: Vector, sphere2Radius: number): boolean;
|
|
545
|
+
}
|
|
546
|
+
|
|
547
|
+
interface UtilLib {
|
|
548
|
+
/**
|
|
549
|
+
* Checks if the specified model is valid.
|
|
550
|
+
*
|
|
551
|
+
*
|
|
552
|
+
* A model is considered invalid in following cases:
|
|
553
|
+
* * Starts with a space or **maps**
|
|
554
|
+
* * Doesn't start with **models**
|
|
555
|
+
* * Contains any of the following:
|
|
556
|
+
* * `_gestures`
|
|
557
|
+
* * `_animations`
|
|
558
|
+
* * `_postures`
|
|
559
|
+
* * `_gst`
|
|
560
|
+
* * `_pst`
|
|
561
|
+
* * `_shd`
|
|
562
|
+
* * `_ss`
|
|
563
|
+
* * `_anm`
|
|
564
|
+
* * `.bsp`
|
|
565
|
+
* * `cs_fix`
|
|
566
|
+
* * If the model isn't precached on the server, AND if the model file doesn't exist on disk
|
|
567
|
+
* * If precache failed
|
|
568
|
+
* * Model is the error model
|
|
569
|
+
*
|
|
570
|
+
* Running this function will also precache the model.
|
|
571
|
+
*
|
|
572
|
+
*
|
|
573
|
+
* @realm shared
|
|
574
|
+
* @source https://wiki.facepunch.com/gmod/util.IsValidModel
|
|
575
|
+
*/
|
|
576
|
+
IsValidModel(modelName: string): boolean;
|
|
577
|
+
}
|
|
578
|
+
|
|
579
|
+
interface UtilLib {
|
|
580
|
+
/**
|
|
581
|
+
* Checks whether the given numbered physics object of the given entity is valid or not. Most useful for ragdolls.
|
|
582
|
+
* @realm shared
|
|
583
|
+
* @source https://wiki.facepunch.com/gmod/util.IsValidPhysicsObject
|
|
584
|
+
*/
|
|
585
|
+
IsValidPhysicsObject(ent: Entity, physobj: number): boolean;
|
|
586
|
+
}
|
|
587
|
+
|
|
588
|
+
interface UtilLib {
|
|
589
|
+
/**
|
|
590
|
+
* Checks if the specified prop is valid (has valid physics object).
|
|
591
|
+
* @realm shared
|
|
592
|
+
* @source https://wiki.facepunch.com/gmod/util.IsValidProp
|
|
593
|
+
*/
|
|
594
|
+
IsValidProp(modelName: string): boolean;
|
|
595
|
+
}
|
|
596
|
+
|
|
597
|
+
interface UtilLib {
|
|
598
|
+
/**
|
|
599
|
+
* Checks if the specified model name points to a valid ragdoll.
|
|
600
|
+
* @realm shared
|
|
601
|
+
* @source https://wiki.facepunch.com/gmod/util.IsValidRagdoll
|
|
602
|
+
*/
|
|
603
|
+
IsValidRagdoll(ragdollName: string): boolean;
|
|
604
|
+
}
|
|
605
|
+
|
|
606
|
+
interface UtilLib {
|
|
607
|
+
/**
|
|
608
|
+
* Converts a JSON string to a Lua table. It supports comments and trailing commas.
|
|
609
|
+
*
|
|
610
|
+
* See [util.TableToJSON](https://wiki.facepunch.com/gmod/util.TableToJSON) for the opposite function.
|
|
611
|
+
*
|
|
612
|
+
* Colors will not have the color metatable.
|
|
613
|
+
*
|
|
614
|
+
* @realm shared and menu
|
|
615
|
+
* @source https://wiki.facepunch.com/gmod/util.JSONToTable
|
|
616
|
+
*/
|
|
617
|
+
JSONToTable(json: string, ignoreLimits?: boolean, ignoreConversions?: boolean): table | nil;
|
|
618
|
+
}
|
|
619
|
+
|
|
620
|
+
interface UtilLib {
|
|
621
|
+
/**
|
|
622
|
+
* Converts a Valve KeyValue string (typically from [util.TableToKeyValues](https://wiki.facepunch.com/gmod/util.TableToKeyValues)) to a Lua table.
|
|
623
|
+
*
|
|
624
|
+
* **NOTE**: Due to how [table](https://wiki.facepunch.com/gmod/table)s work in Lua, keys will not repeat within a table. See [util.KeyValuesToTablePreserveOrder](https://wiki.facepunch.com/gmod/util.KeyValuesToTablePreserveOrder) for alternative.
|
|
625
|
+
*
|
|
626
|
+
*
|
|
627
|
+
* @realm shared and menu
|
|
628
|
+
* @source https://wiki.facepunch.com/gmod/util.KeyValuesToTable
|
|
629
|
+
*/
|
|
630
|
+
KeyValuesToTable(keyValues: string, usesEscapeSequences?: boolean, preserveKeyCase?: boolean): table;
|
|
631
|
+
}
|
|
632
|
+
|
|
633
|
+
interface UtilLib {
|
|
634
|
+
/**
|
|
635
|
+
* Similar to [util.KeyValuesToTable](https://wiki.facepunch.com/gmod/util.KeyValuesToTable), but it also preserves order of keys (since Lua dictionary-style tables do not guarantee a specific order), and allows handling of repeated keys. (since each key can only appear once in a dictionary data structure)
|
|
636
|
+
* @realm shared and menu
|
|
637
|
+
* @source https://wiki.facepunch.com/gmod/util.KeyValuesToTablePreserveOrder
|
|
638
|
+
*/
|
|
639
|
+
KeyValuesToTablePreserveOrder(keyValues: string, usesEscapeSequences?: boolean, preserveKeyCase?: boolean): table;
|
|
640
|
+
}
|
|
641
|
+
|
|
642
|
+
interface UtilLib {
|
|
643
|
+
/**
|
|
644
|
+
* A convenience function around LocalToWorld-related functions.
|
|
645
|
+
*
|
|
646
|
+
* **NOTE**: If [Entity:EntIndex](https://wiki.facepunch.com/gmod/Entity:EntIndex) returns `0`, the function will return the passed `lpos`.
|
|
647
|
+
*
|
|
648
|
+
*
|
|
649
|
+
* @realm shared
|
|
650
|
+
* @source https://wiki.facepunch.com/gmod/util.LocalToWorld
|
|
651
|
+
*/
|
|
652
|
+
LocalToWorld(ent: Entity, lpos: Vector, bone?: number): Vector;
|
|
653
|
+
}
|
|
654
|
+
|
|
655
|
+
interface UtilLib {
|
|
656
|
+
/**
|
|
657
|
+
* Generates the [MD5 hash](https://en.wikipedia.org/wiki/MD5) of the specified string.
|
|
658
|
+
* **WARNING**: MD5 is considered cryptographically broken and is known to be vulnerable to a variety of attacks including duplicate return values. If security or duplicate returns is a concern, use [util.SHA256](https://wiki.facepunch.com/gmod/util.SHA256).
|
|
659
|
+
*
|
|
660
|
+
*
|
|
661
|
+
* @realm shared
|
|
662
|
+
* @source https://wiki.facepunch.com/gmod/util.MD5
|
|
663
|
+
*/
|
|
664
|
+
MD5(stringToHash: string): string;
|
|
665
|
+
}
|
|
666
|
+
|
|
667
|
+
interface UtilLib {
|
|
668
|
+
/**
|
|
669
|
+
* Returns the networked string associated with the given ID from the string table.
|
|
670
|
+
* @realm shared
|
|
671
|
+
* @source https://wiki.facepunch.com/gmod/util.NetworkIDToString
|
|
672
|
+
*/
|
|
673
|
+
NetworkIDToString(stringTableID: number): string;
|
|
674
|
+
}
|
|
675
|
+
|
|
676
|
+
interface UtilLib {
|
|
677
|
+
/**
|
|
678
|
+
* Returns the networked ID associated with the given string from the string table.
|
|
679
|
+
* @realm shared
|
|
680
|
+
* @source https://wiki.facepunch.com/gmod/util.NetworkStringToID
|
|
681
|
+
*/
|
|
682
|
+
NetworkStringToID(networkString: string): number;
|
|
683
|
+
}
|
|
684
|
+
|
|
685
|
+
interface UtilLib {
|
|
686
|
+
/**
|
|
687
|
+
* Formats a float by stripping off extra `0's` and `.'s`.
|
|
688
|
+
* @realm shared and menu
|
|
689
|
+
* @source https://wiki.facepunch.com/gmod/util.NiceFloat
|
|
690
|
+
*/
|
|
691
|
+
NiceFloat(float: number): string;
|
|
692
|
+
}
|
|
693
|
+
|
|
694
|
+
interface UtilLib {
|
|
695
|
+
/**
|
|
696
|
+
* Creates an orange box (.pcf) tracer effect with the given parameters. See [util.ParticleTracerEx](https://wiki.facepunch.com/gmod/util.ParticleTracerEx) for version with additional arguments.
|
|
697
|
+
*
|
|
698
|
+
* Internally uses `ParticleTracer` engine effect. ([util.Effect](https://wiki.facepunch.com/gmod/util.Effect)) which then spawns in `ParticleEffect` effect.
|
|
699
|
+
* **NOTE**: The default bullet effect is not in .pcf format, therefore it is not used with util.ParticleTracer. Consider utilizing [util.Effect](https://wiki.facepunch.com/gmod/util.Effect) instead
|
|
700
|
+
*
|
|
701
|
+
*
|
|
702
|
+
* @realm shared
|
|
703
|
+
* @source https://wiki.facepunch.com/gmod/util.ParticleTracer
|
|
704
|
+
*/
|
|
705
|
+
ParticleTracer(name: string, startPos: Vector, endPos: Vector, doWhiz: boolean): void;
|
|
706
|
+
}
|
|
707
|
+
|
|
708
|
+
interface UtilLib {
|
|
709
|
+
/**
|
|
710
|
+
* Creates a tracer effect with the given parameters. Expanded version of [util.ParticleTracer](https://wiki.facepunch.com/gmod/util.ParticleTracer).
|
|
711
|
+
* @realm shared
|
|
712
|
+
* @source https://wiki.facepunch.com/gmod/util.ParticleTracerEx
|
|
713
|
+
*/
|
|
714
|
+
ParticleTracerEx(name: string, startPos: Vector, endPos: Vector, doWhiz: boolean, entityIndex: number, attachmentIndex: number): void;
|
|
715
|
+
}
|
|
716
|
+
|
|
717
|
+
interface UtilLib {
|
|
718
|
+
/**
|
|
719
|
+
* Returns the visibility of a square that is always pointed at the camera in the world-space.
|
|
720
|
+
*
|
|
721
|
+
* This is typically used for in-game sprites or "billboards". ([render.DrawSprite](https://wiki.facepunch.com/gmod/render.DrawSprite))
|
|
722
|
+
*
|
|
723
|
+
* @realm client
|
|
724
|
+
* @source https://wiki.facepunch.com/gmod/util.PixelVisible
|
|
725
|
+
*/
|
|
726
|
+
PixelVisible(position: Vector, size: number, PixVis: pixelvis_handle_t): number;
|
|
727
|
+
}
|
|
728
|
+
|
|
729
|
+
interface UtilLib {
|
|
730
|
+
/**
|
|
731
|
+
* Returns the contents of the position specified.
|
|
732
|
+
* **NOTE**: This function will sample only the world environments. It can be used to check if [Entity:GetPos](https://wiki.facepunch.com/gmod/Entity:GetPos) is underwater for example unlike [Entity:WaterLevel](https://wiki.facepunch.com/gmod/Entity:WaterLevel) which works for players only.
|
|
733
|
+
*
|
|
734
|
+
*
|
|
735
|
+
* @realm shared
|
|
736
|
+
* @source https://wiki.facepunch.com/gmod/util.PointContents
|
|
737
|
+
*/
|
|
738
|
+
PointContents(position: Vector): CONTENTS;
|
|
739
|
+
}
|
|
740
|
+
|
|
741
|
+
interface UtilLib {
|
|
742
|
+
/**
|
|
743
|
+
* Precaches a model for later use. Model is cached after being loaded once.
|
|
744
|
+
* **WARNING**: Modelprecache is limited to 8192 unique models. When it reaches the limit the game will crash.
|
|
745
|
+
*
|
|
746
|
+
*
|
|
747
|
+
* **NOTE**: Does nothing on the client.
|
|
748
|
+
*
|
|
749
|
+
*
|
|
750
|
+
* @realm shared
|
|
751
|
+
* @source https://wiki.facepunch.com/gmod/util.PrecacheModel
|
|
752
|
+
*/
|
|
753
|
+
PrecacheModel(modelName: string): void;
|
|
754
|
+
}
|
|
755
|
+
|
|
756
|
+
interface UtilLib {
|
|
757
|
+
/**
|
|
758
|
+
* Precaches a sound for later use. Sound is cached after being loaded once.
|
|
759
|
+
* **NOTE**: Soundcache is limited to 16384 unique sounds on the server. Due to this fact this function is disabled on purpose, as exceeding the limit causes the server to shutdown.
|
|
760
|
+
*
|
|
761
|
+
*
|
|
762
|
+
* Ultimately does nothing on client, and only works with sound scripts, not direct paths.
|
|
763
|
+
*
|
|
764
|
+
* @realm shared
|
|
765
|
+
* @source https://wiki.facepunch.com/gmod/util.PrecacheSound
|
|
766
|
+
*/
|
|
767
|
+
PrecacheSound(soundName: string): void;
|
|
768
|
+
}
|
|
769
|
+
|
|
770
|
+
interface UtilLib {
|
|
771
|
+
/**
|
|
772
|
+
* Performs a trace with the given origin, direction, and filter.
|
|
773
|
+
* **NOTE**: This function will throw an error in the menu realm because it internally uses util.TraceLine which doesn't exist in the menu realm and thus error.
|
|
774
|
+
*
|
|
775
|
+
*
|
|
776
|
+
* @realm shared and menu
|
|
777
|
+
* @source https://wiki.facepunch.com/gmod/util.QuickTrace
|
|
778
|
+
*/
|
|
779
|
+
QuickTrace(origin: Vector, dir: Vector, filter?: Entity | Entity[] | string[] | function): TraceResult;
|
|
780
|
+
}
|
|
781
|
+
|
|
782
|
+
interface UtilLib {
|
|
783
|
+
/**
|
|
784
|
+
* Converts the relative path of a given file to the full path on disk.
|
|
785
|
+
* You can use [util.FullPathToRelative_Menu](https://wiki.facepunch.com/gmod/util.FullPathToRelative_Menu) to convert the full path back to the relative path.
|
|
786
|
+
*
|
|
787
|
+
* @realm menu
|
|
788
|
+
* @source https://wiki.facepunch.com/gmod/util.RelativePathToFull_Menu
|
|
789
|
+
*/
|
|
790
|
+
RelativePathToFull_Menu(filePath: string, mountPath?: string): string;
|
|
791
|
+
}
|
|
792
|
+
|
|
793
|
+
interface UtilLib {
|
|
794
|
+
/**
|
|
795
|
+
* Returns which Workshop addon the given file belongs to.
|
|
796
|
+
*
|
|
797
|
+
* @realm menu
|
|
798
|
+
* @source https://wiki.facepunch.com/gmod/util.RelativePathToGMA_Menu
|
|
799
|
+
*/
|
|
800
|
+
RelativePathToGMA_Menu(filePath: string): table;
|
|
801
|
+
}
|
|
802
|
+
|
|
803
|
+
interface UtilLib {
|
|
804
|
+
/**
|
|
805
|
+
* Removes world decals at given position, in given radius. Does not remove decals on models!
|
|
806
|
+
*
|
|
807
|
+
* @realm client
|
|
808
|
+
* @source https://wiki.facepunch.com/gmod/util.RemoveDecalsAt
|
|
809
|
+
*/
|
|
810
|
+
RemoveDecalsAt(pos: Vector, distance: number, limit?: number, permanent?: boolean): number;
|
|
811
|
+
}
|
|
812
|
+
|
|
813
|
+
interface UtilLib {
|
|
814
|
+
/**
|
|
815
|
+
* Removes persistent data of an offline player using their SteamID.
|
|
816
|
+
*
|
|
817
|
+
* See also [Player:RemovePData](https://wiki.facepunch.com/gmod/Player:RemovePData) for a more convenient version of this function for online players, [util.SetPData](https://wiki.facepunch.com/gmod/util.SetPData) and
|
|
818
|
+
* [util.GetPData](https://wiki.facepunch.com/gmod/util.GetPData) for the other accompanying functions.
|
|
819
|
+
*
|
|
820
|
+
* **NOTE**: This function internally uses [util.SteamIDTo64](https://wiki.facepunch.com/gmod/util.SteamIDTo64), it previously utilized [Player:UniqueID](https://wiki.facepunch.com/gmod/Player:UniqueID) which can cause collisions (two or more players sharing the same PData entry). This function now tries to remove both old and new entries.
|
|
821
|
+
*
|
|
822
|
+
* @realm shared and menu
|
|
823
|
+
* @source https://wiki.facepunch.com/gmod/util.RemovePData
|
|
824
|
+
*/
|
|
825
|
+
RemovePData(steamID: string, name: string): void;
|
|
826
|
+
}
|
|
827
|
+
|
|
828
|
+
interface UtilLib {
|
|
829
|
+
/**
|
|
830
|
+
* Generates the [SHA-1 hash](https://en.wikipedia.org/wiki/SHA-1) of the specified string.
|
|
831
|
+
* **WARNING**: SHA-1 is considered cryptographically broken and is known to be vulnerable to a variety of attacks. If security is a concern, use [util.SHA256](https://wiki.facepunch.com/gmod/util.SHA256).
|
|
832
|
+
*
|
|
833
|
+
*
|
|
834
|
+
* @realm shared
|
|
835
|
+
* @source https://wiki.facepunch.com/gmod/util.SHA1
|
|
836
|
+
*/
|
|
837
|
+
SHA1(stringToHash: string): string;
|
|
838
|
+
}
|
|
839
|
+
|
|
840
|
+
interface UtilLib {
|
|
841
|
+
/**
|
|
842
|
+
* Generates the [SHA-256 hash](https://en.wikipedia.org/wiki/SHA-2) of the specified string. This is mostly unique and is astronomically unlikely to return the same hash for a different string unlike [util.CRC](https://wiki.facepunch.com/gmod/util.CRC) or [util.MD5](https://wiki.facepunch.com/gmod/util.MD5) which are both much more vulnerable to duplicate returns.
|
|
843
|
+
* @realm shared
|
|
844
|
+
* @source https://wiki.facepunch.com/gmod/util.SHA256
|
|
845
|
+
*/
|
|
846
|
+
SHA256(stringToHash: string): string;
|
|
847
|
+
}
|
|
848
|
+
|
|
849
|
+
interface UtilLib {
|
|
850
|
+
/**
|
|
851
|
+
* Makes the screen shake.
|
|
852
|
+
*
|
|
853
|
+
* **NOTE**: The screen shake effect is rendered by modifying the view origin on the client. If you override the view origin in [GM:CalcView](https://wiki.facepunch.com/gmod/GM:CalcView) you may not be able to see the shake effect.
|
|
854
|
+
*
|
|
855
|
+
* @realm shared
|
|
856
|
+
* @source https://wiki.facepunch.com/gmod/util.ScreenShake
|
|
857
|
+
*/
|
|
858
|
+
ScreenShake(pos: Vector, amplitude: number, frequency: number, duration: number, radius: number, airshake?: boolean, filter?: CRecipientFilter): void;
|
|
859
|
+
}
|
|
860
|
+
|
|
861
|
+
interface UtilLib {
|
|
862
|
+
/**
|
|
863
|
+
* Sets persistent data for offline player using their SteamID.
|
|
864
|
+
*
|
|
865
|
+
* See also [Player:SetPData](https://wiki.facepunch.com/gmod/Player:SetPData) for a more convenient version of this function for online players, [util.RemovePData](https://wiki.facepunch.com/gmod/util.RemovePData) and
|
|
866
|
+
* [util.GetPData](https://wiki.facepunch.com/gmod/util.GetPData) for the other accompanying functions.
|
|
867
|
+
* **NOTE**: This function internally uses [util.SteamIDTo64](https://wiki.facepunch.com/gmod/util.SteamIDTo64), it previously utilized [Player:UniqueID](https://wiki.facepunch.com/gmod/Player:UniqueID) which could have caused collisions (two or more players sharing the same PData entry).
|
|
868
|
+
*
|
|
869
|
+
*
|
|
870
|
+
* @realm shared and menu
|
|
871
|
+
* @source https://wiki.facepunch.com/gmod/util.SetPData
|
|
872
|
+
*/
|
|
873
|
+
SetPData(steamID: string, name: string, value: any): void;
|
|
874
|
+
}
|
|
875
|
+
|
|
876
|
+
interface UtilLib {
|
|
877
|
+
/**
|
|
878
|
+
* Generates a random float value that should be the same on client and server.
|
|
879
|
+
*
|
|
880
|
+
* **NOTE**: This function is best used in a [predicted hook](https://wiki.facepunch.com/gmod/prediction).
|
|
881
|
+
*
|
|
882
|
+
*
|
|
883
|
+
* This uses a different method of obtaining random numbers and is unaffected by [math.randomseed](https://wiki.facepunch.com/gmod/math.randomseed). Instead it uses an internal seed that is based on the player's current predicted command and is fixed to a value of -1 outside of prediction.
|
|
884
|
+
*
|
|
885
|
+
* @realm shared
|
|
886
|
+
* @source https://wiki.facepunch.com/gmod/util.SharedRandom
|
|
887
|
+
*/
|
|
888
|
+
SharedRandom(uniqueName: string, min: number, max: number, additionalSeed?: number): number;
|
|
889
|
+
}
|
|
890
|
+
|
|
891
|
+
interface UtilLib {
|
|
892
|
+
/**
|
|
893
|
+
* Adds a trail to the specified entity.
|
|
894
|
+
* @realm server
|
|
895
|
+
* @source https://wiki.facepunch.com/gmod/util.SpriteTrail
|
|
896
|
+
*/
|
|
897
|
+
SpriteTrail(ent: Entity, attachmentID: number, color: Color, additive: boolean, startWidth: number, endWidth: number, lifetime: number, textureRes: number, texture: string): Entity;
|
|
898
|
+
}
|
|
899
|
+
|
|
900
|
+
interface UtilLib {
|
|
901
|
+
/**
|
|
902
|
+
* Returns a new [Stack](https://wiki.facepunch.com/gmod/Stack) object.
|
|
903
|
+
* @realm shared and menu
|
|
904
|
+
* @source https://wiki.facepunch.com/gmod/util.Stack
|
|
905
|
+
*/
|
|
906
|
+
Stack(): Stack;
|
|
907
|
+
}
|
|
908
|
+
|
|
909
|
+
interface UtilLib {
|
|
910
|
+
/**
|
|
911
|
+
* Given a [64bit SteamID](https://wiki.facepunch.com/gmod/Player:SteamID64) will return a [STEAM_0:0:0](https://wiki.facepunch.com/gmod/Player:SteamID) style Steam ID.
|
|
912
|
+
*
|
|
913
|
+
* **NOTE**: This operation induces data loss. Not all fields of a [64bit SteamID](https://developer.valvesoftware.com/wiki/SteamID) can be represented using the `STEAM_0:0:0` format, specifically the "account type" and "account instance" fields.
|
|
914
|
+
*
|
|
915
|
+
*
|
|
916
|
+
* @realm shared
|
|
917
|
+
* @source https://wiki.facepunch.com/gmod/util.SteamIDFrom64
|
|
918
|
+
*/
|
|
919
|
+
SteamIDFrom64(id: string): string;
|
|
920
|
+
}
|
|
921
|
+
|
|
922
|
+
interface UtilLib {
|
|
923
|
+
/**
|
|
924
|
+
* Converts a [STEAM_0:0:0](https://wiki.facepunch.com/gmod/Player:SteamID) style SteamID to a [64bit SteamID](https://wiki.facepunch.com/gmod/Player:SteamID64).
|
|
925
|
+
* @realm shared
|
|
926
|
+
* @source https://wiki.facepunch.com/gmod/util.SteamIDTo64
|
|
927
|
+
*/
|
|
928
|
+
SteamIDTo64(id: string): string;
|
|
929
|
+
}
|
|
930
|
+
|
|
931
|
+
interface UtilLib {
|
|
932
|
+
/**
|
|
933
|
+
* Converts a string to the specified type.
|
|
934
|
+
*
|
|
935
|
+
* This can be useful when dealing with ConVars.
|
|
936
|
+
*
|
|
937
|
+
* @realm shared and menu
|
|
938
|
+
* @source https://wiki.facepunch.com/gmod/util.StringToType
|
|
939
|
+
*/
|
|
940
|
+
StringToType(str: string, typename: string): any;
|
|
941
|
+
}
|
|
942
|
+
|
|
943
|
+
interface UtilLib {
|
|
944
|
+
/**
|
|
945
|
+
* Converts a table to a JSON string. Keep in mind that not every data type can be stored in the JSON format, notably any entity will not be written, as if it wasn't in the table. Same goes for materials and textures, etc.
|
|
946
|
+
*
|
|
947
|
+
* See [util.JSONToTable](https://wiki.facepunch.com/gmod/util.JSONToTable) for the opposite function.
|
|
948
|
+
*
|
|
949
|
+
* **WARNING**: All keys are strings in the JSON format, so all keys of other types will be converted to strings!
|
|
950
|
+
* This can lead to loss of data where a number key could be converted into an already existing string key! (for example in a table like this: `{["5"] = "ok", [5] = "BBB"}`)
|
|
951
|
+
*
|
|
952
|
+
*
|
|
953
|
+
* @realm shared and menu
|
|
954
|
+
* @source https://wiki.facepunch.com/gmod/util.TableToJSON
|
|
955
|
+
*/
|
|
956
|
+
TableToJSON(table: table, prettyPrint?: boolean): string;
|
|
957
|
+
}
|
|
958
|
+
|
|
959
|
+
interface UtilLib {
|
|
960
|
+
/**
|
|
961
|
+
* Converts the given table into a Valve keyValue formatted string.
|
|
962
|
+
*
|
|
963
|
+
* Use [util.KeyValuesToTable](https://wiki.facepunch.com/gmod/util.KeyValuesToTable) to perform the opposite transformation.
|
|
964
|
+
*
|
|
965
|
+
* [util.TableToJSON](https://wiki.facepunch.com/gmod/util.TableToJSON) can be used as an alternative.
|
|
966
|
+
*
|
|
967
|
+
* @realm shared and menu
|
|
968
|
+
* @source https://wiki.facepunch.com/gmod/util.TableToKeyValues
|
|
969
|
+
*/
|
|
970
|
+
TableToKeyValues(table: table, rootKey?: string): string;
|
|
971
|
+
}
|
|
972
|
+
|
|
973
|
+
interface UtilLib {
|
|
974
|
+
/**
|
|
975
|
+
* Creates a timer object. The returned timer will be already started with given duration.
|
|
976
|
+
* @realm shared and menu
|
|
977
|
+
* @source https://wiki.facepunch.com/gmod/util.Timer
|
|
978
|
+
*/
|
|
979
|
+
Timer(duration?: number): table;
|
|
980
|
+
}
|
|
981
|
+
|
|
982
|
+
interface UtilLib {
|
|
983
|
+
/**
|
|
984
|
+
* Returns the time since this function has been last called
|
|
985
|
+
* @realm shared and menu
|
|
986
|
+
* @source https://wiki.facepunch.com/gmod/util.TimerCycle
|
|
987
|
+
*/
|
|
988
|
+
TimerCycle(): number;
|
|
989
|
+
}
|
|
990
|
+
|
|
991
|
+
interface UtilLib {
|
|
992
|
+
/**
|
|
993
|
+
* Runs a trace using the entity's collision model between two points. Does not
|
|
994
|
+
* take the entity's angles into account (traces the unrotated collision model).
|
|
995
|
+
* @realm shared
|
|
996
|
+
* @source https://wiki.facepunch.com/gmod/util.TraceEntity
|
|
997
|
+
*/
|
|
998
|
+
TraceEntity(tracedata: Trace, ent: Entity): TraceResult;
|
|
999
|
+
}
|
|
1000
|
+
|
|
1001
|
+
|
|
1002
|
+
interface UtilLib {
|
|
1003
|
+
/**
|
|
1004
|
+
* Identical to util.TraceHull but uses an entity's Axis-Aligned Bounding Box
|
|
1005
|
+
* (AABB) for `mins`/`maxs` inputs (those two keys are ignored in the table).
|
|
1006
|
+
* @realm shared
|
|
1007
|
+
* @source https://wiki.facepunch.com/gmod/util.TraceEntityHull
|
|
1008
|
+
*/
|
|
1009
|
+
TraceEntityHull(tracedata: HullTrace, ent: Entity): TraceResult;
|
|
1010
|
+
}
|
|
1011
|
+
|
|
1012
|
+
|
|
1013
|
+
interface UtilLib {
|
|
1014
|
+
/**
|
|
1015
|
+
* Performs an AABB hull (axis-aligned bounding box, not rotated) trace with the
|
|
1016
|
+
* given trace data. This trace type cannot hit hitboxes. See util.TraceLine for
|
|
1017
|
+
* a simple line ("ray") trace.
|
|
1018
|
+
* @realm shared
|
|
1019
|
+
* @source https://wiki.facepunch.com/gmod/util.TraceHull
|
|
1020
|
+
*/
|
|
1021
|
+
TraceHull(TraceData: HullTrace): TraceResult;
|
|
1022
|
+
}
|
|
1023
|
+
|
|
1024
|
+
|
|
1025
|
+
interface UtilLib {
|
|
1026
|
+
/**
|
|
1027
|
+
* Performs an infinitely thin, invisible ray trace in a line and returns a
|
|
1028
|
+
* table with information about what, if anything, the trace hit or intersected.
|
|
1029
|
+
* See util.TraceHull for a "box" type trace.
|
|
1030
|
+
* @realm shared
|
|
1031
|
+
* @source https://wiki.facepunch.com/gmod/util.TraceLine
|
|
1032
|
+
*/
|
|
1033
|
+
TraceLine(traceConfig: Trace): TraceResult;
|
|
1034
|
+
}
|
|
1035
|
+
|
|
1036
|
+
|
|
1037
|
+
interface UtilLib {
|
|
1038
|
+
/**
|
|
1039
|
+
* Converts a type to a (nice, but still parsable) string
|
|
1040
|
+
* @realm shared and menu
|
|
1041
|
+
* @source https://wiki.facepunch.com/gmod/util.TypeToString
|
|
1042
|
+
*/
|
|
1043
|
+
TypeToString(input: any): string;
|
|
1044
|
+
}
|
|
1045
|
+
|
|
1046
|
+
interface UtilLib {
|
|
1047
|
+
/**
|
|
1048
|
+
* Converts string or a number to a bool, if possible. Alias of [Global.tobool](https://wiki.facepunch.com/gmod/Global.tobool).
|
|
1049
|
+
*
|
|
1050
|
+
* @realm shared and menu
|
|
1051
|
+
* @source https://wiki.facepunch.com/gmod/util.tobool
|
|
1052
|
+
* @deprecated You should use Global.tobool instead.
|
|
1053
|
+
*/
|
|
1054
|
+
tobool(input: any): boolean;
|
|
1055
|
+
}
|
|
1056
|
+
|
|
1057
|
+
interface UtilworldpickerLib {
|
|
1058
|
+
/**
|
|
1059
|
+
* Returns if the user is currently picking an entity.
|
|
1060
|
+
* @realm client
|
|
1061
|
+
* @source https://wiki.facepunch.com/gmod/util.worldpicker.Active
|
|
1062
|
+
*/
|
|
1063
|
+
Active(): boolean;
|
|
1064
|
+
}
|
|
1065
|
+
|
|
1066
|
+
interface UtilworldpickerLib {
|
|
1067
|
+
/**
|
|
1068
|
+
* **INTERNAL**: This is used internally - although you're able to use it you probably shouldn't.
|
|
1069
|
+
*
|
|
1070
|
+
*
|
|
1071
|
+
* Finishes the world picking. This is called when a user presses their mouse after calling [util.worldpicker.Start](https://wiki.facepunch.com/gmod/util.worldpicker.Start).
|
|
1072
|
+
*
|
|
1073
|
+
* @realm client
|
|
1074
|
+
* @source https://wiki.facepunch.com/gmod/util.worldpicker.Finish
|
|
1075
|
+
*/
|
|
1076
|
+
Finish(tr: TraceResult): void;
|
|
1077
|
+
}
|
|
1078
|
+
|
|
1079
|
+
interface UtilworldpickerLib {
|
|
1080
|
+
/**
|
|
1081
|
+
* Starts picking an entity in the world. This will suppress the next mouse click, and instead use it as a direction in the trace sent to the callback.
|
|
1082
|
+
* @realm client
|
|
1083
|
+
* @source https://wiki.facepunch.com/gmod/util.worldpicker.Start
|
|
1084
|
+
*/
|
|
1085
|
+
Start(callback: (tr: table) => void): void;
|
|
1086
|
+
}
|
|
1087
|
+
|