From 0f583f3bd88553ea8b953f11ca649d714c7a50db Mon Sep 17 00:00:00 2001 From: jacob1 Date: Mon, 15 Dec 2014 15:52:08 -0500 Subject: [PATCH] fix PLSM spawning in fusion (allow some stacking), GRVT in O2 fusion --- src/simulation/elements/H2.cpp | 12 ++++++++---- src/simulation/elements/NBLE.cpp | 12 ++++++++---- src/simulation/elements/O2.cpp | 15 +++++++++++---- 3 files changed, 27 insertions(+), 12 deletions(-) diff --git a/src/simulation/elements/H2.cpp b/src/simulation/elements/H2.cpp index e5972effbb..bc1031e39e 100644 --- a/src/simulation/elements/H2.cpp +++ b/src/simulation/elements/H2.cpp @@ -117,11 +117,15 @@ int Element_H2::update(UPDATE_FUNC_ARGS) parts[j].temp = temp; parts[j].tmp = 0x1; } - j = sim->create_part(-1,x+rand()%3-1,y+rand()%3-1,PT_PLSM); - if (j>-1) + rx = x+rand()%3-1, ry = y+rand()%3-1, rt = pmap[ry][rx]&0xFF; + if (sim->can_move[PT_PLSM][rt] || rt == PT_H2) { - parts[j].temp = temp; - parts[j].tmp |= 4; + j = sim->create_part(-3,rx,ry,PT_PLSM); + if (j>-1) + { + parts[j].temp = temp; + parts[j].tmp |= 4; + } } parts[i].temp = temp+750+rand()%500; sim->pv[y/CELL][x/CELL] += 30; diff --git a/src/simulation/elements/NBLE.cpp b/src/simulation/elements/NBLE.cpp index a84448eeda..89b1f42b6f 100644 --- a/src/simulation/elements/NBLE.cpp +++ b/src/simulation/elements/NBLE.cpp @@ -74,11 +74,15 @@ int Element_NBLE::update(UPDATE_FUNC_ARGS) parts[j].temp = temp; parts[j].tmp = 0x1; } - j = sim->create_part(-1,x+rand()%3-1,y+rand()%3-1,PT_PLSM); - if (j != -1) + int rx = x+rand()%3-1, ry = y+rand()%3-1, rt = pmap[ry][rx]&0xFF; + if (sim->can_move[PT_PLSM][rt] || rt == PT_NBLE) { - parts[j].temp = temp; - parts[j].tmp |= 4; + j = sim->create_part(-3,rx,ry,PT_PLSM); + if (j != -1) + { + parts[j].temp = temp; + parts[j].tmp |= 4; + } } parts[i].temp = temp+1750+rand()%500; sim->pv[y/CELL][x/CELL] += 50; diff --git a/src/simulation/elements/O2.cpp b/src/simulation/elements/O2.cpp index fe41cf46f4..1d38054f67 100644 --- a/src/simulation/elements/O2.cpp +++ b/src/simulation/elements/O2.cpp @@ -92,12 +92,19 @@ int Element_O2::update(UPDATE_FUNC_ARGS) parts[j].temp = MAX_TEMP; parts[j].tmp = 0x1; } - j = sim->create_part(-1,x+rand()%3-1,y+rand()%3-1,PT_PLSM); - if (j != -1) + rx = x+rand()%3-1, ry = y+rand()%3-1, r = pmap[ry][rx]&0xFF; + if (sim->can_move[PT_PLSM][r] || r == PT_O2) { - parts[j].temp = MAX_TEMP; - parts[j].tmp |= 4; + j = sim->create_part(-3,rx,ry,PT_PLSM); + if (j > -1) + { + parts[j].temp = MAX_TEMP; + parts[j].tmp |= 4; + } } + j = sim->create_part(-3,x,y,PT_GRVT); + if (j != -1) + parts[j].temp = MAX_TEMP; parts[i].temp = MAX_TEMP; sim->pv[y/CELL][x/CELL] = 256; }