From 93cbb065ddd72f7d9ff7f78bde1c063b6767e078 Mon Sep 17 00:00:00 2001 From: Saveliy Skresanov Date: Sat, 30 Sep 2023 20:05:29 +0700 Subject: [PATCH 01/12] Add liquid resist (RSST) and solid resist (RSSS). --- src/simulation/Simulation.cpp | 4 ++- src/simulation/elements/BTRY.cpp | 3 +- src/simulation/elements/DLAY.cpp | 3 +- src/simulation/elements/DTEC.cpp | 3 +- src/simulation/elements/ELEC.cpp | 9 +++++ src/simulation/elements/GRVT.cpp | 19 ++++++++++ src/simulation/elements/LITH.cpp | 6 ++-- src/simulation/elements/LSNS.cpp | 3 +- src/simulation/elements/NEUT.cpp | 8 +++++ src/simulation/elements/PHOT.cpp | 7 ++++ src/simulation/elements/PROT.cpp | 12 +++++++ src/simulation/elements/PSNS.cpp | 3 +- src/simulation/elements/RSSS.cpp | 55 +++++++++++++++++++++++++++++ src/simulation/elements/RSST.cpp | 43 ++++++++++++++++++++++ src/simulation/elements/SPRK.cpp | 13 +++---- src/simulation/elements/SWCH.cpp | 3 +- src/simulation/elements/TSNS.cpp | 3 +- src/simulation/elements/VSNS.cpp | 3 +- src/simulation/elements/meson.build | 2 ++ 19 files changed, 185 insertions(+), 17 deletions(-) create mode 100644 src/simulation/elements/RSSS.cpp create mode 100644 src/simulation/elements/RSST.cpp diff --git a/src/simulation/Simulation.cpp b/src/simulation/Simulation.cpp index 04c66700c..a772e6283 100644 --- a/src/simulation/Simulation.cpp +++ b/src/simulation/Simulation.cpp @@ -1197,7 +1197,7 @@ void Simulation::init_can_move() || destinationType == PT_CLNE || destinationType == PT_PCLN || destinationType == PT_BCLN || destinationType == PT_PBCN || destinationType == PT_WATR || destinationType == PT_DSTW || destinationType == PT_SLTW || destinationType == PT_GLOW || destinationType == PT_ISOZ || destinationType == PT_ISZS || destinationType == PT_QRTZ || destinationType == PT_PQRT - || destinationType == PT_H2 || destinationType == PT_BGLA || destinationType == PT_C5) + || destinationType == PT_H2 || destinationType == PT_BGLA || destinationType == PT_C5 || destinationType == PT_RSST) can_move[PT_PHOT][destinationType] = 2; if (destinationType != PT_DMND && destinationType != PT_INSL && destinationType != PT_VOID && destinationType != PT_PVOD && destinationType != PT_VIBR && destinationType != PT_BVBR && destinationType != PT_PRTI && destinationType != PT_PRTO) { @@ -1238,6 +1238,8 @@ void Simulation::init_can_move() can_move[PT_TRON][PT_SWCH] = 3; can_move[PT_SOAP][PT_OIL] = 0; can_move[PT_OIL][PT_SOAP] = 1; + can_move[PT_ELEC][PT_RSST] = 2; + can_move[PT_ELEC][PT_RSSS] = 2; } /* diff --git a/src/simulation/elements/BTRY.cpp b/src/simulation/elements/BTRY.cpp index 2f5dd934a..c580132b3 100644 --- a/src/simulation/elements/BTRY.cpp +++ b/src/simulation/elements/BTRY.cpp @@ -57,7 +57,8 @@ static int update(UPDATE_FUNC_ARGS) if (!r) continue; auto rt = TYP(r); - if (sim->parts_avg(i,ID(r),PT_INSL) != PT_INSL) + auto pavg = sim->parts_avg(i,ID(r),PT_INSL); + if (pavg!=PT_INSL && pavg!=PT_RSSS) { if ((sim->elements[rt].Properties&PROP_CONDUCTS) && !(rt==PT_WATR||rt==PT_SLTW||rt==PT_NTCT||rt==PT_PTCT||rt==PT_INWR) && parts[ID(r)].life==0) { diff --git a/src/simulation/elements/DLAY.cpp b/src/simulation/elements/DLAY.cpp index bbc14ad0b..f3a071ec3 100644 --- a/src/simulation/elements/DLAY.cpp +++ b/src/simulation/elements/DLAY.cpp @@ -62,7 +62,8 @@ static int update(UPDATE_FUNC_ARGS) if (rx || ry) { auto r = pmap[y+ry][x+rx]; - if (!r || sim->parts_avg(ID(r), i,PT_INSL)==PT_INSL) + auto pavg = sim->parts_avg(ID(r), i, PT_INSL); + if (!r || pavg==PT_INSL || pavg==PT_RSSS) continue; if (TYP(r)==PT_SPRK && parts[i].life==0 && parts[ID(r)].life>0 && parts[ID(r)].life<4 && parts[ID(r)].ctype==PT_PSCN) { diff --git a/src/simulation/elements/DTEC.cpp b/src/simulation/elements/DTEC.cpp index 911bd2dde..f9eb703b0 100644 --- a/src/simulation/elements/DTEC.cpp +++ b/src/simulation/elements/DTEC.cpp @@ -66,7 +66,8 @@ static int update(UPDATE_FUNC_ARGS) if (!r) continue; auto rt = TYP(r); - if (sim->parts_avg(i,ID(r),PT_INSL) != PT_INSL) + auto pavg = sim->parts_avg(i,ID(r),PT_INSL); + if (pavg != PT_INSL && pavg != PT_RSSS) { if ((sim->elements[rt].Properties&PROP_CONDUCTS) && !(rt==PT_WATR||rt==PT_SLTW||rt==PT_NTCT||rt==PT_PTCT||rt==PT_INWR) && parts[ID(r)].life==0) { diff --git a/src/simulation/elements/ELEC.cpp b/src/simulation/elements/ELEC.cpp index 9874019e9..9b3c10086 100644 --- a/src/simulation/elements/ELEC.cpp +++ b/src/simulation/elements/ELEC.cpp @@ -115,6 +115,15 @@ static int update(UPDATE_FUNC_ARGS) parts[ID(r)].tmp2 += 5; parts[ID(r)].life = 1000; break; + case PT_RSST: + if(!rx && !ry) + { + sim->kill_part(ID(r)); + sim->kill_part(i); + + return 1; + } + break; case PT_NONE: //seems to speed up ELEC even if it isn't used break; default: diff --git a/src/simulation/elements/GRVT.cpp b/src/simulation/elements/GRVT.cpp index 55fc9608a..348f06d97 100644 --- a/src/simulation/elements/GRVT.cpp +++ b/src/simulation/elements/GRVT.cpp @@ -59,6 +59,25 @@ static int update(UPDATE_FUNC_ARGS) if (parts[i].tmp <= -100) parts[i].tmp = -100; + int under = pmap[y][x]; + int utype = TYP(under); + int uID = ID(under); + + if(utype == PT_RSST) + { + sim->part_change_type(uID, x, y, PT_SWCH); + sim->kill_part(i); + + return 1; + } + else if(utype == PT_RSSS) + { + sim->part_change_type(uID, x, y, PT_NSCN); + sim->kill_part(i); + + return 1; + } + sim->gravmap[(y/CELL)*XCELLS+(x/CELL)] = 0.2f*parts[i].tmp; return 0; } diff --git a/src/simulation/elements/LITH.cpp b/src/simulation/elements/LITH.cpp index 4ace0e832..10605a255 100644 --- a/src/simulation/elements/LITH.cpp +++ b/src/simulation/elements/LITH.cpp @@ -93,6 +93,8 @@ static int update(UPDATE_FUNC_ARGS) } Particle &neighbor = parts[ID(neighborData)]; + auto pavg = sim->parts_avg(i, ID(neighborData), PT_INSL); + switch (TYP(neighborData)) { case PT_SLTW: @@ -134,7 +136,7 @@ static int update(UPDATE_FUNC_ARGS) break; case PT_SPRK: - if (sim->parts_avg(i, ID(neighborData), PT_INSL) == PT_INSL) + if (pavg == PT_INSL || pavg == PT_RSSS) { break; } @@ -149,7 +151,7 @@ static int update(UPDATE_FUNC_ARGS) break; case PT_NSCN: - if (sim->parts_avg(i, ID(neighborData), PT_INSL) == PT_INSL) + if (pavg == PT_INSL || pavg == PT_RSSS) { break; } diff --git a/src/simulation/elements/LSNS.cpp b/src/simulation/elements/LSNS.cpp index a70f4a22e..794ad3fe5 100644 --- a/src/simulation/elements/LSNS.cpp +++ b/src/simulation/elements/LSNS.cpp @@ -67,7 +67,8 @@ static int update(UPDATE_FUNC_ARGS) if (!r) continue; int rt = TYP(r); - if (sim->parts_avg(i, ID(r), PT_INSL) != PT_INSL) + auto pavg = sim->parts_avg(i, ID(r), PT_INSL); + if (pavg != PT_INSL && pavg != PT_RSSS) { if ((sim->elements[rt].Properties&PROP_CONDUCTS) && !(rt == PT_WATR || rt == PT_SLTW || rt == PT_NTCT || rt == PT_PTCT || rt == PT_INWR) && parts[ID(r)].life == 0) { diff --git a/src/simulation/elements/NEUT.cpp b/src/simulation/elements/NEUT.cpp index bfd0c146a..d367556a5 100644 --- a/src/simulation/elements/NEUT.cpp +++ b/src/simulation/elements/NEUT.cpp @@ -164,6 +164,14 @@ static int update(UPDATE_FUNC_ARGS) else sim->create_part(ID(r), x+rx, y+ry, PT_CAUS); break; + case PT_RSSS: + if(!rx && !ry) + { + sim->part_change_type(ID(r), x, y, PT_RSST); + sim->kill_part(i); + return 1; + } + break; default: break; } diff --git a/src/simulation/elements/PHOT.cpp b/src/simulation/elements/PHOT.cpp index 56432a48b..74b03d395 100644 --- a/src/simulation/elements/PHOT.cpp +++ b/src/simulation/elements/PHOT.cpp @@ -107,6 +107,13 @@ static int update(UPDATE_FUNC_ARGS) parts[i].vx = vx; parts[i].vy = vy; } + else if(TYP(r) == PT_RSST && !ry && !rx)//if on RSST + { + sim->part_change_type(ID(r),x,y,PT_RSSS); + sim->kill_part(i); + + return 1; + } else if (TYP(r) == PT_FILT && parts[ID(r)].tmp==9) { parts[i].vx += ((float)sim->rng.between(-500, 500))/1000.0f; diff --git a/src/simulation/elements/PROT.cpp b/src/simulation/elements/PROT.cpp index 5d0c7a2a3..f5a997932 100644 --- a/src/simulation/elements/PROT.cpp +++ b/src/simulation/elements/PROT.cpp @@ -101,6 +101,18 @@ static int update(UPDATE_FUNC_ARGS) else change = 0.0f; parts[uID].temp = restrict_flt(parts[uID].temp + change, MIN_TEMP, MAX_TEMP); break; + case PT_RSST: + { + sim->part_change_type(uID, x, y, PT_METL); + sim->kill_part(i); + } + break; + case PT_RSSS: + { + sim->part_change_type(uID, x, y, PT_PSCN); + sim->kill_part(i); + } + break; case PT_NONE: //slowly kill if it's not inside an element if (parts[i].life) diff --git a/src/simulation/elements/PSNS.cpp b/src/simulation/elements/PSNS.cpp index 3d893f287..06b94113d 100644 --- a/src/simulation/elements/PSNS.cpp +++ b/src/simulation/elements/PSNS.cpp @@ -59,7 +59,8 @@ static int update(UPDATE_FUNC_ARGS) auto r = pmap[y+ry][x+rx]; if (!r) continue; - if (sim->parts_avg(i,ID(r),PT_INSL) != PT_INSL) + auto pavg = sim->parts_avg(i,ID(r),PT_INSL); + if (pavg != PT_INSL && pavg != PT_RSSS) { auto rt = TYP(r); if ((sim->elements[rt].Properties&PROP_CONDUCTS) && !(rt==PT_WATR||rt==PT_SLTW||rt==PT_NTCT||rt==PT_PTCT||rt==PT_INWR) && parts[ID(r)].life==0) diff --git a/src/simulation/elements/RSSS.cpp b/src/simulation/elements/RSSS.cpp new file mode 100644 index 000000000..a853ddd13 --- /dev/null +++ b/src/simulation/elements/RSSS.cpp @@ -0,0 +1,55 @@ +#include "simulation/ElementCommon.h" +#include "simulation/Air.h" + +static int update(UPDATE_FUNC_ARGS); + +void Element::Element_RSSS() +{ + Identifier = "DEFAULT_PT_RSSS"; + Name = "RSSS"; + Colour = 0xC43626_rgb; + MenuVisible = 1; + MenuSection = SC_SOLIDS; + Enabled = 1; + + Advection = 0.0f; + AirDrag = 0.00f * CFDS; + AirLoss = 0.90f; + Loss = 0.00f; + Collision = 0.0f; + Gravity = 0.0f; + Diffusion = 0.00f; + HotAir = 0.000f * CFDS; + Falldown = 0; + + Flammable = 0; + Explosive = 0; + Meltable = 0; + Hardness = 0; + + Weight = 100; + + HeatConduct = 251; + Description = "Solidified resist."; + + Properties = TYPE_SOLID|PROP_NEUTPASS; + + LowPressure = IPL; + LowPressureTransition = NT; + HighPressure = IPH; + HighPressureTransition = NT; + LowTemperature = ITL; + LowTemperatureTransition = NT; + HighTemperature = ITH; + HighTemperatureTransition = NT; + + Update = &update; +} + +static int update(UPDATE_FUNC_ARGS) +{ + sim->air->bmap_blockair[y/CELL][x/CELL] = 1; + sim->air->bmap_blockairh[y/CELL][x/CELL] = 0x8; + + return 0; +} diff --git a/src/simulation/elements/RSST.cpp b/src/simulation/elements/RSST.cpp new file mode 100644 index 000000000..bfe304284 --- /dev/null +++ b/src/simulation/elements/RSST.cpp @@ -0,0 +1,43 @@ +#include "simulation/ElementCommon.h" + +void Element::Element_RSST() +{ + Identifier = "DEFAULT_PT_RSST"; + Name = "RSST"; + Colour = 0xF95B49_rgb; + MenuVisible = 1; + MenuSection = SC_LIQUID; + Enabled = 1; + + Advection = 0.3f; + AirDrag = 0.02f * CFDS; + AirLoss = 0.98f; + Loss = 0.80f; + Collision = 0.0f; + Gravity = 0.15f; + Diffusion = 0.00f; + HotAir = 0.000f * CFDS; + Falldown = 2; + + Flammable = 0; + Explosive = 0; + Meltable = 0; + Hardness = 50; + + Weight = 40; + + DefaultProperties.temp = R_TEMP + 20.0f + 273.15f; + HeatConduct = 44; + Description = "Resist."; + + Properties = TYPE_LIQUID|PROP_NEUTPASS; + + LowPressure = IPL; + LowPressureTransition = NT; + HighPressure = IPH; + HighPressureTransition = NT; + LowTemperature = ITL; + LowTemperatureTransition = NT; + HighTemperature = ITH; + HighTemperatureTransition = NT; +} diff --git a/src/simulation/elements/SPRK.cpp b/src/simulation/elements/SPRK.cpp index 4b43a5869..cc06f8aae 100644 --- a/src/simulation/elements/SPRK.cpp +++ b/src/simulation/elements/SPRK.cpp @@ -89,7 +89,8 @@ static int update(UPDATE_FUNC_ARGS) { int Element_ETRD_nearestSparkablePart(Simulation *sim, int targetId); auto nearp = Element_ETRD_nearestSparkablePart(sim, i); - if (nearp!=-1 && sim->parts_avg(i, nearp, PT_INSL)!=PT_INSL) + auto pavg = sim->parts_avg(i, nearp, PT_INSL); + if (nearp!=-1 && pavg!=PT_INSL && pavg!=PT_RSSS) { sim->CreateLine(x, y, (int)(parts[nearp].x+0.5f), (int)(parts[nearp].y+0.5f), PT_PLSM); parts[i].life = 20; @@ -197,7 +198,7 @@ static int update(UPDATE_FUNC_ARGS) switch (receiver) { case PT_SWCH: - if (pavg!=PT_INSL && parts[i].life<4) + if (pavg!=PT_INSL && pavg!=PT_RSSS && parts[i].life<4) { if(sender==PT_PSCN && parts[ID(r)].life<10) { parts[ID(r)].life = 10; @@ -210,7 +211,7 @@ static int update(UPDATE_FUNC_ARGS) } break; case PT_SPRK: - if (pavg!=PT_INSL && parts[i].life<4) + if (pavg!=PT_INSL && pavg!=PT_RSSS && parts[i].life<4) { if (parts[ID(r)].ctype==PT_SWCH) { @@ -243,7 +244,7 @@ static int update(UPDATE_FUNC_ARGS) } continue; case PT_PPIP: - if (parts[i].life == 3 && pavg!=PT_INSL) + if (parts[i].life == 3 && pavg!=PT_INSL && pavg!=PT_RSSS) { void Element_PPIP_flood_trigger(Simulation * sim, int x, int y, int sparkedBy); if (sender == PT_NSCN || sender == PT_PSCN || sender == PT_INST) @@ -251,7 +252,7 @@ static int update(UPDATE_FUNC_ARGS) } continue; case PT_NTCT: case PT_PTCT: case PT_INWR: - if (sender==PT_METL && pavg!=PT_INSL && parts[i].life<4) + if (sender==PT_METL && pavg!=PT_INSL && pavg!=PT_RSSS && parts[i].life<4) { parts[ID(r)].temp = 473.0f; if (receiver==PT_NTCT||receiver==PT_PTCT) @@ -270,7 +271,7 @@ static int update(UPDATE_FUNC_ARGS) continue; } - if (pavg == PT_INSL) continue; //Insulation blocks everything past here + if ((pavg == PT_INSL) || (pavg == PT_RSSS)) continue; //Insulation blocks everything past here if (!((sim->elements[receiver].Properties&PROP_CONDUCTS)||receiver==PT_INST||receiver==PT_QRTZ)) continue; //Stop non-conducting receivers, allow INST and QRTZ as special cases if (abs(rx)+abs(ry)>=4 &&sender!=PT_SWCH&&receiver!=PT_SWCH) continue; //Only switch conducts really far if (receiver==sender && receiver!=PT_INST && receiver!=PT_QRTZ) goto conduct; //Everything conducts to itself, except INST. diff --git a/src/simulation/elements/SWCH.cpp b/src/simulation/elements/SWCH.cpp index c41525b28..ed8806bfe 100644 --- a/src/simulation/elements/SWCH.cpp +++ b/src/simulation/elements/SWCH.cpp @@ -65,7 +65,8 @@ static int update(UPDATE_FUNC_ARGS) auto r = pmap[y+ry][x+rx]; if (!r) continue; - if (sim->parts_avg(i,ID(r),PT_INSL)!=PT_INSL) + auto pavg = sim->parts_avg(i,ID(r),PT_INSL); + if (pavg!=PT_INSL && pavg!=PT_RSSS) { auto rt = TYP(r); if (rt==PT_SWCH) diff --git a/src/simulation/elements/TSNS.cpp b/src/simulation/elements/TSNS.cpp index 7da107e06..488638514 100644 --- a/src/simulation/elements/TSNS.cpp +++ b/src/simulation/elements/TSNS.cpp @@ -67,7 +67,8 @@ static int update(UPDATE_FUNC_ARGS) if (!r) continue; int rt = TYP(r); - if (sim->parts_avg(i, ID(r), PT_INSL) != PT_INSL) + auto pavg = sim->parts_avg(i, ID(r), PT_INSL); + if (pavg != PT_INSL && pavg != PT_RSSS) { if ((sim->elements[rt].Properties&PROP_CONDUCTS) && !(rt == PT_WATR || rt == PT_SLTW || rt == PT_NTCT || rt == PT_PTCT || rt == PT_INWR) && parts[ID(r)].life == 0) { diff --git a/src/simulation/elements/VSNS.cpp b/src/simulation/elements/VSNS.cpp index 2b54de686..d60a53469 100644 --- a/src/simulation/elements/VSNS.cpp +++ b/src/simulation/elements/VSNS.cpp @@ -65,7 +65,8 @@ static int update(UPDATE_FUNC_ARGS) if (!r) continue; int rt = TYP(r); - if (sim->parts_avg(i, ID(r), PT_INSL) != PT_INSL) + auto pavg = sim->parts_avg(i, ID(r), PT_INSL); + if (pavg != PT_INSL && pavg != PT_RSSS) { if ((sim->elements[rt].Properties &PROP_CONDUCTS) && !(rt == PT_WATR || rt == PT_SLTW || rt == PT_NTCT || rt == PT_PTCT || rt == PT_INWR) && parts[ID(r)].life == 0) { diff --git a/src/simulation/elements/meson.build b/src/simulation/elements/meson.build index 05cc5792f..4f1dc9c64 100644 --- a/src/simulation/elements/meson.build +++ b/src/simulation/elements/meson.build @@ -191,6 +191,8 @@ simulation_elem_names = [ 'VSNS', 'ROCK', 'LITH', + 'RSST', + 'RSSS' ] simulation_elem_src = [] From b000abcdd8de19b19ca9bb65d86fb2f064c80710 Mon Sep 17 00:00:00 2001 From: Saveliy Skresanov Date: Sun, 1 Oct 2023 21:00:53 +0700 Subject: [PATCH 02/12] 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; } From 78bc86d107b24a88da1ca7c95d858899870eddb7 Mon Sep 17 00:00:00 2001 From: Saveliy Skresanov Date: Mon, 2 Oct 2023 22:41:22 +0700 Subject: [PATCH 03/12] Add ctype mechanics. --- src/simulation/elements/NEUT.cpp | 19 ++++++++++++++++++- src/simulation/elements/PHOT.cpp | 20 ++++++++++++++++++-- 2 files changed, 36 insertions(+), 3 deletions(-) diff --git a/src/simulation/elements/NEUT.cpp b/src/simulation/elements/NEUT.cpp index d367556a5..1652e4fda 100644 --- a/src/simulation/elements/NEUT.cpp +++ b/src/simulation/elements/NEUT.cpp @@ -167,8 +167,25 @@ static int update(UPDATE_FUNC_ARGS) case PT_RSSS: if(!rx && !ry) { - sim->part_change_type(ID(r), x, y, PT_RSST); + int ct_under, tmp_under; + + ct_under = parts[ID(r)].ctype; + tmp_under = parts[ID(r)].tmp; + + //If there's a correct ctype set, use it + if(ct_under > 0 && ct_under < PT_NUM) + { + sim->create_part(ID(r), x, y, ct_under); + + //If there's a correct tmp set, use it for ctype + if(tmp_under > 0 && ct_under < PT_NUM) + parts[ID(r)].ctype = tmp_under; + } + else + sim->part_change_type(ID(r), x, y, PT_RSST); + sim->kill_part(i); + return 1; } break; diff --git a/src/simulation/elements/PHOT.cpp b/src/simulation/elements/PHOT.cpp index 74b03d395..524b06832 100644 --- a/src/simulation/elements/PHOT.cpp +++ b/src/simulation/elements/PHOT.cpp @@ -107,9 +107,25 @@ static int update(UPDATE_FUNC_ARGS) parts[i].vx = vx; parts[i].vy = vy; } - else if(TYP(r) == PT_RSST && !ry && !rx)//if on RSST + else if(TYP(r) == PT_RSST && !ry && !rx)//if on RSST, make it solid { - sim->part_change_type(ID(r),x,y,PT_RSSS); + int ct_under, tmp_under; + + ct_under = parts[ID(r)].ctype; + tmp_under = parts[ID(r)].tmp; + + //If there's a correct ctype set, use it + if(ct_under > 0 && ct_under < PT_NUM) + { + sim->create_part(ID(r), x, y, ct_under); + + //If there's a correct tmp set, use it for ctype + if(tmp_under > 0 && ct_under < PT_NUM) + parts[ID(r)].ctype = tmp_under; + } + else + sim->part_change_type(ID(r), x, y, PT_RSSS); + sim->kill_part(i); return 1; From 84b790ceaf0e5c37f44043502f2e587575bbd8bb Mon Sep 17 00:00:00 2001 From: Saveliy Skresanov Date: Mon, 9 Oct 2023 00:20:15 +0700 Subject: [PATCH 04/12] Add descriptions for RSST and RSSS. --- src/simulation/elements/RSSS.cpp | 2 +- src/simulation/elements/RSST.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/simulation/elements/RSSS.cpp b/src/simulation/elements/RSSS.cpp index a853ddd13..10c8ceaa7 100644 --- a/src/simulation/elements/RSSS.cpp +++ b/src/simulation/elements/RSSS.cpp @@ -30,7 +30,7 @@ void Element::Element_RSSS() Weight = 100; HeatConduct = 251; - Description = "Solidified resist."; + Description = "Solidified resist. Blocks pressure and insulates SPRK. Liquefies on contact with NEUT."; Properties = TYPE_SOLID|PROP_NEUTPASS; diff --git a/src/simulation/elements/RSST.cpp b/src/simulation/elements/RSST.cpp index 426197167..6640bb5e8 100644 --- a/src/simulation/elements/RSST.cpp +++ b/src/simulation/elements/RSST.cpp @@ -30,7 +30,7 @@ void Element::Element_RSST() DefaultProperties.temp = R_TEMP + 20.0f + 273.15f; HeatConduct = 44; - Description = "Resist."; + Description = "Resist. Solidifies on contact with PHOT, and reacts with other energy particles."; Properties = TYPE_LIQUID|PROP_NEUTPASS; From 4377f83184fbdba04f8712544a13bc62611bf3d5 Mon Sep 17 00:00:00 2001 From: Saveliy Skresanov Date: Sat, 30 Sep 2023 20:05:29 +0700 Subject: [PATCH 05/12] Add liquid resist (RSST) and solid resist (RSSS). --- src/simulation/Simulation.cpp | 4 ++- src/simulation/elements/BTRY.cpp | 3 +- src/simulation/elements/DLAY.cpp | 3 +- src/simulation/elements/DTEC.cpp | 3 +- src/simulation/elements/ELEC.cpp | 9 +++++ src/simulation/elements/GRVT.cpp | 19 ++++++++++ src/simulation/elements/LITH.cpp | 6 ++-- src/simulation/elements/LSNS.cpp | 3 +- src/simulation/elements/NEUT.cpp | 8 +++++ src/simulation/elements/PHOT.cpp | 7 ++++ src/simulation/elements/PROT.cpp | 12 +++++++ src/simulation/elements/PSNS.cpp | 3 +- src/simulation/elements/RSSS.cpp | 55 +++++++++++++++++++++++++++++ src/simulation/elements/RSST.cpp | 43 ++++++++++++++++++++++ src/simulation/elements/SPRK.cpp | 13 +++---- src/simulation/elements/SWCH.cpp | 3 +- src/simulation/elements/TSNS.cpp | 3 +- src/simulation/elements/VSNS.cpp | 3 +- src/simulation/elements/meson.build | 2 ++ 19 files changed, 185 insertions(+), 17 deletions(-) create mode 100644 src/simulation/elements/RSSS.cpp create mode 100644 src/simulation/elements/RSST.cpp diff --git a/src/simulation/Simulation.cpp b/src/simulation/Simulation.cpp index 1950bf77a..260223a30 100644 --- a/src/simulation/Simulation.cpp +++ b/src/simulation/Simulation.cpp @@ -1197,7 +1197,7 @@ void Simulation::init_can_move() || destinationType == PT_CLNE || destinationType == PT_PCLN || destinationType == PT_BCLN || destinationType == PT_PBCN || destinationType == PT_WATR || destinationType == PT_DSTW || destinationType == PT_SLTW || destinationType == PT_GLOW || destinationType == PT_ISOZ || destinationType == PT_ISZS || destinationType == PT_QRTZ || destinationType == PT_PQRT - || destinationType == PT_H2 || destinationType == PT_BGLA || destinationType == PT_C5) + || destinationType == PT_H2 || destinationType == PT_BGLA || destinationType == PT_C5 || destinationType == PT_RSST) can_move[PT_PHOT][destinationType] = 2; if (destinationType != PT_DMND && destinationType != PT_INSL && destinationType != PT_VOID && destinationType != PT_PVOD && destinationType != PT_VIBR && destinationType != PT_BVBR && destinationType != PT_PRTI && destinationType != PT_PRTO) { @@ -1238,6 +1238,8 @@ void Simulation::init_can_move() can_move[PT_TRON][PT_SWCH] = 3; can_move[PT_SOAP][PT_OIL] = 0; can_move[PT_OIL][PT_SOAP] = 1; + can_move[PT_ELEC][PT_RSST] = 2; + can_move[PT_ELEC][PT_RSSS] = 2; } /* diff --git a/src/simulation/elements/BTRY.cpp b/src/simulation/elements/BTRY.cpp index 2f5dd934a..c580132b3 100644 --- a/src/simulation/elements/BTRY.cpp +++ b/src/simulation/elements/BTRY.cpp @@ -57,7 +57,8 @@ static int update(UPDATE_FUNC_ARGS) if (!r) continue; auto rt = TYP(r); - if (sim->parts_avg(i,ID(r),PT_INSL) != PT_INSL) + auto pavg = sim->parts_avg(i,ID(r),PT_INSL); + if (pavg!=PT_INSL && pavg!=PT_RSSS) { if ((sim->elements[rt].Properties&PROP_CONDUCTS) && !(rt==PT_WATR||rt==PT_SLTW||rt==PT_NTCT||rt==PT_PTCT||rt==PT_INWR) && parts[ID(r)].life==0) { diff --git a/src/simulation/elements/DLAY.cpp b/src/simulation/elements/DLAY.cpp index bbc14ad0b..f3a071ec3 100644 --- a/src/simulation/elements/DLAY.cpp +++ b/src/simulation/elements/DLAY.cpp @@ -62,7 +62,8 @@ static int update(UPDATE_FUNC_ARGS) if (rx || ry) { auto r = pmap[y+ry][x+rx]; - if (!r || sim->parts_avg(ID(r), i,PT_INSL)==PT_INSL) + auto pavg = sim->parts_avg(ID(r), i, PT_INSL); + if (!r || pavg==PT_INSL || pavg==PT_RSSS) continue; if (TYP(r)==PT_SPRK && parts[i].life==0 && parts[ID(r)].life>0 && parts[ID(r)].life<4 && parts[ID(r)].ctype==PT_PSCN) { diff --git a/src/simulation/elements/DTEC.cpp b/src/simulation/elements/DTEC.cpp index 911bd2dde..f9eb703b0 100644 --- a/src/simulation/elements/DTEC.cpp +++ b/src/simulation/elements/DTEC.cpp @@ -66,7 +66,8 @@ static int update(UPDATE_FUNC_ARGS) if (!r) continue; auto rt = TYP(r); - if (sim->parts_avg(i,ID(r),PT_INSL) != PT_INSL) + auto pavg = sim->parts_avg(i,ID(r),PT_INSL); + if (pavg != PT_INSL && pavg != PT_RSSS) { if ((sim->elements[rt].Properties&PROP_CONDUCTS) && !(rt==PT_WATR||rt==PT_SLTW||rt==PT_NTCT||rt==PT_PTCT||rt==PT_INWR) && parts[ID(r)].life==0) { diff --git a/src/simulation/elements/ELEC.cpp b/src/simulation/elements/ELEC.cpp index 9874019e9..9b3c10086 100644 --- a/src/simulation/elements/ELEC.cpp +++ b/src/simulation/elements/ELEC.cpp @@ -115,6 +115,15 @@ static int update(UPDATE_FUNC_ARGS) parts[ID(r)].tmp2 += 5; parts[ID(r)].life = 1000; break; + case PT_RSST: + if(!rx && !ry) + { + sim->kill_part(ID(r)); + sim->kill_part(i); + + return 1; + } + break; case PT_NONE: //seems to speed up ELEC even if it isn't used break; default: diff --git a/src/simulation/elements/GRVT.cpp b/src/simulation/elements/GRVT.cpp index 55fc9608a..348f06d97 100644 --- a/src/simulation/elements/GRVT.cpp +++ b/src/simulation/elements/GRVT.cpp @@ -59,6 +59,25 @@ static int update(UPDATE_FUNC_ARGS) if (parts[i].tmp <= -100) parts[i].tmp = -100; + int under = pmap[y][x]; + int utype = TYP(under); + int uID = ID(under); + + if(utype == PT_RSST) + { + sim->part_change_type(uID, x, y, PT_SWCH); + sim->kill_part(i); + + return 1; + } + else if(utype == PT_RSSS) + { + sim->part_change_type(uID, x, y, PT_NSCN); + sim->kill_part(i); + + return 1; + } + sim->gravmap[(y/CELL)*XCELLS+(x/CELL)] = 0.2f*parts[i].tmp; return 0; } diff --git a/src/simulation/elements/LITH.cpp b/src/simulation/elements/LITH.cpp index 4ace0e832..10605a255 100644 --- a/src/simulation/elements/LITH.cpp +++ b/src/simulation/elements/LITH.cpp @@ -93,6 +93,8 @@ static int update(UPDATE_FUNC_ARGS) } Particle &neighbor = parts[ID(neighborData)]; + auto pavg = sim->parts_avg(i, ID(neighborData), PT_INSL); + switch (TYP(neighborData)) { case PT_SLTW: @@ -134,7 +136,7 @@ static int update(UPDATE_FUNC_ARGS) break; case PT_SPRK: - if (sim->parts_avg(i, ID(neighborData), PT_INSL) == PT_INSL) + if (pavg == PT_INSL || pavg == PT_RSSS) { break; } @@ -149,7 +151,7 @@ static int update(UPDATE_FUNC_ARGS) break; case PT_NSCN: - if (sim->parts_avg(i, ID(neighborData), PT_INSL) == PT_INSL) + if (pavg == PT_INSL || pavg == PT_RSSS) { break; } diff --git a/src/simulation/elements/LSNS.cpp b/src/simulation/elements/LSNS.cpp index a70f4a22e..794ad3fe5 100644 --- a/src/simulation/elements/LSNS.cpp +++ b/src/simulation/elements/LSNS.cpp @@ -67,7 +67,8 @@ static int update(UPDATE_FUNC_ARGS) if (!r) continue; int rt = TYP(r); - if (sim->parts_avg(i, ID(r), PT_INSL) != PT_INSL) + auto pavg = sim->parts_avg(i, ID(r), PT_INSL); + if (pavg != PT_INSL && pavg != PT_RSSS) { if ((sim->elements[rt].Properties&PROP_CONDUCTS) && !(rt == PT_WATR || rt == PT_SLTW || rt == PT_NTCT || rt == PT_PTCT || rt == PT_INWR) && parts[ID(r)].life == 0) { diff --git a/src/simulation/elements/NEUT.cpp b/src/simulation/elements/NEUT.cpp index bfd0c146a..d367556a5 100644 --- a/src/simulation/elements/NEUT.cpp +++ b/src/simulation/elements/NEUT.cpp @@ -164,6 +164,14 @@ static int update(UPDATE_FUNC_ARGS) else sim->create_part(ID(r), x+rx, y+ry, PT_CAUS); break; + case PT_RSSS: + if(!rx && !ry) + { + sim->part_change_type(ID(r), x, y, PT_RSST); + sim->kill_part(i); + return 1; + } + break; default: break; } diff --git a/src/simulation/elements/PHOT.cpp b/src/simulation/elements/PHOT.cpp index fc7b21641..29a8f94bb 100644 --- a/src/simulation/elements/PHOT.cpp +++ b/src/simulation/elements/PHOT.cpp @@ -107,6 +107,13 @@ static int update(UPDATE_FUNC_ARGS) parts[i].vx = vx; parts[i].vy = vy; } + else if(TYP(r) == PT_RSST && !ry && !rx)//if on RSST + { + sim->part_change_type(ID(r),x,y,PT_RSSS); + sim->kill_part(i); + + return 1; + } else if (TYP(r) == PT_FILT && parts[ID(r)].tmp==9) { parts[i].vx += ((float)sim->rng.between(-500, 500))/1000.0f; diff --git a/src/simulation/elements/PROT.cpp b/src/simulation/elements/PROT.cpp index 5d0c7a2a3..f5a997932 100644 --- a/src/simulation/elements/PROT.cpp +++ b/src/simulation/elements/PROT.cpp @@ -101,6 +101,18 @@ static int update(UPDATE_FUNC_ARGS) else change = 0.0f; parts[uID].temp = restrict_flt(parts[uID].temp + change, MIN_TEMP, MAX_TEMP); break; + case PT_RSST: + { + sim->part_change_type(uID, x, y, PT_METL); + sim->kill_part(i); + } + break; + case PT_RSSS: + { + sim->part_change_type(uID, x, y, PT_PSCN); + sim->kill_part(i); + } + break; case PT_NONE: //slowly kill if it's not inside an element if (parts[i].life) diff --git a/src/simulation/elements/PSNS.cpp b/src/simulation/elements/PSNS.cpp index 3d893f287..06b94113d 100644 --- a/src/simulation/elements/PSNS.cpp +++ b/src/simulation/elements/PSNS.cpp @@ -59,7 +59,8 @@ static int update(UPDATE_FUNC_ARGS) auto r = pmap[y+ry][x+rx]; if (!r) continue; - if (sim->parts_avg(i,ID(r),PT_INSL) != PT_INSL) + auto pavg = sim->parts_avg(i,ID(r),PT_INSL); + if (pavg != PT_INSL && pavg != PT_RSSS) { auto rt = TYP(r); if ((sim->elements[rt].Properties&PROP_CONDUCTS) && !(rt==PT_WATR||rt==PT_SLTW||rt==PT_NTCT||rt==PT_PTCT||rt==PT_INWR) && parts[ID(r)].life==0) diff --git a/src/simulation/elements/RSSS.cpp b/src/simulation/elements/RSSS.cpp new file mode 100644 index 000000000..a853ddd13 --- /dev/null +++ b/src/simulation/elements/RSSS.cpp @@ -0,0 +1,55 @@ +#include "simulation/ElementCommon.h" +#include "simulation/Air.h" + +static int update(UPDATE_FUNC_ARGS); + +void Element::Element_RSSS() +{ + Identifier = "DEFAULT_PT_RSSS"; + Name = "RSSS"; + Colour = 0xC43626_rgb; + MenuVisible = 1; + MenuSection = SC_SOLIDS; + Enabled = 1; + + Advection = 0.0f; + AirDrag = 0.00f * CFDS; + AirLoss = 0.90f; + Loss = 0.00f; + Collision = 0.0f; + Gravity = 0.0f; + Diffusion = 0.00f; + HotAir = 0.000f * CFDS; + Falldown = 0; + + Flammable = 0; + Explosive = 0; + Meltable = 0; + Hardness = 0; + + Weight = 100; + + HeatConduct = 251; + Description = "Solidified resist."; + + Properties = TYPE_SOLID|PROP_NEUTPASS; + + LowPressure = IPL; + LowPressureTransition = NT; + HighPressure = IPH; + HighPressureTransition = NT; + LowTemperature = ITL; + LowTemperatureTransition = NT; + HighTemperature = ITH; + HighTemperatureTransition = NT; + + Update = &update; +} + +static int update(UPDATE_FUNC_ARGS) +{ + sim->air->bmap_blockair[y/CELL][x/CELL] = 1; + sim->air->bmap_blockairh[y/CELL][x/CELL] = 0x8; + + return 0; +} diff --git a/src/simulation/elements/RSST.cpp b/src/simulation/elements/RSST.cpp new file mode 100644 index 000000000..bfe304284 --- /dev/null +++ b/src/simulation/elements/RSST.cpp @@ -0,0 +1,43 @@ +#include "simulation/ElementCommon.h" + +void Element::Element_RSST() +{ + Identifier = "DEFAULT_PT_RSST"; + Name = "RSST"; + Colour = 0xF95B49_rgb; + MenuVisible = 1; + MenuSection = SC_LIQUID; + Enabled = 1; + + Advection = 0.3f; + AirDrag = 0.02f * CFDS; + AirLoss = 0.98f; + Loss = 0.80f; + Collision = 0.0f; + Gravity = 0.15f; + Diffusion = 0.00f; + HotAir = 0.000f * CFDS; + Falldown = 2; + + Flammable = 0; + Explosive = 0; + Meltable = 0; + Hardness = 50; + + Weight = 40; + + DefaultProperties.temp = R_TEMP + 20.0f + 273.15f; + HeatConduct = 44; + Description = "Resist."; + + Properties = TYPE_LIQUID|PROP_NEUTPASS; + + LowPressure = IPL; + LowPressureTransition = NT; + HighPressure = IPH; + HighPressureTransition = NT; + LowTemperature = ITL; + LowTemperatureTransition = NT; + HighTemperature = ITH; + HighTemperatureTransition = NT; +} diff --git a/src/simulation/elements/SPRK.cpp b/src/simulation/elements/SPRK.cpp index 4b43a5869..cc06f8aae 100644 --- a/src/simulation/elements/SPRK.cpp +++ b/src/simulation/elements/SPRK.cpp @@ -89,7 +89,8 @@ static int update(UPDATE_FUNC_ARGS) { int Element_ETRD_nearestSparkablePart(Simulation *sim, int targetId); auto nearp = Element_ETRD_nearestSparkablePart(sim, i); - if (nearp!=-1 && sim->parts_avg(i, nearp, PT_INSL)!=PT_INSL) + auto pavg = sim->parts_avg(i, nearp, PT_INSL); + if (nearp!=-1 && pavg!=PT_INSL && pavg!=PT_RSSS) { sim->CreateLine(x, y, (int)(parts[nearp].x+0.5f), (int)(parts[nearp].y+0.5f), PT_PLSM); parts[i].life = 20; @@ -197,7 +198,7 @@ static int update(UPDATE_FUNC_ARGS) switch (receiver) { case PT_SWCH: - if (pavg!=PT_INSL && parts[i].life<4) + if (pavg!=PT_INSL && pavg!=PT_RSSS && parts[i].life<4) { if(sender==PT_PSCN && parts[ID(r)].life<10) { parts[ID(r)].life = 10; @@ -210,7 +211,7 @@ static int update(UPDATE_FUNC_ARGS) } break; case PT_SPRK: - if (pavg!=PT_INSL && parts[i].life<4) + if (pavg!=PT_INSL && pavg!=PT_RSSS && parts[i].life<4) { if (parts[ID(r)].ctype==PT_SWCH) { @@ -243,7 +244,7 @@ static int update(UPDATE_FUNC_ARGS) } continue; case PT_PPIP: - if (parts[i].life == 3 && pavg!=PT_INSL) + if (parts[i].life == 3 && pavg!=PT_INSL && pavg!=PT_RSSS) { void Element_PPIP_flood_trigger(Simulation * sim, int x, int y, int sparkedBy); if (sender == PT_NSCN || sender == PT_PSCN || sender == PT_INST) @@ -251,7 +252,7 @@ static int update(UPDATE_FUNC_ARGS) } continue; case PT_NTCT: case PT_PTCT: case PT_INWR: - if (sender==PT_METL && pavg!=PT_INSL && parts[i].life<4) + if (sender==PT_METL && pavg!=PT_INSL && pavg!=PT_RSSS && parts[i].life<4) { parts[ID(r)].temp = 473.0f; if (receiver==PT_NTCT||receiver==PT_PTCT) @@ -270,7 +271,7 @@ static int update(UPDATE_FUNC_ARGS) continue; } - if (pavg == PT_INSL) continue; //Insulation blocks everything past here + if ((pavg == PT_INSL) || (pavg == PT_RSSS)) continue; //Insulation blocks everything past here if (!((sim->elements[receiver].Properties&PROP_CONDUCTS)||receiver==PT_INST||receiver==PT_QRTZ)) continue; //Stop non-conducting receivers, allow INST and QRTZ as special cases if (abs(rx)+abs(ry)>=4 &&sender!=PT_SWCH&&receiver!=PT_SWCH) continue; //Only switch conducts really far if (receiver==sender && receiver!=PT_INST && receiver!=PT_QRTZ) goto conduct; //Everything conducts to itself, except INST. diff --git a/src/simulation/elements/SWCH.cpp b/src/simulation/elements/SWCH.cpp index c41525b28..ed8806bfe 100644 --- a/src/simulation/elements/SWCH.cpp +++ b/src/simulation/elements/SWCH.cpp @@ -65,7 +65,8 @@ static int update(UPDATE_FUNC_ARGS) auto r = pmap[y+ry][x+rx]; if (!r) continue; - if (sim->parts_avg(i,ID(r),PT_INSL)!=PT_INSL) + auto pavg = sim->parts_avg(i,ID(r),PT_INSL); + if (pavg!=PT_INSL && pavg!=PT_RSSS) { auto rt = TYP(r); if (rt==PT_SWCH) diff --git a/src/simulation/elements/TSNS.cpp b/src/simulation/elements/TSNS.cpp index 7da107e06..488638514 100644 --- a/src/simulation/elements/TSNS.cpp +++ b/src/simulation/elements/TSNS.cpp @@ -67,7 +67,8 @@ static int update(UPDATE_FUNC_ARGS) if (!r) continue; int rt = TYP(r); - if (sim->parts_avg(i, ID(r), PT_INSL) != PT_INSL) + auto pavg = sim->parts_avg(i, ID(r), PT_INSL); + if (pavg != PT_INSL && pavg != PT_RSSS) { if ((sim->elements[rt].Properties&PROP_CONDUCTS) && !(rt == PT_WATR || rt == PT_SLTW || rt == PT_NTCT || rt == PT_PTCT || rt == PT_INWR) && parts[ID(r)].life == 0) { diff --git a/src/simulation/elements/VSNS.cpp b/src/simulation/elements/VSNS.cpp index baefbe56b..ad7b32f8d 100644 --- a/src/simulation/elements/VSNS.cpp +++ b/src/simulation/elements/VSNS.cpp @@ -65,7 +65,8 @@ static int update(UPDATE_FUNC_ARGS) if (!r) continue; int rt = TYP(r); - if (sim->parts_avg(i, ID(r), PT_INSL) != PT_INSL) + auto pavg = sim->parts_avg(i, ID(r), PT_INSL); + if (pavg != PT_INSL && pavg != PT_RSSS) { if ((sim->elements[rt].Properties &PROP_CONDUCTS) && !(rt == PT_WATR || rt == PT_SLTW || rt == PT_NTCT || rt == PT_PTCT || rt == PT_INWR) && parts[ID(r)].life == 0) { diff --git a/src/simulation/elements/meson.build b/src/simulation/elements/meson.build index 05cc5792f..4f1dc9c64 100644 --- a/src/simulation/elements/meson.build +++ b/src/simulation/elements/meson.build @@ -191,6 +191,8 @@ simulation_elem_names = [ 'VSNS', 'ROCK', 'LITH', + 'RSST', + 'RSSS' ] simulation_elem_src = [] From c4db637887f84c606ca3cdbbb57f1a2285d511fc Mon Sep 17 00:00:00 2001 From: Saveliy Skresanov Date: Sun, 1 Oct 2023 21:00:53 +0700 Subject: [PATCH 06/12] 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; } From 15a22c6906c77952c0d11d48c6d03a3096647956 Mon Sep 17 00:00:00 2001 From: Saveliy Skresanov Date: Mon, 2 Oct 2023 22:41:22 +0700 Subject: [PATCH 07/12] Add ctype mechanics. --- src/simulation/elements/NEUT.cpp | 19 ++++++++++++++++++- src/simulation/elements/PHOT.cpp | 20 ++++++++++++++++++-- 2 files changed, 36 insertions(+), 3 deletions(-) diff --git a/src/simulation/elements/NEUT.cpp b/src/simulation/elements/NEUT.cpp index d367556a5..1652e4fda 100644 --- a/src/simulation/elements/NEUT.cpp +++ b/src/simulation/elements/NEUT.cpp @@ -167,8 +167,25 @@ static int update(UPDATE_FUNC_ARGS) case PT_RSSS: if(!rx && !ry) { - sim->part_change_type(ID(r), x, y, PT_RSST); + int ct_under, tmp_under; + + ct_under = parts[ID(r)].ctype; + tmp_under = parts[ID(r)].tmp; + + //If there's a correct ctype set, use it + if(ct_under > 0 && ct_under < PT_NUM) + { + sim->create_part(ID(r), x, y, ct_under); + + //If there's a correct tmp set, use it for ctype + if(tmp_under > 0 && ct_under < PT_NUM) + parts[ID(r)].ctype = tmp_under; + } + else + sim->part_change_type(ID(r), x, y, PT_RSST); + sim->kill_part(i); + return 1; } break; diff --git a/src/simulation/elements/PHOT.cpp b/src/simulation/elements/PHOT.cpp index 29a8f94bb..7fae3824d 100644 --- a/src/simulation/elements/PHOT.cpp +++ b/src/simulation/elements/PHOT.cpp @@ -107,9 +107,25 @@ static int update(UPDATE_FUNC_ARGS) parts[i].vx = vx; parts[i].vy = vy; } - else if(TYP(r) == PT_RSST && !ry && !rx)//if on RSST + else if(TYP(r) == PT_RSST && !ry && !rx)//if on RSST, make it solid { - sim->part_change_type(ID(r),x,y,PT_RSSS); + int ct_under, tmp_under; + + ct_under = parts[ID(r)].ctype; + tmp_under = parts[ID(r)].tmp; + + //If there's a correct ctype set, use it + if(ct_under > 0 && ct_under < PT_NUM) + { + sim->create_part(ID(r), x, y, ct_under); + + //If there's a correct tmp set, use it for ctype + if(tmp_under > 0 && ct_under < PT_NUM) + parts[ID(r)].ctype = tmp_under; + } + else + sim->part_change_type(ID(r), x, y, PT_RSSS); + sim->kill_part(i); return 1; From f5f275e6574f035e053d6907abac6d70374d8d21 Mon Sep 17 00:00:00 2001 From: Saveliy Skresanov Date: Mon, 9 Oct 2023 00:20:15 +0700 Subject: [PATCH 08/12] Add descriptions for RSST and RSSS. --- src/simulation/elements/RSSS.cpp | 2 +- src/simulation/elements/RSST.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/simulation/elements/RSSS.cpp b/src/simulation/elements/RSSS.cpp index a853ddd13..10c8ceaa7 100644 --- a/src/simulation/elements/RSSS.cpp +++ b/src/simulation/elements/RSSS.cpp @@ -30,7 +30,7 @@ void Element::Element_RSSS() Weight = 100; HeatConduct = 251; - Description = "Solidified resist."; + Description = "Solidified resist. Blocks pressure and insulates SPRK. Liquefies on contact with NEUT."; Properties = TYPE_SOLID|PROP_NEUTPASS; diff --git a/src/simulation/elements/RSST.cpp b/src/simulation/elements/RSST.cpp index 426197167..6640bb5e8 100644 --- a/src/simulation/elements/RSST.cpp +++ b/src/simulation/elements/RSST.cpp @@ -30,7 +30,7 @@ void Element::Element_RSST() DefaultProperties.temp = R_TEMP + 20.0f + 273.15f; HeatConduct = 44; - Description = "Resist."; + Description = "Resist. Solidifies on contact with PHOT, and reacts with other energy particles."; Properties = TYPE_LIQUID|PROP_NEUTPASS; From bc5fad1500893c403418abd1da0d61d92a5331e5 Mon Sep 17 00:00:00 2001 From: Saveliy Skresanov Date: Sun, 26 Nov 2023 20:59:51 +0700 Subject: [PATCH 09/12] Redo resist reactions. --- src/simulation/elements/GRVT.cpp | 12 +----------- src/simulation/elements/PROT.cpp | 9 ++------- src/simulation/elements/RSSS.cpp | 4 ++-- src/simulation/elements/RSST.cpp | 13 +++++++++---- src/simulation/elements/SPRK.cpp | 14 ++++++++++++++ 5 files changed, 28 insertions(+), 24 deletions(-) diff --git a/src/simulation/elements/GRVT.cpp b/src/simulation/elements/GRVT.cpp index 348f06d97..0eab88ba3 100644 --- a/src/simulation/elements/GRVT.cpp +++ b/src/simulation/elements/GRVT.cpp @@ -61,20 +61,10 @@ static int update(UPDATE_FUNC_ARGS) int under = pmap[y][x]; int utype = TYP(under); - int uID = ID(under); - if(utype == PT_RSST) + if((utype == PT_RSSS) && sim->rng.chance(1, 5)) { - sim->part_change_type(uID, x, y, PT_SWCH); sim->kill_part(i); - - return 1; - } - else if(utype == PT_RSSS) - { - sim->part_change_type(uID, x, y, PT_NSCN); - sim->kill_part(i); - return 1; } diff --git a/src/simulation/elements/PROT.cpp b/src/simulation/elements/PROT.cpp index f5a997932..2b915eec2 100644 --- a/src/simulation/elements/PROT.cpp +++ b/src/simulation/elements/PROT.cpp @@ -101,16 +101,11 @@ static int update(UPDATE_FUNC_ARGS) else change = 0.0f; parts[uID].temp = restrict_flt(parts[uID].temp + change, MIN_TEMP, MAX_TEMP); break; - case PT_RSST: - { - sim->part_change_type(uID, x, y, PT_METL); - sim->kill_part(i); - } - break; case PT_RSSS: { - sim->part_change_type(uID, x, y, PT_PSCN); + sim->kill_part(uID); sim->kill_part(i); + return 1; } break; case PT_NONE: diff --git a/src/simulation/elements/RSSS.cpp b/src/simulation/elements/RSSS.cpp index 10c8ceaa7..3dbe14502 100644 --- a/src/simulation/elements/RSSS.cpp +++ b/src/simulation/elements/RSSS.cpp @@ -29,8 +29,8 @@ void Element::Element_RSSS() Weight = 100; - HeatConduct = 251; - Description = "Solidified resist. Blocks pressure and insulates SPRK. Liquefies on contact with NEUT."; + HeatConduct = 130; + Description = "Solidified resist. Blocks pressure and insulates electricity. Liquefies on contact with neutrons."; Properties = TYPE_SOLID|PROP_NEUTPASS; diff --git a/src/simulation/elements/RSST.cpp b/src/simulation/elements/RSST.cpp index 6640bb5e8..504f642eb 100644 --- a/src/simulation/elements/RSST.cpp +++ b/src/simulation/elements/RSST.cpp @@ -26,13 +26,13 @@ void Element::Element_RSST() Meltable = 0; Hardness = 50; - Weight = 34; + Weight = 33; DefaultProperties.temp = R_TEMP + 20.0f + 273.15f; - HeatConduct = 44; - Description = "Resist. Solidifies on contact with PHOT, and reacts with other energy particles."; + HeatConduct = 55; + Description = "Resist. Solidifies on contact with photons, is destroyed by electrons and spark."; - Properties = TYPE_LIQUID|PROP_NEUTPASS; + Properties = TYPE_LIQUID|PROP_CONDUCTS|PROP_LIFE_DEC|PROP_NEUTPASS; LowPressure = IPL; LowPressureTransition = NT; @@ -63,6 +63,11 @@ int update(UPDATE_FUNC_ARGS) sim->kill_part(ID(r)); return 1; } + + if((TYP(r) == PT_CLNE) || (TYP(r) == PT_PCLN)) + { + parts[i].ctype = parts[ID(r)].ctype; + } } } diff --git a/src/simulation/elements/SPRK.cpp b/src/simulation/elements/SPRK.cpp index cc06f8aae..b1d9d41c8 100644 --- a/src/simulation/elements/SPRK.cpp +++ b/src/simulation/elements/SPRK.cpp @@ -69,6 +69,12 @@ static int update(UPDATE_FUNC_ARGS) parts[i].life = 54; else if (ct == PT_SWCH) parts[i].life = 14; + else if (ct == PT_RSST) + { + sim->kill_part(i); + return 1; + } + if (sim->part_change_type(i,x,y,ct)) return 1; return 0; @@ -357,6 +363,14 @@ static int update(UPDATE_FUNC_ARGS) sim->FloodINST(x+rx,y+ry);//spark the wire } } + else if (receiver==PT_RSST) { + if (parts[ID(r)].life==0 && parts[i].life<4) + { + sim->part_change_type(ID(r),x+rx,y+ry,PT_SPRK); + parts[ID(r)].life = 5; + parts[ID(r)].ctype = receiver; + } + } else if (parts[ID(r)].life==0 && parts[i].life<4) { parts[ID(r)].life = 4; parts[ID(r)].ctype = receiver; From 929b7ee5251f5cc6d5671626d750aba301dff28f Mon Sep 17 00:00:00 2001 From: Saveliy Skresanov Date: Sun, 31 Dec 2023 22:53:56 +0700 Subject: [PATCH 10/12] Resist and bcoal now make fuse powder. --- src/simulation/elements/RSST.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/simulation/elements/RSST.cpp b/src/simulation/elements/RSST.cpp index 504f642eb..988390546 100644 --- a/src/simulation/elements/RSST.cpp +++ b/src/simulation/elements/RSST.cpp @@ -57,6 +57,7 @@ int update(UPDATE_FUNC_ARGS) if (!r) continue; + // RSST + GUNP = FIRW if(TYP(r) == PT_GUNP) { sim->part_change_type(i, x, y, PT_FIRW); @@ -64,6 +65,16 @@ int update(UPDATE_FUNC_ARGS) return 1; } + // RSST + BCOL = FSEP + if(TYP(r) == PT_BCOL) + { + sim->part_change_type(i, x, y, PT_FSEP); + parts[i].life = 50; + sim->kill_part(ID(r)); + return 1; + } + + // Set RSST ctype from nearby clone if((TYP(r) == PT_CLNE) || (TYP(r) == PT_PCLN)) { parts[i].ctype = parts[ID(r)].ctype; From c352b08d86207bad04e39c512f7f23173ae99082 Mon Sep 17 00:00:00 2001 From: Saveliy Skresanov Date: Tue, 2 Jan 2024 18:23:19 +0700 Subject: [PATCH 11/12] More resist-related comments. --- src/simulation/elements/ELEC.cpp | 2 +- src/simulation/elements/GLOW.cpp | 2 +- src/simulation/elements/GRVT.cpp | 1 + src/simulation/elements/NEUT.cpp | 4 ++-- src/simulation/elements/PHOT.cpp | 4 ++-- src/simulation/elements/PROT.cpp | 2 +- src/simulation/elements/RSSS.cpp | 1 + src/simulation/elements/SPRK.cpp | 2 +- 8 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/simulation/elements/ELEC.cpp b/src/simulation/elements/ELEC.cpp index 9b3c10086..6390b6adf 100644 --- a/src/simulation/elements/ELEC.cpp +++ b/src/simulation/elements/ELEC.cpp @@ -115,7 +115,7 @@ static int update(UPDATE_FUNC_ARGS) parts[ID(r)].tmp2 += 5; parts[ID(r)].life = 1000; break; - case PT_RSST: + case PT_RSST: //Destroy RSST if(!rx && !ry) { sim->kill_part(ID(r)); diff --git a/src/simulation/elements/GLOW.cpp b/src/simulation/elements/GLOW.cpp index e3fbf493b..1c4f6d6dd 100644 --- a/src/simulation/elements/GLOW.cpp +++ b/src/simulation/elements/GLOW.cpp @@ -66,7 +66,7 @@ static int update(UPDATE_FUNC_ARGS) parts[ID(r)].life = 10; return 1; } - else if (TYP(r) == PT_GEL) + else if (TYP(r) == PT_GEL) //GLOW + GEL = RSST { sim->kill_part(i); sim->part_change_type(ID(r),x+rx,y+ry,PT_RSST); diff --git a/src/simulation/elements/GRVT.cpp b/src/simulation/elements/GRVT.cpp index 0eab88ba3..b6dd2a9c1 100644 --- a/src/simulation/elements/GRVT.cpp +++ b/src/simulation/elements/GRVT.cpp @@ -62,6 +62,7 @@ static int update(UPDATE_FUNC_ARGS) int under = pmap[y][x]; int utype = TYP(under); + //Randomly kill GRVT inside RSSS if((utype == PT_RSSS) && sim->rng.chance(1, 5)) { sim->kill_part(i); diff --git a/src/simulation/elements/NEUT.cpp b/src/simulation/elements/NEUT.cpp index 1652e4fda..183adecfe 100644 --- a/src/simulation/elements/NEUT.cpp +++ b/src/simulation/elements/NEUT.cpp @@ -172,7 +172,7 @@ static int update(UPDATE_FUNC_ARGS) ct_under = parts[ID(r)].ctype; tmp_under = parts[ID(r)].tmp; - //If there's a correct ctype set, use it + //If there's a correct ctype set, liquefy into it if(ct_under > 0 && ct_under < PT_NUM) { sim->create_part(ID(r), x, y, ct_under); @@ -182,7 +182,7 @@ static int update(UPDATE_FUNC_ARGS) parts[ID(r)].ctype = tmp_under; } else - sim->part_change_type(ID(r), x, y, PT_RSST); + sim->part_change_type(ID(r), x, y, PT_RSST); //Default to RSST if no ctype sim->kill_part(i); diff --git a/src/simulation/elements/PHOT.cpp b/src/simulation/elements/PHOT.cpp index 7fae3824d..2c6d0289a 100644 --- a/src/simulation/elements/PHOT.cpp +++ b/src/simulation/elements/PHOT.cpp @@ -114,7 +114,7 @@ static int update(UPDATE_FUNC_ARGS) ct_under = parts[ID(r)].ctype; tmp_under = parts[ID(r)].tmp; - //If there's a correct ctype set, use it + //If there's a correct ctype set, solidify RSST into it if(ct_under > 0 && ct_under < PT_NUM) { sim->create_part(ID(r), x, y, ct_under); @@ -124,7 +124,7 @@ static int update(UPDATE_FUNC_ARGS) parts[ID(r)].ctype = tmp_under; } else - sim->part_change_type(ID(r), x, y, PT_RSSS); + sim->part_change_type(ID(r), x, y, PT_RSSS); //Default to RSSS if no ctype sim->kill_part(i); diff --git a/src/simulation/elements/PROT.cpp b/src/simulation/elements/PROT.cpp index 2b915eec2..c161d9808 100644 --- a/src/simulation/elements/PROT.cpp +++ b/src/simulation/elements/PROT.cpp @@ -101,7 +101,7 @@ static int update(UPDATE_FUNC_ARGS) else change = 0.0f; parts[uID].temp = restrict_flt(parts[uID].temp + change, MIN_TEMP, MAX_TEMP); break; - case PT_RSSS: + case PT_RSSS: //Destroy RSSS { sim->kill_part(uID); sim->kill_part(i); diff --git a/src/simulation/elements/RSSS.cpp b/src/simulation/elements/RSSS.cpp index 3dbe14502..7ca3fd424 100644 --- a/src/simulation/elements/RSSS.cpp +++ b/src/simulation/elements/RSSS.cpp @@ -48,6 +48,7 @@ void Element::Element_RSSS() static int update(UPDATE_FUNC_ARGS) { + //Block air like TTAN sim->air->bmap_blockair[y/CELL][x/CELL] = 1; sim->air->bmap_blockairh[y/CELL][x/CELL] = 0x8; diff --git a/src/simulation/elements/SPRK.cpp b/src/simulation/elements/SPRK.cpp index b1d9d41c8..896e3f206 100644 --- a/src/simulation/elements/SPRK.cpp +++ b/src/simulation/elements/SPRK.cpp @@ -69,7 +69,7 @@ static int update(UPDATE_FUNC_ARGS) parts[i].life = 54; else if (ct == PT_SWCH) parts[i].life = 14; - else if (ct == PT_RSST) + else if (ct == PT_RSST) //RSST disappears at the end of its spark cycle { sim->kill_part(i); return 1; From c5034dd01a69a13ba860f1056bc740b3f0ec2655 Mon Sep 17 00:00:00 2001 From: Saveliy Skresanov Date: Fri, 12 Jan 2024 23:34:34 +0700 Subject: [PATCH 12/12] Fix clone producing RSST(RSST). --- src/simulation/elements/RSST.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/simulation/elements/RSST.cpp b/src/simulation/elements/RSST.cpp index 988390546..2f0c5eb90 100644 --- a/src/simulation/elements/RSST.cpp +++ b/src/simulation/elements/RSST.cpp @@ -77,7 +77,8 @@ int update(UPDATE_FUNC_ARGS) // Set RSST ctype from nearby clone if((TYP(r) == PT_CLNE) || (TYP(r) == PT_PCLN)) { - parts[i].ctype = parts[ID(r)].ctype; + if(parts[ID(r)].ctype != PT_RSST) + parts[i].ctype = parts[ID(r)].ctype; } } }