Help with moding

  • InfernoIVIVIV
    3rd Mar 2011 Member 0 Permalink
    I want to try to make some mods but the tutorial that was given in the wiki was not helpful to me. Is there anyone who can explain the process to me from start to finish?
  • Neospector
    3rd Mar 2011 Member 0 Permalink
    Download visual studios.
    Download the source
    Find powder.h
    Find the line that reads "#define PT_NUM"
    Make a new line above that.
    Write the name of your element. I.E. "#define PT_HYDR"
    Pick a color from hexidecimal coding.
    Copy that and write "PIXPACK(0x*Color code*)
    Advec: How much the particle is accelerated by moving air.

    Airdrag: How much air the particle generates in the direction of travel.

    Airloss: How much the particle slows down moving air (although this won't have as big an effect as a wall). 1 = no effect, 0 = maximum effect.

    Loss: How much velocity the particle loses each frame. 1 = no loss, .5 = half loss.

    Collid: Velocity is multiplied by this when the particle collides with something.

    Grav: How fast the particle falls. A negative number means it floats.

    Diffus: How much the particle “wiggles” around (think GAS).

    Hotair: How much the particle increases the pressure by.

    Fal: How does the particle move? 0 = solid, 1 = powder, 2 = liquid

    Burn: Does it burn? 0 = no, higher numbers = higher “burnage”.

    Exp: Does it explode? 0 = no, higher numbers = higher pressure generated.

    Mel: Does it melt? 1 = yes, 0 = no.

    Hrd: How much does acid affect it? 0 = no effect, higher numbers = higher effect.

    M: Does it show up on the menu? 1 = yes, 0 = no.

    Weight: Heavier elements sink beneath lighter ones. 1 = Gas. 2 = Light, 98 = Heavy (liquids 0-49, powder 50-99). 100 = Solid. -1 is Neutrons and Photons.

    Section: The section of the menu it is in. Prefix everything with 'SC_'.

    H: What temperature does it have when created? Temperature is in Kelvin (Kelvin = degrees C + 273.15). R_TEMP+273.15f gives room temperature.

    Ins: specific heat value (how fast it transfers heat to particles touching it), can be found by using the real life heat value in J/G K (or KJ/KG K) by 96.635/RealLifeValue. 0 - no heat transfer, 250 - maximum heat transfer speed.

    Description: A short one sentence description of the element, shown when you mouse over it in-game.

    State: What state is this element? Options are ST_NONE, ST_SOLID, ST_LIQUID, ST_GAS.

    Properties: Does this element have special properties? The properties can be found at 214. Separate each property with | inside the property variable.

    Function: This is new, and adds a huge performance increase, for now please put NULL here, we will come back to this later.

    Then find the state changes.
    IPH means "if the pressure is high"
    IPL means "if the pressure is low"
    Same for temperature. So hydrogen would be:
    {IPL, NT, IPH, NT, ITL, NT, 423.15f,PT_PLSM},

    Define any reactions in the element.c files, BOYL and hydrogen's code would be:

    #include

    int update_BOYL(UPDATE_FUNC_ARGS) {
    int r, rx, ry;
    if (pv[y/CELL][x/CELL]<(parts[i].temp/100))<br /> pv[y/CELL][x/CELL] += 0.001f*((parts[i].temp/100)-pv[y/CELL][x/CELL]);
    if (y+CELL pv[y/CELL+1][x/CELL] += 0.001f*((parts[i].temp/100)-pv[y/CELL+1][x/CELL]);
    if (x+CELL {
    pv[y/CELL][x/CELL+1] += 0.001f*((parts[i].temp/100)-pv[y/CELL][x/CELL+1]);
    if (y+CELL pv[y/CELL+1][x/CELL+1] += 0.001f*((parts[i].temp/100)-pv[y/CELL+1][x/CELL+1]);
    }
    if (y-CELL>=0 && pv[y/CELL-1][x/CELL]<(parts[i].temp/100))<br /> pv[y/CELL-1][x/CELL] += 0.001f*((parts[i].temp/100)-pv[y/CELL-1][x/CELL]);
    if (x-CELL>=0)
    {
    pv[y/CELL][x/CELL-1] += 0.001f*((parts[i].temp/100)-pv[y/CELL][x/CELL-1]);
    if (y-CELL>=0)
    pv[y/CELL-1][x/CELL-1] += 0.001f*((parts[i].temp/100)-pv[y/CELL-1][x/CELL-1]);
    }
    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_WATR && 1>rand()%30)
    {
    part_change_type(r>>8,x+rx,y+ry,PT_FOG);
    }
    else if ((r&0xFF)==PT_O2 && 1>rand()%9)
    {
    kill_part(r>>8);
    part_change_type(i,x,y,PT_WATR);
    pv[y/CELL][x/CELL] += 4.0;
    }
    }
    return 0;
    }
    Make sense?
  • InfernoIVIVIV
    3rd Mar 2011 Member 0 Permalink
    yes but how do you save/use the mod once this is done?
  • MasterMind555
    3rd Mar 2011 Member 0 Permalink
    @InfernoIVIVIV
    The little green arrow to test it
  • Finalflash50
    3rd Mar 2011 Banned 0 Permalink
    This post is hidden because the user is banned
  • InfernoIVIVIV
    3rd Mar 2011 Member 0 Permalink
    Thank you everyone.