Fix switch not activating completely while being sparked

Check life>=10 so that activation still spreads just after the switch has
been sparked. Copy other particle's life value instead of setting to 10
to avoid spark loops.
This commit is contained in:
jacksonmj 2012-01-26 04:27:26 +08:00 committed by Simon Robertshaw
parent 24335704b5
commit 1a5cd45eb8

View File

@ -17,8 +17,11 @@ int update_SWCH(UPDATE_FUNC_ARGS) {
{ {
if (parts[i].life>=10&&parts[r>>8].life<10&&parts[r>>8].life>0) if (parts[i].life>=10&&parts[r>>8].life<10&&parts[r>>8].life>0)
parts[i].life = 9; parts[i].life = 9;
else if (parts[i].life==0&&parts[r>>8].life==10) else if (parts[i].life==0&&parts[r>>8].life>=10)
parts[i].life = 10; {
//Set to other particle's life instead of 10, otherwise spark loops form when SWCH is sparked while turning on
parts[i].life = parts[r>>8].life;
}
} }
else if (rt==PT_SPRK&&parts[i].life==10&&parts[r>>8].ctype!=PT_PSCN&&parts[r>>8].ctype!=PT_NSCN) { else if (rt==PT_SPRK&&parts[i].life==10&&parts[r>>8].ctype!=PT_PSCN&&parts[r>>8].ctype!=PT_NSCN) {
part_change_type(i,x,y,PT_SPRK); part_change_type(i,x,y,PT_SPRK);