diff --git a/src/simulation/Simulation.cpp b/src/simulation/Simulation.cpp index 8dff706f8..590e5280d 100644 --- a/src/simulation/Simulation.cpp +++ b/src/simulation/Simulation.cpp @@ -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) diff --git a/src/simulation/elements/ELEC.cpp b/src/simulation/elements/ELEC.cpp index 871b61eab..f49d3a64c 100644 --- a/src/simulation/elements/ELEC.cpp +++ b/src/simulation/elements/ELEC.cpp @@ -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; diff --git a/src/simulation/elements/NEUT.cpp b/src/simulation/elements/NEUT.cpp index 9e47e7e63..d61466c05 100644 --- a/src/simulation/elements/NEUT.cpp +++ b/src/simulation/elements/NEUT.cpp @@ -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() {} diff --git a/src/simulation/elements/PROT.cpp b/src/simulation/elements/PROT.cpp index 43022440c..3e6a66112 100644 --- a/src/simulation/elements/PROT.cpp +++ b/src/simulation/elements/PROT.cpp @@ -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; ccreate_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) {