Battery Suggestion

  • cyberdragon
    2nd Jul 2013 Member 0 Permalink

    Have battery programmable with ctype. ctype none = normal mode, ctype non-conductor = off

     

    Mine already does: (C++)

     

    if(parts[i].ctype==PT_NONE)
    {
    parts[r>>8].life = 4;
    parts[r>>8].ctype = rt;
    sim->part_change_type(r>>8,x+rx,y+ry,PT_SPRK);
    }
    if((r&0xFF)==parts[i].ctype && parts[i].ctype!=PT_NONE)
    {
    parts[r>>8].life = 4;
    parts[r>>8].ctype = rt;
    sim->part_change_type(r>>8,x+rx,y+ry,PT_SPRK);
    }
    else if(!(sim->elements[parts[i].ctype].Properties&PROP_CONDUCTS)) //this works fine, it ignores none
    {
    return 0;
    }
    else
    {
    return 0;
    }

     

  • Bloodloon7
    4th Jul 2013 Member 0 Permalink

    Is that lua? If so, Im confused. may I just ask, what is c type, tmp1 and tmp 2? I think tmp1 is the element.

  • cyberdragon
    4th Jul 2013 Member 0 Permalink

    C++, I don't know anything about lua. Those are The properties you see at the top of the screen when you press D key. (except tmp 2 is not shown, only tmp1) ctype is in the () after the element name.

  • therocketeer
    4th Jul 2013 Member 2 Permalink
    Can you explain a little more please? I don't understand C++ and this is literally a slap in the face for users who are not experienced coders. its just showing off.

    I would atleast appreciate this if I understood what you were saying.
  • cyberdragon
    5th Jul 2013 Member 0 Permalink

    If you give battery a ctype of an element that battery can conduct to then it will only conduct to that ctype, no ctype = regular battery, nonconductive ctype (like dust or something) causes it to do nothing.

     

    The code is only for developers and people who compile Powder Toy themselves, but it is otherwise implemented in my mod (Mythical Mod).

  • edza101
    5th Jul 2013 Member 0 Permalink

    As a suggestion the same rules apply, unless this is something of a suggestion of a suggestion! This has been requested before. Even if this is normal, how would you change the ctype, pcln/nscn? Unless this is just to show a solution around the problem.

  • billion57
    5th Jul 2013 Member 0 Permalink

    No ctype? Is that possible, or do you mean ctype==0? But I think this needs to be thought out a bit more.

    I tried to figure out the coding using my Python knowledge, but got nowhere.

  • cyberdragon
    5th Jul 2013 Member 0 Permalink

    Yes and no, yes that would probably work the same but it's usually NONE unless you're in property editor tool.