summaryrefslogtreecommitdiff
path: root/src/elements/co2.c
diff options
context:
space:
mode:
authorCate <cate@cate-6sh2.(none)>2011-09-22 17:01:54 (GMT)
committer Simon Robertshaw <simon@hardwired.org.uk>2011-09-22 17:11:57 (GMT)
commit39525e6ef0e90964f674a27993c38590c0bd98ea (patch)
tree1f73bc4564e7d47b2a803936d4849df448731aa0 /src/elements/co2.c
parent3ac14d94e74e9bc4b75ce49ca7c848c717005c55 (diff)
downloadpowder-39525e6ef0e90964f674a27993c38590c0bd98ea.zip
powder-39525e6ef0e90964f674a27993c38590c0bd98ea.tar.gz
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.
Diffstat (limited to 'src/elements/co2.c')
-rw-r--r--src/elements/co2.c12
1 files changed, 6 insertions, 6 deletions
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 <element.h>
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<XRES && y+ry<YRES && (rx || ry))
{
r = pmap[y+ry][x+rx];
+ if (20>(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);