· 3 years ago · Feb 08, 2022, 08:50 AM
1tpt = {
2 -- Particle type selected under LMB
3 selectedl = 0,
4 -- Particle type selected under RMB
5 selectedr = 0,
6 -- Particle type selected under MMB
7 selecteda = 0,
8
9 selectedreplace = 0,
10
11 --Brush X size
12 brushx = 0,
13 --Brush Y size
14 brushy = 0,
15 --Brush shape ID (0 circle, 1 square, 2 triangle)
16 brushID = 0,
17}
18
19-- Draw text to the screen (for one frame, only useful in scripts)
20function tpt.drawtext(number_x, number_y, string_text)
21end
22function tpt.drawtext(number_x, number_y, string_text, number_red, number_green, number_blue)
23end
24function tpt.drawtext(number_x, number_y, string_text, number_red, number_green, number_blue, number_alpha)
25end
26
27--Create a particle at location.
28--```
29--tpt.create(number x, number y, string type)
30--```
31--Returns the index of the newly created particle.
32function tpt.create(number_x, number_y, string_type)
33end
34
35--Sets the paused state of the game.
36--The number argument is either 0 or 1, where 1 means the game will be paused, and 0 will unpause the game. If you don't pass in any arguments, the command will return an integer, either 0 or 1, about whether the game is currently paused.
37--**Examples:**
38-- - Pause the game:
39--```
40--tpt.set_pause(1)
41--```
42-- - Get if the game is paused currently:
43--```
44--tpt.set_pause() == 1
45--```
46function tpt.set_pause(number_state)
47end
48function tpt.set_pause()
49 if true then return 0 else return 1 end
50end
51
52--Toggle pause.
53function tpt.toggle_pause() end
54
55--Set the visibility state of the console.
56--The number argument can be either 0 or 1, where 1 means the console will be opened, and 0 will close the console. If you don't pass in any arguments, the command will return an integer, either 0 or 1, about whether the console is currently opened.
57--**Examples:**
58-- - Open the console:
59--```
60--tpt.set_console(1)
61--```
62-- - Get if the console is currently open:
63--```
64--tpt.set_console() == 1
65--```
66function tpt.set_console(number_state)
67end
68function tpt.set_console()
69 if true then return 0 else return 1 end
70end
71
72
73--Log a message to the console
74function tpt.log(string_text)
75end
76
77--Sets or resets pressure in the pressure map to some pressure. I sometimes imagine how much I can repeat the word "pressure" inside a sentence before it becomes gibberish.
78--Default values:
79--x = 0
80--y = 0
81--width = XRES/CELL = 612 / 4 = 153
82--height= YRES/CELL = 384 / 4 = 96
83--value = 0
84--
85--**Examples:**
86-- - Reset pressure everywhere:
87--```
88--tpt.set_pressure()
89--```
90-- - Set pressure at (100,100) (for a 1x1 rectangle to only use one wallpixel) to 200:
91--```
92--tpt.set_pressure(100,100,1,1,200)
93--```
94-- - Set pressure everywhere to 200:
95--```
96--tpt.set_pressure(nil,nil,nil,nil,200)
97--```
98function tpt.set_pressure(number_x, number_y, number_width, number_height, number_value)
99end
100function tpt.set_pressure()
101end
102
103--Sets Newtonian Gravity at a position or area to some value.
104--Default values:
105--x = 0
106--y = 0
107--width = XRES/CELL = 612 / 4 = 153
108--height = YRES/CELL = 384 / 4 = 96
109--value = 0
110--
111--**Examples:**
112-- - Reset gravity at point (150, 150):
113--```
114--tpt.set_gravity(150, 150)
115--```
116-- - Reset gravity from (100,100) to (300,300):
117--```
118--tpt.set_gravity(100, 100, 200, 200)
119--```
120-- - Set the entire stage's gravity to 1000:
121--```
122--tpt.set_gravity(nil, nil, nil, nil, 1000)
123--```
124function tpt.set_gravity(number_x, number_y, number_width, number_height, number_value)
125end
126function tpt.set_gravity(number_x, number_y, number_width, number_height)
127end
128function tpt.set_gravity(number_x, number_y)
129end
130
131--Thoroughly resets Newtonian gravity on a given point.
132--Instead of tpt.set_gravity which only modifies `sim->gravmap`, this code modifies `sim->gravp`, `sim->gravx` and `sim->gravy`.
133--Mmm, gravy.
134--Default values:
135--x = 0
136--y = 0
137--width = XRES/CELL = 612 / 4 = 153
138--height = YRES/CELL = 384 / 4 = 96
139--**Examples:**
140-- - Thoroughly reset gravity at point (150, 150):
141--```
142--tpt.reset_gravity_field(150, 150)
143--```
144-- - Reset gravity from (100,100) to (300,300):
145--```
146--tpt.reset_gravity_field(100, 100, 200, 200)
147--```
148function tpt.reset_gravity_field(number_x, number_y, number_width, number_height)
149end
150function tpt.reset_gravity_field(number_x, number_y)
151end
152
153--Sets velocity (both x and y) in a given region or point to 0.
154--Default values:
155--x = 0
156--y = 0
157--width = XRES/CELL = 612 / 4 = 153
158--height = YRES/CELL = 384 / 4 = 96
159--**Examples:**
160-- - Reset velocity everywhere:
161--```
162--tpt.reset_velocity()
163--```
164-- - Reset velocity in the point (100,100):
165--```
166--tpt.reset_velocity(100,100,1,1)
167--```
168function tpt.reset_velocity(number_x, number_y, number_width, number_height)
169end
170function tpt.reset_velocity()
171end
172
173--Removes electrified wires from the simulation, resetting to the original material
174function tpt.reset_spark() end
175
176--| Sets various properties of particles for given criteria
177function tpt.set_property(string_property, object_value)
178end
179function tpt.set_property(string_property, object_value, string_type)
180end
181function tpt.set_property(string_property, object_value, number_index)
182end
183function tpt.set_property(string_property, object_value, number_index, string_type)
184end
185function tpt.set_property(string_property, object_value, number_x, number_y)
186end
187function tpt.set_property(string_property, object_value, number_x, number_y, string_type)
188end
189function tpt.set_property(string_property, object_value, number_x, number_y, number_width, number_height)
190end
191function tpt.set_property(string_property, object_value, number_x, number_y, number_width, number_height, string_type)
192end
193function tpt.get_property(string_property, number_index)
194end
195function tpt.get_property(string_property, number_x, number_y)
196end
197
198--Sets the wall at a position. Uses wall/air map coordinates. Divide the actual coordinate by 4 to get the wall coordinate. So to set the wall at (100, 200), pass 100/4 for x and 200/4 for y.
199function tpt.set_wallmap(number_x, number_y, number_walltype)
200end
201function tpt.set_wallmap(number_x, number_y, number_width, number_height, number_walltype)
202end
203
204--Gets the wall at a position. Uses wall/air map coordinates. Divide the actual coordinate by 4 to get the wall coordinate. So to set the wall at (100, 200), pass 100/4 for x and 200/4 for y.
205function tpt.get_wallmap(number_x,number_y) end
206
207--Sets the "electricity" flag for a wall at a position. This flag is usually set when walls are sparked. The value is decremented by 1 every frame, just like SPRK .life, and when it reaches 0 the wall is "unsparked". Uses wall/air map coordinates. Divide the actual coordinate by 4 to get the wall coordinate. So to set the wall at (100, 200), pass 100/4 for x and 200/4 for y.
208function tpt.set_elecmap(number_x, number_y, number_walltype)
209end
210function tpt.set_elecmap(number_x, number_y, number_width, number_height, number_walltype)
211end
212
213--Gets the "electricity" flag for a wall at a position. This flag is usually set when walls are sparked. Uses wall/air map coordinates. Divide the actual coordinate by 4 to get the wall coordinate. So to set the wall at (100, 200), pass 100/4 for x and 200/4 for y.
214function tpt.get_elecmap(number_x, number_y)
215end
216
217--Draws a pixel on the screen (for one frame, only useful in scripts)
218function tpt.drawpixel(number_x, number_y)
219end
220function tpt.drawpixel(number_x, number_y, number_red, number_green, number_blue)
221end
222function tpt.drawpixel(number_x, number_y, number_red, number_green, number_blue, number_alpha)
223end
224
225--Draws a rectangle on the screen (for one frame, only useful in scripts)
226function tpt.drawrect(number_x, number_y, number_width, number_height)
227end
228function tpt.drawrect(number_x, number_y, number_width, number_height, number_red, number_green, number_blue)
229end
230function tpt.drawrect(number_x, number_y, number_width, number_height, number_red, number_green, number_blue, number_alpha)
231end
232
233--Draws a filled in rectangle on the screen (for one frame, only useful in scripts)
234--Because tpt.fillrect is slightly broken in tpt, the coordinates will be off. It fills the rectangle from (x+1, y+1) to (x+w-1, y+h-1)
235function tpt.fillrect(number_x, number_y, number_width, number_height)
236end
237function tpt.fillrect(number_x, number_y, number_width, number_height, number_red, number_green, number_blue)
238end
239function tpt.fillrect(number_x, number_y, number_width, number_height, number_red, number_green, number_blue, number_alpha)
240end
241
242--Draws a line on the screen (for one frame, only useful in scripts). The line starts at point (x1, y1) and ends at point (x2,y2).
243function tpt.drawline(number_x1, number_y1, number_x2, number_y2)
244end
245function tpt.drawline(number_x1, number_y1, number_x2, number_y2, number_red, number_green, number_blue)
246end
247function tpt.drawline(number_x1, number_y1, number_x2, number_y2, number_red, number_green, number_blue, number_alpha)
248end
249
250--Measures (in pixels) the width of a given string. Returns a number.
251function tpt.textwidth(string_text)
252 return 0
253end
254
255--Returns the current username.
256function tpt.get_name()
257 return ""
258end
259
260--Delete a specific particle, or a particle at a location.
261function tpt.delete(number_index)
262end
263function tpt.delete(number_x, number_y)
264end
265
266--Ask the user to input some text. Returns a string of what ever the user says. The argument "text" is pre-entered text (optional).
267function tpt.input(string_title, string_message)
268end
269function tpt.input(string_title, string_message, string_text)
270end
271
272--Display an OK-Only message box with a title and message.
273function tpt.message_box(string_title, string_message)
274end
275
276--Display an confirm message box with a title and message. Returns true if the button with button_name is clicked, returns false if Cancel is clicked.
277function tpt.confirm(string_title, string_message,string_button_name)
278 return true
279end
280
281--Returns the number of particles currently on the screen.
282--A newer way to get this is the variable sim.NUM_PARTS
283function tpt.get_numOfParts()
284 return 0
285end
286
287--Start the iterator for receiving all indices of the particles. (Used to help get particle indices, see tpt.next_getPartIndex)
288function tpt.start_getPartIndex() end
289
290--Jump to the next available particle index. Returns false if the iterator has reached the end of all particle indecies. Returns true if a new index was available. (Used to help get particle indecies, see tpt.getPartIndex)
291function tpt.next_getPartIndex()
292 return true
293end
294
295--Get the current index iterator.
296--Index code example:
297--```
298-- tpt.start_getPartIndex()
299-- while tpt.next_getPartIndex() do
300-- local index = tpt.getPartIndex()
301-- if tpt.get_property("ctype",index) == 21 then
302-- tpt.set_property("ctype","sing",index)
303-- end
304-- end
305--```
306--These functions are made obsolete by the function sim.parts(). That allows you to use Lua's iterators.
307function tpt.getPartIndex() end
308
309--Set HUD visibility.
310--Does the same thing as pressing the H key normally. The number argument can be either 0 or 1, where 1 will show the HUD, and 0 will hide the HUD. If you don't pass in any arguments, the command will return an integer, either 0 or 1, about whether the HUD is visible right now.
311function tpt.hud(number_state)
312end
313function tpt.hud()
314 return 0
315end
316
317--Sets Newtonian Gravity on and off.
318--Does the same thing as Ctrl+N in normal gameplay.
319--The number argument can be either 0 or 1, where 1 will enable Newtonian Gravity, and 0 will disable Newtonian Gravity. If you don't pass in any arguments, the command will return an integer, either 0 or 1, about whether Newtonian Gravity is turned on at the given moment.
320function tpt.newtonian_gravity(number_state)
321end
322function tpt.newtonian_gravity()
323 return 0
324end
325
326--Toggles Ambient Heat state.
327--The number argument can be either 0 or 1, where 1 will enable Ambient Heat, 0 will disable it. If you don't pass in any arguments, the command will return an integer, either 0 or 1, about whether Ambient Heat is turned on at the given moment.
328function tpt.ambient_heat(number_state)
329end
330function tpt.ambient_heat()
331 return 0
332end
333
334--Changes activated menu. If you don't pass in any arguments, the command will return the currently active menu.
335--The menu IDs are detailed here: https://powdertoy.co.uk/Wiki/W/Element_Properties.html#Menu_sections
336--**Example:**
337--```
338--tpt.active_menu(elem.SC_EXPLOSIVE)
339--```
340function tpt.active_menu(number_menu)
341end
342function tpt.active_menu()
343 return 0
344end
345
346--Not documented by the wiki. See this link in case it has been already added
347-- https://powdertoy.co.uk/Wiki/W/Lua.html#tpt.menu_enabled
348function tpt.menu_enabled(...) end
349
350--Not documented by the wiki. See this link in case it has been already added
351--https://powdertoy.co.uk/Wiki/W/Lua.html#tpt.num_menus
352function tpt.num_menus(...) end
353
354--Toggle drawing decorations.
355--The number argument can be either 0 or 1, where 1 will enable decorations, and 0 will disable them. If you don't pass in any arguments, the command will return an integer, either 0 or 1, about whether decorations are turned on at the given moment.
356function tpt.decorations_enable(number_state)
357end
358function tpt.decorations_enable()
359 return 0
360end
361
362--Changes activated display mode.
363--There's 11 display modes, detailed here https://github.com/ThePowderToy/The-Powder-Toy/blob/f54189a97f6d80181deb4f6d952ccf10f0e59ccf/src/graphics/Renderer.cpp#L2587-L2644
364--
365--But I'll provide a reference below:
366--Display Modes
367--0 = Alternate Velocity
368--1 = Velocity
369--2 = Pressure
370--3 = Persistent
371--4 = Fire
372--5 = Blob
373--6 = Heat
374--7 = Fancy
375--8 = Nothing
376--9 = Heat Gradient
377--10 = Life Gradient
378function tpt.display_mode(number_display)
379end
380
381--Displays an error message box.
382function tpt.throw_error(string_text)
383end
384
385--Toggles Heat Simulation.
386--The number argument can be either 0 or 1, where 1 will enable heat, and 0 will disable it. If you don't pass in any arguments, the command will return an integer, either 0 or 1, about whether heat is turned on at the given moment.
387--It's usually wise not to disable this, as there are practically no saves left that need the compatibility mode in order to work. Nevertheless this option exists.
388function tpt.heat(number_state)
389end
390function tpt.heat()
391 return 0
392end
393
394--Changes the strength of the games glowing effects. `tpt.setfire(1)` is default.
395function tpt.setfire(number_strength)
396end
397
398--Sets the "debug mode". It works using bitmasks, so you can turn on multiple debug features at the same time.
399--Setting 0x1 will display info on the number of particles on the screen.
400--Setting 0x2 will draw a graph showing the percentages of each type of element on the screen.
401--Setting 0x4 will display useful information when you draw lines using shift.
402--Setting 0x8 enables subframe particle debugging. Use alt+f to step one particle at a time. Use shift+f to step up to the particle underneath the mouse. When not over a particle, it advances to the end of the frame.
403function tpt.setdebug(number_mode)
404end
405
406--Changes the upper FPS limit the program will run at. This value is
407--60 by default.
408--Don't set it too high, it'll eat all your CPU speed and make the game too responsive! Don't also set it too low, since UI and everything related to it uses the same FPS, so you'll find buttons and stuff not working.
409--If you don't pass in any arguments, it will return the current fps cap. If you set the fpscap to 2, this will uncap the framerate.
410function tpt.setfpscap(number_fpscap)
411end
412function tpt.setfpscap()
413 return 0
414end
415
416--Not documented by the wiki. See this link in case it has been already added
417--https://powdertoy.co.uk/Wiki/W/Lua.html#tpt.getscript
418function tpt.getscript(number_id, string_name,number_idk_sorry_im_writing_this_manually) end
419
420--Changes a few special properties as to what size the game renders at.
421--Scale is a multiplier by which every pixel shall get multiplied at, currently it can either be 1 (612x384) or 2 (1224x768).
422--Full screen is a toggle (0 or 1) that enables "kiosk mode", which basically scales the game up to fill the screen and makes the rest of the edge black.
423function tpt.setwindowsize(number_scale, number_fullscreen)
424end
425
426--Not documented by the wiki. See this link in case it has been already added
427--https://powdertoy.co.uk/Wiki/W/Lua.html#tpt.watertest
428function tpt.watertest(...) end
429
430--Takes a screenshot of the current screen, minus the menu and HUD.
431--**Screenshot format:**
432--0 - png
433--1 - bmp
434--2 - ppm
435--**Examples:**
436--`tpt.screenshot(1,1)` - take fullscreen screenshot in bmp format
437--`tpt.screenshot(1,2)` - take fullscreen screenshot in ppm format
438function tpt.screenshot(boolean_fullscreen,number_screenshot_format)
439end
440
441--Not documented by the wiki. See this link in case it has been already added
442--https://powdertoy.co.uk/Wiki/W/Lua.html#tpt.record
443function tpt.record(...) end
444
445--Returns an element's number. For example, it would return 28 for dmnd. If passed a number it will return the name instead.
446function tpt.element(string_elementname)
447 return 0
448end
449function tpt.element(number_elementid)
450 return ""
451end
452
453--Allows you to replace or add on to an element's update function.
454--Write a function like normal, and then put its name into this command. Use `tpt.element("...")` or `tpt.el.dust.id` for el_number.
455--If replace is set to 1, the new function will be called after the original update function.
456--If replace is set to 2, the original function will be overwritten.
457--If replace is set to 3, the new function will be called before the original update function.
458--Replace automatically defaults to 1.
459--new function arguments: index, x, y, surround_space, nt
460--Returns: return 1 from your function if the particle is killed.
461function tpt.element_func(function_newfunction, number_el_number)
462end
463function tpt.element_func(function_newfunction, number_el_number, number_replace)
464end
465
466--Allows you to replace an element's graphics function. Write a function like normal, and then put its name into this command. Use tpt.el.(name of element to change).id for el_number.
467--
468--Function arguments: index, colr, colg, colb
469--Returns: cache, pixel_mode, cola, colr, colg, colb, firea, firer, fireg, and fireb.
470--
471--Set cache to 1 if you don't want the function to ever be called again, preventing lag. Don't do this if you need the way your element looks to change depending on its properties.
472--colr/g/b are the red, green, and blue colors of your element. firea/r/g/b set the fire colors, but pixel_mode needs to be set to 0x00022000 for them to work.
473--The pixel mode values you can use are:
474--```
475--PMODE_NONE 0x00000000 --prevents anything from being drawn
476--PMODE_FLAT 0x00000001 --draw a basic pixel, overwriting the color under it. Doesn't support cola.
477--PMODE_BLOB 0x00000002 --adds a blobby effect, like you were using blob (5) display mode
478--PMODE_BLUR 0x00000004 --used in liquids in fancy display mode
479--PMODE_GLOW 0x00000008 --Glow effect, used in elements like DEUT and TRON in fancy display mode
480--PMODE_SPARK 0x00000010 -- used for things such as GBMB at first, dimmer than other modes
481--PMODE_FLARE 0x00000020 --BOMB and other similar elements, brighter than PMODE_SPARK
482--PMODE_LFLARE 0x00000040 --brightest spark mode, used when DEST hits something
483--PMODE_ADD 0x00000080 --like PMODE_FLAT, but adds color to a pixel, instead of overwriting it.
484--PMODE_BLEND 0x00000100 --basically the same thing as PMODE_ADD, but has better OpenGL support
485--PSPEC_STICKMAN 0x00000200 --does nothing, because the stickmen won't get drawn unless it actually is one
486--NO_DECO 0x00001000 --prevents decoration from showing on the element (used in LCRY)
487--DECO_FIRE 0x00002000 --Allow decoration to be drawn on using the fire effect (gasses have this set)
488--FIRE_ADD 0x00010000 --adds a weak fire effect around the element (ex. LAVA/LIGH)
489--FIRE_BLEND 0x00020000 --adds a stronger fire effect around the element, default for gasses
490--EFFECT_GRAVIN 0x01000000 --adds a PRTI effect. Might take some coding in an update function to get it to work properly, PRTI uses life and ctype to create the effects
491--EFFECT_GRAVOUT 0x02000000 --adds a PRTO effect. Might take some coding in an update function to get it to work properly, PRTI uses life and ctype to create the effects
492--```
493--You can combine them in any way you want, you probably need more than one anyway. Radioactive elements default to PMODE_FLAT+PMODE_GLOW, liquids to PMODE_FLAT+PMODE_BLUR, and gasses to FIRE_BLEND+DECO_FIRE, with a firea of 125 and firer/g/b of colr/g/b divided by 2
494--See this for a picture of what they look like:
495--https://powdertoy.co.uk/Wiki/W/File:Particle_Drawing_Modes.png.html
496function tpt.graphics_func(function_newfunction, number_el_number)
497end
498
499--Returns contents of the clipboard.
500function tpt.get_clipboard()
501 return ""
502end
503
504--Copy to clipboard.
505function tpt.set_clipboard(string_text)
506end
507
508--tpt.setdrawcap
509--Changes the rate that particle graphics and the UI render to the screen. This is separate from the fpscap, which only affects the simulation. The drawcap allows TPT to skip drawing every frame. This may increase the framerate in some instances.
510--The default is set to the maximum refresh rate of all attached monitors.
511function tpt.setdrawcap(number_drawcap) end
512
513--Not documented by the wiki. See this link in case it has been already added
514--https://powdertoy.co.uk/Wiki/W/Lua.html#tpt.perfectCircleBrush
515function tpt.perfectCircleBrush(...) end
516
517
518interface = {}
519
520Component = {}
521
522--Sets the visibility of the component
523function Component:visible(bool_visible)
524end
525--Returns the visibility of the component
526function Component:visible()
527 return true
528end
529
530--Returns the width and height of the component
531function Component:size()
532 return 0, 0
533end
534--Sets the size of the component to be width by height
535function Component:size(number_width, number_height)
536end
537
538--Sets the position of the component to be x, y
539function Component:position(number_x,number_y)
540end
541--Returns the x and y coord of the component
542function Component:position()
543 return 0,0
544end
545
546--Extends Component, fires "action" when clicked
547Button = Component
548
549--Extends Component, fires "action" when clicked
550function Button:new(number_x, number_y, number_width, number_height)
551 return Button
552end
553function Button:new(number_x, number_y, number_width, number_height, string_text)
554 return Button
555end
556function Button:new(number_x, number_y, number_width, number_height, string_text, string_tooltip)
557 return Button
558end
559
560--```
561--nil Button:action(function(sender) actionListener)
562--```
563--Sets the listener for button actions Example:
564--```
565--local newButton = Button:new(10, 10, 100, 17, "Press to change text")
566--newButton:action(function(sender) sender:text("Text changed") end)
567--interface.addComponent(newButton)
568--```
569function Button:action(function_SENDER_actionListener)
570end
571
572--Returns the button text
573function Button:text()
574 return ""
575end
576--Sets the text of the button
577function Button:text(string_text)
578end
579
580--Returns the enabled state of the button
581function Button:enabled()
582 return true
583end
584--Sets the enabled state of the button
585function Button:enabled(bool_enabled)
586end
587
588--Extends Component, used to indicate progress for long running tasks
589ProgressBar = Component
590
591--Extends Component, used to indicate progress for long running tasks
592function ProgressBar:new(number_x, number_y, number_width, number_height, number_progress, string_status)
593 return ProgressBar
594end
595
596--Progress ranges from 0 to 100, but a special case of -1 will change the behaviour of the progress bar to intermediate (constantly scrolling to indicate progress)
597--Returns the progress value
598function ProgressBar:progress()
599 return 0
600end
601--Sets the progress value
602function ProgressBar:progress(number_progress)
603end
604
605--Status is simple a text representation of the current action being performed, for example "Working" or just a percentage
606--Returns the progress bar status
607function ProgressBar:status()
608 return ""
609end
610--Sets the progress bar status
611function ProgressBar:status(string_status)
612end
613
614
615--Extends Component, fires "onValueChanged" when the value is changed (i.e used by the user)
616Slider = Component
617
618--Extends Component, fires "onValueChanged" when the value is changed (i.e used by the user)
619function Slider:new(number_x, number_y, number_width, number_height)
620 return Slider
621end
622function Slider:new(number_x, number_y, number_width, number_height, string_steps)
623 return Slider
624end
625
626--Sets the listener for slider actions
627function Slider:onValueChange(function_SENDER_VALUE_actionListener)
628end
629
630--Returns the value of the slider
631function Slider:value()
632 return 0
633end
634--Sets the value of the slider
635function Slider:value(number_value)
636end
637
638--Returns the number of steps the slider has
639function Slider:steps()
640 return 0
641end
642--Sets the number of steps for the slider
643function Slider:steps(number_steps)
644end
645
646--Extends Component, fires "onValueChanged" when the checkbox is checked or unchecked
647Checkbox = Component
648
649--Extends Component, fires "onValueChanged" when the checkbox is checked or unchecked
650function Checkbox:new(number_x, number_y, number_width, number_height)
651 return Checkbox
652end
653function Checkbox:new(number_x, number_y, number_width, number_height, string_text)
654 return Checkbox
655end
656
657--Sets the listener for checkbox actions
658function Checkbox:action(function_SENDER_CHECKED_actionListener)
659end
660
661--Returns the checkbox text
662function Checkbox:text()
663 return ""
664end
665--Sets the text of the checkbox
666function Checkbox:text(string_text)
667end
668
669--Returns the checked state of the checkbox
670function Checkbox:checked()
671 return true
672end
673--Sets the checked state of the checkbox
674function Checkbox:checked(bool_checked)
675end
676
677--Extends Component, is a simple selectable, readonly text field
678Label = Component
679
680--Extends Component, is a simple selectable, readonly text field
681function Label:new(number_x, number_y, number_width, number_height)
682 return Label
683end
684function Label:new(number_x, number_y, number_width, number_height, string_text)
685 return Label
686end
687
688--Returns the label text
689function Label:text()
690 return ""
691end
692--Sets the text of the label
693function Label:text(string_text)
694end
695
696--Extends Component, is a text input field, the placeholder text is shown if the component is no focused and contains no text
697Textbox = Component
698
699--Extends Component, is a text input field, the placeholder text is shown if the component is no focused and contains no text
700function Textbox:new(number_x, number_y, number_width, number_height)
701 return Textbox
702end
703function Textbox:new(number_x, number_y, number_width, number_height,string_text)
704 return Textbox
705end
706function Textbox:new(number_x, number_y, number_width, number_height,string_text,string_placeholder)
707 return Textbox
708end
709
710--Sets the listener for text changed actions
711function Textbox:onTextChanged(function_SENDER_textChangedListener)
712end
713
714--Returns the text in the field
715function Textbox:text()
716 return ""
717end
718--Sets the text of the field
719function Textbox:text(string_text)
720end
721
722--Returns the readonly status of the field.
723function Textbox:readonly()
724 return true
725end
726--Sets the readonly status of the field.
727function Textbox:readonly(bool_readonly)
728end
729
730--A modal form to display components, using -1 for either x or y values will centre the Window on that axis.
731Window = {}
732
733--A modal form to display components, using -1 for either x or y values will centre the Window on that axis.
734function Window:new(number_x, number_y, number_width, number_height)
735 return Window
736end
737
738--Add a component to the window (The component must not have already been added to another Window object)
739function Window:addComponent(Component_newComponent)
740end
741
742--Remove a component from the window
743function Window:removeComponent(Component_newComponent)
744end
745
746--```
747--nil interface.showWindow(Window newWindow)
748--```
749--Push a Window into the top of the modal stack
750function interface.showWindow(Window_newWindow)
751end
752
753--```
754--nil interface.closeWindow(Window newWindow)
755--```
756--Pop a Window off the top of the modal stack. If the given Window is not the top item in the stack, this will have no effect.
757function interface.closeWindow(Window_newWindow)
758end
759
760--```
761--nil interface.addComponent(Component newComponent)
762--```
763--Add a component to master game window.
764function interface.addComponent(Component_newComponent)
765end
766
767
768--```
769--nil interface.removeComponent(Component newComponent)
770--```
771--Remove a component from the master game window.
772function interface.removeComponent(Component_newComponent)
773end
774
775
776--```
777--nil interface.grabTextInput()
778--```
779--Signal to the interface engine that textinput events are expected and will be handled (for example, your textbox just gained focus and is ready for such events). Once called, it should not be called again until after calling interface.dropTextInput; see below.
780--From the API user's perspective, the grabTextInput-dropTextInput pair implements an on-off switch. The purpose of this switch is to help the interface engine determine when to enter and exit text input state. In this state, the engine asks for OS help with text input (which may or may not involve enabling an Input Method) and delivers textinput events received from the OS to the API user.
781--The engine should only enter text input state when the API user expects textinput events (for example, when a textbox is in focus). To correctly communicate this, grabTextInput should be called when processing of textinput events starts and dropTextInput when it ends. Note that textinput events may be delivered regardless of the state of this on-off switch, most likely as a result of another API user calling grabTextInput and dropTextInput.
782function interface.grabTextInput() end
783
784--```
785--nil interface.dropTextInput()
786--```
787--Signal to the interface engine that textinput events are not expected and will not be handled (for example, your textbox just lost focus and will not handle such events anymore). Once called, it should not be called again until after calling interface.grabTextInput; see above.
788function interface.dropTextInput() end
789
790--```
791--nil interface.textInputRect(number x, number y, number w, number h)
792--```
793--Enables composition, for multi-byte unicode characters.
794function interface.textInputRect(number_x, number_y, number_w, number_h)
795end
796
797
798
799simulation = {}
800
801--```
802--number ... sim.partNeighbors(number x, number y, number radius, [number type])
803--```
804--Returns a list of particles indexes that neighbour the given coordinates that matches the given type (if it is specified) The resulting list does not contain the "origin particle"
805function simulation.partNeighbors(number_x, number_y, number_radius, number_type)
806 return {0,1,2,3,4}
807end
808function simulation.partNeighbors(number_x, number_y, number_radius)
809 return {0,1,2,3,4}
810end
811--```
812--number ... sim.partNeighbours(number x, number y, number radius, [number type])
813--```
814--Returns a list of particles indexes that neighbour the given coordinates that matches the given type (if it is specified) The resulting list does not contain the "origin particle"
815function simulation.partNeighbours(number_x, number_y, number_radius, number_type)
816 return {0,1,2,3,4}
817end
818function simulation.partNeighbours(number_x, number_y, number_radius)
819 return {0,1,2,3,4}
820end
821
822--```
823--nil sim.partChangeType(number index, number type)
824--```
825--Reliably change the type of a particle, this method avoids the side effects created by changing the type directly with the "partProperty" method.
826function simulation.partChangeType(number_index, number_type)
827end
828
829
830--```
831--number sim.partCreate(number index, number x, number y, number type)
832--```
833--Create a single particle at location x, y. Returns the index of the new particle, or a negative number on failure.
834--Possible values for index are:
835-- 1. Normal particle creation. This is the most useful value. No particle is created if position x, y is occupied and the requested new particle type cannot pass through the particle that is already there.
836-- 2. Create particle as though it was drawn by the user with the brush. Usually not useful.
837-- 3. Create particle without checking for collisions with existing particles. In most cases, this is a bad idea, since a lot of elements don't work properly when there are multiple particles in the same place. Particles may also turn into BHOL if there are too many in the same place. The exception to this is elements that have been specifically designed to cope with this (such as multiple energy particles like PHOT and NEUT in the same place).
838--
839-- Particle index >= 0: Overwrite an existing particle with a new particle. At the moment no collision checking is performed, so the same considerations apply as for index=-3. It is usually safe if the new particle is in the same location as the old one. This is roughly equivalent to calling `sim.partKill` then `sim.partCreate(-3, ...)`.
840function simulation.partCreate(number_index, number_x, number_y, number_type)
841 return 0
842end
843
844--```
845--nil sim.partProperty(number index, object field, object value)
846--```
847--Set the property value on a particle specified by index
848function simulation.partProperty(number_index, object_field, object_value)
849end
850--```
851--nil sim.partProperty(number index, object field)
852--```
853--Get the property value on a particle specified by the index
854--The "field" may be a field name or field ID, see FIELD constants below for valid fields.
855function simulation.partProperty(number_index, object_field)
856end
857
858
859--```
860--number x, number y sim.partPosition(number index)
861--```
862--Get the location of the particle at the specified index
863function simulation.partPosition(number_index)
864 return 0,0
865end
866
867
868--```
869--number sim.partID(number x, number y)
870--```
871--Get the index of a particle at the specified position. As of v89.3, this will return nil if there is no particle there.
872--Example (though this is probably best done with sim.neighbours):
873--```
874--for fx = -1, 1, 1 do
875-- for fy = -1, 1, 1 do
876-- local i = sim.partID(x + fx, y + fy)
877-- if i~=nil and sim.partProperty(i, 'type') == elements.DEFAULT_PT_DMND then
878-- sim.partProperty(index, sim.FIELD_TEMP, 9999)
879-- end
880-- end
881--end
882--```
883function simulation.partID(number_x, number_y)
884 return 0
885end
886
887--```
888--nil sim.partKill(number index)
889--nil sim.partKill(number x, number y)
890--```
891--Reliably delete a particle at a specified index or location, this method avoids the side effects created by changing the type to 0/DEFAULT_PT_NONE with the "partProperty" method
892function simulation.partKill(number_index)
893end
894function simulation.partKill(number_x, number_y)
895end
896
897
898--```
899--number sim.pressure(number x, number y)
900--```
901--Returns a value on the pressure map.
902function simulation.pressure(number_x, number_y)
903 return 0
904end
905--```
906--nil sim.pressure(number x, number y, number pressure, [number width, number height])
907--```
908--Sets values on the pressure map.
909function simulation.pressure(number_x, number_y, number_pressure, number_width, number_height)
910end
911function simulation.pressure(number_x, number_y, number_pressure)
912end
913
914
915--```
916--number sim.ambientHeat(number x, number y)
917--```
918--Returns a value on the ambient heat map (the temperature of the air at that point).
919function simulation.ambientHeat(number_x, number_y)
920 return 0
921end
922--```
923--nil sim.ambientHeat(number x, number y, number temp, [number width, number height])
924--```
925--Sets values on the ambient heat map.
926function simulation.ambientHeat(number_x, number_y, number_temp, number_width, number_height)
927end
928function simulation.ambientHeat(number_x, number_y, number_temp)
929end
930
931--```
932--number sim.velocityX(number x, number y)
933--```
934--Returns an X value on the velocity map.
935function simulation.velocityX(number_x, number_y)
936 return 0
937end
938--```
939--nil sim.velocityX(number x, number y, [number value], [number width, number height])
940--```
941--Sets X values on the velocity map.
942function simulation.velocityX(number_x, number_y, number_value, number_width, number_height)
943end
944function simulation.velocityX(number_x, number_y, number_value)
945end
946
947--```
948--number sim.velocityY(number x, number y)
949--```
950--Returns an Y value on the velocity map.
951function simulation.velocityY(number_x, number_y)
952 return 0
953end
954--```
955--nil sim.velocityY(number x, number y, [number value], [number width, number height])
956--```
957--Sets Y values on the velocity map.
958function simulation.velocityY(number_x, number_y, number_value, number_width, number_height)
959end
960function simulation.velocityY(number_x, number_y, number_value)
961end
962
963--```
964--nil sim.gravMap(number x, number y, [number width, number height, [number value]])
965--```
966--Returns the newtonian gravity at the given coordinates in the simulation. If given a value, will set the newtonian gravity at those coordinates. Width and height refer to the rectangle of affected cells, starting with the coords. If not given, they will default to 1,1.
967function simulation.gravMap(number_x, number_y)
968 return 0
969end
970function simulation.gravMap(number_x, number_y, number_width, number_height, number_value)
971end
972
973
974--```
975--number sim.createParts(number x, number y, [number rx], [number ry], [number type], [number brush], [number flag])
976--```
977--Does something.
978function simulation.createParts(number_x, number_y, number_rx, number_ry, number_type, number_brush, number_flag)
979 return 0
980end
981
982
983--```
984--nil sim.createLine(number x1, number y1, number x2, number y2, [number rx], [number ry], [number type], [number brush], [number, flag])
985--```
986--Creates a line of of either the user's currently selected type or the type specified at the specified coordinates.
987--rx and ry describe the radius of the brush used. Default radius is 5, 5.
988--flag refers to particle replacement flags.
989function simulation.createLine(number_x1, number_y1, number_x2, number_y2, number_rx, number_ry, number_type, number_brush, number_flag) end
990
991
992--```
993--nil sim.createBox(number x1, number y1, number x2, number y2, [number type], [number flag])
994--```
995--Creates a filled box of either the user's currently selected type or the type specified at the specified coordinates.
996--flag refers to particle replacement flags.
997function simulation.createBox(number_x1, number_y1, number_x2, number_y2, number_type, number_flag)
998end
999
1000
1001--```
1002--number sim.floodParts(number x, number y, [number type], [number cm?], [number flag])
1003--```
1004--Flood fills either the user's currently selected type or the type specified at the coordinates given.
1005--flag refers to particle replacement flags.
1006function simulation.floodParts(number_x, number_y, number_type, number_cm, number_flag)
1007 return 0
1008end
1009
1010
1011
1012--```
1013--number sim.createWalls(number x, number y, [number rx], [number ry], [number walltype])
1014--```
1015--Does something
1016function simulation.createWalls(number_x, number_y, number_rx, number_ry, number_walltype)
1017 return 0
1018end
1019
1020
1021--```
1022--nil sim.createWallLine(number x1, number y1, number x2, number y2, [number rx], [number ry], [number walltype])
1023--```
1024--Creates a line of either the specified walltype or the type of the basic wall at the specified particle coordinates.
1025--Note: the coordinates might change from particle coordinates to map coordinates in the future.
1026function simulation.createWallLine(number_x1, number_y1, number_x2, number_y2, number_rx, number_ry, number_walltype)
1027end
1028
1029--```
1030--nil sim.createWallBox(number x1, number y1, number x2, number y2, [number walltype])
1031--```
1032--Creates a filled box of either the specified walltype or the type of the basic wall at the specified particle coordinates.
1033--Note: the coordinates might change from particle coordinates to map coordinates in the future.
1034function simulation.createWallBox(number_x1, number_y1, number_x2, number_y2, number_walltype)
1035end
1036
1037
1038--```
1039--number sim.floodWalls(number x, number y, [number walltype], [number bm?])
1040--```
1041--Flood fills either the specified walltype or the type of the basic wall at the specified particle coordinates.
1042--Note: the coordinates might change from particle coordinates to map coordinates in the future.
1043function simulation.floodWalls(number_x, number_y, number_walltype, number_bm)
1044 return 0;
1045end
1046
1047
1048--```
1049--number sim.toolBrush(number x, number y, [number rx], [number ry], [number tool], [number brush], [number strength])
1050--```
1051--Performs the given tool (HEAT, COOL, AIR, etc) on the given coordinates with the given brush size. The brush types are 0 (circle), 1 (square) and 2 (triangle).
1052function simulation.toolBrush(number_x, number_y, number_rx, number_ry, number_tool, number_brush, number_strength)
1053 return 0;
1054end
1055
1056
1057
1058--```
1059--type sim.toolLine(number x1, number y1, number x2, number y2, [number rx], [number ry], [number tool], [number brush], [number strength])
1060--```
1061--Does something
1062function simulation.toolLine(number_x1, number_y1, number_x2, number_y2, number_rx, number_ry, number_tool, number_brush, number_strength)
1063end
1064
1065
1066--```
1067--type sim.toolBox(number x1, number y1, number x2, number y2, [number tool], [number strength])
1068--```
1069--Does something
1070function simulation.toolBox(number_x1, number_y1, number_x2, number_y2, number_tool, number_strength)
1071end
1072
1073--```
1074--nil sim.decoBrush(number x, number y, [number rx], [number ry], [number r, number g, number b, [number a]], [number tool], [number brush])
1075--```
1076--Does something
1077--tool refers to decoration tools.
1078function simulation.decoBrush(number_x, number_y, number_rx, number_ry, number_r, number_g, number_b, number_a, number_tool, number_brush)
1079end
1080
1081
1082--```
1083--nil sim.decoLine(number x1, number y1, number x2, number y2, [number rx], [number ry], [number r, number g, number b, [number a]], [number tool], [number brush])
1084--```
1085--Changes the decoration color of all particles in the line specified.
1086--rx and ry describe the radius of the brush used. Default radius is 5, 5.
1087--tool refers to decoration tools.
1088function simulation.decoLine(number_x1, number_y1, number_x2, number_y2, number_rx, number_ry, number_r, number_g, number_b, number_a, number_tool, number_brush)
1089end
1090
1091
1092--```
1093--nil sim.decoBox(number x1, number y1, number x2, number y2, [number r, number g, number b, [number a]], [number tool])
1094--```
1095--Changes the decoration color of all particles in the specified coordinates.
1096--tool refers to decoration tools.
1097function simulation.decoBox(number_x1, number_y1, number_x2, number_y2, number_r, number_g, number_b, number_a, number_tool)
1098end
1099
1100--```
1101--number sim.decoColor()
1102--```
1103--Returns the currently selected decoration color.
1104function simulation.decoColor(number_color)
1105 return 0
1106end
1107
1108--```
1109--nil sim.decoColor(number color)
1110--```
1111--Sets the selected decoration color to color.
1112--color is in the format 0xAARRGGBB
1113function simulation.decoColor(number_color)
1114end
1115
1116--```
1117--nil sim.decoColor(number r, number g, number b, [number a])
1118--```
1119--Sets the selected decoration color to r,g,b,a
1120function simulation.decoColor(number_r, number_g, number_b, number_a)
1121end
1122function simulation.decoColor(number_r, number_g, number_b)
1123end
1124
1125--```
1126--nil sim.decoColour(number r, number g, number b, [number a])
1127--```
1128--Sets the selected decoration color to r,g,b,a
1129function simulation.decoColour(number_r, number_g, number_b, number_a)
1130end
1131function simulation.decoColour(number_r, number_g, number_b)
1132end
1133
1134
1135--Not documented by the wiki. See this link in case it has been already added
1136--https://powdertoy.co.uk/Wiki/W/Lua_API:Simulation.html#simulation.floodDeco
1137function simulation.floodDeco(...) end
1138
1139
1140--```
1141--nil sim.clearSim()
1142--```
1143--Clears everything in the simulation.
1144function simulation.clearSim() end
1145
1146--Not documented by the wiki. See this link in case it has been already added
1147--https://powdertoy.co.uk/Wiki/W/Lua_API:Simulation.html#simulation.clearRect
1148function simulation.clearRect(...) end
1149
1150
1151--```
1152--nil sim.resetTemp()
1153--```
1154--Resets the temperature of all particles to their spawn temperature.
1155function simulation.resetTemp() end
1156
1157--```
1158--nil sim.resetPressure()
1159--```
1160--Resets the pressure map to no pressure.
1161function simulation.resetPressure() end
1162
1163
1164--```
1165--string sim.saveStamp([number x, number y, number width, number height])
1166--```
1167--Creates a stamp of the specified coordinates. Coordinates default to entire simulation.
1168--Returns the stamp id created.
1169function simulation.saveStamp(number_x, number_y, number_width, number_height)
1170 return 0
1171end
1172function simulation.saveStamp()
1173 return 0
1174end
1175
1176--```
1177--sim.loadStamp(string filename, number x, number y)
1178--sim.loadStamp(number id, number x, number y)
1179--```
1180--Loads a stamp identified by filename or ID, and places it at position x,y. Filenames should be given without stamps/ or the .stm suffix. On success, returns 1. On failure, returns nil and the failure reason as a string.
1181function simulation.loadStamp(string_filename, number_x, number_y)
1182 if true then
1183 return 1
1184 else
1185 return nil, ""
1186 end
1187end
1188function simulation.loadStamp(number_id, number_x, number_y)
1189 if true then
1190 return 1
1191 else
1192 return nil, ""
1193 end
1194end
1195
1196
1197--```
1198--type sim.deleteStamp(string name)
1199--```
1200--Deleting a stamp identified by filename or ID.
1201function simulation.deleteStamp(string_name)
1202end
1203
1204
1205--```
1206--nil sim.loadSave(number SaveID, [number hideDescription], [number history?])
1207--```
1208--Loads the save associated with the specified SaveID.
1209--If hideDescription is non zero, the information for the save is not shown.
1210function simulation.loadSave(number_SaveID, number_hideDescription, number_history)
1211end
1212function simulation.loadSave(number_SaveID, number_hideDescription)
1213end
1214function simulation.loadSave(number_SaveID)
1215end
1216
1217
1218--```
1219--nil sim.reloadSave()
1220--```
1221--Reloading save.
1222function simulation.reloadSave() end
1223
1224
1225--```
1226--number, number sim.getSaveID()
1227--```
1228--Returns the save ID and the history offset of the currently loaded save or nil if the simulation is not a downloaded save. The history offset can be used with loadSave.
1229function simulation.getSaveID()
1230 return 0,0
1231end
1232
1233
1234--```
1235--number, number sim.adjustCoords(number x, number y)
1236--```
1237--Actually this is more of a UI method than a simulation method. Given a mouse position x, y in the window, this function returns the corresponding coordinates in the simulation (taking into account the visibility and position of the zoom window, if applicable).
1238function simulation.adjustCoords(number_x, number_y)
1239 return 0, 0
1240end
1241
1242--```
1243--number sim.prettyPowders()
1244--nil sim.prettyPowders(mode)
1245--```
1246--Sets whether the "pretty powders mode" (powders, such as SAND or BCOL, will be assigned random deco values) is on or off. When called with no arguments, returns a value determining whether it is on or off.
1247function simulation.prettyPowders()
1248 return 0
1249end
1250function simulation.prettyPowders(number_mode) end
1251
1252
1253--```
1254--number sim.gravityGrid()
1255--```
1256--Returns the current setting for drawing the gravity grid. More of a renderer setting than a simulation setting.
1257function simulation.gravityGrid()
1258 return 0
1259end
1260--```
1261--nil sim.gravityGrid(number mode)
1262--```
1263--Sets the setting for drawing the gravity grid to mode.
1264function simulation.gravityGrid(number_mode)
1265end
1266
1267
1268--```
1269--number sim.edgeMode()
1270--```
1271--Returns the current Edge Mode
1272function simulation.edgeMode()
1273 return 0
1274end
1275--```
1276--nil sim.edgeMode(number mode)
1277--```
1278--Sets the current Edge Mode to mode. 0 means normal, 1 creates a wall all the way round the edge of the simulation.
1279function simulation.edgeMode(number_mode)
1280end
1281
1282
1283--```
1284--number sim.gravityMode()
1285--```
1286--Returns the current gravity simulation mode.
1287function simulation.gravityMode()
1288 return 0
1289end
1290--```
1291--nil sim.gravityMode(number mode)
1292--```
1293--Sets the gravity simulation mode to mode.
1294-- 0. Normal, vertical gravity
1295-- 1. No gravity
1296-- 2. Radial gravity
1297function simulation.gravityMode(number_mode)
1298end
1299
1300
1301--```
1302--number sim.airMode()
1303--```
1304--Returns the current Air Simulation Mode.
1305function simulation.airMode()
1306 return 0
1307end
1308--```
1309--nil sim.airMode(number mode)
1310--```
1311--Sets the Air Simulation Mode to mode.
1312--Mode numbers are as follows (not currently available as named constants):
1313-- 0. Normal
1314-- 1. Pressure off
1315-- 2. Velocity off
1316-- 3. Velocity and pressure off
1317-- 4. No update
1318function simulation.airMode(number_mode)
1319end
1320
1321
1322--```
1323--number sim.waterEqualisation()
1324--```
1325--Returns the current Water equalisation setting.
1326function simulation.waterEqualisation()
1327 return 0
1328end
1329--```
1330--nil sim.waterEqualisation(number setting)
1331--```
1332--Set the Water equalisation setting to setting.
1333function simulation.waterEqualisation(number_setting)
1334end
1335
1336
1337--```
1338--number sim.ambientAirTemp()
1339--```
1340--Returns the current ambient temperature. When ambient heat mode is turned on, the air at the edges of the screen will remain at this temperature.
1341function simulation.ambientAirTemp()
1342 return 0
1343end
1344--```
1345--nil sim.ambientAirTemp(number temp)
1346--```
1347--Sets the ambient temperature. The temperature is measured in Kelvin.
1348function simulation.ambientAirTemp(number_temp)
1349end
1350
1351
1352--```
1353--number sim.elementCount(number type)
1354--```
1355--Returns the number of particles of the specified type in the simulation.
1356function simulation.elementCount(number_type)
1357 return 0
1358end
1359
1360--Not documented by the wiki. See this link in case it has been already added
1361--https://powdertoy.co.uk/Wiki/W/Lua_API:Simulation.html#simulation.can_move
1362function simulation.can_move(...) end
1363
1364--Not documented by the wiki. See this link in case it has been already added
1365--https://powdertoy.co.uk/Wiki/W/Lua_API:Simulation.html#simulation.brush
1366function simulation.brush(...) end
1367
1368--```
1369--function sim.parts()
1370--```
1371--Returns an iterator over particle indexes that can be used in lua for loops
1372function simulation.parts() end
1373
1374--```
1375--number sim.pmap(number x, number y)
1376--```
1377--Get the index of the particle at the specified position. Returns 0 if there is no particle there. This function is very similar to sim.partID, but excludes energy particles (such as PHOT, NEUT, ELEC).
1378function simulation.pmap(number_x, number_y)
1379 return 0
1380end
1381
1382--```
1383--number sim.photons(number x, number y)
1384--```
1385--Get the index of the energy particle at the specified position. Returns 0 if there is no particle there. This function is very similar to sim.pmap
1386function simulation.photons(number_x, number_y)
1387 return 0
1388end
1389
1390--```
1391--type sim.neighbors(number x, number y, [number rx], [number ry], [number type])
1392--```
1393--Used for iterating through particles in an area centred on the given coordinates (x, y). Radius in the x and y directions is set by rx and ry. Default radius is 2, 2. If type is provided, only particles of the corresponding type will be returned.
1394--The size of the rectangular area is one plus twice the radius, so a radius of 2, 2 gives a 5x5 pixel area centred on x, y. Particles in the centre position x, y are excluded. Only one particle in each position is included, and energy particles (such as photons, neutrons, electrons) are ignored.
1395--Example (i is the index of the neighbouring particle and nx, ny are its coordinates):
1396--```
1397--for i,nx,ny in sim.neighbors(100,200,1,1) do
1398-- sim.partProperty(i, sim.FIELD_TEMP, 9999)
1399--end
1400--```
1401--Or if coordinates of the neighbouring particles are not required:
1402--```
1403--for i in sim.neighbors(100,200,1,1) do
1404-- sim.partProperty(i, sim.FIELD_TEMP, 9999)
1405--end
1406--```
1407function simulation.neighbors(number_x, number_y, number_rx, number_ry, number_type)
1408end
1409function simulation.neighbors(number_x, number_y, number_rx, number_ry)
1410end
1411function simulation.neighbors(number_x, number_y)
1412end
1413
1414
1415--```
1416--number sim.framerender()
1417--sim.framerender(number frames)
1418--```
1419--Advances the simulation the given number of frames, even when paused. If called with no arguments, returns the number of frames currently to be rendered. Usually is 0.
1420function simulation.framerender(number_frames)
1421end
1422function simulation.framerender()
1423 return 0
1424end
1425
1426
1427--```
1428--number sim.gspeed()
1429--```
1430--Returns the current GoL speed
1431function simulation.gspeed()
1432 return 0
1433end
1434--```
1435--nil sim.gspeed(number newSpeed)
1436--```
1437--Sets the current GoL speed. This is the number of frames between GoL updates. Default is one, larger numbers make it slower.
1438function simulation.gspeed(number_newSpeed)
1439end
1440
1441
1442--```
1443--nil sim.takeSnapshot()
1444--```
1445--Takes a undo snapshot, for use with ctrl + z
1446function simulation.takeSnapshot() end
1447
1448--Not documented by the wiki. See this link in case it has been already added
1449--https://powdertoy.co.uk/Wiki/W/Lua_API:Simulation.html#simulation.replaceModeFlags
1450function simulation.replaceModeFlags(...) end
1451
1452--Not documented by the wiki. See this link in case it has been already added
1453--https://powdertoy.co.uk/Wiki/W/Lua_API:Simulation.html#simulation.listCustomGol
1454function simulation.listCustomGol(...) end
1455
1456--Not documented by the wiki. See this link in case it has been already added
1457--https://powdertoy.co.uk/Wiki/W/Lua_API:Simulation.html#simulation.addCustomGol
1458function simulation.addCustomGol(...) end
1459
1460--Not documented by the wiki. See this link in case it has been already added
1461--https://powdertoy.co.uk/Wiki/W/Lua_API:Simulation.html#simulation.removeCustomGol
1462function simulation.removeCustomGol(...) end
1463
1464
1465renderer = {
1466 --#### These should be used in lua graphics functions to set how particles will be drawn. Effects like fire, glowing, and flares are set here. How a particle is actually rendered depends on the current render and display modes.
1467 PMODE = 0x00000FFF, --> A bitmask which can be used to check if a particle has any PMODEs set.
1468 --#### These should be used in lua graphics functions to set how particles will be drawn. Effects like fire, glowing, and flares are set here. How a particle is actually rendered depends on the current render and display modes.
1469 PMODE_NONE = 0x00000000, --> Don't draw a point where a particle is at all. Unused.
1470 --#### These should be used in lua graphics functions to set how particles will be drawn. Effects like fire, glowing, and flares are set here. How a particle is actually rendered depends on the current render and display modes.
1471 PMODE_FLAT = 0x00000001, --> Draw a basic pixel, overwriting the color under it. Given by default to everything unless overridden, Doesn't support cola.
1472 --#### These should be used in lua graphics functions to set how particles will be drawn. Effects like fire, glowing, and flares are set here. How a particle is actually rendered depends on the current render and display modes.
1473 PMODE_BLOB = 0x00000002, --> Draw a blob like in blob mode. Everything is given this in blob display mode, but can be set manually.
1474 --#### These should be used in lua graphics functions to set how particles will be drawn. Effects like fire, glowing, and flares are set here. How a particle is actually rendered depends on the current render and display modes.
1475 PMODE_BLUR = 0x00000004, --> Blur effect, used in fancy display mode. Given to all liquids without a graphics functions by default, if not this isn't set.
1476 --#### These should be used in lua graphics functions to set how particles will be drawn. Effects like fire, glowing, and flares are set here. How a particle is actually rendered depends on the current render and display modes.
1477 PMODE_GLOW = 0x00000008, --> Glow effect, used in elements like DEUT and TRON in fancy display mode, also given to radioactive elements.
1478 --#### These should be used in lua graphics functions to set how particles will be drawn. Effects like fire, glowing, and flares are set here. How a particle is actually rendered depends on the current render and display modes.
1479 PMODE_SPARK = 0x00000010, --> Draws a very light sparkle around a particle.
1480 --#### These should be used in lua graphics functions to set how particles will be drawn. Effects like fire, glowing, and flares are set here. How a particle is actually rendered depends on the current render and display modes.
1481 PMODE_FLARE = 0x00000020, --> Draws a flare around a particle, used by BOMB.
1482 --#### These should be used in lua graphics functions to set how particles will be drawn. Effects like fire, glowing, and flares are set here. How a particle is actually rendered depends on the current render and display modes.
1483 PMODE_LFLARE = 0x00000040, --> Very large and bright flare, used by DEST when it hits something.
1484 --#### These should be used in lua graphics functions to set how particles will be drawn. Effects like fire, glowing, and flares are set here. How a particle is actually rendered depends on the current render and display modes.
1485 PMODE_ADD = 0x00000080, --> Like PMODE_FLAT, but adds color to a pixel, instead of overwriting it.
1486 --#### These should be used in lua graphics functions to set how particles will be drawn. Effects like fire, glowing, and flares are set here. How a particle is actually rendered depends on the current render and display modes.
1487 PMODE_BLEND = 0x00000100, --> Basically the same thing as PMODE_ADD, but has better OpenGL support
1488 --#### These should be used in lua graphics functions to set how particles will be drawn. Effects like fire, glowing, and flares are set here. How a particle is actually rendered depends on the current render and display modes.
1489 PSPEC_STICKMAN = 0x00000200, --> Used by stickmen. Won't do anything unless the element actually is a stickman.
1490 --#### These should be used in lua graphics functions to set how particles will be drawn. Effects like fire, glowing, and flares are set here. How a particle is actually rendered depends on the current render and display modes.
1491 OPTIONS = 0x0000F000, --> A bitmask which can be used to check if a particle has any display options set.
1492 --#### These should be used in lua graphics functions to set how particles will be drawn. Effects like fire, glowing, and flares are set here. How a particle is actually rendered depends on the current render and display modes.
1493 NO_DECO = 0x00001000, --> Prevents decoration from being shown on an element.
1494 --#### These should be used in lua graphics functions to set how particles will be drawn. Effects like fire, glowing, and flares are set here. How a particle is actually rendered depends on the current render and display modes.
1495 DECO_FIRE = 0x00002000, --> Allows decoration to be drawn onto the fire effect. All gasses have this on by default.
1496 --#### These should be used in lua graphics functions to set how particles will be drawn. Effects like fire, glowing, and flares are set here. How a particle is actually rendered depends on the current render and display modes.
1497 FIREMODE = 0x00FF0000, --> A bitmask which can be used to check if a particle has any fire graphics set.
1498 --#### These should be used in lua graphics functions to set how particles will be drawn. Effects like fire, glowing, and flares are set here. How a particle is actually rendered depends on the current render and display modes.
1499 FIRE_ADD = 0x00010000, --> Adds a weak fire effect around an element. Does not support many colors like FIRE_BLEND does.
1500 --#### These should be used in lua graphics functions to set how particles will be drawn. Effects like fire, glowing, and flares are set here. How a particle is actually rendered depends on the current render and display modes.
1501 FIRE_BLEND = 0x00020000, --> Adds a stronger fire effect around an element. All gasses have this on by default.
1502 --#### These should be used in lua graphics functions to set how particles will be drawn. Effects like fire, glowing, and flares are set here. How a particle is actually rendered depends on the current render and display modes.
1503 EFFECT = 0xFF000000, --> A bitmask which can be used to check if a particle has any special effects set.
1504 --#### These should be used in lua graphics functions to set how particles will be drawn. Effects like fire, glowing, and flares are set here. How a particle is actually rendered depends on the current render and display modes.
1505 EFFECT_GRAVIN = 0x01000000, --> Adds a PRTI effect. Won't work unless .life and .ctype are set properly in an update function.
1506 --#### These should be used in lua graphics functions to set how particles will be drawn. Effects like fire, glowing, and flares are set here. How a particle is actually rendered depends on the current render and display modes.
1507 EFFECT_GRAVOUT = 0x02000000, --> Adds a PRTO effect. Won't work unless .life and .ctype are set properly in an update function.
1508 --#### These should be used in lua graphics functions to set how particles will be drawn. Effects like fire, glowing, and flares are set here. How a particle is actually rendered depends on the current render and display modes.
1509 EFFECT_LINES = 0x04000000, --> Used by SOAP to draw lines between attached SOAP particles. Ignored by everything else.
1510 --#### These should be used in lua graphics functions to set how particles will be drawn. Effects like fire, glowing, and flares are set here. How a particle is actually rendered depends on the current render and display modes.
1511 EFFECT_DBGLINES = 0x08000000, --> Draw lines between particles of the same type with similar temperatures. Used by WIFI and portals to draw lines between particles of the same channel when in debug mode.
1512
1513
1514 --#### These are the values used and returned by ren.renderMode. They are combinations of the above values, and sometimes overlap. All source definitions also include OPTIONS and PSPEC_STICKMAN (so that options can always be set and stickmen are always rendered), but they are not listed here.
1515 --> In source code `PMODE_SPARK | PMODE_FLARE | PMODE_LFLARE`
1516 --> Used in all display modes except for heat, nothing, heat gradient, and life gradient. Turns on all basic effects like flares and portal effects.
1517 RENDER_EFFE = nil,
1518 --#### These are the values used and returned by ren.renderMode. They are combinations of the above values, and sometimes overlap. All source definitions also include OPTIONS and PSPEC_STICKMAN (so that options can always be set and stickmen are always rendered), but they are not listed here.
1519 --> In source code `PMODE_BLEND | FIREMODE`
1520 --> Used in fire, blob, and fancy display modes. Turns on all fire effects.
1521 RENDER_FIRE = 0x3f380,
1522 --#### These are the values used and returned by ren.renderMode. They are combinations of the above values, and sometimes overlap. All source definitions also include OPTIONS and PSPEC_STICKMAN (so that options can always be set and stickmen are always rendered), but they are not listed here.
1523 --> In source code `PMODE_ADD | PMODE_BLEND`
1524 --> Used in fancy display mode, so that radioactive elements glow.
1525 RENDER_GLOW = 0xf388,
1526 --#### These are the values used and returned by ren.renderMode. They are combinations of the above values, and sometimes overlap. All source definitions also include OPTIONS and PSPEC_STICKMAN (so that options can always be set and stickmen are always rendered), but they are not listed here.
1527 --> In source code `PMODE_ADD | PMODE_BLEND`
1528 --> Used in fancy display mode, to turn on the liquid blur effect.
1529 RENDER_BLUR = 0xf384,
1530 --#### These are the values used and returned by ren.renderMode. They are combinations of the above values, and sometimes overlap. All source definitions also include OPTIONS and PSPEC_STICKMAN (so that options can always be set and stickmen are always rendered), but they are not listed here.
1531 --> In source code `PMODE_ADD | PMODE_BLEND`
1532 --> Causes every particle to get PMODE_BLOB.
1533 RENDER_BLOB = 0xf382,
1534 --#### These are the values used and returned by ren.renderMode. They are combinations of the above values, and sometimes overlap. All source definitions also include OPTIONS and PSPEC_STICKMAN (so that options can always be set and stickmen are always rendered), but they are not listed here.
1535 --> In source code `PMODE_ADD | PMODE_BLEND | EFFECT_LINES`
1536 --> Used by every single display mode, turns on PMODE_FLAT so particles get displayed.
1537 RENDER_BASC = 0x400f381,
1538 --#### These are the values used and returned by ren.renderMode. They are combinations of the above values, and sometimes overlap. All source definitions also include OPTIONS and PSPEC_STICKMAN (so that options can always be set and stickmen are always rendered), but they are not listed here.
1539 --> In source code `PMODE_FLAT`
1540 --> Not used at all, but would make sure at least each individual pixel gets drawn.
1541 RENDER_NONE = 0xf201,
1542
1543
1544 --#### These are the values used and returned by ren.displayMode. They can be set together, although no official display mode does this.
1545 --> Cracker air display mode, used in alternate velocity display.
1546 DISPLAY_AIRC = 0x00000001,
1547 --#### These are the values used and returned by ren.displayMode. They can be set together, although no official display mode does this.
1548 --> Used by pressure display mode.
1549 DISPLAY_AIRP = 0x00000002,
1550 --#### These are the values used and returned by ren.displayMode. They can be set together, although no official display mode does this.
1551 --> Used by velocity display mode.
1552 DISPLAY_AIRV = 0x00000004,
1553 --#### These are the values used and returned by ren.displayMode. They can be set together, although no official display mode does this.
1554 --> Used by heat display mode.
1555 DISPLAY_AIRH = 0x00000008,
1556 --#### These are the values used and returned by ren.displayMode. They can be set together, although no official display mode does this.
1557 --> A bitmask which can be used to check if an air display mode is set.
1558 DISPLAY_AIR = 0x0000000F,
1559 --#### These are the values used and returned by ren.displayMode. They can be set together, although no official display mode does this.
1560 --> Used by fancy display mode, turns on gravity lensing, causing newtonian gravity areas to bend light.
1561 DISPLAY_WARP = 0x00000010,
1562 --#### These are the values used and returned by ren.displayMode. They can be set together, although no official display mode does this.
1563 --> Used by persistent display mode.
1564 DISPLAY_PERS = 0x00000020,
1565 --#### These are the values used and returned by ren.displayMode. They can be set together, although no official display mode does this.
1566 --> Doesn't do anything at all, unless maybe OpenGL is on. Unclear what it does even then.
1567 DISPLAY_EFFE = 0x00000040,
1568
1569 --#### These are the values used and returned by ren.colorMode. Only one can be set at a time, and they control which types of colors particles are drawn in.
1570 --> Default colors, nothing gets changed.
1571 COLOUR_DEFAULT = nil,
1572 --#### These are the values used and returned by ren.colorMode. Only one can be set at a time, and they control which types of colors particles are drawn in.
1573 --> Render elements in heat display colors. Pink = hottest, Blue = coldest.
1574 COLOUR_HEAT = nil,
1575 --#### These are the values used and returned by ren.colorMode. Only one can be set at a time, and they control which types of colors particles are drawn in.
1576 --> Render elements in a greyscale gradient dependent on .life value.
1577 COLOUR_LIFE = nil,
1578 --#### These are the values used and returned by ren.colorMode. Only one can be set at a time, and they control which types of colors particles are drawn in.
1579 --> Render elements normally, but with a slight greyscale gradient dependent on a particle's temperature.
1580 COLOUR_GRAD = nil,
1581 --#### These are the values used and returned by ren.colorMode. Only one can be set at a time, and they control which types of colors particles are drawn in.
1582 --> Remove all color changes from elements, elements get rendered in whichever color their element button is.
1583 COLOUR_BASC = nil,
1584}
1585
1586--```
1587--table ren.renderModes()
1588--ren.renderModes(table newModes)
1589--```
1590--If called with no arguments, returns a table containing the currently activated render modes. If called with a table argument, turns on all the render modes specified in the table. Render modes are typically used to change the way all particles render, display modes set extra added effects.
1591--Print out all current render modes in hex:
1592--```
1593--for k,v in pairs(ren.renderModes()) do
1594-- print(k,"0x"..bit.tohex(v))
1595--end
1596-->>1, 0x00fff380; 2, 0xff00f270; 3, 0x0400f381
1597--```
1598--Set the current render mode to a weird form of blob display
1599--```
1600--ren.renderModes({ren.RENDER_BLOB, ren.RENDER_EFFE})
1601--```
1602function renderer.renderModes(table_newModes)
1603end
1604
1605
1606--```
1607--table ren.displayModes()
1608--ren.displayModes(table newModes)
1609--```
1610--Works exactly like rennder.renderModes(). If called with no arguments, returns a table containing the currently activated display modes. If called with a table argument, turns on all the display modes specified in the table. Render modes are typically used to change the way all particles render, display modes set extra added effects.
1611--Print out all current display modes in hex:
1612--```
1613--for k,v in pairs(ren.displayModes()) do
1614-- print(k,"0x"..bit.tohex(v))
1615--end
1616-->>1, 0x00000002; 2, 0x00000010
1617--```
1618--Set the current display mode to persistent with cracker velocity display
1619--```
1620--ren.displayModes({ren.DISPLAY_AIRC, ren.DISPLAY_PERS})
1621--```
1622function renderer.displayModes(table_newModes)
1623end
1624
1625--```
1626--number ren.colorMode
1627--ren.colorMode(number colourMode)
1628--```
1629-- This function takes one optional integer and sets which colour modes the currently appIying render mode uses. If the function is called with no arguments, it returns the current colour mode as an integer as well.
1630-- A colour mode is basically a description of how particles are drawn. The other details which are considered when particles are drawn are fire mode, pixel mode and effect mode (rare cases like portals).
1631-- On the bottom of this page there's a list of descriptions of what each colour mode does.
1632function renderer.colorMode()
1633 return 0
1634end
1635function renderer.colorMode(number_colorMode)
1636end
1637--```
1638--number ren.colourMode()
1639--ren.colourMode(number colourMode)
1640--```
1641-- This function takes one optional integer and sets which colour modes the currently appIying render mode uses. If the function is called with no arguments, it returns the current colour mode as an integer as well.
1642-- A colour mode is basically a description of how particles are drawn. The other details which are considered when particles are drawn are fire mode, pixel mode and effect mode (rare cases like portals).
1643-- On the bottom of this page there's a list of descriptions of what each colour mode does.
1644function renderer.colourMode()
1645 return 0
1646end
1647function renderer.colourMode(number_colourMode)
1648end
1649
1650
1651--```
1652--number ren.decorations()
1653--ren.decorations(number decoSetting)
1654--```
1655--If called with no arguments, returns a 0 or a 1 representing the current deco mode setting. If a number is passed in, turns decorations on or off.
1656function renderer.decorations(number_decoSetting)
1657end
1658function renderer.decorations()
1659 return 0
1660end
1661
1662
1663--```
1664--number ren.grid()
1665--ren.grid(number gridSize)
1666--```
1667--If called with no arguments, returns the current grid size (normally set with 'g'). Grid sizes range from 0 (no grid) to 9. Each size increases the number of pixels between lines by 4.
1668--If an argument is passed in, sets the current grid size. There are no checks to make sure it is in the valid range, but if negative numbers are passed in it may cause strange behavior.
1669function renderer.grid(number_gridSize)
1670end
1671function renderer.grid()
1672 return 0
1673end
1674
1675
1676--```
1677--number ren.debugHUD()
1678--ren.debugHUD(number debugSetting)
1679--```
1680--If called with no arguments, returns a 0 or a 1 representing whether the debug HUD (normally set with 'd') is on or off. If a number is passed in, turns the debug HUD on or off.
1681function renderer.debugHUD(number_debugSetting)
1682end
1683function renderer.debugHUD()
1684 return 0
1685end
1686
1687
1688--```
1689--number ren.showBrush()
1690--ren.showBrush(number brushSetting)
1691--```
1692--If called with no arguments, returns a 0 or a 1 representing whether the brush is currently shown. If a number is passed in, disables rendering the brush. This function is intended for recording scripts which want to hide the brush and other hud elements.
1693--
1694function renderer.showBrush(number_brushSetting)
1695end
1696function renderer.showBrush()
1697 return 0
1698end
1699
1700--Not documented by the wiki. See this link in case it has been already added
1701--https://powdertoy.co.uk/Wiki/W/Lua_API:Renderer.html#renderer.depth3d
1702function renderer.depth3d(...) end
1703
1704--```
1705-- ren.zoomEnabled(bool zoomState)
1706-- bool ren.zoomEnabled()
1707--```
1708-- If called with no arguments, returns a boolean indicating whether the zoom window is open or not. If a number is passed in, it shows or hides the zoom window
1709function renderer.zoomEnabled(bool_zoomState)
1710end
1711function renderer.zoomEnabled()
1712 return true
1713end
1714
1715--```
1716-- number, number, number, number ren.zoomWindow()
1717-- ren.zoomWindow(number x, number y, number zoomFactor)
1718--```
1719-- The zoom window displays the magnified image. If called with no arguments, returns 4 numbers: left top corner X position, left top corner Y position, the zoom factor and the inner window size in pixels. If arguments are passed then the zoom window will be moved to the specified X and Y coordinates (from its top left corner) and change its zoom factor.
1720function renderer.zoomWindow(number_x, number_y, number_zoomFactor)
1721end
1722function renderer.zoomWindow()
1723 return 0,0,0,0
1724end
1725
1726
1727--```
1728-- number, number, number ren.zoomScope()
1729-- ren.zoomScope(number x, number y, number size)
1730-- The zoom scope defines the area where to zoom in. If called with no arguments, returns 3 numbers: left top corner X position, left top corner Y position and its size. If arguments are passed then the zoom scope will be moved to the specified X and Y coordinates (from its top left corner). It will also make it span the amount of pixels specified by the 'size' argument equally in width and height.
1731--```
1732function renderer.zoomScope()
1733 return 0,0,0
1734end
1735function renderer.zoomScope(number_x, number_y, number_size)
1736end
1737
1738
1739elements = {}
1740
1741
1742--```
1743--number elements.allocate(string group, string name)
1744--```
1745--Use this function to create a new element. This function will return the id of your element, and create a unique identifier that can be used to modify the properties later. The identifier is in the form GROUP_PT_NAME, where group is the name of the mod or script (or just anything unique, like your username), and name is the name of the element. For example, elements.allocate("mymod", "virus") would create the identifier MYMOD_PT_VIRUS.
1746--The identifier is added as a constant in the elements table, so elements.MYMOD_PT_VIRUS would be equivalent to the new element's id, and can be used as the elementID argument to any of the functions below.
1747--The new element is created with all the default properties, and won't be visible until you modify it to show up in the menu.
1748--Returns -1 on failure (there are no free spaces to create a new element).
1749function elements.allocate(string_group, string_name)
1750 return 0
1751end
1752
1753--```
1754--local myNewElement = elements.allocate("wiki", "expl")
1755--elements.element(myNewElement, elements.element(elements.DEFAULT_PT_WATR))
1756--elements.property(myNewElement, "Name", "EXPL")
1757--elements.property(myNewElement, "Description", "This is an example element from the Wiki")
1758--```
1759--In this example, the element properties for our new element (EXPL) are copied from WATR
1760--```
1761--local star = elements.allocate("ELEMENT", "STAR")
1762--elements.element(star, elements.element(elements.DEFAULT_PT_DMND))
1763--elements.property(star, "Name", "STAR")
1764--elements.property(star, "Description", "STAR. Enough Pressure Makes It Explode Into LAVA.")
1765--elements.property(star, "Colour", 0xFFFFFF)
1766--elements.property(star, "MenuSection", elem.SC_SOLIDS)
1767--elements.property(star, "HotAir", -0.009)
1768--elements.property(star, "Weight", 333)
1769--elements.property(star, "Temperature", 4556)
1770--elements.property(star, "HighPressure", 200)
1771--elements.property(star, "HighPressureTransition", elements.DEFAULT_PT_LAVA)
1772--local function graphics1(i, colr, colg, colb)
1773-- return 1,ren.FIRE_ADD,255,100,155,210,255,255,255,255
1774--end
1775--elements.property(star, "Graphics", graphics1)
1776--```
1777--Another Example, from an actual script. For more info on graphics functions, see the legacy api page
1778--```
1779--table elements.element(number elementID)
1780--```
1781--Returns a table containing all of an element's properties (Name, Description, etc)
1782function elements.element(number_elementID)
1783 return {}
1784end
1785--Sets the properties from the given table onto the element.
1786--These two functions are useful for copying or templating from already present elements, for example
1787function elements.element(number_elementID, table_properties)
1788end
1789
1790
1791--```
1792--object elements.property(number elementID, string property)
1793--```
1794--Gets the value of an element property
1795function elements.property(number_elementID, string_property)
1796end
1797--```
1798--elements.property(number elementID, string property, object value)
1799--```
1800--Sets the value of an element property
1801function elements.property(number_elementID, string_property, object_value)
1802end
1803
1804--```
1805--elements.free(number elementID)
1806--```
1807--Free a previously allocated element, so it will disappear from the game. The element id will be freed and can used later by another script. elementID must be a non-default element (i.e you cannot free the default WATR element)
1808function elements.free(number_elementID)
1809end
1810
1811
1812--```
1813--elements.loadDefault(number elementID)
1814--```
1815--Reset an element to its original state before it was modified
1816function elements.loadDefault(number_elementID)
1817end
1818--```
1819--elements.loadDefault()
1820--```
1821--Resets all elements to the original state. This will also erase any elements created with any scripts, only the default elements will be available.
1822function elements.loadDefault()
1823end
1824
1825
1826graphics = {
1827 WIDTH = 629,
1828 HEIGHT = 424,
1829}
1830
1831
1832--```
1833--number, number graphics.textSize(string text)
1834--```
1835--Returns the width and height of the specified text.
1836function graphics.textSize(string_text)
1837 return 0,0
1838end
1839
1840--```
1841--graphics.drawText(number x, number y, string text, [number r, number g, number b, [number a]])
1842--```
1843--Draws the specified text at (x,y). Providing the color is optional, if not provided defaults to white.
1844function graphics.drawText(number_x, number_y, string_text, number_r, number_g, number_b, number_a)
1845end
1846function graphics.drawText(number_x, number_y, string_text, number_r, number_g, number_b)
1847end
1848function graphics.drawText(number_x, number_y, string_text)
1849end
1850
1851--```
1852--graphics.drawLine(number x1, number y1, number x2, number y2, [number r, number g, number b, [number a]])
1853--```
1854--Draws a line from (x1,y1) to (x2,y2). Providing the color is optional, if not provided defaults to white.
1855function graphics.drawLine(number_x1, number_y1, number_x2, number_y2, number_r, number_g, number_b, number_a)
1856end
1857function graphics.drawLine(number_x1, number_y1, number_x2, number_y2, number_r, number_g, number_b)
1858end
1859function graphics.drawLine(number_x1, number_y1, number_x2, number_y2)
1860end
1861
1862--```
1863--graphics.drawRect(number x, number y, number width, number height, [number r, number g, number b, [number a]])
1864--```
1865--Draws a hollow rectangle at (x,y) with the specified width and height. Providing the color is optional, if not provided defaults to white.
1866function graphics.drawRect(number_x, number_y, number_width, number_height, number_r, number_g, number_b, number_a)
1867end
1868function graphics.drawRect(number_x, number_y, number_width, number_height, number_r, number_g, number_b)
1869end
1870function graphics.drawRect(number_x, number_y, number_width, number_height)
1871end
1872
1873--```
1874--graphics.fillRect(number x, number y, number width, number height, [number r, number g, number b, [number a]])
1875--```
1876--Draws a filled rectangle at (x,y) with the specified width and height. Providing the color is optional, if not provided defaults to white.
1877function graphics.fillRect(number_x, number_y, number_width, number_height, number_r, number_g, number_b, number_a)
1878end
1879function graphics.fillRect(number_x, number_y, number_width, number_height, number_r, number_g, number_b)
1880end
1881function graphics.fillRect(number_x, number_y, number_width, number_height)
1882end
1883
1884--```
1885--graphics.drawCircle(number x, number y, number radiusW, number radiusH, [number r, number g, number b, [number a]])
1886--```
1887--Draws a hollow circle at (x,y) with radius of (radiusW,radiusH). Providing the color is optional, if not provided defaults to white.
1888function graphics.drawCircle(number_x, number_y, number_radiusW, number_radiusH, number_r, number_g, number_b, number_a)
1889end
1890function graphics.drawCircle(number_x, number_y, number_radiusW, number_radiusH, number_r, number_g, number_b)
1891end
1892function graphics.drawCircle(number_x, number_y, number_radiusW, number_radiusH)
1893end
1894
1895--```
1896--graphics.fillCircle(number x, number y, number radiusW, number radiusH, [number r, number g, number b, [number a]])
1897--```
1898--Draws a filled circle at (x,y) with radius of (radiusW,radiusH). Providing the color is optional, if not provided defaults to white.
1899function graphics.fillCircle(number_x, number_y, number_radiusW, number_radiusH, number_r, number_g, number_b, number_a)
1900end
1901function graphics.fillCircle(number_x, number_y, number_radiusW, number_radiusH, number_r, number_g, number_b)
1902end
1903function graphics.fillCircle(number_x, number_y, number_radiusW, number_radiusH)
1904end
1905
1906--```
1907--graphics.getColors(number color)
1908--```
1909--Converts color from hex. Return number r,g,b,a.
1910function graphics.getColors(number_color)
1911 return 0,0,0,0
1912end
1913
1914
1915--```
1916--graphics.getHexColor( [number r], [number g], [number b], [number a])
1917--```
1918--Converts color to hex.
1919function graphics.getHexColor(number_r, number_g, number_b, number_a)
1920 return 0
1921end
1922function graphics.getHexColor(number_r, number_g, number_b)
1923 return 0
1924end
1925
1926
1927fileSystem = {}
1928
1929--```
1930--table fs.list(string folder)
1931--```
1932--Returns a table containing a list of files and folders in "folder"
1933function fileSystem.list(string_folder)
1934 return {}
1935end
1936
1937--```
1938--boolean fs.exists(string path)
1939--```
1940--Returns a boolean indicating whether "path" exists as either a file or folder
1941function fileSystem.exists(string_path)
1942 return false
1943end
1944
1945--```
1946--boolean fs.isFile(string path)
1947--```
1948--Returns a boolean indicating whether "path" exists as a file (i.e not a folder)
1949function fileSystem.isFile(string_path)
1950 return false
1951end
1952
1953--```
1954--boolean fs.isDirectory(string path)
1955--```
1956--Returns a boolean indicating whether "path" exists as a folder (i.e not a file)
1957function fileSystem.isDirectory(string_path)
1958 return false
1959end
1960
1961
1962--```
1963--boolean fs.makeDirectory(string path)
1964--```
1965--Creates the folder "path", this function is not recursive and won't create parent directories (makeDirectory("parent/child") will fail if "parent" does not exist). This function returns true on success and false on failure.
1966function fileSystem.makeDirectory(string_path)
1967 return false
1968end
1969
1970--```
1971--boolean fs.removeDirectory(string path)
1972--```
1973--Removes the empty folder specified by "path". This function returns true on success and false on failure.
1974function fileSystem.removeDirectory(string_path)
1975 return false
1976end
1977
1978--```
1979--boolean fs.removeFile(string path)
1980--```
1981--Removes the file "path". This function returns true on success and false on failure.
1982function fileSystem.removeFile(string_path)
1983 return false
1984end
1985
1986--```
1987--boolean fs.move(string path, string newPath)
1988--```
1989--Moves the file or folder specified by "path" to "newPath". This function returns true on success and false on failure.
1990function fileSystem.move(string_path, string_newPath)
1991 return false
1992end
1993
1994--```
1995--boolean fs.copy(string path, string newPath)
1996--```
1997--Copies the file "path" to "newPath". This function returns true on success and false on failure.
1998function fileSystem.copy(string_path, string_newPath)
1999 return false
2000end
2001
2002
2003platform = {}
2004function platform.platform(...) end
2005function platform.build(...) end
2006function platform.releaseType(...) end
2007function platform.exeName(...) end
2008function platform.restart(...) end
2009function platform.openLink(...) end
2010function platform.clipboardCopy(...) end
2011function platform.clipboardPaste(...) end
2012
2013event = {
2014 --### keypress
2015 --> This event is sent every time a key is pressed, and continuously re-sent if they key is held down. This event should be used if you want to have a key shortcut; The textinput event should be used instead if you want to handle text input / Unicode.
2016 --> This event can be canceled
2017 --> Arguments: key, scan, repeat, shift, ctrl, alt
2018 -->> key is the key code, a number that is usually the ascii value for the key, but for non-printable characters it may be a high number. You can find a list of key codes here: https://wiki.libsdl.org/SDLKeycodeLookup
2019 -->> scan is the scan code. This is a number that represents the physical location of a key on a keyboard. You can find a list of scan codes here: https://wiki.libsdl.org/SDLScancodeLookup
2020 -->> repeat is a boolean that tells whether this is a key repeat event (sent every so often when the key is held down). You may want to ignore this event when it is just a key repeat event
2021 -->> shift / ctrl / alt are booleans that will tell you whether those modifiers are currently held
2022 keypress = 0,
2023
2024 --### keyrelease
2025 --> This event is sent every time a key is released
2026 --> This event can be canceled
2027 --> Arguments: key, scan, repeat, shift, ctrl, alt
2028 -->> These arguments mean exactly the same thing as for keypress events. Repeat will always be false.
2029 keyrelease = 1,
2030
2031 --### textinput
2032 --> This event is sent every time text is input. The text will be sent as a string, and may be more than one character or contain Unicode.
2033 --> Arguments: text
2034 textinput = 2,
2035
2036 --### mousedown
2037 --> This event is sent whenever the mouse is clicked.
2038 --> This event can be canceled
2039 --> Arguments: x, y, button
2040 -->> x and y will not be adjusted for the zoom window. See sim.adjustCoords for that. Coordinates may be outside of the simulation bounds (clicks outside the simulation area are still sent)
2041 -->> button is the mouse button pressed. 1 is left click, 2 is middle click, 3 is right click. There may also be higher mouse buttons like 4 and 5.
2042 mousedown = 4,
2043
2044 --### mouseup
2045 --> This event is sent whenever the mouse is released. There are also other some special cases this event may be sent,
2046 --> This event can be canceled (only when reason = 0)
2047 --> Arguments: x, y, button, reason
2048 -->> x, y, and button function the same as the mousedown event
2049 -->> reason is a number that describes what type of mouseup event this is (basically, hacks we sent mouseup events on anyway). reason 0 is for normal mouseup events. reason 1 is used when another interface is opened and a blur event is sent. This is how tpt ensures that the mouse isn't "stuck" down forever if you release the mouse after opening another interface. reason 2 is used when the mouse moves inside or outside of the zoom window. This is how tpt cancels mouse drawing with zoom windows to ensure a big line isn't drawn across the screen. The normal reason = 0 event will still be sent later.
2050 mouseup = 5,
2051
2052 --### mousemove
2053 --> This event is sent every time the mouse is moved. It is only sent when the mouse is inside the tpt window, unless the mouse is held, in which case it can also be sent outside of the tpt window until the mouse is released. Coordinates from outside the tpt window bounds (including negative coordinates) can be sent in that case.
2054 --> This event can be canceled
2055 --> Arguments: x, y, dx, dy
2056 -->> x and y are the mouse coordinates. dx and dy are the diff from the previous coordinates to the current ones.
2057 mousemove = 6,
2058
2059 --### mousewheel
2060 --> This event is sent whenever the mousewheel is scrolled.
2061 --> This event can be canceled
2062 --> Arguments: x, y, d
2063 -->> x and y are the mouse position where the wheel was scrolled
2064 -->> d is the distance the mouse was scrolled. On nearly all mice this will be 1 or -1, but in certain situations it may be higher. You most likely want to treat higher values as 1 or -1 anyway. Horizontal scrolling is not supported at the moment, in the meantime d will be 0 for horizontal scrolling.
2065 mousewheel = 7,
2066
2067 --### tick
2068 --> This event is sent once per frame. It is sent after the simulation frame finishes and everything is drawn to the screen.
2069 tick = 8,
2070
2071 --### blur
2072 --> This event is sent whenever a blocking interface (such as the save browser or the console) is opened. Lua scripts don't function in those interfaces, so this event can be used to detect when the lua script is about to stop receiving any events during that time.
2073 blur = 9,
2074
2075 --### close
2076 --> This event is sent whenever the tpt window is about to close.
2077 close = 10
2078}
2079
2080
2081--```
2082--event.register(eventType, eventHandler)
2083--```
2084--Registers an event handler for a certain type of event. See the list of constants at the bottom of the page for possible events you can listen to. The constants exist under the event namespace, not as strings. Returns eventHandler, in case it's a lambda function and you want to unregister it later.
2085--The event handler will be called with a varying number of arguments, depending on which type of event is being handled. Certain events can also be canceled by returning false from the event.
2086--**Example:**
2087--```
2088--event.register(event.mousedown, function(x, y) print("mouse clicked at " .. x .. "," .. y) end)
2089--```
2090function event.register(eventType, eventHandler) end
2091
2092--```
2093--event.unregister(eventType, eventHandler)
2094--```
2095--Unregister a previously registered event handler. Has no effect of this function wasn't registered or wasn't registered under this event type.
2096function event.unregister(eventType, eventHandler) end
2097
2098--```
2099--event.getmodifiers()
2100--```
2101--Gets the current keyboard modifier state. Includes bits describing whether shift, ctrl, alt, caps lock, num lock, and other modifiers are pressed / set.
2102function event.getmodifiers()
2103 return 0
2104end
2105
2106
2107http = {}
2108
2109HTTPRequest = {}
2110
2111--Returns one of the following:
2112-- - "running" if the request hasn't finished yet;
2113-- - "done" if the request has finished and the response body is ready to be read;
2114-- - "dead" if the request is dead, i.e. if it has been cancelled or if the response body has been read.
2115function HTTPRequest:status()
2116 return ""
2117end
2118
2119--If the request is not dead, returns the size of the response body in bytes in the first return value (-1 if the size is not known), and the number of bytes received so far in the second. If the request is dead, returns nothing.
2120function HTTPRequest:progress()
2121 return 0,0
2122end
2123
2124--Cancels the request. Does nothing if the request is dead
2125function HTTPRequest:cancel()
2126end
2127
2128-- Finishes the request and returns the response body and the status code. Call this only when HTTPRequest:status returns "done". Does and returns nothing if the request is dead.
2129-- Non-standard status codes of note are 601, which is returned by plain HTTP requests if TPT is built with ENFORCE_HTTPS, and 604, which is returned by all requests if TPT is built with NOHTTP. Note that both codes may be returned for other reasons.
2130function HTTPRequest:finish()
2131 return "", 0
2132end
2133
2134--```
2135--HTTPRequest http.get(string uri, [table headers])
2136--```
2137--Constructs an HTTPRequest object and starts the underlying GET request immediately with the URI and headers supplied. The optional table argument is a collection of string key and string value pairs.
2138function http.get(string_uri, table_headers)
2139 return HTTPRequest
2140end
2141function http.get(string_uri)
2142 return HTTPRequest
2143end
2144
2145--```
2146--HTTPRequest http.post(string uri, table post_params, [table headers])
2147--```
2148--Same as http.get, except the underlying request is a POST. Post parameters are passed in the extra table argument, a collection of string key and string value pairs.
2149function http.post(string_uri, table_postParams, table_headers)
2150 return HTTPRequest
2151end
2152function http.post(string_uri, table_postParams)
2153 return HTTPRequest
2154end
2155
2156ui = interface
2157sim = simulation
2158ren = renderer
2159elem = elements
2160gfx = graphics
2161fs = fileSystem
2162plat = platform
2163evt = event
2164simulation.XRES = nil
2165simulation.YRES = nil
2166simulation.CELL = nil
2167simulation.NT = nil
2168simulation.ST = nil
2169simulation.ITH = nil
2170simulation.ITL = nil
2171simulation.IPH = nil
2172simulation.IPL = nil
2173simulation.PT_NUM = nil
2174simulation.R_TEMP = nil
2175simulation.MAX_TEMP = nil
2176simulation.MIN_TEMP = nil
2177simulation.TOOL_HEAT = nil
2178simulation.TOOL_COOL = nil
2179simulation.TOOL_VAC = nil
2180simulation.TOOL_AIR = nil
2181simulation.TOOL_PGRV = nil
2182simulation.TOOL_NGRV = nil
2183simulation.TOOL_MIX = nil
2184simulation.TOOL_CYCL = nil
2185simulation.DECO_DRAW = nil
2186simulation.DECO_CLEAR = nil
2187simulation.DECO_ADD = nil
2188simulation.DECO_SUBTRACT = nil
2189simulation.DECO_MULTIPLY = nil
2190simulation.DECO_DIVIDE = nil
2191simulation.DECO_SMUDGE = nil
2192simulation.PMAPBITS = nil
2193simulation.PMAPMASK = nil
2194
2195elements.TYPE_PART = nil
2196elements.TYPE_LIQUID = nil
2197elements.TYPE_SOLID = nil
2198elements.TYPE_GAS = nil
2199elements.TYPE_ENERGY = nil
2200elements.PROP_CONDUCTS = nil
2201elements.PROP_BLACK = nil
2202elements.PROP_NEUTPENETRATE = nil
2203elements.PROP_NEUTABSORB = nil
2204elements.PROP_NEUTPASS = nil
2205elements.PROP_DEADLY = nil
2206elements.PROP_HOT_GLOW = nil
2207elements.PROP_LIFE = nil
2208elements.PROP_RADIOACTIVE = nil
2209elements.PROP_LIFE_DEC = nil
2210elements.PROP_LIFE_KILL = nil
2211elements.PROP_LIFE_KILL_DEC = nil
2212elements.PROP_SPARKSETTLE = nil
2213elements.PROP_NOAMBHEAT = nil
2214elements.PROP_NOCTYPEDRAW = nil
2215
2216elements.DEFAULT_PT_NONE = 0
2217elements.DEFAULT_PT_DUST = 1
2218elements.DEFAULT_PT_WATR = 2
2219elements.DEFAULT_PT_OIL = 3
2220elements.DEFAULT_PT_FIRE = 4
2221elements.DEFAULT_PT_STNE = 5
2222elements.DEFAULT_PT_LAVA = 6
2223elements.DEFAULT_PT_GUN = 7
2224elements.DEFAULT_PT_NITR = 8
2225elements.DEFAULT_PT_CLNE = 9
2226elements.DEFAULT_PT_GAS = 10
2227elements["DEFAULT_PT_C-4"] = 11
2228elements.DEFAULT_PT_GOO = 12
2229elements.DEFAULT_PT_ICE = 13
2230elements.DEFAULT_PT_METL = 14
2231elements.DEFAULT_PT_SPRK = 15
2232elements.DEFAULT_PT_SNOW = 16
2233elements.DEFAULT_PT_WOOD = 17
2234elements.DEFAULT_PT_NEUT = 18
2235elements.DEFAULT_PT_PLUT = 19
2236elements.DEFAULT_PT_PLNT = 20
2237elements.DEFAULT_PT_ACID = 21
2238elements.DEFAULT_PT_VOID = 22
2239elements.DEFAULT_PT_WTRV = 23
2240elements.DEFAULT_PT_CNCT = 24
2241elements.DEFAULT_PT_DSTW = 25
2242elements.DEFAULT_PT_SALT = 26
2243elements.DEFAULT_PT_SLTW = 27
2244elements.DEFAULT_PT_DMND = 28
2245elements.DEFAULT_PT_BMTL = 29
2246elements.DEFAULT_PT_BRMT = 30
2247elements.DEFAULT_PT_PHOT = 31
2248elements.DEFAULT_PT_URAN = 32
2249elements.DEFAULT_PT_WAX = 33
2250elements.DEFAULT_PT_MWAX = 34
2251elements.DEFAULT_PT_PSCN = 35
2252elements.DEFAULT_PT_NSCN = 36
2253elements.DEFAULT_PT_LN2 = 37
2254elements.DEFAULT_PT_INSL = 38
2255elements.DEFAULT_PT_VACU = 39
2256elements.DEFAULT_PT_VENT = 40
2257elements.DEFAULT_PT_RBDM = 41
2258elements.DEFAULT_PT_LRBD = 42
2259elements.DEFAULT_PT_NTCT = 43
2260elements.DEFAULT_PT_SAND = 44
2261elements.DEFAULT_PT_GLAS = 45
2262elements.DEFAULT_PT_PTCT = 46
2263elements.DEFAULT_PT_BGLA = 47
2264elements.DEFAULT_PT_THDR = 48
2265elements.DEFAULT_PT_PLSM = 49
2266elements.DEFAULT_PT_ETRD = 50
2267elements.DEFAULT_PT_NICE = 51
2268elements.DEFAULT_PT_NBLE = 52
2269elements.DEFAULT_PT_BTRY = 53
2270elements.DEFAULT_PT_LCRY = 54
2271elements.DEFAULT_PT_STKM = 55
2272elements.DEFAULT_PT_SWCH = 56
2273elements.DEFAULT_PT_SMKE = 57
2274elements.DEFAULT_PT_DESL = 58
2275elements.DEFAULT_PT_COAL = 59
2276elements.DEFAULT_PT_LOXY = 60
2277elements.DEFAULT_PT_OXYG = 61
2278elements.DEFAULT_PT_INWR = 62
2279elements.DEFAULT_PT_YEST = 63
2280elements.DEFAULT_PT_DYST = 64
2281elements.DEFAULT_PT_THRM = 65
2282elements.DEFAULT_PT_GLOW = 66
2283elements.DEFAULT_PT_BRCK = 67
2284elements.DEFAULT_PT_CFLM = 68
2285elements.DEFAULT_PT_FIRW = 69
2286elements.DEFAULT_PT_FUSE = 70
2287elements.DEFAULT_PT_FSEP = 71
2288elements.DEFAULT_PT_AMTR = 72
2289elements.DEFAULT_PT_BCOL = 73
2290elements.DEFAULT_PT_PCLN = 74
2291elements.DEFAULT_PT_HSWC = 75
2292elements.DEFAULT_PT_IRON = 76
2293elements.DEFAULT_PT_MORT = 77
2294elements.DEFAULT_PT_LIFE = 78
2295elements.DEFAULT_PT_DLAY = 79
2296elements.DEFAULT_PT_CO2 = 80
2297elements.DEFAULT_PT_DRIC = 81
2298elements.DEFAULT_PT_BUBW = 82
2299elements.DEFAULT_PT_STOR = 83
2300elements.DEFAULT_PT_PVOD = 84
2301elements.DEFAULT_PT_CONV = 85
2302elements.DEFAULT_PT_CAUS = 86
2303elements.DEFAULT_PT_LIGH = 87
2304elements.DEFAULT_PT_TESC = 88
2305elements.DEFAULT_PT_DEST = 89
2306elements.DEFAULT_PT_SPNG = 90
2307elements.DEFAULT_PT_RIME = 91
2308elements.DEFAULT_PT_FOG = 92
2309elements.DEFAULT_PT_BCLN = 93
2310elements.DEFAULT_PT_LOVE = 94
2311elements.DEFAULT_PT_DEUT = 95
2312elements.DEFAULT_PT_WARP = 96
2313elements.DEFAULT_PT_PUMP = 97
2314elements.DEFAULT_PT_FWRK = 98
2315elements.DEFAULT_PT_PIPE = 99
2316elements.DEFAULT_PT_FRZZ = 100
2317elements.DEFAULT_PT_FRZW = 101
2318elements.DEFAULT_PT_GRAV = 102
2319elements.DEFAULT_PT_BIZR = 103
2320elements.DEFAULT_PT_BIZG = 104
2321elements.DEFAULT_PT_BIZS = 105
2322elements.DEFAULT_PT_INST = 106
2323elements.DEFAULT_PT_ISOZ = 107
2324elements.DEFAULT_PT_ISZS = 108
2325elements.DEFAULT_PT_PRTI = 109
2326elements.DEFAULT_PT_PRTO = 110
2327elements.DEFAULT_PT_PSTE = 111
2328elements.DEFAULT_PT_PSTS = 112
2329elements.DEFAULT_PT_ANAR = 113
2330elements.DEFAULT_PT_VINE = 114
2331elements.DEFAULT_PT_INVS = 115
2332elements.DEFAULT_PT_EQVE = 116
2333elements.DEFAULT_PT_SPWN2 = 117
2334elements.DEFAULT_PT_SPWN = 118
2335elements.DEFAULT_PT_SHLD = 119
2336elements.DEFAULT_PT_SHD2 = 120
2337elements.DEFAULT_PT_SHD3 = 121
2338elements.DEFAULT_PT_SHD4 = 122
2339elements.DEFAULT_PT_LOLZ = 123
2340elements.DEFAULT_PT_WIFI = 124
2341elements.DEFAULT_PT_FILT = 125
2342elements.DEFAULT_PT_ARAY = 126
2343elements.DEFAULT_PT_BRAY = 127
2344elements.DEFAULT_PT_STK2 = 128
2345elements.DEFAULT_PT_BOMB = 129
2346elements["DEFAULT_PT_C-5"] = 130
2347elements.DEFAULT_PT_SING = 131
2348elements.DEFAULT_PT_QRTZ = 132
2349elements.DEFAULT_PT_PQRT = 133
2350elements.DEFAULT_PT_EMP = 134
2351elements.DEFAULT_PT_BREL = 135
2352elements.DEFAULT_PT_ELEC = 136
2353elements.DEFAULT_PT_ACEL = 137
2354elements.DEFAULT_PT_DCEL = 138
2355elements.DEFAULT_PT_TNT = 139
2356elements.DEFAULT_PT_IGNC = 140
2357elements.DEFAULT_PT_BOYL = 141
2358elements.DEFAULT_PT_GEL = 142
2359elements.DEFAULT_PT_TRON = 143
2360elements.DEFAULT_PT_TTAN = 144
2361elements.DEFAULT_PT_EXOT = 145
2362elements.DEFAULT_PT_EMBR = 147
2363elements.DEFAULT_PT_HYGN = 148
2364elements.DEFAULT_PT_SOAP = 149
2365elements.DEFAULT_PT_BHOL = 150
2366elements.DEFAULT_PT_WHOL = 151
2367elements.DEFAULT_PT_MERC = 152
2368elements.DEFAULT_PT_PBCN = 153
2369elements.DEFAULT_PT_GPMP = 154
2370elements.DEFAULT_PT_CLST = 155
2371elements.DEFAULT_PT_WWLD = 156
2372elements.DEFAULT_PT_GBMB = 157
2373elements.DEFAULT_PT_FIGH = 158
2374elements.DEFAULT_PT_FRAY = 159
2375elements.DEFAULT_PT_RPEL = 160
2376elements.DEFAULT_PT_PPIP = 161
2377elements.DEFAULT_PT_DTEC = 162
2378elements.DEFAULT_PT_DMG = 163
2379elements.DEFAULT_PT_TSNS = 164
2380elements.DEFAULT_PT_VIBR = 165
2381elements.DEFAULT_PT_BVBR = 166
2382elements.DEFAULT_PT_CRAY = 167
2383elements.DEFAULT_PT_PSTN = 168
2384elements.DEFAULT_PT_FRME = 169
2385elements.DEFAULT_PT_GOLD = 170
2386elements.DEFAULT_PT_TUNG = 171
2387elements.DEFAULT_PT_PSNS = 172
2388elements.DEFAULT_PT_PROT = 173
2389elements.DEFAULT_PT_VIRS = 174
2390elements.DEFAULT_PT_VRSS = 175
2391elements.DEFAULT_PT_VRSG = 176
2392elements.DEFAULT_PT_GRVT = 177
2393elements.DEFAULT_PT_DRAY = 178
2394elements.DEFAULT_PT_CRMC = 179
2395elements.DEFAULT_PT_HEAC = 180
2396elements.DEFAULT_PT_SAWD = 181
2397elements.DEFAULT_PT_POLO = 182
2398elements.DEFAULT_PT_RFRG = 183
2399elements.DEFAULT_PT_RFGL = 184
2400elements.DEFAULT_PT_LSNS = 185
2401elements.DEFAULT_PT_LDTC = 186
2402elements.DEFAULT_PT_SLCN = 187
2403elements.DEFAULT_PT_PTNM = 188
2404elements.DEFAULT_PT_VSNS = 189
2405elements.DEFAULT_PT_ROCK = 190
2406elements.DEFAULT_PT_LITH = 191
2407
2408--Set in `parts[i].flags`. Used by liquids and powders to speed up simulation by moving them less
2409elements.FLAG_STAGNANT = nil
2410--Set in `parts[i].flags`. Given to PHOT by PCLN and PBCN to fix gaps in lasers, only useable by energy particles
2411elements.FLAG_SKIPMOVE = nil
2412--Set in `parts[i].flags`. Used internally for water equalization
2413elements.FLAG_WATEREQUAL = nil
2414--Set in `parts[i].flags`. Can be used to re-enable moving sponge
2415elements.FLAG_MOVABLE = nil
2416--Set in `parts[i].flags`. Re-enables deco on photons for compatibility. Defined as the same value as FLAG_MOVABLE (they only apply to different elements)
2417elements.FLAG_PHOTDECO = nil
2418
2419--#### Menu Sections
2420elements.SC_WALL = nil
2421--#### Menu Sections
2422elements.SC_ELEC = nil
2423--#### Menu Sections
2424elements.SC_POWERED = nil
2425--#### Menu Sections
2426elements.SC_SENSOR = nil
2427--#### Menu Sections
2428elements.SC_FORCE = nil
2429--#### Menu Sections
2430elements.SC_EXPLOSIVE = nil
2431--#### Menu Sections
2432elements.SC_GAS = nil
2433--#### Menu Sections
2434elements.SC_LIQUID = nil
2435--#### Menu Sections
2436elements.SC_POWDERS = nil
2437--#### Menu Sections
2438elements.SC_SOLIDS = nil
2439--#### Menu Sections
2440elements.SC_NUCLEAR = nil
2441--#### Menu Sections
2442elements.SC_SPECIAL = nil
2443--#### Menu Sections
2444elements.SC_LIFE = nil
2445--#### Menu Sections
2446elements.SC_TOOL = nil
2447--#### Menu Sections
2448elements.SC_DECO = nil
2449
2450function print() end