Coding TPT

  • greymatter
    28th Jun 2013 Member 1 Permalink
    @cyberdragon (View Post)
    I had that, Just didn't copy.
    Now this is what the code looks like:

    //#TPT-Directive ElementHeader Element_HTER static int update(UPDATE_FUNC_ARGS)
    int Element_HTER::update(UPDATE_FUNC_ARGS) {
    int r,rx,ry;
    for (rx=-2; rx<3; rx++){<br/> for (ry=-2; ry<3; ry++){<br/> if (BOUNDS_CHECK)
    {
    r=pmap[x+rx][y+ry];
    if(!r)
    continue;
    if((r&0xFF)!=PT_HTER && parts[r>>8].temp * 2.2f < MAX_TEMP){

    parts[r>>8].temp *= 2.2f;

    }
    else {parts[r>>8].temp = MAX_TEMP;}
    }}}
    return 0;
    }

    Element_HTER::~Element_HTER() {}

    It still doesn't work.
    The full code is here, if it helps: http://chopapp.com/#ip8ehymd

    Also, how do i change the starting text?
  • xetalim
    28th Jun 2013 Member 1 Permalink

    @greymatter (View Post)

     starting text?

    what do you mean?

  • jacob1
    28th Jun 2013 Developer 1 Permalink
    @greymatter (View Post)
    Try using my code instead, the problem was that you did pmap[x+rx][y+ry] instead of pmap[y+ry][x+rx], and also it was activated on empty particles

    Also it's in IntroText.h. I'm not sure where that file is, look in places like src/client/ or src/gui/game/
  • greymatter
    28th Jun 2013 Member 1 Permalink
    @jacob1 (View Post)
    Wow, that was quick.
    Works like a charm. Thank you.

    Now more questions: How to change the name of the menus? I'm also making lithium, as a rechargable battery. I ran into a few issues, but i will try to fix them myself before posting it here.
  • xetalim
    28th Jun 2013 Member 1 Permalink
    @greymatter (View Post)
    change the name of the element menus?
    simulationdata(in /src/simulation
    line 143
    @jacob1 (View Post)
    it is in SOURCE/data
  • greymatter
    28th Jun 2013 Member 1 Permalink
    @xetalim (View Post)
    I can see it in the soution explorer of VC++, so the location doesn't matter, just the file name is enough.
    And the element menus names are not in there...
  • xetalim
    28th Jun 2013 Member 1 Permalink

    @greymatter (View Post)

     they are in.

    here

    this code

        menu_section msections[] = //doshow does not do anything currently.
        {
            {"\xC1", "Walls", 0, 1},
            {"\xC2", "Electronics", 0, 1},
            {"\xD6", "Powered Materials", 0, 1},
            {"\x99", "Sensors", 0, 1},
            {"\xE2", "Force", 0, 1},
            {"\xC3", "Explosives", 0, 1},
            {"\xC5", "Gasses", 0, 1},
            {"\xC4", "Liquids", 0, 1},
            {"\xD0", "Powders", 0, 1},
            {"\xD1", "Solids", 0, 1},
            {"\xC6", "Radioactive", 0, 1},
            {"\xCC", "Special", 0, 1},
            {"\xD2", "Game Of Life", 0, 1},
            {"\xD7", "Tools", 0, 1},
            {"\xE4", "Decoration tools", 0, 1},
            {"\xC8", "Cracker", 0, 0},
            {"\xC8", "Cracker!", 0, 0},
        };

  • greymatter
    29th Jun 2013 Member 1 Permalink
    @xetalim (View Post)
    Oh looks like i was looking in the wrong file. Thanks!

    A problem with LTHM:
    It's not completely done,but it isn't sparking NSCN although it drains the tmp. So it's entering the if block, but not sparking the NSCN.
    //#TPT-Directive ElementHeader Element_LTHM static int update(UPDATE_FUNC_ARGS)
    int Element_LTHM::update(UPDATE_FUNC_ARGS)
    {
    int r,rx,ry;
    for(rx=-1;rx<2;rx++){<br/> for(ry=-1;ry<2;ry++){<br/> if(BOUNDS_CHECK)
    {
    r=pmap[y+ry][x+rx];
    if(!r)
    continue;
    if((r&0xFF)==PT_SPRK && parts[r>>8].ctype==PT_PSCN)
    {
    parts[i].tmp++;
    }
    if((r&0xFF)==PT_NSCN && parts[i].tmp > 0)
    {
    parts[i].tmp--;
    parts[r>>8].ctype==PT_NSCN;
    (r&0xFF)==PT_SPRK;
    }
    }}}return 0;
    }
    Element_LTHM::~Element_LTHM() {}
  • jacob1
    29th Jun 2013 Developer 1 Permalink
    @greymatter (View Post)
    (r&0xFF) is sort of read only, you can't change it and make the element change type. You will have to do this:

    parts[r>>8].type = PT_SPRK;
    parts[r>>8].ctype = PT_NSCN;
    parts[r>>8].life = 4;

    Also I noticed you use == to assign the values instead of =, that won't work. == is only for comparison, - is for assigning
  • greymatter
    29th Jun 2013 Member 1 Permalink
    @jacob1 (View Post)
    I edited a few things after posting this, like the == sign, but it still wouldn't work. I'll try with your changes. Also, can you find out the spam upvoter?

    EDIT: It works. Thanks!
    Now, only the 1 pixel directly in contact with the SPRK(PSCN) gets it's tmp to go up. To make the tmp of all adjacent LTHM particles to up too, i tried this, but failed. How to solve this problem?

    if((r&0xFF)==PT_LTHM && parts[r>>8].tmp < parts[i].tmp)
    {
    parts[r>>8].tmp = parts[i].tmp;
    }