Skip to content

Commit

Permalink
HEAC is now meltable via LIGH, fix HEAC hardness, fixes #441
Browse files Browse the repository at this point in the history
  • Loading branch information
jacob1 committed Jun 12, 2017
1 parent fb2431d commit 1718fe9
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/simulation/Simulation.cpp
Expand Up @@ -3922,7 +3922,7 @@ void Simulation::UpdateParticles(int start, int end)
if (ctemph >= pres+elements[PT_CRMC].HighTemperature)
s = 0;
}
else if (elements[parts[i].ctype].HighTemperatureTransition == PT_LAVA)
else if (elements[parts[i].ctype].HighTemperatureTransition == PT_LAVA || parts[i].ctype == PT_HEAC)
{
if (pt >= elements[parts[i].ctype].HighTemperature)
s = 0;
Expand Down
23 changes: 17 additions & 6 deletions src/simulation/elements/FIRE.cpp
Expand Up @@ -128,14 +128,25 @@ int Element_FIRE::update(UPDATE_FUNC_ARGS)
}
}

// LAVA(CLST) + LAVA(PQRT) + high enough temp = LAVA(CRMC) + LAVA(CRMC)
if (t == PT_LAVA && parts[i].ctype == PT_QRTZ && rt == PT_LAVA && parts[r>>8].ctype == PT_CLST)
if (t == PT_LAVA)
{
float pres = std::max(sim->pv[y/CELL][x/CELL]*10.0f, 0.0f);
if (parts[i].temp >= pres+sim->elements[PT_CRMC].HighTemperature+50.0f)
// LAVA(CLST) + LAVA(PQRT) + high enough temp = LAVA(CRMC) + LAVA(CRMC)
if (parts[i].ctype == PT_QRTZ && rt == PT_LAVA && parts[r>>8].ctype == PT_CLST)
{
parts[i].ctype = PT_CRMC;
parts[r>>8].ctype = PT_CRMC;
float pres = std::max(sim->pv[y/CELL][x/CELL]*10.0f, 0.0f);
if (parts[i].temp >= pres+sim->elements[PT_CRMC].HighTemperature+50.0f)
{
parts[i].ctype = PT_CRMC;
parts[r>>8].ctype = PT_CRMC;
}
}
else if (rt == PT_HEAC && parts[i].ctype == PT_HEAC)
{
if (parts[r>>8].temp > sim->elements[PT_HEAC].HighTemperature && rand()%200)
{
sim->part_change_type(r>>8, x+rx, y+ry, PT_LAVA);
parts[r>>8].ctype = PT_HEAC;
}
}
}

Expand Down
5 changes: 3 additions & 2 deletions src/simulation/elements/HEAC.cpp
Expand Up @@ -23,7 +23,7 @@ Element_HEAC::Element_HEAC()
Flammable = 0;
Explosive = 0;
Meltable = 1;
Hardness = 50;
Hardness = 0;

Weight = 100;

Expand All @@ -39,7 +39,8 @@ Element_HEAC::Element_HEAC()
HighPressureTransition = NT;
LowTemperature = ITL;
LowTemperatureTransition = NT;
HighTemperature = ITH;
// can't melt by normal heat conduction, this is used by other elements for special melting behavior
HighTemperature = 1887.15f;
HighTemperatureTransition = NT;

Update = &Element_HEAC::update;
Expand Down
8 changes: 8 additions & 0 deletions src/simulation/elements/LIGH.cpp
Expand Up @@ -133,6 +133,14 @@ int Element_LIGH::update(UPDATE_FUNC_ARGS)
if (sim->player2.elem!=PT_LIGH)
parts[r>>8].life-=powderful/100;
break;
case PT_HEAC:
parts[r>>8].temp = restrict_flt(parts[r>>8].temp+powderful/10, MIN_TEMP, MAX_TEMP);
if (parts[r>>8].temp > sim->elements[PT_HEAC].HighTemperature)
{
sim->part_change_type(r>>8, x+rx, y+ry, PT_LAVA);
parts[r>>8].ctype = PT_HEAC;
}
break;
default:
break;
}
Expand Down

0 comments on commit 1718fe9

Please sign in to comment.