@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.
Files changed (278) hide show
  1. package/README.md +28 -0
  2. package/__metadata.json +4 -0
  3. package/_globals.d.tlua +178 -0
  4. package/_gmod-std.d.tlua +35 -0
  5. package/achievementicon.d.tlua +12 -0
  6. package/achievements.d.tlua +162 -0
  7. package/ai.d.tlua +65 -0
  8. package/ai_schedule.d.tlua +17 -0
  9. package/ai_task.d.tlua +17 -0
  10. package/angle.d.tlua +197 -0
  11. package/avatarimage.d.tlua +10 -0
  12. package/awesomium.d.tlua +14 -0
  13. package/baseclass.d.tlua +42 -0
  14. package/bf_read.d.tlua +110 -0
  15. package/bit.d.tlua +121 -0
  16. package/button.d.tlua +13 -0
  17. package/cam.d.tlua +220 -0
  18. package/ceffectdata.d.tlua +337 -0
  19. package/chat.d.tlua +62 -0
  20. package/checkbutton.d.tlua +14 -0
  21. package/cleanup.d.tlua +88 -0
  22. package/cluaemitter.d.tlua +119 -0
  23. package/clualocomotion.d.tlua +383 -0
  24. package/cluaparticle.d.tlua +426 -0
  25. package/cmovedata.d.tlua +476 -0
  26. package/cnavarea.d.tlua +845 -0
  27. package/cnavladder.d.tlua +209 -0
  28. package/cnewparticleeffect.d.tlua +259 -0
  29. package/color.d.tlua +339 -0
  30. package/concommand.d.tlua +69 -0
  31. package/constraint.d.tlua +311 -0
  32. package/construct.d.tlua +26 -0
  33. package/contentheader.d.tlua +32 -0
  34. package/contenticon.d.tlua +86 -0
  35. package/contentsidebar.d.tlua +45 -0
  36. package/contentsidebartoolbox.d.tlua +13 -0
  37. package/contextbase.d.tlua +37 -0
  38. package/controlpanel.d.tlua +140 -0
  39. package/controlpresets.d.tlua +118 -0
  40. package/convar.d.tlua +162 -0
  41. package/cookie.d.tlua +60 -0
  42. package/coroutine.d.tlua +90 -0
  43. package/crecipientfilter.d.tlua +152 -0
  44. package/csent.d.tlua +10 -0
  45. package/csoundpatch.d.tlua +150 -0
  46. package/ctakedamageinfo.d.tlua +366 -0
  47. package/ctrllistbox.d.tlua +12 -0
  48. package/ctrlnumpad.d.tlua +73 -0
  49. package/cusercmd.d.tlua +320 -0
  50. package/custom_classes.d.tlua +65 -0
  51. package/custom_entity_fields.d.tlua +96 -0
  52. package/cvars.d.tlua +80 -0
  53. package/dadjustablemodelpanel.d.tlua +81 -0
  54. package/dalphabar.d.tlua +27 -0
  55. package/dbinder.d.tlua +37 -0
  56. package/dbubblecontainer.d.tlua +18 -0
  57. package/dbutton.d.tlua +88 -0
  58. package/dcategoryheader.d.tlua +13 -0
  59. package/dcategorylist.d.tlua +11 -0
  60. package/dcheckbox.d.tlua +46 -0
  61. package/dcheckboxlabel.d.tlua +90 -0
  62. package/dcollapsiblecategory.d.tlua +240 -0
  63. package/dcolorbutton.d.tlua +73 -0
  64. package/dcolorcombo.d.tlua +54 -0
  65. package/dcolorcube.d.tlua +137 -0
  66. package/dcolormixer.d.tlua +303 -0
  67. package/dcolorpalette.d.tlua +294 -0
  68. package/dcolumnsheet.d.tlua +49 -0
  69. package/dcombobox.d.tlua +161 -0
  70. package/ddragbase.d.tlua +151 -0
  71. package/ddrawer.d.tlua +72 -0
  72. package/debug.d.tlua +236 -0
  73. package/debugoverlay.d.tlua +193 -0
  74. package/dentityproperties.d.tlua +63 -0
  75. package/derma.d.tlua +119 -0
  76. package/dexpandbutton.d.tlua +30 -0
  77. package/dfilebrowser.d.tlua +228 -0
  78. package/dform.d.tlua +176 -0
  79. package/dframe.d.tlua +261 -0
  80. package/dgrid.d.tlua +113 -0
  81. package/dhorizontaldivider.d.tlua +196 -0
  82. package/dhorizontalscroller.d.tlua +104 -0
  83. package/dhscrollbar.d.tlua +109 -0
  84. package/dhtml.d.tlua +91 -0
  85. package/dhtmlcontrols.d.tlua +62 -0
  86. package/diconbrowser.d.tlua +113 -0
  87. package/diconlayout.d.tlua +190 -0
  88. package/dimage.d.tlua +221 -0
  89. package/dimagebutton.d.tlua +103 -0
  90. package/dkillicon.d.tlua +9 -0
  91. package/dlabel.d.tlua +385 -0
  92. package/dlabeleditable.d.tlua +51 -0
  93. package/dlabelurl.d.tlua +100 -0
  94. package/dlistbox.d.tlua +82 -0
  95. package/dlistboxitem.d.tlua +42 -0
  96. package/dlistlayout.d.tlua +14 -0
  97. package/dlistview.d.tlua +360 -0
  98. package/dlistview_column.d.tlua +135 -0
  99. package/dlistview_columnplain.d.tlua +11 -0
  100. package/dlistview_draggerbar.d.tlua +11 -0
  101. package/dlistview_line.d.tlua +140 -0
  102. package/dlistviewheaderlabel.d.tlua +11 -0
  103. package/dlistviewlabel.d.tlua +11 -0
  104. package/dlistviewline.d.tlua +11 -0
  105. package/dmenu.d.tlua +266 -0
  106. package/dmenubar.d.tlua +42 -0
  107. package/dmenuoption.d.tlua +135 -0
  108. package/dmenuoptioncvar.d.tlua +64 -0
  109. package/dmodelpanel.d.tlua +207 -0
  110. package/dmodelselect.d.tlua +20 -0
  111. package/dmodelselectmulti.d.tlua +19 -0
  112. package/dnotify.d.tlua +93 -0
  113. package/dnumberscratch.d.tlua +284 -0
  114. package/dnumberwang.d.tlua +147 -0
  115. package/dnumpad.d.tlua +11 -0
  116. package/dnumslider.d.tlua +182 -0
  117. package/dpanel.d.tlua +152 -0
  118. package/dpanellist.d.tlua +109 -0
  119. package/dpaneloverlay.d.tlua +65 -0
  120. package/dpanelselect.d.tlua +13 -0
  121. package/dpanpanel.d.tlua +64 -0
  122. package/dprogress.d.tlua +27 -0
  123. package/dproperties.d.tlua +52 -0
  124. package/dproperty_boolean.d.tlua +12 -0
  125. package/dproperty_combo.d.tlua +31 -0
  126. package/dproperty_entity.d.tlua +12 -0
  127. package/dproperty_float.d.tlua +12 -0
  128. package/dproperty_generic.d.tlua +50 -0
  129. package/dproperty_int.d.tlua +12 -0
  130. package/dproperty_vectorcolor.d.tlua +14 -0
  131. package/dpropertysheet.d.tlua +167 -0
  132. package/dragndrop.d.tlua +123 -0
  133. package/draw.d.tlua +162 -0
  134. package/drgbpicker.d.tlua +49 -0
  135. package/drive.d.tlua +159 -0
  136. package/dscrollbargrip.d.tlua +13 -0
  137. package/dscrollpanel.d.tlua +110 -0
  138. package/dshape.d.tlua +72 -0
  139. package/dsizetocontents.d.tlua +46 -0
  140. package/dslider.d.tlua +302 -0
  141. package/dsprite.d.tlua +84 -0
  142. package/dtab.d.tlua +81 -0
  143. package/dtextentry.d.tlua +442 -0
  144. package/dtilelayout.d.tlua +218 -0
  145. package/dtooltip.d.tlua +76 -0
  146. package/dtree.d.tlua +185 -0
  147. package/dtree_node.d.tlua +793 -0
  148. package/dtree_node_button.d.tlua +13 -0
  149. package/duplicator.d.tlua +338 -0
  150. package/dverticaldivider.d.tlua +223 -0
  151. package/dvscrollbar.d.tlua +109 -0
  152. package/editablepanel.d.tlua +10 -0
  153. package/effect.d.tlua +121 -0
  154. package/effects.d.tlua +77 -0
  155. package/engine.d.tlua +248 -0
  156. package/entity.d.tlua +8295 -0
  157. package/ents.d.tlua +267 -0
  158. package/enums.d.tlua +7082 -0
  159. package/file.d.tlua +419 -0
  160. package/file_class.d.tlua +7 -0
  161. package/fingerposer.d.tlua +12 -0
  162. package/fingervar.d.tlua +13 -0
  163. package/frame.d.tlua +11 -0
  164. package/frame_blend.d.tlua +105 -0
  165. package/game.d.tlua +482 -0
  166. package/gameevent.d.tlua +968 -0
  167. package/gamemode.d.tlua +48 -0
  168. package/global.d.tlua +3156 -0
  169. package/gm.d.tlua +3218 -0
  170. package/gmod.d.tlua +20 -0
  171. package/gmsave.d.tlua +53 -0
  172. package/gui.d.tlua +232 -0
  173. package/gwen.d.tlua +55 -0
  174. package/halo.d.tlua +42 -0
  175. package/hammer.d.tlua +17 -0
  176. package/hook.d.tlua +64 -0
  177. package/html.d.tlua +22 -0
  178. package/http.d.tlua +72 -0
  179. package/iconeditor.d.tlua +130 -0
  180. package/igmodaudiochannel.d.tlua +419 -0
  181. package/imagecheckbox.d.tlua +48 -0
  182. package/imaterial.d.tlua +288 -0
  183. package/imesh.d.tlua +70 -0
  184. package/index.d.tlua +277 -0
  185. package/input.d.tlua +252 -0
  186. package/invalidateinternalentitycache.d.tlua +13 -0
  187. package/irestore.d.tlua +94 -0
  188. package/isave.d.tlua +94 -0
  189. package/itexture.d.tlua +108 -0
  190. package/ivideowriter.d.tlua +53 -0
  191. package/jit.d.tlua +243 -0
  192. package/killicon.d.tlua +84 -0
  193. package/label.d.tlua +20 -0
  194. package/language.d.tlua +26 -0
  195. package/list.d.tlua +112 -0
  196. package/makeballoon.d.tlua +15 -0
  197. package/markup.d.tlua +38 -0
  198. package/markupobject.d.tlua +53 -0
  199. package/material.d.tlua +9 -0
  200. package/math.d.tlua +899 -0
  201. package/matproxy.d.tlua +60 -0
  202. package/matselect.d.tlua +106 -0
  203. package/menu.d.tlua +20 -0
  204. package/menubar.d.tlua +39 -0
  205. package/mesh.d.tlua +183 -0
  206. package/modelimage.d.tlua +12 -0
  207. package/motionsensor.d.tlua +115 -0
  208. package/navmesh.d.tlua +274 -0
  209. package/net.d.tlua +639 -0
  210. package/nextbot.d.tlua +380 -0
  211. package/notification.d.tlua +35 -0
  212. package/npc.d.tlua +1787 -0
  213. package/numpad.d.tlua +89 -0
  214. package/os.d.tlua +56 -0
  215. package/package.d.tlua +15 -0
  216. package/package.json +18 -0
  217. package/panel.d.tlua +3650 -0
  218. package/panellist.d.tlua +13 -0
  219. package/pathfollower.d.tlua +301 -0
  220. package/permissions.d.tlua +77 -0
  221. package/physcollide.d.tlua +40 -0
  222. package/physenv.d.tlua +136 -0
  223. package/physobj.d.tlua +799 -0
  224. package/pixelvis_handle_t.d.tlua +9 -0
  225. package/player.d.tlua +3320 -0
  226. package/player_manager.d.tlua +147 -0
  227. package/preseteditor.d.tlua +13 -0
  228. package/presets.d.tlua +79 -0
  229. package/projectedtexture.d.tlua +553 -0
  230. package/properties.d.tlua +65 -0
  231. package/propselect.d.tlua +50 -0
  232. package/radiobutton.d.tlua +13 -0
  233. package/render.d.tlua +1700 -0
  234. package/resource.d.tlua +73 -0
  235. package/richtext.d.tlua +17 -0
  236. package/sandbox.d.tlua +576 -0
  237. package/saverestore.d.tlua +148 -0
  238. package/schedule.d.tlua +69 -0
  239. package/scripted_ents.d.tlua +124 -0
  240. package/search.d.tlua +26 -0
  241. package/serverlist.d.tlua +85 -0
  242. package/slidebar.d.tlua +12 -0
  243. package/slider.d.tlua +11 -0
  244. package/sound.d.tlua +140 -0
  245. package/spawnicon.d.tlua +95 -0
  246. package/spawnmenu.d.tlua +286 -0
  247. package/spawnmenucontentpanel.d.tlua +52 -0
  248. package/sql.d.tlua +154 -0
  249. package/stack.d.tlua +57 -0
  250. package/steamworks.d.tlua +208 -0
  251. package/string.d.tlua +535 -0
  252. package/structures.d.tlua +4442 -0
  253. package/surface.d.tlua +463 -0
  254. package/surfaceinfo.d.tlua +70 -0
  255. package/system.d.tlua +134 -0
  256. package/table.d.tlua +533 -0
  257. package/task.d.tlua +92 -0
  258. package/team.d.tlua +195 -0
  259. package/textentry.d.tlua +12 -0
  260. package/tgaimage.d.tlua +11 -0
  261. package/timer.d.tlua +198 -0
  262. package/tool.d.tlua +466 -0
  263. package/ugcpublishwindow.d.tlua +83 -0
  264. package/umsg.d.tlua +147 -0
  265. package/undo.d.tlua +122 -0
  266. package/urllabel.d.tlua +13 -0
  267. package/usermessage.d.tlua +48 -0
  268. package/utf8.d.tlua +89 -0
  269. package/util.d.tlua +1087 -0
  270. package/vector.d.tlua +413 -0
  271. package/vehicle.d.tlua +472 -0
  272. package/vgui.d.tlua +201 -0
  273. package/video.d.tlua +17 -0
  274. package/vmatrix.d.tlua +392 -0
  275. package/weapon.d.tlua +913 -0
  276. package/weapons.d.tlua +90 -0
  277. package/widgets.d.tlua +29 -0
  278. package/workshopfilebase.d.tlua +68 -0
