improvement of anti-matter

  • MaksimProgr
    11th Feb 2011 Member 0 Permalink
    I improve element anti-matter (realized it was just awful). This code should replace the contents of file "amtr.c" in directory src/elements/.
    Then need to recompile "The Powder toy".
    code:

    #include < element.h >



    int update_AMTR(UPDATE_FUNC_ARGS) {

    int r, rx, ry;

    for (rx=-1; rx<2; rx++)<br />
    for (ry=-1; ry<2; ry++)<br />
    if (x+rx>=0 && y+ry>0 && x+rx
    {

    r = pmap[y+ry][x+rx];

    if ((r>>8)>=NPART || !r)

    continue;

    if ((r&0xFF)!=PT_AMTR && (r&0xFF)!=PT_DMND && (r&0xFF)!=PT_CLNE && (r&0xFF)!=PT_PCLN && (r&0xFF)!=PT_NONE && (r&0xFF)!=PT_PHOT && (r&0xFF)!=PT_VOID && (r&0xFF)!=PT_BHOL && (r&0xFF)!=PT_PRTI && (r&0xFF)!=PT_PRTO)

    {

    create_part(i, x, y, PT_PHOT);

    parts[i].temp = MAX_TEMP;

    create_part(r>>8, x+rx, y+ry, PT_PHOT);

    parts[r>>8].temp = MAX_TEMP;

    pv[y/CELL][x/CELL] -= 5.0f;

    return 1;

    }

    }

    return 0;

    }
  • cracker64
    11th Feb 2011 Developer 0 Permalink
    thats hardly any different, creating more photons will only lag.
  • MaksimProgr
    11th Feb 2011 Member 0 Permalink
    but very little photons is non realistic. in my version photons have max temperature (stands for the annihilation of a lot of energy, it can not be simulated). My version would create, for example, antimatter engine.
  • Diissaster
    11th Feb 2011 Member 0 Permalink
    Please Pastebin Code.
  • Xenocide
    11th Feb 2011 Former Staff 0 Permalink
    @MaksimProgr
    There was a good reason I only coded it to release a handful of photons. :) You've also reduced its destructive ness by only allowing it to eat one particle before dying.
  • dnerd
    11th Feb 2011 Member 0 Permalink
    @MaksimProgr
    thank you so much, i have been campaigning for this FOREVER i just decided to try and code it myself, but you did it first, THANKK YOUUU!!!