Обновить Lua API

pavetr
2026-09-02 17:18:44 +00:00
parent 0ec8d5242f
commit 5583ba186e

@@ -210,3 +210,48 @@ tab = fatal.menu_tab("My Script 3")
How it looks in game:
<br/>
![User view](https://dev.pavetr.ru/uploads/fatal_docs/fatal_menu_interaction.png)
### ``fatal.draw.line(x1, y1, x2, y2, r, g, b, a, [thickness])``
### ``fatal.draw.rect(x, y, w, h, r, g, b, a)``
### ``fatal.draw.rect_filled(x, y, w, h, r, g, b, a)``
### ``fatal.draw.circle(cx, cy, radius, r, g, b, a, [thickness])``
### ``fatal.draw.circle_filled(cx, cy, radius, r, g, b, a)``
### ``fatal.draw.text(x, y, text, r, g, b, a)``
### ``fatal.draw.clear()``
**Example**
```lua
hook.Remove("Think", "fatal_demo_draw")
hook.Add("Think", "fatal_demo_draw", function()
local t = RealTime()
-- Line: x1, y1, x2, y2, r, g, b, a [, thickness]
fatal.draw.line(100, 100, 500, 300, 1, 0, 0, 1, 2)
-- Running line
local x = 100 + (t * 60 % 400)
fatal.draw.line(x, 180, x + 80, 180, 0, 1, 0, 0.8, 1)
-- Rect outline: x, y, w, h, r, g, b, a
fatal.draw.rect(200, 220, 150, 80, 1, 1, 1, 1)
-- Rect fill
fatal.draw.rect_filled(420, 60, 90, 30, 0.2, 0.6, 1, 0.5)
-- Circle outline: cx, cy, radius, r, g, b, a [, thickness]
fatal.draw.circle(650, 300, 40, 1, 1, 0, 1, 2)
-- Circle fill
fatal.draw.circle_filled(720, 200, 15, 0, 1, 0, 0.6)
-- Text: x, y, text, r, g, b, a
fatal.draw.text(100, 260, "fatal.draw works", 1, 1, 1, 1)
-- Manually clear buffer (not necessary - it clears by itself)
-- fatal.draw.clear()
end)
```
How it looks in game (it's unscreengrabable because draws in overlay):
<br/>
![User view](https://dev.pavetr.ru/uploads/fatal_docs/fatal_draw_overlay.png)