TPT: Prevent stacking from ELEC+NEUT, ELEC+water, and CO2 from BUBW ae5470ca78
This commit is contained in:
parent
08d1dd06ed
commit
6dc7eaf43e
@ -55,10 +55,10 @@ int Element_CO2::update(UPDATE_FUNC_ARGS)
|
|||||||
if (x+rx>=0 && y+ry>0 && x+rx<XRES && y+ry<YRES && (rx || ry))
|
if (x+rx>=0 && y+ry>0 && x+rx<XRES && y+ry<YRES && (rx || ry))
|
||||||
{
|
{
|
||||||
r = pmap[y+ry][x+rx];
|
r = pmap[y+ry][x+rx];
|
||||||
if (20>(rand()%40000)&&parts[i].ctype==5)
|
if (parts[i].ctype==5 && 20>(rand()%40000))
|
||||||
{
|
{
|
||||||
|
if (sim->create_part(-1, x+rx, y+ry, PT_WATR)>=0)
|
||||||
parts[i].ctype = 0;
|
parts[i].ctype = 0;
|
||||||
sim->create_part(-3, x, y, PT_WATR);
|
|
||||||
}
|
}
|
||||||
if ((r>>8)>=NPART || !r)
|
if ((r>>8)>=NPART || !r)
|
||||||
continue;
|
continue;
|
||||||
@ -72,6 +72,9 @@ int Element_CO2::update(UPDATE_FUNC_ARGS)
|
|||||||
if (((r&0xFF)==PT_WATR || (r&0xFF)==PT_DSTW) && 1>(rand()%250))
|
if (((r&0xFF)==PT_WATR || (r&0xFF)==PT_DSTW) && 1>(rand()%250))
|
||||||
{
|
{
|
||||||
sim->part_change_type(i,x,y,PT_CBNW);
|
sim->part_change_type(i,x,y,PT_CBNW);
|
||||||
|
if (parts[i].ctype==5) //conserve number of water particles - ctype=5 means this CO2 hasn't released the water particle from BUBW yet
|
||||||
|
sim->create_part(r>>8, x+rx, y+ry, PT_CBNW);
|
||||||
|
else
|
||||||
sim->kill_part(r>>8);
|
sim->kill_part(r>>8);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -98,21 +98,15 @@ int Element_ELEC::update(UPDATE_FUNC_ARGS)
|
|||||||
if(rand()%2)
|
if(rand()%2)
|
||||||
{
|
{
|
||||||
sim->create_part(r>>8, x+rx, y+ry, PT_H2);
|
sim->create_part(r>>8, x+rx, y+ry, PT_H2);
|
||||||
sim->part_change_type(i, x, y, PT_O2);
|
|
||||||
parts[i].life = 0;
|
|
||||||
parts[i].ctype = 0;
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
sim->create_part(r>>8, x+rx, y+ry, PT_O2);
|
sim->create_part(r>>8, x+rx, y+ry, PT_O2);
|
||||||
sim->part_change_type(i, x, y, PT_H2);
|
|
||||||
parts[i].life = 0;
|
|
||||||
parts[i].ctype = 0;
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ((r&0xFF)==PT_NEUT)
|
if ((r&0xFF)==PT_NEUT && !pmap[y+ry][x+rx])
|
||||||
{
|
{
|
||||||
sim->part_change_type(r>>8, x+rx, y+ry, PT_H2);
|
sim->part_change_type(r>>8, x+rx, y+ry, PT_H2);
|
||||||
parts[r>>8].life = 0;
|
parts[r>>8].life = 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user