How to fix temperature glitch -nan(ind)?

  • BrianTheEngineer
    16th Sep 2019 Member 0 Permalink

    I was searching through the script manager when suddenly I found a script called Pure Energy. I decided to test it out on some wood and put a few pixels near it. It was too powerful so I put only one pixel. It spawned a PHOT that touched the wood. For some reason, the wood turns blue and its temperature said -nan(ind). What does this mean? How can I fix it?

  • DanielGalrito
    17th Sep 2019 Member 0 Permalink

    Replacing  " tpt.set_property("temp", math.huge, x, y) " with "  tpt.set_property("temp", 100000, x, y) " should fix it, as the problem seems to be the math.huge.

    No idea why this happens.

  • jacob1
    17th Sep 2019 Developer 0 Permalink
    That's definitely a bug in the script. I wonder if the author knew about it.

    math.huge is infinity, you can't set temperature to infinity unless you want the game to really glitch out.
  • BrianTheEngineer
    17th Sep 2019 Member 0 Permalink

    @DanielGalrito (View Post)

     

    Is there a way to set the temperature to 9725.85C? The code tpt.set_property("temp", 100000, x, y) fixed the glitch but the SING, NEUT, PHOT, and PROT now spawn at normal temperature and the mod is called Pure Energy so is there a way to set the temperature of the things that spawn to higher values? Thanks in advance.

  • DanielGalrito
    17th Sep 2019 Member 0 Permalink

    These particles are coded to spawn at normal temperature, but if you still want them to spawn hotter

    replace from lines 6 to 12 with

     

    local ri = -1
    if math.random(1,3) == 1 then
    ri = tpt.create(x + math.random(-1,1), y + math.random(-1,1), 'phot')
    elseif math.random(1,3) == 2 then
    ri = tpt.create(x + math.random(-1,1), y + math.random(-1,1), 'neut')
    elseif math.random(1,3) == 3 then
    ri = tpt.create(x + math.random(-1,1), y + math.random(-1,1), 'elec')
    end
    if ri > -1 then
    tpt.set_property("temp", 100000, ri)
    end

    Edited 2 times by DanielGalrito. Last: 17th Sep 2019
  • BrianTheEngineer
    18th Sep 2019 Member 0 Permalink

    @DanielGalrito (View Post)

     

    Thanks a lot