The-Powder-Toy/src/elements/yest.c

22 lines
483 B
C
Raw Normal View History

#include <element.h>
2011-01-07 14:03:58 -06:00
int update_YEST(UPDATE_FUNC_ARGS) {
2011-01-09 13:23:05 -06:00
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))
2011-01-07 14:03:58 -06:00
{
2011-01-09 13:23:05 -06:00
r = pmap[y+ry][x+rx];
if (!r)
2011-01-07 14:03:58 -06:00
continue;
if ((r&0xFF)==PT_DYST && 1>(rand()%30) && !legacy_enable)
{
2011-01-09 13:23:05 -06:00
part_change_type(i,x,y,PT_DYST);
2011-01-07 14:03:58 -06:00
}
}
if (parts[i].temp>303&&parts[i].temp<317) {
create_part(-1, x+rand()%3-1, y+rand()%3-1, PT_YEST);
}
return 0;
}