Variables

From The Powder Toy
Revision as of 13:57, 29 September 2011 by Simon (talk | contribs) (More formatting)
Jump to: navigation, search

This is a list of useful variables and usages of them inside the source.


General

Variable What it returns
pmap[y][x] Particle-map. Returns particle at [y][x]
bmap[y][x] Block-map. Returns wall at [y][x].
emap[y][x] Electronics-map. Used for conductive walls.
r usually preset to pmap[y][x]
pv[y/CELL][x/CELL] The pressure at x,y. Pressure is on a 4x4 grid like walls. Is a float(0.0f for 0).
hv[y/CELL][x/CELL] The ambient heat at x,y. It is on a 4x4 grid like walls and pressure. Is a float(0.0f for 0).
sl Selected left. Means particle selected in menu by left mouse button.
sr Selected right. Means particle selected in menu by right mouse button.
t Current particle type. ex. PT_DUST

Particle

Particle Information

Variable What it returns
parts[i].1 Current Particle
parts[r>>8].1 A property of particle 'r'. Is usually around(based on for loops) the current one(i).
(r&0xFF) Same as (parts[r>>8].type)
Variable What it returns
parts[2].type Contains the particles current type.
parts[2].ctype Contains the particles previous type (for example LAVA) or the type of particle to clone with BCLN, PCLN or CLNE
parts[2].life Contains the particles life.
parts[2].temp Contains the particles Temperature. Is a float(0.0f for 0).
parts[2].tmp Contains the particles temporary values which can be used for anything.

1 - use either type, ctype, life, temp or tmp

2 - use either r>>8 or i