File tree Expand file tree Collapse file tree 1 file changed +79
-0
lines changed
pages/ox_lib/Modules/Grid Expand file tree Collapse file tree 1 file changed +79
-0
lines changed Original file line number Diff line number Diff line change 1+ # Shared
2+
3+ A system that divides the map into smaller 2D cells. Entries in a cell can be added, removed, and listed.
4+
5+ ## GridEntry Class
6+
7+ A table representing a grid entry with the following properties.
8+
9+ - coords: ` vector `
10+ - length?: ` number `
11+ - width?: ` number `
12+ - radius?: ` number `
13+
14+ ## lib.grid.getCellPosition
15+
16+ Returns the position of the cell at the given point.
17+
18+ ``` lua
19+ lib .grid .getCellPosition (point )
20+ ```
21+
22+ - point: ` vector `
23+
24+ ** Returns:**
25+ - x: ` number `
26+ - y: ` number `
27+
28+ ## lib.grid.getCell
29+
30+ Returns all entries in the cell that belongs to the point.
31+
32+ ``` lua
33+ lib .grid .getCell (point )
34+ ```
35+
36+ - point: ` vector `
37+
38+ ** Returns:**
39+ - entries: ` GridEntry[] `
40+
41+ ## lib.grid.getNearbyEntries
42+
43+ Returns all entries near the point with an optional filter
44+
45+ ``` lua
46+ lib .grid .getNearbyEntries (point , filter )
47+ ```
48+
49+ - point: ` vector `
50+ - filter: ` function(entry: GridEntry): boolean `
51+
52+ ** Returns:**
53+
54+ - entries: ` Array<GridEntry> `
55+
56+ ## lib.grid.addEntry
57+
58+ Adds an entry to the grid
59+
60+
61+ ``` lua
62+ lib .grid .addEntry (entry )
63+ ```
64+
65+ - entry: ` GridEntry `
66+
67+ ## lib.grid.removeEntry
68+
69+ Removes and entry that was previously added to the grid
70+
71+ ``` lua
72+ lib .grid .removeEntry (entry )
73+ ```
74+
75+ - entry: ` GridEntry `
76+
77+ ** Returns:**
78+
79+ - success: ` boolean `
You can’t perform that action at this time.
0 commit comments