diff --git a/src/simulation/elements/PIPE.cpp b/src/simulation/elements/PIPE.cpp index 455ff8e77..95f7c0834 100644 --- a/src/simulation/elements/PIPE.cpp +++ b/src/simulation/elements/PIPE.cpp @@ -170,6 +170,7 @@ int Element_PIPE_update(UPDATE_FUNC_ARGS) int lastneighbor = -1; int neighborcount = 0; int count = 0; + bool heatPipe = false; // make automatic pipe pattern for (auto rx = -1; rx <= 1; rx++) { @@ -181,6 +182,11 @@ int Element_PIPE_update(UPDATE_FUNC_ARGS) auto r = pmap[y+ry][x+rx]; if (!r) continue; + if (TYP(r) == PT_HEAC) + { + heatPipe = true; + continue; + } if (TYP(r) != PT_PIPE && TYP(r) != PT_PPIP) continue; unsigned int next = nextColor(parts[i].tmp); @@ -213,6 +219,8 @@ int Element_PIPE_update(UPDATE_FUNC_ARGS) } if (neighborcount == 1) parts[lastneighbor].tmp |= 0x100; + if (heatPipe) + Element_PPIP_flood_trigger(sim, x, y, PT_HEAC); } else { diff --git a/src/simulation/elements/PPIP.cpp b/src/simulation/elements/PPIP.cpp index 7778b09b1..f42441ecb 100644 --- a/src/simulation/elements/PPIP.cpp +++ b/src/simulation/elements/PPIP.cpp @@ -72,6 +72,9 @@ void Element_PPIP_flood_trigger(Simulation * sim, int x, int y, int sparkedBy) Particle * parts = sim->parts; int (*pmap)[XRES] = sim->pmap; + int t = TYP(pmap[y][x]); + if (t != PT_PIPE && t != PT_PPIP) + return; // Separate flags for on and off in case PPIP is sparked by PSCN and NSCN on the same frame // - then PSCN can override NSCN and behaviour is not dependent on particle order @@ -79,8 +82,9 @@ void Element_PPIP_flood_trigger(Simulation * sim, int x, int y, int sparkedBy) if (sparkedBy==PT_PSCN) prop = PPIP_TMPFLAG_TRIGGER_ON << 3; else if (sparkedBy==PT_NSCN) prop = PPIP_TMPFLAG_TRIGGER_OFF << 3; else if (sparkedBy==PT_INST) prop = PPIP_TMPFLAG_TRIGGER_REVERSE << 3; + else if (sparkedBy == PT_HEAC) prop = PFLAG_CAN_CONDUCT; // Special case for HEAC near pipe - if (prop==0 || TYP(pmap[y][x])!=PT_PPIP || (parts[ID(pmap[y][x])].tmp & prop)) + if (prop == 0 || (t != PT_PPIP && sparkedBy != PT_HEAC) || (parts[ID(pmap[y][x])].tmp & prop)) return; coord_stack = new unsigned short[coord_stack_limit][2]; @@ -97,7 +101,7 @@ void Element_PPIP_flood_trigger(Simulation * sim, int x, int y, int sparkedBy) // go left as far as possible while (x1>=CELL) { - if (TYP(pmap[y][x1-1]) != PT_PPIP) + if (TYP(pmap[y][x1-1]) != t) { break; } @@ -106,7 +110,7 @@ void Element_PPIP_flood_trigger(Simulation * sim, int x, int y, int sparkedBy) // go right as far as possible while (x2=CELL+1) for (x=x1-1; x<=x2+1; x++) - if (TYP(pmap[y-1][x]) == PT_PPIP && !(parts[ID(pmap[y-1][x])].tmp & prop)) + if (TYP(pmap[y-1][x]) == t && !(parts[ID(pmap[y-1][x])].tmp & prop)) { coord_stack[coord_stack_size][0] = x; coord_stack[coord_stack_size][1] = y-1; @@ -138,7 +142,7 @@ void Element_PPIP_flood_trigger(Simulation * sim, int x, int y, int sparkedBy) } if (y