From 39525e6ef0e90964f674a27993c38590c0bd98ea Mon Sep 17 00:00:00 2001 From: Cate Date: Fri, 23 Sep 2011 01:01:54 +0800 Subject: Fixes to carbonated water explosions. Help from cracker with create_part making overlapping particles to fix CO2 emitting water (as a bit of a sneaky trick to make less overlapping water.) Carb water slowly increases pressure if sealed, causing explosions when released. diff --git a/src/elements/cbnw.c b/src/elements/cbnw.c index 60b1bf3..478fba7 100644 --- a/src/elements/cbnw.c +++ b/src/elements/cbnw.c @@ -3,9 +3,9 @@ int update_CBNW(UPDATE_FUNC_ARGS) { int r, rx, ry, oldt; oldt = parts[i].tmp; - if (pv[y/CELL][x/CELL]<=1) + if (pv[y/CELL][x/CELL]<=5) { - if(20>(rand()%20000)) + if(20>(rand()%80000)) { part_change_type(i,x,y,PT_CO2); parts[i].ctype = 5; @@ -25,10 +25,9 @@ int update_CBNW(UPDATE_FUNC_ARGS) { //Explode if(rand()%4) { - part_change_type(i,x,y,PT_WATR); - } else { - pv[y/CELL][x/CELL] += 0.5f; - part_change_type(i,x,y,PT_CO2); + part_change_type(i,x,y,PT_CO2); + parts[i].ctype = 5; + pv[y/CELL][x/CELL] += 0.2f; } } for (rx=-2; rx<3; rx++) @@ -47,10 +46,9 @@ int update_CBNW(UPDATE_FUNC_ARGS) { { if(rand()%2) { - part_change_type(i,x,y,PT_WATR); - } else { - pv[y/CELL][x/CELL] += 0.5f; - part_change_type(i,x,y,PT_CO2); + part_change_type(i,x,y,PT_CO2); + parts[i].ctype = 5; + pv[y/CELL][x/CELL] += 0.2f; } } if ((r&0xFF)==PT_CBNW) diff --git a/src/elements/co2.c b/src/elements/co2.c index 3bc86a8..f820425 100644 --- a/src/elements/co2.c +++ b/src/elements/co2.c @@ -1,12 +1,17 @@ #include int update_CO2(UPDATE_FUNC_ARGS) { - int r, rx, ry, np; + 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(rand()%40000)&&parts[i].ctype==5) + { + parts[i].ctype = 0; + create_part(-3, x, y, PT_WATR); + } if ((r>>8)>=NPART || !r) continue; if ((r&0xFF)==PT_FIRE){ @@ -16,11 +21,6 @@ int update_CO2(UPDATE_FUNC_ARGS) { return 1; } } - if ((r)&&parts[i].ctype==5) - { - parts[i].ctype = 0; - create_part(-1, x+rand()%3-1, y+rand()%3-1, PT_WATR); - } if (((r&0xFF)==PT_WATR || (r&0xFF)==PT_DSTW) && 1>(rand()%250)) { part_change_type(i,x,y,PT_CBNW); -- cgit v0.9.2-21-gd62e