package/weapon.d.tlua ADDED
@@ -0,0 +1,913 @@
1
+ // AUTO-GENERATED tlua declarations. Do not edit by hand.
2
+
3
+ /**
4
+ * This is a list of all methods only available for weapons. It is also possible to call [Entity](https://wiki.facepunch.com/gmod/Entity) functions on weapons.
5
+ *
6
+ * **NOTE**: A list of available methods has been expanded in your navigation bar.
7
+ *
8
+ * @source https://wiki.facepunch.com/gmod/Weapon
9
+ */
10
+ interface Weapon extends Entity {}
11
+ interface WEAPON extends Weapon {}
12
+
13
+ interface Weapon {
14
+ /**
15
+ * Allows you to adjust the weapon's mouse sensitivity. This hook only works if you haven't overridden [GM:AdjustMouseSensitivity](https://wiki.facepunch.com/gmod/GM:AdjustMouseSensitivity).
16
+ * @realm client
17
+ * @source https://wiki.facepunch.com/gmod/WEAPON:AdjustMouseSensitivity
18
+ */
19
+ AdjustMouseSensitivity(self: Weapon, defaultSensitivity: number, localFOV: number, defaultFOV: number): number;
20
+ }
21
+
22
+ interface Weapon {
23
+ /**
24
+ * Returns how much of primary ammo the player has.
25
+ * @realm shared
26
+ * @source https://wiki.facepunch.com/gmod/WEAPON:Ammo1
27
+ */
28
+ Ammo1(self: Weapon): number;
29
+ }
30
+
31
+ interface Weapon {
32
+ /**
33
+ * Returns how much of secondary ammo the player has.
34
+ * @realm shared
35
+ * @source https://wiki.facepunch.com/gmod/WEAPON:Ammo2
36
+ */
37
+ Ammo2(self: Weapon): number;
38
+ }
39
+
40
+ interface Weapon {
41
+ /**
42
+ * Allows you to adjust player view while this weapon in use.
43
+ *
44
+ * This hook is called from the default implementation of [GM:CalcView](https://wiki.facepunch.com/gmod/GM:CalcView) which is [here](https://github.com/Facepunch/garrysmod/blob/master/garrysmod/gamemodes/base/gamemode/cl_init.lua#L387-L395). Therefore, it will not be called if any other hook added to `CalcView` returns any value, or if the current gamemode overrides the default hook and does not call the SWEP function.
45
+ *
46
+ * @realm client
47
+ * @source https://wiki.facepunch.com/gmod/WEAPON:CalcView
48
+ */
49
+ CalcView(self: Weapon, ply: Player, pos: Vector, ang: Angle, fov: number): (Vector, Angle, number);
50
+ }
51
+
52
+ interface Weapon {
53
+ /**
54
+ * Allows overriding the position and angle of the viewmodel. This hook only works if you haven't overridden [GM:CalcViewModelView](https://wiki.facepunch.com/gmod/GM:CalcViewModelView).
55
+ * @realm client
56
+ * @source https://wiki.facepunch.com/gmod/WEAPON:CalcViewModelView
57
+ */
58
+ CalcViewModelView(self: Weapon, ViewModel: Entity, OldEyePos: Vector, OldEyeAng: Angle, EyePos: Vector, EyeAng: Angle): (Vector, Angle);
59
+ }
60
+
61
+ interface Weapon {
62
+ /**
63
+ * Called when a Citizen NPC is looking around to a (better) weapon to pickup.
64
+ * @realm server
65
+ * @source https://wiki.facepunch.com/gmod/WEAPON:CanBePickedUpByNPCs
66
+ */
67
+ CanBePickedUpByNPCs(self: Weapon): boolean;
68
+ }
69
+
70
+ interface Weapon {
71
+ /**
72
+ * Helper function for checking for no ammo.
73
+ * @realm shared
74
+ * @source https://wiki.facepunch.com/gmod/WEAPON:CanPrimaryAttack
75
+ */
76
+ CanPrimaryAttack(self: Weapon): boolean;
77
+ }
78
+
79
+ interface Weapon {
80
+ /**
81
+ * Helper function for checking for no ammo.
82
+ * @realm shared
83
+ * @source https://wiki.facepunch.com/gmod/WEAPON:CanSecondaryAttack
84
+ */
85
+ CanSecondaryAttack(self: Weapon): boolean;
86
+ }
87
+
88
+ interface Weapon {
89
+ /**
90
+ * Allows you to use any numbers you want for the ammo display on the HUD.
91
+ *
92
+ * Can be useful for weapons that don't use standard ammo.
93
+ *
94
+ * @realm client
95
+ * @source https://wiki.facepunch.com/gmod/WEAPON:CustomAmmoDisplay
96
+ */
97
+ CustomAmmoDisplay(self: Weapon): table;
98
+ }
99
+
100
+ interface Weapon {
101
+ /**
102
+ * Called when player has just switched to this weapon.
103
+ *
104
+ * **NOTE**: Due to this hook being predicted, it is not called clientside in singleplayer at all, and in multiplayer it will not be called clientside if the weapon is switched with [Player:SelectWeapon](https://wiki.facepunch.com/gmod/Player:SelectWeapon) or the "use" console command, however it will be called clientside with the default weapon selection menu and when using [CUserCmd:SelectWeapon](https://wiki.facepunch.com/gmod/CUserCmd:SelectWeapon)
105
+ *
106
+ *
107
+ * @realm shared
108
+ * @source https://wiki.facepunch.com/gmod/WEAPON:Deploy
109
+ */
110
+ Deploy(self: Weapon): boolean;
111
+ }
112
+
113
+ interface Weapon {
114
+ /**
115
+ * Called when the crosshair is about to get drawn, and allows you to override it.
116
+ *
117
+ * This function will **not** be called if `SWEP.DrawCrosshair` is set to false or if player is affected by [Player:CrosshairDisable](https://wiki.facepunch.com/gmod/Player:CrosshairDisable).
118
+ *
119
+ * @realm client
120
+ * @source https://wiki.facepunch.com/gmod/WEAPON:DoDrawCrosshair
121
+ */
122
+ DoDrawCrosshair(self: Weapon, x: number, y: number): boolean;
123
+ }
124
+
125
+ interface Weapon {
126
+ /**
127
+ * This hook allows you to draw on screen while this weapon is in use.
128
+ *
129
+ * If you want to draw a custom crosshair, consider using [WEAPON:DoDrawCrosshair](https://wiki.facepunch.com/gmod/WEAPON:DoDrawCrosshair) instead.
130
+ *
131
+ * @realm client
132
+ * @source https://wiki.facepunch.com/gmod/WEAPON:DrawHUD
133
+ */
134
+ DrawHUD(self: Weapon): void;
135
+ }
136
+
137
+ interface Weapon {
138
+ /**
139
+ * This hook allows you to draw on screen while this weapon is in use. This hook is called **before** [WEAPON:DrawHUD](https://wiki.facepunch.com/gmod/WEAPON:DrawHUD) and is equivalent of [GM:HUDPaintBackground](https://wiki.facepunch.com/gmod/GM:HUDPaintBackground).
140
+ * @realm client
141
+ * @source https://wiki.facepunch.com/gmod/WEAPON:DrawHUDBackground
142
+ */
143
+ DrawHUDBackground(self: Weapon): void;
144
+ }
145
+
146
+ interface Weapon {
147
+ /**
148
+ * This hook draws the selection icon in the weapon selection menu.
149
+ * @realm client
150
+ * @source https://wiki.facepunch.com/gmod/WEAPON:DrawWeaponSelection
151
+ */
152
+ DrawWeaponSelection(self: Weapon, x: number, y: number, width: number, height: number, alpha: number): void;
153
+ }
154
+
155
+ interface Weapon {
156
+ /**
157
+ * Called when we are about to draw the opaque parts of the weapon's world model.
158
+ *
159
+ * See [WEAPON:DrawWorldModelTranslucent](https://wiki.facepunch.com/gmod/WEAPON:DrawWorldModelTranslucent) for translucent pass callback.
160
+ * See [WEAPON:ViewModelDrawn](https://wiki.facepunch.com/gmod/WEAPON:ViewModelDrawn) for view model rendering.
161
+ *
162
+ *
163
+ *
164
+ * @realm client
165
+ * @source https://wiki.facepunch.com/gmod/WEAPON:DrawWorldModel
166
+ */
167
+ DrawWorldModel(self: Weapon, flags: number): void;
168
+ }
169
+
170
+ interface Weapon {
171
+ /**
172
+ * Called when we are about to draw the translucent parts of the weapon's world model.
173
+ *
174
+ * See [WEAPON:DrawWorldModel](https://wiki.facepunch.com/gmod/WEAPON:DrawWorldModel) for opaque pass callback.
175
+ * See [WEAPON:ViewModelDrawn](https://wiki.facepunch.com/gmod/WEAPON:ViewModelDrawn) for view model rendering.
176
+ *
177
+ *
178
+ *
179
+ * @realm client
180
+ * @source https://wiki.facepunch.com/gmod/WEAPON:DrawWorldModelTranslucent
181
+ */
182
+ DrawWorldModelTranslucent(self: Weapon, flags: number): void;
183
+ }
184
+
185
+ interface Weapon {
186
+ /**
187
+ * Called when a player or NPC has picked the weapon up.
188
+ * @realm server
189
+ * @source https://wiki.facepunch.com/gmod/WEAPON:Equip
190
+ */
191
+ Equip(self: Weapon, NewOwner: Entity): void;
192
+ }
193
+
194
+ interface Weapon {
195
+ /**
196
+ * The player has picked up the weapon and has taken the ammo from it.
197
+ * The weapon will be removed immediately after this call.
198
+ *
199
+ * @realm server
200
+ * @source https://wiki.facepunch.com/gmod/WEAPON:EquipAmmo
201
+ */
202
+ EquipAmmo(self: Weapon, ply: Player): void;
203
+ }
204
+
205
+ interface Weapon {
206
+ /**
207
+ * This hook allows you to freeze players screen.
208
+ * **NOTE**: Player will still be able to move or shoot
209
+ *
210
+ *
211
+ * @realm client
212
+ * @source https://wiki.facepunch.com/gmod/WEAPON:FreezeMovement
213
+ */
214
+ FreezeMovement(self: Weapon): boolean;
215
+ }
216
+
217
+ interface Weapon {
218
+ /**
219
+ * This hook is for NPCs, you return what they should try to do with it.
220
+ * **WARNING**: Calling [NPC:CapabilitiesGet](https://wiki.facepunch.com/gmod/NPC:CapabilitiesGet) in this hook on the same entity can cause infinite loops since that function adds the result of [WEAPON:GetCapabilities](https://wiki.facepunch.com/gmod/WEAPON:GetCapabilities) on top of the return value.
221
+ *
222
+ *
223
+ * @realm server
224
+ * @source https://wiki.facepunch.com/gmod/WEAPON:GetCapabilities
225
+ */
226
+ GetCapabilities(self: Weapon): CAP;
227
+ }
228
+
229
+ interface Weapon {
230
+ /**
231
+ * Called when the weapon is used by NPCs to determine how accurate the bullets fired should be.
232
+ *
233
+ * The inaccuracy is simulated by changing the [NPC:GetAimVector](https://wiki.facepunch.com/gmod/NPC:GetAimVector) based on the value returned from this hook.
234
+ *
235
+ * @realm server
236
+ * @source https://wiki.facepunch.com/gmod/WEAPON:GetNPCBulletSpread
237
+ */
238
+ GetNPCBulletSpread(self: Weapon, proficiency: number): number;
239
+ }
240
+
241
+ interface Weapon {
242
+ /**
243
+ * Called when the weapon is used by NPCs to tell the NPC how to use this weapon. Controls how long the NPC can or should shoot continuously.
244
+ * @realm server
245
+ * @source https://wiki.facepunch.com/gmod/WEAPON:GetNPCBurstSettings
246
+ */
247
+ GetNPCBurstSettings(self: Weapon): (number, number, number);
248
+ }
249
+
250
+ interface Weapon {
251
+ /**
252
+ * Called when the weapon is used by NPCs to tell the NPC how to use this weapon. Controls amount of time the NPC can rest (not shoot) between bursts.
253
+ * @realm server
254
+ * @source https://wiki.facepunch.com/gmod/WEAPON:GetNPCRestTimes
255
+ */
256
+ GetNPCRestTimes(self: Weapon): (number, number);
257
+ }
258
+
259
+ interface Weapon {
260
+ /**
261
+ * Allows you to override where the tracer effect comes from. ( Visual bullets )
262
+ * @realm client
263
+ * @source https://wiki.facepunch.com/gmod/WEAPON:GetTracerOrigin
264
+ */
265
+ GetTracerOrigin(self: Weapon): Vector;
266
+ }
267
+
268
+ interface Weapon {
269
+ /**
270
+ * This hook allows you to adjust view model position and angles.
271
+ * @realm client
272
+ * @source https://wiki.facepunch.com/gmod/WEAPON:GetViewModelPosition
273
+ */
274
+ GetViewModelPosition(self: Weapon, EyePos: Vector, EyeAng: Angle): (Vector, Angle);
275
+ }
276
+
277
+ interface Weapon {
278
+ /**
279
+ * This hook determines which parts of the HUD to draw.
280
+ * @realm client
281
+ * @source https://wiki.facepunch.com/gmod/WEAPON:HUDShouldDraw
282
+ */
283
+ HUDShouldDraw(self: Weapon, element: string): boolean;
284
+ }
285
+
286
+ interface Weapon {
287
+ /**
288
+ * Called when the weapon tries to holster. Return true to allow the weapon to
289
+ * holster. This has no effect if the weapon was switched away from using
290
+ * Player:SetActiveWeapon.
291
+ * @hook Holster
292
+ * @realm shared
293
+ * @source https://wiki.facepunch.com/gmod/WEAPON:Holster
294
+ */
295
+ Holster(self: Weapon, weapon?: Weapon): boolean;
296
+ }
297
+
298
+
299
+ interface Weapon {
300
+ /**
301
+ * Called internally during `TASK_RANGE_ATTACK1 --> OnRangeAttack1`. This allows you to separate your SWEPs primary firing function from players and NPCs.
302
+ *
303
+ * To get the delay the NPC will fire again, you can call `self:GetOwner():GetInternalVariable("m_flNextAttack")`
304
+ *
305
+ * **NOTE**: This hook is called internally only for NPCs that has `CAP_USE_SHOT_REGULATOR` set.
306
+ *
307
+ *
308
+ * @realm server
309
+ * @source https://wiki.facepunch.com/gmod/WEAPON:NPCShoot_Primary
310
+ */
311
+ NPCShoot_Primary(self: Weapon, shootPos?: Vector, shootDir?: Vector): void;
312
+ }
313
+
314
+ interface Weapon {
315
+ /**
316
+ * A utility function to seperate your SWEPs secondary firing from players.
317
+ *
318
+ * Unlike [WEAPON:NPCShoot_Primary](https://wiki.facepunch.com/gmod/WEAPON:NPCShoot_Primary), this won't be called by the engine for `TASK_RANGE_ATTACK2`.
319
+ *
320
+ *
321
+ * @realm server
322
+ * @source https://wiki.facepunch.com/gmod/WEAPON:NPCShoot_Secondary
323
+ */
324
+ NPCShoot_Secondary(self: Weapon, shootPos?: Vector, shootDir?: Vector): void;
325
+ }
326
+
327
+ interface Weapon {
328
+ /**
329
+ * Called when weapon is dropped by [Player:DropWeapon](https://wiki.facepunch.com/gmod/Player:DropWeapon).
330
+ *
331
+ * See also [WEAPON:OwnerChanged](https://wiki.facepunch.com/gmod/WEAPON:OwnerChanged).
332
+ *
333
+ * @realm server
334
+ * @source https://wiki.facepunch.com/gmod/WEAPON:OnDrop
335
+ */
336
+ OnDrop(self: Weapon, owner: Entity): void;
337
+ }
338
+
339
+ interface Weapon {
340
+ /**
341
+ * Called when weapon is dropped or picked up by a new player. This can be called clientside for all players on the server if the weapon has no owner and is picked up.
342
+ *
343
+ * See also [WEAPON:OnDrop](https://wiki.facepunch.com/gmod/WEAPON:OnDrop).
344
+ *
345
+ * @realm shared
346
+ * @source https://wiki.facepunch.com/gmod/WEAPON:OwnerChanged
347
+ */
348
+ OwnerChanged(self: Weapon): void;
349
+ }
350
+
351
+ interface Weapon {
352
+ /**
353
+ * Called after the view model has been drawn while the weapon in use.
354
+ *
355
+ * This hook relies on default implementation of [GM:PostDrawViewModel](https://wiki.facepunch.com/gmod/GM:PostDrawViewModel). If it appears to not work, it may have been overwritten/broken by the currently active gamemode or other addons.
356
+ *
357
+ * [WEAPON:ViewModelDrawn](https://wiki.facepunch.com/gmod/WEAPON:ViewModelDrawn) is an alternative hook which is always called before [GM:PostDrawViewModel](https://wiki.facepunch.com/gmod/GM:PostDrawViewModel).
358
+ *
359
+ * See also [WEAPON:PreDrawViewModel](https://wiki.facepunch.com/gmod/WEAPON:PreDrawViewModel).
360
+ *
361
+ *
362
+ *
363
+ *
364
+ * @realm client
365
+ * @source https://wiki.facepunch.com/gmod/WEAPON:PostDrawViewModel
366
+ */
367
+ PostDrawViewModel(self: Weapon, vm: Entity, weapon: Weapon, ply: Player, flags: number): void;
368
+ }
369
+
370
+ interface Weapon {
371
+ /**
372
+ * Allows you to modify viewmodel while the weapon in use before it is drawn.
373
+ *
374
+ * This hook relies on default implementation of [GM:PreDrawViewModel](https://wiki.facepunch.com/gmod/GM:PreDrawViewModel). If it appears to not work, it may have been overwritten/broken by the currently active gamemode or other addons.
375
+ *
376
+ * See also [WEAPON:ViewModelDrawn](https://wiki.facepunch.com/gmod/WEAPON:ViewModelDrawn) and [WEAPON:PostDrawViewModel](https://wiki.facepunch.com/gmod/WEAPON:PostDrawViewModel).
377
+ *
378
+ *
379
+ *
380
+ * @realm client
381
+ * @source https://wiki.facepunch.com/gmod/WEAPON:PreDrawViewModel
382
+ */
383
+ PreDrawViewModel(self: Weapon, vm: Entity, weapon: Weapon, ply: Player, flags: number): boolean;
384
+ }
385
+
386
+ interface Weapon {
387
+ /**
388
+ * Called when primary attack button ( +attack ) is pressed.
389
+ *
390
+ * When in singleplayer, this function is only called in the server realm. When in multiplayer, the hook will be called on both the server and the client in order to allow for [Prediction](https://wiki.facepunch.com/gmod/Prediction).
391
+ *
392
+ * You can force the hook to always be called on client like this:
393
+ *
394
+ * ```
395
+ * if ( game.SinglePlayer() ) then self:CallOnClient( "PrimaryAttack" ) end
396
+ * ```
397
+ *
398
+ *
399
+ * Note that due to prediction, in multiplayer SWEP:PrimaryAttack is called multiple times per one "shot" with the gun. To work around that, use [Global.IsFirstTimePredicted](https://wiki.facepunch.com/gmod/Global.IsFirstTimePredicted).
400
+ *
401
+ * @realm shared
402
+ * @source https://wiki.facepunch.com/gmod/WEAPON:PrimaryAttack
403
+ */
404
+ PrimaryAttack(self: Weapon): void;
405
+ }
406
+
407
+ interface Weapon {
408
+ /**
409
+ * A convenience function that draws the weapon info box, used in [WEAPON:DrawWeaponSelection](https://wiki.facepunch.com/gmod/WEAPON:DrawWeaponSelection).
410
+ * @realm client
411
+ * @source https://wiki.facepunch.com/gmod/WEAPON:PrintWeaponInfo
412
+ */
413
+ PrintWeaponInfo(self: Weapon, x: number, y: number, alpha: number): void;
414
+ }
415
+
416
+ interface Weapon {
417
+ /**
418
+ * Called when the reload key ( +reload ) is pressed.
419
+ * @realm shared
420
+ * @source https://wiki.facepunch.com/gmod/WEAPON:Reload
421
+ */
422
+ Reload(self: Weapon): void;
423
+ }
424
+
425
+ interface Weapon {
426
+ /**
427
+ * Called every frame just before [GM:RenderScene](https://wiki.facepunch.com/gmod/GM:RenderScene).
428
+ *
429
+ * Used by the Tool Gun to render view model screens ([TOOL:DrawToolScreen](https://wiki.facepunch.com/gmod/TOOL:DrawToolScreen)).
430
+ *
431
+ *
432
+ * **NOTE**: Materials rendered in this hook require $ignorez parameter to draw properly.
433
+ *
434
+ *
435
+ * @realm client
436
+ * @source https://wiki.facepunch.com/gmod/WEAPON:RenderScreen
437
+ */
438
+ RenderScreen(self: Weapon): void;
439
+ }
440
+
441
+ interface Weapon {
442
+ /**
443
+ * Called when secondary attack button ( +attack2 ) is pressed.
444
+ *
445
+ * For issues with this hook being called rapidly on the client side, see the global function [Global.IsFirstTimePredicted](https://wiki.facepunch.com/gmod/Global.IsFirstTimePredicted).
446
+ *
447
+ * @realm shared
448
+ * @source https://wiki.facepunch.com/gmod/WEAPON:SecondaryAttack
449
+ */
450
+ SecondaryAttack(self: Weapon): void;
451
+ }
452
+
453
+ interface Weapon {
454
+ /**
455
+ * Sets the weapon deploy speed. This value needs to match on client and server.
456
+ * @realm shared
457
+ * @source https://wiki.facepunch.com/gmod/WEAPON:SetDeploySpeed
458
+ */
459
+ SetDeploySpeed(self: Weapon, speed: number): void;
460
+ }
461
+
462
+ interface Weapon {
463
+ /**
464
+ * Sets the hold type of the weapon. This must be called on **both** the server and the client to work properly.
465
+ *
466
+ * **NOTE**: You should avoid calling this function and call [Weapon:SetHoldType](https://wiki.facepunch.com/gmod/Weapon:SetHoldType) now.
467
+ *
468
+ *
469
+ * @realm shared
470
+ * @source https://wiki.facepunch.com/gmod/WEAPON:SetWeaponHoldType
471
+ */
472
+ SetWeaponHoldType(self: Weapon, name: string): void;
473
+ }
474
+
475
+ interface Weapon {
476
+ /**
477
+ * A convenient function to shoot bullets.
478
+ * @realm shared
479
+ * @source https://wiki.facepunch.com/gmod/WEAPON:ShootBullet
480
+ */
481
+ ShootBullet(self: Weapon, damage: number, num_bullets: number, aimcone: number, ammo_type?: string, force?: number, tracer?: number): void;
482
+ }
483
+
484
+ interface Weapon {
485
+ /**
486
+ * A convenience function to create shoot effects.
487
+ * @realm shared
488
+ * @source https://wiki.facepunch.com/gmod/WEAPON:ShootEffects
489
+ */
490
+ ShootEffects(self: Weapon): void;
491
+ }
492
+
493
+ interface Weapon {
494
+ /**
495
+ * Called to determine if the view model should be drawn or not.
496
+ * @realm client
497
+ * @source https://wiki.facepunch.com/gmod/WEAPON:ShouldDrawViewModel
498
+ */
499
+ ShouldDrawViewModel(self: Weapon): boolean;
500
+ }
501
+
502
+ interface Weapon {
503
+ /**
504
+ * Should this weapon be dropped when its owner dies?
505
+ *
506
+ * This only works if the player has [Player:ShouldDropWeapon](https://wiki.facepunch.com/gmod/Player:ShouldDropWeapon) set to true.
507
+ *
508
+ * @realm server
509
+ * @source https://wiki.facepunch.com/gmod/WEAPON:ShouldDropOnDie
510
+ */
511
+ ShouldDropOnDie(self: Weapon): boolean;
512
+ }
513
+
514
+ interface Weapon {
515
+ /**
516
+ * A convenience function to remove primary ammo from clip.
517
+ * @realm shared
518
+ * @source https://wiki.facepunch.com/gmod/WEAPON:TakePrimaryAmmo
519
+ */
520
+ TakePrimaryAmmo(self: Weapon, amount: number): void;
521
+ }
522
+
523
+ interface Weapon {
524
+ /**
525
+ * A convenience function to remove secondary ammo from clip.
526
+ * @realm shared
527
+ * @source https://wiki.facepunch.com/gmod/WEAPON:TakeSecondaryAmmo
528
+ */
529
+ TakeSecondaryAmmo(self: Weapon, amount: number): void;
530
+ }
531
+
532
+ interface Weapon {
533
+ /**
534
+ * Alias of [Weapon:Think](https://wiki.facepunch.com/gmod/Weapon:Think).
535
+ *
536
+ * @realm shared
537
+ * @source https://wiki.facepunch.com/gmod/WEAPON:Tick
538
+ * @deprecated Use Weapon:Think instead.
539
+ */
540
+ Tick(self: Weapon): void;
541
+ }
542
+
543
+ interface Weapon {
544
+ /**
545
+ * Allows to change players field of view while player holds the weapon.
546
+ *
547
+ * **NOTE**: This hook must be defined shared and return same value on both to properly affect Area Portals.
548
+ *
549
+ *
550
+ * @realm shared
551
+ * @source https://wiki.facepunch.com/gmod/WEAPON:TranslateFOV
552
+ */
553
+ TranslateFOV(self: Weapon, fov: number): number;
554
+ }
555
+
556
+ interface Weapon {
557
+ /**
558
+ * Called straight after the view model has been drawn. This is called before [GM:PostDrawViewModel](https://wiki.facepunch.com/gmod/GM:PostDrawViewModel) and [WEAPON:PostDrawViewModel](https://wiki.facepunch.com/gmod/WEAPON:PostDrawViewModel).
559
+ *
560
+ * See [WEAPON:DrawWorldModel](https://wiki.facepunch.com/gmod/WEAPON:DrawWorldModel) for world model rendering.
561
+ *
562
+ * See also [WEAPON:PreDrawViewModel](https://wiki.facepunch.com/gmod/WEAPON:PreDrawViewModel) and [WEAPON:PostDrawViewModel](https://wiki.facepunch.com/gmod/WEAPON:PostDrawViewModel).
563
+ *
564
+ *
565
+ *
566
+ * @realm client
567
+ * @source https://wiki.facepunch.com/gmod/WEAPON:ViewModelDrawn
568
+ */
569
+ ViewModelDrawn(self: Weapon, ViewModel: Entity, flags: number): void;
570
+ }
571
+
572
+ interface Weapon {
573
+ /**
574
+ * Returns whether the weapon allows to being switched from when a better ( [Weapon:GetWeight](https://wiki.facepunch.com/gmod/Weapon:GetWeight) ) weapon is being picked up.
575
+ * @realm shared
576
+ * @source https://wiki.facepunch.com/gmod/Weapon:AllowsAutoSwitchFrom
577
+ */
578
+ AllowsAutoSwitchFrom(self: Weapon): boolean;
579
+ }
580
+
581
+ interface Weapon {
582
+ /**
583
+ * Returns whether the weapon allows to being switched to when a better ([Weapon:GetWeight](https://wiki.facepunch.com/gmod/Weapon:GetWeight)) weapon is being picked up.
584
+ * @realm shared
585
+ * @source https://wiki.facepunch.com/gmod/Weapon:AllowsAutoSwitchTo
586
+ */
587
+ AllowsAutoSwitchTo(self: Weapon): boolean;
588
+ }
589
+
590
+ interface Weapon {
591
+ /**
592
+ * Calls a SWEP function on client. Does nothing on client.
593
+ *
594
+ * **WARNING**: This uses the [usermessage](https://wiki.facepunch.com/gmod/usermessage) internally, because of that, the combined length of the arguments of this function may not exceed 254 bytes/characters or the function will cease to function!
595
+ *
596
+ *
597
+ * @realm shared
598
+ * @source https://wiki.facepunch.com/gmod/Weapon:CallOnClient
599
+ */
600
+ CallOnClient(self: Weapon, functionName: string, data?: string): void;
601
+ }
602
+
603
+ interface Weapon {
604
+ /**
605
+ * Returns how much primary ammo is in the magazine.
606
+ * **NOTE**: This is not shared between clients and will instead return the maximum primary clip size.
607
+ *
608
+ *
609
+ * @realm shared
610
+ * @source https://wiki.facepunch.com/gmod/Weapon:Clip1
611
+ */
612
+ Clip1(self: Weapon): number;
613
+ }
614
+
615
+ interface Weapon {
616
+ /**
617
+ * Returns how much secondary ammo is in the magazine.
618
+ * **NOTE**: This is not shared between clients and will instead return the maximum secondary clip size.
619
+ *
620
+ *
621
+ * @realm shared
622
+ * @source https://wiki.facepunch.com/gmod/Weapon:Clip2
623
+ */
624
+ Clip2(self: Weapon): number;
625
+ }
626
+
627
+ interface Weapon {
628
+ /**
629
+ * Forces the weapon to reload while playing given animation.
630
+ * **NOTE**: This will stop the [Weapon:Think](https://wiki.facepunch.com/gmod/Weapon:Think) function from getting called while the weapon is reloading!
631
+ *
632
+ *
633
+ * @realm shared
634
+ * @source https://wiki.facepunch.com/gmod/Weapon:DefaultReload
635
+ */
636
+ DefaultReload(self: Weapon, act: number): boolean;
637
+ }
638
+
639
+ interface Weapon {
640
+ /**
641
+ * Returns the sequence enumeration number that the weapon is playing.
642
+ *
643
+ * This can return inconsistent results between the server and client.
644
+ *
645
+ * @realm shared
646
+ * @source https://wiki.facepunch.com/gmod/Weapon:GetActivity
647
+ */
648
+ GetActivity(self: Weapon): number;
649
+ }
650
+
651
+ interface Weapon {
652
+ /**
653
+ * Returns the weapon deploy speed, as set by [Weapon:SetDeploySpeed](https://wiki.facepunch.com/gmod/Weapon:SetDeploySpeed). If not previously set, the value will be polled from the `sv_defaultdeployspeed` [ConVar](https://wiki.facepunch.com/gmod/ConVar).
654
+ * @realm shared
655
+ * @source https://wiki.facepunch.com/gmod/Weapon:GetDeploySpeed
656
+ */
657
+ GetDeploySpeed(self: Weapon): number;
658
+ }
659
+
660
+ interface Weapon {
661
+ /**
662
+ * Returns the hold type of the weapon.
663
+ * @realm shared
664
+ * @source https://wiki.facepunch.com/gmod/Weapon:GetHoldType
665
+ */
666
+ GetHoldType(self: Weapon): string;
667
+ }
668
+
669
+ interface Weapon {
670
+ /**
671
+ * Returns maximum primary clip size
672
+ * @realm shared
673
+ * @source https://wiki.facepunch.com/gmod/Weapon:GetMaxClip1
674
+ */
675
+ GetMaxClip1(self: Weapon): number;
676
+ }
677
+
678
+ interface Weapon {
679
+ /**
680
+ * Returns maximum secondary clip size
681
+ * @realm shared
682
+ * @source https://wiki.facepunch.com/gmod/Weapon:GetMaxClip2
683
+ */
684
+ GetMaxClip2(self: Weapon): number;
685
+ }
686
+
687
+ interface Weapon {
688
+ /**
689
+ * Gets the next time the weapon can primary fire. ( Can call [WEAPON:PrimaryAttack](https://wiki.facepunch.com/gmod/WEAPON:PrimaryAttack) )
690
+ * @realm shared
691
+ * @source https://wiki.facepunch.com/gmod/Weapon:GetNextPrimaryFire
692
+ */
693
+ GetNextPrimaryFire(self: Weapon): number;
694
+ }
695
+
696
+ interface Weapon {
697
+ /**
698
+ * Gets the next time the weapon can secondary fire. ( Can call [WEAPON:SecondaryAttack](https://wiki.facepunch.com/gmod/WEAPON:SecondaryAttack) )
699
+ * @realm shared
700
+ * @source https://wiki.facepunch.com/gmod/Weapon:GetNextSecondaryFire
701
+ */
702
+ GetNextSecondaryFire(self: Weapon): number;
703
+ }
704
+
705
+ interface Weapon {
706
+ /**
707
+ * Gets the primary ammo type of the given weapon.
708
+ * @realm shared
709
+ * @source https://wiki.facepunch.com/gmod/Weapon:GetPrimaryAmmoType
710
+ */
711
+ GetPrimaryAmmoType(self: Weapon): number;
712
+ }
713
+
714
+ interface Weapon {
715
+ /**
716
+ * Returns the non-internal name of the weapon, that should be for displaying.
717
+ *
718
+ * **NOTE**: If that returns an untranslated message (#HL2_XX), use [language.GetPhrase](https://wiki.facepunch.com/gmod/language.GetPhrase) to see the "nice" name.
719
+ *
720
+ * **NOTE**: If SWEP.PrintName is not set in the Weapon or the Weapon Base then "" will be returned.
721
+ *
722
+ *
723
+ * @realm shared
724
+ * @source https://wiki.facepunch.com/gmod/Weapon:GetPrintName
725
+ */
726
+ GetPrintName(self: Weapon): string;
727
+ }
728
+
729
+ interface Weapon {
730
+ /**
731
+ * Gets the ammo type of the given weapons secondary fire.
732
+ * @realm shared
733
+ * @source https://wiki.facepunch.com/gmod/Weapon:GetSecondaryAmmoType
734
+ */
735
+ GetSecondaryAmmoType(self: Weapon): number;
736
+ }
737
+
738
+ interface Weapon {
739
+ /**
740
+ * Returns the slot of the weapon.
741
+ * **NOTE**: The slot numbers start from 0.
742
+ *
743
+ * @realm shared
744
+ * @source https://wiki.facepunch.com/gmod/Weapon:GetSlot
745
+ */
746
+ GetSlot(self: Weapon): number;
747
+ }
748
+
749
+ interface Weapon {
750
+ /**
751
+ * Returns slot position of the weapon
752
+ * @realm shared
753
+ * @source https://wiki.facepunch.com/gmod/Weapon:GetSlotPos
754
+ */
755
+ GetSlotPos(self: Weapon): number;
756
+ }
757
+
758
+ interface Weapon {
759
+ /**
760
+ * Returns the view model of the weapon.
761
+ * @realm shared
762
+ * @source https://wiki.facepunch.com/gmod/Weapon:GetWeaponViewModel
763
+ */
764
+ GetWeaponViewModel(self: Weapon): string;
765
+ }
766
+
767
+ interface Weapon {
768
+ /**
769
+ * Returns the world model of the weapon.
770
+ * @realm shared
771
+ * @source https://wiki.facepunch.com/gmod/Weapon:GetWeaponWorldModel
772
+ */
773
+ GetWeaponWorldModel(self: Weapon): string;
774
+ }
775
+
776
+ interface Weapon {
777
+ /**
778
+ * Returns the "weight" of the weapon, which is used when deciding which [Weapon](https://wiki.facepunch.com/gmod/Weapon) is better by the engine.
779
+ * @realm shared
780
+ * @source https://wiki.facepunch.com/gmod/Weapon:GetWeight
781
+ */
782
+ GetWeight(self: Weapon): number;
783
+ }
784
+
785
+ interface Weapon {
786
+ /**
787
+ * Returns whether the weapon has ammo left or not. It will return false when there's no ammo left in the magazine **and** when there's no reserve ammo left.
788
+ *
789
+ * **NOTE**: This will return true for weapons like crowbar, gravity gun, etc.
790
+ *
791
+ *
792
+ * @realm shared
793
+ * @source https://wiki.facepunch.com/gmod/Weapon:HasAmmo
794
+ */
795
+ HasAmmo(self: Weapon): boolean;
796
+ }
797
+
798
+ interface Weapon {
799
+ /**
800
+ * Returns whenever the weapon is carried by the local player.
801
+ * @realm client
802
+ * @source https://wiki.facepunch.com/gmod/Weapon:IsCarriedByLocalPlayer
803
+ */
804
+ IsCarriedByLocalPlayer(self: Weapon): boolean;
805
+ }
806
+
807
+ interface Weapon {
808
+ /**
809
+ * Returns whether the weapon is visible. The term visibility is not exactly what gets checked here, first it checks if the owner is a player, then checks if the active view model has EF_NODRAW flag NOT set.
810
+ * @realm shared
811
+ * @source https://wiki.facepunch.com/gmod/Weapon:IsWeaponVisible
812
+ */
813
+ IsWeaponVisible(self: Weapon): boolean;
814
+ }
815
+
816
+ interface Weapon {
817
+ /**
818
+ * Returns the time since this weapon last fired a bullet with [Entity:FireBullets](https://wiki.facepunch.com/gmod/Entity:FireBullets) in seconds. It is not networked.
819
+ * @realm shared
820
+ * @source https://wiki.facepunch.com/gmod/Weapon:LastShootTime
821
+ */
822
+ LastShootTime(self: Weapon): number;
823
+ }
824
+
825
+ interface Weapon {
826
+ /**
827
+ * Forces weapon to play activity/animation.
828
+ * @realm shared
829
+ * @source https://wiki.facepunch.com/gmod/Weapon:SendWeaponAnim
830
+ */
831
+ SendWeaponAnim(self: Weapon, act: number): void;
832
+ }
833
+
834
+ interface Weapon {
835
+ /**
836
+ * Sets the activity the weapon is playing.
837
+ *
838
+ * See also [Weapon:GetActivity](https://wiki.facepunch.com/gmod/Weapon:GetActivity).
839
+ *
840
+ * @realm shared
841
+ * @source https://wiki.facepunch.com/gmod/Weapon:SetActivity
842
+ */
843
+ SetActivity(self: Weapon, act: number): void;
844
+ }
845
+
846
+ interface Weapon {
847
+ /**
848
+ * Lets you change the number of bullets in the given weapons primary clip.
849
+ * @realm shared
850
+ * @source https://wiki.facepunch.com/gmod/Weapon:SetClip1
851
+ */
852
+ SetClip1(self: Weapon, ammo: number): void;
853
+ }
854
+
855
+ interface Weapon {
856
+ /**
857
+ * Lets you change the number of bullets in the given weapons secondary clip.
858
+ * @realm shared
859
+ * @source https://wiki.facepunch.com/gmod/Weapon:SetClip2
860
+ */
861
+ SetClip2(self: Weapon, ammo: number): void;
862
+ }
863
+
864
+ interface Weapon {
865
+ /**
866
+ * Sets the hold type of the weapon. This function also calls [WEAPON:SetWeaponHoldType](https://wiki.facepunch.com/gmod/WEAPON:SetWeaponHoldType) and properly networks it to all clients.
867
+ *
868
+ * **NOTE**: This only works on scripted weapons.
869
+ *
870
+ *
871
+ * Using this function on weapons held by bots will not network holdtype changes to clients if the world model is set to an empty string (SWEP.WorldModel = "").
872
+ *
873
+ * @realm shared
874
+ * @source https://wiki.facepunch.com/gmod/Weapon:SetHoldType
875
+ */
876
+ SetHoldType(self: Weapon, name: string): void;
877
+ }
878
+
879
+ interface Weapon {
880
+ /**
881
+ * Sets the time since this weapon last fired in seconds. Used in conjunction with [Weapon:LastShootTime](https://wiki.facepunch.com/gmod/Weapon:LastShootTime).
882
+ *
883
+ * This value is **not** networked to the client if set from server.
884
+ *
885
+ * @realm shared
886
+ * @source https://wiki.facepunch.com/gmod/Weapon:SetLastShootTime
887
+ */
888
+ SetLastShootTime(self: Weapon, time?: number): void;
889
+ }
890
+
891
+ interface Weapon {
892
+ /**
893
+ * Sets when the weapon can fire again. Time should be based on [Global.CurTime](https://wiki.facepunch.com/gmod/Global.CurTime).
894
+ *
895
+ * **NOTE**: The standard HL2 Pistol (`weapon_pistol`) bypasses this function due to an [internal implementation](https://github.com/ValveSoftware/source-sdk-2013/blob/master/src/game/server/hl2/weapon_pistol.cpp#L313-L317).
896
+ *
897
+ * This will fire extra bullets if the time is set to less than [Global.CurTime](https://wiki.facepunch.com/gmod/Global.CurTime).
898
+ *
899
+ * @realm shared
900
+ * @source https://wiki.facepunch.com/gmod/Weapon:SetNextPrimaryFire
901
+ */
902
+ SetNextPrimaryFire(self: Weapon, time: number): void;
903
+ }
904
+
905
+ interface Weapon {
906
+ /**
907
+ * Sets when the weapon can alt-fire again. Time should be based on [Global.CurTime](https://wiki.facepunch.com/gmod/Global.CurTime).
908
+ * @realm shared
909
+ * @source https://wiki.facepunch.com/gmod/Weapon:SetNextSecondaryFire
910
+ */
911
+ SetNextSecondaryFire(self: Weapon, time: number): void;
912
+ }
913
+