Some ROCK fixes

Improve efficiency in FIRE logic, it no longer runs the check multiple times for each surrounding particle. RNG chances reduced accordingly.
Remove unnecessary code in init_can_move
Set Weight to 100, which is the proper max for weight
This commit is contained in:
jacob1 2021-03-30 23:14:53 -04:00
parent 7614042e19
commit da2ccc70fe
3 changed files with 58 additions and 61 deletions

View File

@ -2382,9 +2382,8 @@ void Simulation::init_can_move()
can_move[movingType][PT_FIGH] = 0; can_move[movingType][PT_FIGH] = 0;
//INVS behaviour varies with pressure //INVS behaviour varies with pressure
can_move[movingType][PT_INVIS] = 3; can_move[movingType][PT_INVIS] = 3;
//stop CNCT and ROCK from being displaced by other particles //stop CNCT from being displaced by other particles
can_move[movingType][PT_CNCT] = 0; can_move[movingType][PT_CNCT] = 0;
can_move[movingType][PT_ROCK] = 0;
//VOID and PVOD behaviour varies with powered state and ctype //VOID and PVOD behaviour varies with powered state and ctype
can_move[movingType][PT_PVOD] = 3; can_move[movingType][PT_PVOD] = 3;
can_move[movingType][PT_VOID] = 3; can_move[movingType][PT_VOID] = 3;

View File

@ -87,6 +87,56 @@ int Element_FIRE_update(UPDATE_FUNC_ARGS)
} }
} }
break; break;
case PT_LAVA:
if (parts[i].ctype == PT_ROCK)
{
float pres = sim->pv[y / CELL][x / CELL];
if (pres <= -9)
{
parts[i].ctype = PT_STNE;
break;
}
if (pres >= 25 && RNG::Ref().chance(1, 12500))
{
if (pres <= 50)
{
if (RNG::Ref().chance(1, 2))
parts[i].ctype = PT_BRMT;
else
parts[i].ctype = PT_CNCT;
}
else if (pres <= 75)
{
if (pres >= 73 || RNG::Ref().chance(1, 8))
parts[i].ctype = PT_GOLD;
else
parts[i].ctype = PT_QRTZ;
}
else if (pres <= 100 && parts[i].temp >= 5000)
{
if (RNG::Ref().chance(1, 5)) // 1 in 5 chance IRON to TTAN
parts[i].ctype = PT_TTAN;
else
parts[i].ctype = PT_IRON;
}
else if (pres <= 255 && parts[i].temp >= 5000 && RNG::Ref().chance(1, 5))
{
if (RNG::Ref().chance(1, 5))
parts[i].ctype = PT_URAN;
else if (RNG::Ref().chance(1, 5))
parts[i].ctype = PT_PLUT;
else
parts[i].ctype = PT_TUNG;
}
}
}
else if (parts[i].ctype == PT_STNE && sim->pv[y / CELL][x / CELL] >= 2.0f) // Form ROCK with pressure
{
parts[i].tmp2 = RNG::Ref().between(0, 10); // Provide tmp2 for color noise
parts[i].ctype = PT_ROCK;
}
break;
default: default:
break; break;
} }
@ -194,66 +244,14 @@ int Element_FIRE_update(UPDATE_FUNC_ARGS)
parts[ID(r)].ctype = PT_HEAC; parts[ID(r)].ctype = PT_HEAC;
} }
} }
else if (parts[i].ctype == PT_ROCK) else if (parts[i].ctype == PT_ROCK && rt == PT_LAVA && parts[ID(r)].ctype == PT_GOLD && parts[ID(r)].tmp == 0 &&
{ sim->pv[y / CELL][x / CELL] >= 50 && RNG::Ref().chance(1, 10000)) // Produce GOLD veins/clusters
float pres = sim->pv[y / CELL][x / CELL];
if (pres <= -9)
{
parts[i].ctype = PT_STNE;
break;
}
if (pres >= 25 && RNG::Ref().chance(1, 100000))
{
if (pres <= 50)
{
if (RNG::Ref().chance(1, 2))
parts[i].ctype = PT_BRMT;
else
parts[i].ctype = PT_CNCT;
break;
}
else if (pres <= 75)
{
if (pres >= 73 || RNG::Ref().chance(1, 8))
parts[i].ctype = PT_GOLD;
else
parts[i].ctype = PT_QRTZ;
break;
}
else if (pres <= 100 && parts[i].temp >= 5000)
{
if (RNG::Ref().chance(1, 5)) // 1 in 5 chance IRON to TTAN
parts[i].ctype = PT_TTAN;
else
parts[i].ctype = PT_IRON;
break;
}
else if (pres <= 255 && parts[i].temp >= 5000 && RNG::Ref().chance(1, 5))
{
if (RNG::Ref().chance(1, 5))
parts[i].ctype = PT_URAN;
else if (RNG::Ref().chance(1, 5))
parts[i].ctype = PT_PLUT;
else
parts[i].ctype = PT_TUNG;
break;
}
}
if (parts[ID(r)].ctype == PT_GOLD && parts[ID(r)].tmp == 0 && pres >= 50 && RNG::Ref().chance(1, 10000)) // Produce GOLD veins/clusters
{ {
parts[i].ctype = PT_GOLD; parts[i].ctype = PT_GOLD;
if (rx > 1 || rx < -1) // Trend veins vertical if (rx > 1 || rx < -1) // Trend veins vertical
parts[i].tmp = 1; parts[i].tmp = 1;
} }
} }
else if (parts[i].ctype == PT_STNE && sim->pv[y / CELL][x / CELL] >= 2.0f) // Form ROCK with pressure
{
parts[i].tmp2 = RNG::Ref().between(0, 10); // Provide tmp2 for color noise
parts[i].ctype = PT_ROCK;
}
}
if ((surround_space || sim->elements[rt].Explosive) && if ((surround_space || sim->elements[rt].Explosive) &&
sim->elements[rt].Flammable && RNG::Ref().chance(int(sim->elements[rt].Flammable + (sim->pv[(y+ry)/CELL][(x+rx)/CELL] * 10.0f)), 1000) && sim->elements[rt].Flammable && RNG::Ref().chance(int(sim->elements[rt].Flammable + (sim->pv[(y+ry)/CELL][(x+rx)/CELL] * 10.0f)), 1000) &&

View File

@ -16,7 +16,7 @@ void Element::Element_ROCK()
AirDrag = 0.00f * CFDS; AirDrag = 0.00f * CFDS;
AirLoss = 0.94f; AirLoss = 0.94f;
Loss = 0.00f; Loss = 0.00f;
Collision = -0.0f; Collision = 0.0f;
Gravity = 0.0f; Gravity = 0.0f;
Diffusion = 0.00f; Diffusion = 0.00f;
HotAir = 0.000f * CFDS; HotAir = 0.000f * CFDS;
@ -27,7 +27,7 @@ void Element::Element_ROCK()
Meltable = 5; Meltable = 5;
Hardness = 70; Hardness = 70;
Weight = 120; Weight = 100;
HeatConduct = 200; HeatConduct = 200;
Description = "Rock. Solid material, CNCT can stack on top of it."; Description = "Rock. Solid material, CNCT can stack on top of it.";