mirror of
https://github.com/The-Powder-Toy/The-Powder-Toy.git
synced 2025-09-02 20:42:36 +02:00
Fix hydrogen not burning right (with and without realistic heat), allow h2 to burn at all temps while still allowing fusion to work correctly
This commit is contained in:
@@ -85,8 +85,15 @@ int Element_CO2::update(UPDATE_FUNC_ARGS)
|
||||
int j;
|
||||
sim->create_part(i,x,y,PT_O2);
|
||||
|
||||
j = sim->create_part(-3,x+rand()%3-1,y+rand()%3-1,PT_NEUT); if (j != -1) parts[j].temp = 15000;
|
||||
if (!(rand()%50)) { j = sim->create_part(-3,x+rand()%3-1,y+rand()%3-1,PT_ELEC); if (j != -1) parts[j].temp = 15000; }
|
||||
j = sim->create_part(-3,x+rand()%3-1,y+rand()%3-1,PT_NEUT);
|
||||
if (j != -1)
|
||||
parts[j].temp = 15000;
|
||||
if (!(rand()%50))
|
||||
{
|
||||
j = sim->create_part(-3,x+rand()%3-1,y+rand()%3-1,PT_ELEC);
|
||||
if (j != -1)
|
||||
parts[j].temp = 15000;
|
||||
}
|
||||
|
||||
parts[i].temp = 15000;
|
||||
sim->pv[y/CELL][x/CELL] += 100;
|
||||
|
@@ -58,7 +58,7 @@ int Element_FIRE::update(UPDATE_FUNC_ARGS)
|
||||
}
|
||||
if(t==PT_FIRE && parts[i].life <=1)
|
||||
{
|
||||
if (parts[i].tmp==3){
|
||||
if ((parts[i].tmp&0x3) == 3){
|
||||
t = PT_DSTW;
|
||||
sim->part_change_type(i,x,y,t);
|
||||
parts[i].life = 0;
|
||||
@@ -73,7 +73,7 @@ int Element_FIRE::update(UPDATE_FUNC_ARGS)
|
||||
}
|
||||
if(t==PT_PLSM && parts[i].life <=1)
|
||||
{
|
||||
if (parts[i].tmp==3){
|
||||
if ((parts[i].tmp&0x3) == 3){
|
||||
t = PT_DSTW;
|
||||
sim->part_change_type(i,x,y,t);
|
||||
parts[i].life = 0;
|
||||
@@ -94,7 +94,7 @@ int Element_FIRE::update(UPDATE_FUNC_ARGS)
|
||||
(t!=PT_SPRK || (rt!=PT_RBDM && rt!=PT_LRBD && rt!=PT_INSL)) &&
|
||||
(t!=PT_PHOT || rt!=PT_INSL) &&
|
||||
(rt!=PT_SPNG || parts[r>>8].life==0) &&
|
||||
(rt!=PT_H2 || (parts[r>>8].temp < 2273.15 && sim->pv[y/CELL][x/CELL] < 50.0f)) &&
|
||||
(rt!=PT_H2 || (parts[r>>8].temp < 2273.15 && sim->pv[y/CELL][x/CELL] < 50.0f)) &&
|
||||
sim->elements[rt].Flammable && (sim->elements[rt].Flammable + (int)(sim->pv[(y+ry)/CELL][(x+rx)/CELL]*10.0f))>(rand()%1000))
|
||||
{
|
||||
sim->part_change_type(r>>8,x+rx,y+ry,PT_FIRE);
|
||||
|
@@ -48,11 +48,8 @@ Element_H2::Element_H2()
|
||||
|
||||
//#TPT-Directive ElementHeader Element_H2 static int update(UPDATE_FUNC_ARGS)
|
||||
int Element_H2::update(UPDATE_FUNC_ARGS)
|
||||
|
||||
{
|
||||
int r,rx,ry,rt;
|
||||
if (parts[i].temp > 2273.15 && sim->pv[y/CELL][x/CELL] > 50.0f)
|
||||
parts[i].tmp = 1;
|
||||
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))
|
||||
@@ -66,9 +63,9 @@ int Element_H2::update(UPDATE_FUNC_ARGS)
|
||||
sim->part_change_type(r>>8,x+rx,y+ry,PT_WATR);
|
||||
sim->part_change_type(i,x,y,PT_OIL);
|
||||
}
|
||||
if (parts[r>>8].temp > 2273.15)// && pv[y/CELL][x/CELL] > 50.0f)
|
||||
if (parts[r>>8].temp > 2273.15 && sim->pv[y/CELL][x/CELL] > 45.0f)
|
||||
continue;
|
||||
if (parts[i].temp < 2273.15)
|
||||
if (sim->pv[y/CELL][x/CELL] <= 45.0f)
|
||||
{
|
||||
if (rt==PT_FIRE)
|
||||
{
|
||||
@@ -77,7 +74,7 @@ int Element_H2::update(UPDATE_FUNC_ARGS)
|
||||
parts[r>>8].temp=3473;
|
||||
parts[r>>8].tmp |= 1;
|
||||
}
|
||||
if (rt==PT_FIRE || rt==PT_PLSM || rt==PT_LAVA)
|
||||
if (rt==PT_FIRE || (rt==PT_PLSM && !(parts[r>>8].tmp&4)) || (rt==PT_LAVA && parts[r>>8].ctype != PT_BMTL))
|
||||
{
|
||||
sim->create_part(i,x,y,PT_FIRE);
|
||||
parts[i].temp+=(rand()/(RAND_MAX/100));
|
||||
@@ -93,11 +90,28 @@ int Element_H2::update(UPDATE_FUNC_ARGS)
|
||||
float temp = parts[i].temp;
|
||||
sim->create_part(i,x,y,PT_NBLE);
|
||||
|
||||
j = sim->create_part(-3,x+rand()%3-1,y+rand()%3-1,PT_NEUT); if (j != -1) parts[j].temp = temp;
|
||||
if (!(rand()%10)) { j = sim->create_part(-3,x+rand()%3-1,y+rand()%3-1,PT_ELEC); if (j != -1) parts[j].temp = temp; }
|
||||
j = sim->create_part(-3,x+rand()%3-1,y+rand()%3-1,PT_PHOT); if (j != -1) { parts[j].ctype = 0x7C0000; parts[j].temp = temp; }
|
||||
j = sim->create_part(-3,x+rand()%3-1,y+rand()%3-1,PT_NEUT);
|
||||
if (j != -1)
|
||||
parts[j].temp = temp;
|
||||
if (!(rand()%10))
|
||||
{
|
||||
j = sim->create_part(-3,x+rand()%3-1,y+rand()%3-1,PT_ELEC);
|
||||
if (j != -1)
|
||||
parts[j].temp = temp;
|
||||
}
|
||||
j = sim->create_part(-3,x+rand()%3-1,y+rand()%3-1,PT_PHOT);
|
||||
if (j != -1)
|
||||
{
|
||||
parts[j].ctype = 0x7C0000;
|
||||
parts[j].temp = temp;
|
||||
}
|
||||
|
||||
j = sim->create_part(-3,x+rand()%3-1,y+rand()%3-1,PT_PLSM); if (j != -1) parts[j].temp = temp;
|
||||
j = sim->create_part(-3,x+rand()%3-1,y+rand()%3-1,PT_PLSM);
|
||||
if (j != -1)
|
||||
{
|
||||
parts[j].temp = temp;
|
||||
parts[j].tmp |= 4;
|
||||
}
|
||||
|
||||
parts[i].temp = temp+750+rand()%500;
|
||||
sim->pv[y/CELL][x/CELL] += 30;
|
||||
|
@@ -59,11 +59,28 @@ int Element_NBLE::update(UPDATE_FUNC_ARGS)
|
||||
float temp = parts[i].temp;
|
||||
sim->create_part(i,x,y,PT_CO2);
|
||||
|
||||
j = sim->create_part(-3,x+rand()%3-1,y+rand()%3-1,PT_NEUT); if (j != -1) parts[j].temp = temp;
|
||||
if (!(rand()%25)) { j = sim->create_part(-3,x+rand()%3-1,y+rand()%3-1,PT_ELEC); if (j != -1) parts[j].temp = temp; }
|
||||
j = sim->create_part(-3,x+rand()%3-1,y+rand()%3-1,PT_PHOT); if (j != -1) { parts[j].ctype = 0xF800000; parts[j].temp = temp; }
|
||||
j = sim->create_part(-3,x+rand()%3-1,y+rand()%3-1,PT_NEUT);
|
||||
if (j != -1)
|
||||
parts[j].temp = temp;
|
||||
if (!(rand()%25))
|
||||
{
|
||||
j = sim->create_part(-3,x+rand()%3-1,y+rand()%3-1,PT_ELEC);
|
||||
if (j != -1)
|
||||
parts[j].temp = temp;
|
||||
}
|
||||
j = sim->create_part(-3,x+rand()%3-1,y+rand()%3-1,PT_PHOT);
|
||||
if (j != -1)
|
||||
{
|
||||
parts[j].ctype = 0xF800000;
|
||||
parts[j].temp = temp;
|
||||
}
|
||||
|
||||
j = sim->create_part(-3,x+rand()%3-1,y+rand()%3-1,PT_PLSM); if (j != -1) parts[j].temp = temp;
|
||||
j = sim->create_part(-3,x+rand()%3-1,y+rand()%3-1,PT_PLSM);
|
||||
if (j != -1)
|
||||
{
|
||||
parts[j].temp = temp;
|
||||
parts[j].tmp |= 4;
|
||||
}
|
||||
|
||||
parts[i].temp = temp+1750+rand()%500;
|
||||
sim->pv[y/CELL][x/CELL] += 50;
|
||||
|
@@ -50,8 +50,6 @@ Element_O2::Element_O2()
|
||||
int Element_O2::update(UPDATE_FUNC_ARGS)
|
||||
{
|
||||
int r,rx,ry;
|
||||
if (parts[i].temp < 9773.15)
|
||||
{
|
||||
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))
|
||||
@@ -67,7 +65,7 @@ int Element_O2::update(UPDATE_FUNC_ARGS)
|
||||
parts[r>>8].temp=3473;
|
||||
parts[r>>8].tmp |= 2;
|
||||
}
|
||||
if ((r&0xFF)==PT_FIRE || (r&0xFF)==PT_PLSM)
|
||||
if ((r&0xFF)==PT_FIRE || ((r&0xFF)==PT_PLSM && !(parts[r>>8].tmp&4)))
|
||||
{
|
||||
sim->create_part(i,x,y,PT_FIRE);
|
||||
parts[i].temp+=(rand()/(RAND_MAX/100));
|
||||
@@ -75,17 +73,25 @@ int Element_O2::update(UPDATE_FUNC_ARGS)
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
else if (parts[i].temp > 9973.15 && sim->pv[y/CELL][x/CELL] > 250.0f && abs(sim->gravx[((y/CELL)*(XRES/CELL))+(x/CELL)]) + abs(sim->gravy[((y/CELL)*(XRES/CELL))+(x/CELL)]) > 20)
|
||||
if (parts[i].temp > 9973.15 && sim->pv[y/CELL][x/CELL] > 250.0f && abs(sim->gravx[((y/CELL)*(XRES/CELL))+(x/CELL)]) + abs(sim->gravy[((y/CELL)*(XRES/CELL))+(x/CELL)]) > 20)
|
||||
{
|
||||
if (rand()%5 < 1)
|
||||
{
|
||||
int j;
|
||||
sim->create_part(i,x,y,PT_BRMT);
|
||||
|
||||
j = sim->create_part(-3,x+rand()%3-1,y+rand()%3-1,PT_NEUT); if (j != -1) parts[j].temp = 15000;
|
||||
j = sim->create_part(-3,x+rand()%3-1,y+rand()%3-1,PT_PHOT); if (j != -1) parts[j].temp = 15000;
|
||||
j = sim->create_part(-3,x+rand()%3-1,y+rand()%3-1,PT_PLSM); if (j != -1) parts[j].temp = 15000;
|
||||
j = sim->create_part(-3,x+rand()%3-1,y+rand()%3-1,PT_NEUT);
|
||||
if (j != -1)
|
||||
parts[j].temp = 15000;
|
||||
j = sim->create_part(-3,x+rand()%3-1,y+rand()%3-1,PT_PHOT);
|
||||
if (j != -1)
|
||||
parts[j].temp = 15000;
|
||||
j = sim->create_part(-3,x+rand()%3-1,y+rand()%3-1,PT_PLSM);
|
||||
if (j != -1)
|
||||
{
|
||||
parts[j].temp = 15000;
|
||||
parts[j].tmp |= 4;
|
||||
}
|
||||
|
||||
parts[i].temp = 15000;
|
||||
sim->pv[y/CELL][x/CELL] += 300;
|
||||
|
@@ -97,6 +97,8 @@ int Element_SPRK::update(UPDATE_FUNC_ARGS)
|
||||
parts[i].life = rand()%150+50;
|
||||
sim->part_change_type(i,x,y,PT_PLSM);
|
||||
parts[i].ctype = PT_NBLE;
|
||||
if (parts[i].temp > 5273.15)
|
||||
parts[i].tmp |= 4;
|
||||
parts[i].temp = 3500;
|
||||
sim->pv[y/CELL][x/CELL] += 1;
|
||||
}
|
||||
|
Reference in New Issue
Block a user