From 1718fe92872110af3128a80e8127897541359879 Mon Sep 17 00:00:00 2001 From: jacob1 Date: Sun, 11 Jun 2017 21:10:19 -0400 Subject: [PATCH] HEAC is now meltable via LIGH, fix HEAC hardness, fixes #441 --- src/simulation/Simulation.cpp | 2 +- src/simulation/elements/FIRE.cpp | 23 +++++++++++++++++------ src/simulation/elements/HEAC.cpp | 5 +++-- src/simulation/elements/LIGH.cpp | 8 ++++++++ 4 files changed, 29 insertions(+), 9 deletions(-) diff --git a/src/simulation/Simulation.cpp b/src/simulation/Simulation.cpp index cf58e825c1..e9111f0d83 100644 --- a/src/simulation/Simulation.cpp +++ b/src/simulation/Simulation.cpp @@ -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; diff --git a/src/simulation/elements/FIRE.cpp b/src/simulation/elements/FIRE.cpp index c4a6b3aefc..eefad62aae 100644 --- a/src/simulation/elements/FIRE.cpp +++ b/src/simulation/elements/FIRE.cpp @@ -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; + } } } diff --git a/src/simulation/elements/HEAC.cpp b/src/simulation/elements/HEAC.cpp index 5c377df76c..b16d6e9b20 100644 --- a/src/simulation/elements/HEAC.cpp +++ b/src/simulation/elements/HEAC.cpp @@ -23,7 +23,7 @@ Element_HEAC::Element_HEAC() Flammable = 0; Explosive = 0; Meltable = 1; - Hardness = 50; + Hardness = 0; Weight = 100; @@ -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; diff --git a/src/simulation/elements/LIGH.cpp b/src/simulation/elements/LIGH.cpp index 616d33a730..47e7dbeab9 100644 --- a/src/simulation/elements/LIGH.cpp +++ b/src/simulation/elements/LIGH.cpp @@ -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; }