PSTN: allow zero or negative contributions towards movement amount
Note that final movement amount < 0 means no movement, it will not reverse the movement direction. This is to keep interpretation of inputs simple - PSCN always extends, other conductors always retract.
This commit is contained in:
parent
cd71a6dff7
commit
91e871d0ea
@ -117,10 +117,7 @@ int Element_PSTN::update(UPDATE_FUNC_ARGS)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (parts[r>>8].temp>283.15)
|
pistonCount += floor((parts[r>>8].temp-268.15)/10);// How many tens of degrees above 0 C, rounded to nearest ten degrees. Can be negative.
|
||||||
pistonCount += (int)((parts[r>>8].temp-268.15)/10);// how many tens of degrees above 0 C, rounded to nearest 10
|
|
||||||
else
|
|
||||||
pistonCount++;
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
pistonEndX = x+nxx;
|
pistonEndX = x+nxx;
|
||||||
@ -154,7 +151,7 @@ int Element_PSTN::update(UPDATE_FUNC_ARGS)
|
|||||||
} else if(state == PISTON_RETRACT) {
|
} else if(state == PISTON_RETRACT) {
|
||||||
if(pistonCount > armCount)
|
if(pistonCount > armCount)
|
||||||
pistonCount = armCount;
|
pistonCount = armCount;
|
||||||
if(armCount) {
|
if(armCount && pistonCount > 0) {
|
||||||
MoveStack(sim, pistonEndX, pistonEndY, directionX, directionY, maxSize, pistonCount, true, parts[i].ctype, true);
|
MoveStack(sim, pistonEndX, pistonEndY, directionX, directionY, maxSize, pistonCount, true, parts[i].ctype, true);
|
||||||
movedPiston = true;
|
movedPiston = true;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user