diff options
| author | Cate <cate@cate-6sh2.(none)> | 2011-07-11 18:09:34 (GMT) |
|---|---|---|
| committer | Simon Robertshaw <simon@hardwired.org.uk> | 2011-07-12 13:00:21 (GMT) |
| commit | 0ce4104c7aacd6151d52a0b11a36e315cf8a5a67 (patch) | |
| tree | fd99304bfe55207fe3ebe8d989d578aadec68d25 /src/elements | |
| parent | 0858b18255a5a31de7ebc677b6d36c73a43652d8 (diff) | |
| download | powder-0ce4104c7aacd6151d52a0b11a36e315cf8a5a67.zip powder-0ce4104c7aacd6151d52a0b11a36e315cf8a5a67.tar.gz | |
Added CLST element, which is Clay dust, for making concrete with water. :D Neat due to element cohesion with itself, which causes it to sludge downwards in a way very uncharacteristic of any current powder. Cohesion is very easy to modify. Thanks to Savask for help with cohesion code. :D
Diffstat (limited to 'src/elements')
| -rw-r--r-- | src/elements/clst.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/elements/clst.c b/src/elements/clst.c new file mode 100644 index 0000000..db0eb7c --- /dev/null +++ b/src/elements/clst.c @@ -0,0 +1,23 @@ +#include <element.h> + +int update_CLST(UPDATE_FUNC_ARGS) { + int r, rx, ry; + for (rx=-2; rx<3; rx++) + for (ry=-2; ry<3; ry++) + if (x+rx>=0 && y+ry>0 && x+rx<XRES && y+ry<YRES && (rx || ry)) + { + r = pmap[y+ry][x+rx]; + if ((r>>8)>=NPART || !r) + continue; + if ((r&0xFF)==PT_WATR && 1>(rand()%1500)) + { + part_change_type(i,x,y,PT_PSTS); + kill_part(r>>8); + } + if ((r&0xFF)==PT_CLST) + { + parts[i].vx += 0.01*rx; parts[i].vy += 0.01*ry; + } + } + return 0; +} |
