SWCH bug - state not saved, doesn't light up properly

  • bchandark
    30th Aug 2010 Member 0 Permalink
    If I light up a block of SWCH and save, when I reload, it's not lit up. When I try to light it up, the bright green doesn't extend to the entire switch block - only some.

    Can this be fixed?
  • TheEyes
    30th Aug 2010 Banned 0 Permalink
    This post is hidden because the user is banned
  • Aizria
    30th Aug 2010 Member 0 Permalink
    I have similar problems with switch. I have tried to use it before as a highly heat-resistant conductor, but this problem always gets in the way of such creations.
  • SerGreen
    30th Aug 2010 Member 0 Permalink
    Me too
    Just today discovered this when doing synchronizers. After reloading the simulation need to change all the switches
  • jacksonmj
    30th Aug 2010 Developer 0 Permalink
    This seems to be due to life values being saved as [saved value] = (life+3)/4 and loaded by life = [saved value]*4 .
    A life of 10 is used to indicate the SWCH is turned on. The saving and loading process turns this into a life of 12, which causes the SWCH to behave as if turned off, but be unable to turn on.

    (Some parts of the SWCH close to PSCN or NSCN may still work, since these materials overwrite the life value of nearby SWCH particles to turn it on/off)

    Occurs in stable and beta versions.

    Possible fix:
    Replace this line (line 1336 in 2010-09-18 git version):
    if((parts[i].life>0&&parts[i].life<10)|| parts[i].life == 11)

    with:
    if(parts[i].life>0&&parts[i].life!=10)
  • kamikai
    30th Aug 2010 Member 0 Permalink
    I think i have heard that before...
    Have you said that in an older post?
  • jacksonmj
    30th Aug 2010 Developer 0 Permalink
    kamikai
    Yes. In the Development forum - however according to https://powdertoy.co.uk/Forum.html?action=vthread&forum=2&topic=820 (which I had not noticed at the time) bug reports should go in Suggestions instead.

    This time I've also posted a possible fix.