Functions

From The Powder Toy
Revision as of 02:55, 5 December 2011 by jacob1 (talk | contribs) (info on using 0 for flags parameter)
Jump to: navigation, search

This is list of functions with their variables, every function is described. There is recommended to read article Hotkeys, it's helpful to understand description of some functions.

clear_area(int area_x, int area_y, int area_w, int area_h) - (like CTRL-Erase) Clears the area with height h and width w. (x,y) is the top left corner.

create_part(int p, int x, int y, int t) - Creates particle which type is t at [x,y]. For p use -1.

create_box(int x1, int y1, int x2, int y2, int c) - Creates rectangle (like CTRL in PT). x1, y1 is first corner position, x2,y2 is second corner position, c is particle type.

create_line(int x1, int y1, int x2, int y2, int rx, int ry, int c, int flags) - Like create_box, but x1,y1,x2,y2 are line ends position. c is the particle to create. Use 0 for flags.

delete_part(int x, int y, int flags) - Deletes part at defined position. Use 0 for flags.

flood_parts(int x, int y, int fullc, int cm, int bm, int flags) - Flood fill. (x,y) is the location to start the fill. fullc&0xFF is the particle type to fill(not the particle itself but the number ex. PT_DUST). set cm and bm to -1, and flags to 0

kill_part(int i) - Deletes particle 'with index 'i.(Does not use x,y location like delete_part)

nearest_part(int ci,int t, int max_d) - Returns nearest particle of type t. ci is current particle. If max_d is not -1, it limits how far away the particle can be. It returns -1 if nothing was found.

parts_avg(int ci, int ni, int t) - Returns if t is directly in between the particles with indexes ci and ni, or, if t is PT_INSL, if their is a particle directly in between them.

part_change_type(int i, int x, int y, int t) - Changes type of particle i. t is new type, x is the x location of the particle, y is the y location of the particle.