Skip to content

Commit 8c87ded

Browse files
committed
scripting: add render flags documentation
1 parent 1f14c16 commit 8c87ded

File tree

2 files changed

+176
-0
lines changed

2 files changed

+176
-0
lines changed

scripts/docs/api/classes/chunk.md

+116
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,21 @@ Represents a chunk in the world
1919
- [clear\_colors](chunk.md#clear_colors)
2020
- [clear\_textures](chunk.md#clear_textures)
2121
- [get\_area\_id](chunk.md#get_area_id)
22+
- [get\_deep\_flag](chunk.md#get_deep_flag)
23+
- [get\_deep\_flag\_high](chunk.md#get_deep_flag_high)
2224
- [get\_effect](chunk.md#get_effect)
25+
- [get\_fishable\_flag](chunk.md#get_fishable_flag)
26+
- [get\_fishable\_flag\_high](chunk.md#get_fishable_flag_high)
2327
- [get\_tex](chunk.md#get_tex)
2428
- [get\_texture](chunk.md#get_texture)
2529
- [get\_texture\_count](chunk.md#get_texture_count)
2630
- [get\_vert](chunk.md#get_vert)
31+
- [has\_render\_flags](chunk.md#has_render_flags)
2732
- [remove\_texture](chunk.md#remove_texture)
2833
- [set\_area\_id](chunk.md#set_area_id)
34+
- [set\_deep\_flag](chunk.md#set_deep_flag)
2935
- [set\_effect](chunk.md#set_effect)
36+
- [set\_fishable\_flag](chunk.md#set_fishable_flag)
3037
- [set\_hole](chunk.md#set_hole)
3138
- [set\_impassable](chunk.md#set_impassable)
3239
- [to\_selection](chunk.md#to_selection)
@@ -142,6 +149,35 @@ Returns the area id of a chunk
142149

143150
___
144151

152+
### get\_deep\_flag
153+
154+
**get_deep_flag**(): *number*
155+
156+
Returns the lower bits of the deep flag
157+
for the water in this chunk.
158+
159+
If chunk has no render data, 0 is returned
160+
161+
**`note`** Only contains the lower 32 bits.
162+
For the higher bits, use get_fishable_flag_high
163+
164+
**Returns:** *number*
165+
166+
___
167+
168+
### get\_deep\_flag\_high
169+
170+
**get_deep_flag_high**(): *number*
171+
172+
Returns the higher bits of the fishable flag
173+
for the water in this chunk.
174+
175+
If chunk has no render data, 0 is returned
176+
177+
**Returns:** *number*
178+
179+
___
180+
145181
### get\_effect
146182

147183
**get_effect**(`layer`: *number*): *number*
@@ -158,6 +194,35 @@ Name | Type |
158194

159195
___
160196

197+
### get\_fishable\_flag
198+
199+
**get_fishable_flag**(): *number*
200+
201+
Returns the lower bits of the fishable flag
202+
for the water in this chunk.
203+
204+
If chunk has no render data, 0xffffffff is returned
205+
206+
**`note`** Only contains the lower 32 bits.
207+
For the higher bits, use get_fishable_flag_high
208+
209+
**Returns:** *number*
210+
211+
___
212+
213+
### get\_fishable\_flag\_high
214+
215+
**get_fishable_flag_high**(): *number*
216+
217+
Returns the higher bits of the fishable flag
218+
for the water in this chunk.
219+
220+
If chunk has no render data, 0xffffffff is returned
221+
222+
**Returns:** *number*
223+
224+
___
225+
161226
### get\_tex
162227

163228
**get_tex**(`index`: *number*): [*tex*](tex.md)
@@ -216,6 +281,16 @@ Name | Type | Description |
216281

217282
___
218283

284+
### has\_render\_flags
285+
286+
**has_render_flags**(): *any*
287+
288+
Returns true if the water in this chunk has deep/fishable flag data.
289+
290+
**Returns:** *any*
291+
292+
___
293+
219294
### remove\_texture
220295

221296
**remove_texture**(`index`: *number*): *void*
@@ -249,6 +324,27 @@ Name | Type |
249324

250325
___
251326

327+
### set\_deep\_flag
328+
329+
**set_deep_flag**(`low`: *number*, `high?`: *number*): *void*
330+
331+
Sets the deep flags for the water in this chunk.
332+
If the first bit is set (it is for value=1), emulators typically interpret this
333+
to mean fatigue should be applied here.
334+
335+
-high is 0 by default.
336+
337+
#### Parameters:
338+
339+
Name | Type |
340+
:------ | :------ |
341+
`low` | *number* |
342+
`high?` | *number* |
343+
344+
**Returns:** *void*
345+
346+
___
347+
252348
### set\_effect
253349

254350
**set_effect**(`layer`: *number*, `effect`: *number*): *any*
@@ -266,6 +362,26 @@ Name | Type | Description |
266362

267363
___
268364

365+
### set\_fishable\_flag
366+
367+
**set_fishable_flag**(`low`: *number*, `high?`: *number*): *void*
368+
369+
Sets the fishable flag for the water in this chunk.
370+
If render flag data is not present, it is automatically created.
371+
372+
- high is 0 by default
373+
374+
#### Parameters:
375+
376+
Name | Type |
377+
:------ | :------ |
378+
`low` | *number* |
379+
`high?` | *number* |
380+
381+
**Returns:** *void*
382+
383+
___
384+
269385
### set\_hole
270386

271387
**set_hole**(`hole`: *boolean*): *void*

scripts/global.d.ts

+60
Original file line numberDiff line numberDiff line change
@@ -305,6 +305,66 @@ declare class chunk {
305305
* @param index valid in range [0-144]
306306
*/
307307
get_vert(index: number): vert;
308+
309+
/**
310+
* Returns true if the water in this chunk has deep/fishable flag data.
311+
*/
312+
has_render_flags(): bool
313+
314+
/**
315+
* Sets the fishable flag for the water in this chunk.
316+
* If render flag data is not present, it is automatically created.
317+
*
318+
* - high is 0 by default
319+
*/
320+
set_fishable_flag(low: number, high?: number): void;
321+
322+
/**
323+
* Returns the lower bits of the fishable flag
324+
* for the water in this chunk.
325+
*
326+
* If chunk has no render data, 0xffffffff is returned
327+
*
328+
* @note Only contains the lower 32 bits.
329+
* For the higher bits, use get_fishable_flag_high
330+
*/
331+
get_fishable_flag(): number;
332+
333+
/**
334+
* Returns the higher bits of the fishable flag
335+
* for the water in this chunk.
336+
*
337+
* If chunk has no render data, 0xffffffff is returned
338+
*/
339+
get_fishable_flag_high(): number;
340+
341+
/**
342+
* Sets the deep flags for the water in this chunk.
343+
* If the first bit is set (it is for value=1), emulators typically interpret this
344+
* to mean fatigue should be applied here.
345+
*
346+
* -high is 0 by default.
347+
*/
348+
set_deep_flag(low: number, high?: number): void;
349+
350+
/**
351+
* Returns the lower bits of the deep flag
352+
* for the water in this chunk.
353+
*
354+
* If chunk has no render data, 0 is returned
355+
*
356+
* @note Only contains the lower 32 bits.
357+
* For the higher bits, use get_fishable_flag_high
358+
*/
359+
get_deep_flag(): number;
360+
361+
/**
362+
* Returns the higher bits of the fishable flag
363+
* for the water in this chunk.
364+
*
365+
* If chunk has no render data, 0 is returned
366+
*/
367+
get_deep_flag_high(): number;
308368
}
309369

310370
/**

0 commit comments

Comments
 (0)