More Realistic DMND

  • keperitan
    31st Dec 2011 Member 3 Permalink
    math.randomseed(os.time())
    function test_update(i, x, y, s, n)

    bump = tpt.get_property("type",x+math.random(-1,1),y+math.random(-1,1))
    foom = tpt.get_property("temp",x+math.random(-1,1),y+math.random(-1,1))
    lava = tpt.el.lava.id
    dmnd = tpt.el.dmnd.id
    oxyg = tpt.el.oxyg.id
    co2 = tpt.el.co2.id
    stkm = tpt.el.stkm.id
    stk2 = tpt.el.stk2.id
    yomama = fat

    if bump == oxyg and foom >= 800 and yomama == fat then
    tpt.delete(i)
    tpt.create(x+math.random(-2,2),y+math.random(-2,2),co2)
    tpt.set_property("temp", 1200, co2)
    end

    if foom >= 3000 and yomama == fat then
    tpt.delete(i)
    tpt.create(x,y,lava)
    tpt.set_property("ctype", dmnd, lava)
    end

    if bump == stkm or bump == tpt.el.stk2 and yomama == fat then
    tpt.set_property("life", 50, stkm)
    tpt.set_property("life", 150, stk2)
    tpt.set_property("vy", 4, stkm)
    tpt.set_property("vy", -4, stk2)
    tpt.set_property("vx", -4, stkm)
    end

    end
    tpt.element_func(test_update, tpt.el.dmnd.id)

    Save the above as autorun.lua. This shows how diamond should behave in real life. However, I can't understand why it lags my computer whenever I melt the diamond all in one go. Someone help?

    EDIT: Fixed. Thanks to whoever it was that pointed out that you could set an element as a variable. But now it melts to plain lava.

    EDIT2: Fixed that, now it's a compromise by taking away the line  'tpt.set_property("ctype", foom, lava)'. Slightly slower but at least no plain lava. Honestly I don't know what makes tpt.set_property so slow.
  • airstrike52
    31st Dec 2011 Member 0 Permalink

    keperitan:

    yomama = fat

    Troll much?
  • keperitan
    31st Dec 2011 Member 4 Permalink
    @airstrike52 (View Post)
    It has got to be true, otherwise the script wouldn't work.
  • evsey
    21st Sep 2013 Member 0 Permalink

    keperitan:

    yomama = fat
    wat
  • Nobody905
    25th Sep 2013 Member 0 Permalink

    @keperitan (View Post)

     Well, lol.

     

    Here's a little code

     

    void yomama();

    {

     int fat = yomama.size;

     int iseating = 1;

      while (iseating == 1)

      {

       fat++

       }

     }

  • FeynmanLogomaker
    25th Sep 2013 Member 0 Permalink

    You know, the variable 'fat' was never defined, so this code would run even if yomama was nil.