From b000abcdd8de19b19ca9bb65d86fb2f064c80710 Mon Sep 17 00:00:00 2001 From: Saveliy Skresanov Date: Sun, 1 Oct 2023 21:00:53 +0700 Subject: [PATCH] Add reactions of resist with other elements. --- src/simulation/elements/GLOW.cpp | 6 ++++++ src/simulation/elements/PTNM.cpp | 4 ++++ src/simulation/elements/RSST.cpp | 29 ++++++++++++++++++++++++++++- 3 files changed, 38 insertions(+), 1 deletion(-) diff --git a/src/simulation/elements/GLOW.cpp b/src/simulation/elements/GLOW.cpp index 7df7367c4..e3fbf493b 100644 --- a/src/simulation/elements/GLOW.cpp +++ b/src/simulation/elements/GLOW.cpp @@ -66,6 +66,12 @@ static int update(UPDATE_FUNC_ARGS) parts[ID(r)].life = 10; return 1; } + else if (TYP(r) == PT_GEL) + { + sim->kill_part(i); + sim->part_change_type(ID(r),x+rx,y+ry,PT_RSST); + return 1; + } } } } diff --git a/src/simulation/elements/PTNM.cpp b/src/simulation/elements/PTNM.cpp index 1593b124f..cd7c7cab9 100644 --- a/src/simulation/elements/PTNM.cpp +++ b/src/simulation/elements/PTNM.cpp @@ -236,6 +236,10 @@ static int update(UPDATE_FUNC_ARGS) case PT_SMKE: // SMKE -> CO2 sim->part_change_type(ID(r), x + rx, y + ry, PT_CO2); break; + + case PT_RSST: // RSST -> BIZR + sim->part_change_type(ID(r), x + rx, y + ry, PT_BIZR); + break; } } } diff --git a/src/simulation/elements/RSST.cpp b/src/simulation/elements/RSST.cpp index bfe304284..426197167 100644 --- a/src/simulation/elements/RSST.cpp +++ b/src/simulation/elements/RSST.cpp @@ -1,5 +1,7 @@ #include "simulation/ElementCommon.h" +int update(UPDATE_FUNC_ARGS); + void Element::Element_RSST() { Identifier = "DEFAULT_PT_RSST"; @@ -24,7 +26,7 @@ void Element::Element_RSST() Meltable = 0; Hardness = 50; - Weight = 40; + Weight = 34; DefaultProperties.temp = R_TEMP + 20.0f + 273.15f; HeatConduct = 44; @@ -40,4 +42,29 @@ void Element::Element_RSST() LowTemperatureTransition = NT; HighTemperature = ITH; HighTemperatureTransition = NT; + + Update = &update; +} + +int update(UPDATE_FUNC_ARGS) +{ + for(int rx = -1; rx < 2; rx++) + { + for(int ry = -1; ry < 2; ry++) + { + auto r = pmap[y+ry][x+rx]; + + if (!r) + continue; + + if(TYP(r) == PT_GUNP) + { + sim->part_change_type(i, x, y, PT_FIRW); + sim->kill_part(ID(r)); + return 1; + } + } + } + + return 0; }