PROT+DEUT causes DEUT implosion (same as with NEUT, just negative pressure)

Also PHOT+H2 now also make PROT+ELEC (which will not combine to make more H2)
This commit is contained in:
jacob1 2013-09-13 22:02:03 -04:00
parent 830bb3ba5e
commit ae8e5e5c34
4 changed files with 37 additions and 5 deletions

View File

@ -2218,8 +2218,10 @@ int Simulation::try_move(int i, int x, int y, int nx, int ny)
}
else if ((r&0xFF) == PT_H2)
{
part_change_type(i, x, y, PT_PROT);
parts[i].ctype = 0;
create_part(i, x, y, PT_PROT);
parts[i].tmp2 = 0x1;
create_part(r>>8, x, y, PT_ELEC);
return 1;
}
}
else if (parts[i].type == PT_NEUT)

View File

@ -88,8 +88,10 @@ int Element_ELEC::update(UPDATE_FUNC_ARGS)
else
sim->create_part(r>>8, x+rx, y+ry, PT_H2);
return 1;
case PT_NEUT:
case PT_PROT: // this is the correct reaction, not NEUT, but leaving NEUT in anyway
if (parts[r>>8].tmp2 & 0x1)
break;
case PT_NEUT:
sim->part_change_type(r>>8, x+rx, y+ry, PT_H2);
parts[r>>8].life = 0;
parts[r>>8].ctype = 0;

View File

@ -49,7 +49,7 @@ Element_NEUT::Element_NEUT()
//#TPT-Directive ElementHeader Element_NEUT static int update(UPDATE_FUNC_ARGS)
int Element_NEUT::update(UPDATE_FUNC_ARGS)
{
int r, rx, ry, rt;
int r, rx, ry;
int pressureFactor = 3 + (int)sim->pv[y/CELL][x/CELL];
for (rx=-1; rx<2; rx++)
for (ry=-1; ry<2; ry++)
@ -209,5 +209,4 @@ int Element_NEUT::DeutExplosion(Simulation * sim, int n, int x, int y, float tem
return 0;
}
Element_NEUT::~Element_NEUT() {}

View File

@ -65,6 +65,14 @@ int Element_PROT::update(UPDATE_FUNC_ARGS)
parts[under>>8].life = 44+parts[under>>8].life;
parts[under>>8].ctype = 0;
}
else if ((under&0xFF) == PT_DEUT)
{
if ((-((int)sim->pv[y/CELL][x/CELL]-4)+(parts[under>>8].life/100)) > rand()%200)
{
DeutImplosion(sim, parts[under>>8].life, x, y, restrict_flt(parts[under>>8].temp + parts[under>>8].life*500, MIN_TEMP, MAX_TEMP), PT_PROT);
sim->kill_part(under>>8);
}
}
//prevent inactive sparkable elements from being sparked
else if ((sim->elements[under&0xFF].Properties&PROP_CONDUCTS) && parts[under>>8].life <= 4)
{
@ -138,6 +146,27 @@ int Element_PROT::update(UPDATE_FUNC_ARGS)
return 0;
}
//#TPT-Directive ElementHeader Element_PROT static int DeutImplosion(Simulation * sim, int n, int x, int y, float temp, int t)
int Element_PROT::DeutImplosion(Simulation * sim, int n, int x, int y, float temp, int t)
{
int i;
n = (n/50);
if (n<1)
n = 1;
else if (n>340)
n = 340;
for (int c=0; c<n; c++)
{
i = sim->create_part(-3, x, y, t);
if (i >= 0)
sim->parts[i].temp = temp;
sim->pv[y/CELL][x/CELL] -= 6.0f * CFDS;
}
return 0;
}
//#TPT-Directive ElementHeader Element_PROT static int graphics(GRAPHICS_FUNC_ARGS)
int Element_PROT::graphics(GRAPHICS_FUNC_ARGS)
{