Limit SPNG saturation, and reduce absorption rate for GEL and SPNG with some elements

This commit is contained in:
jacksonmj
2012-08-22 00:06:19 +01:00
parent 3335172888
commit 48dbf1704c
2 changed files with 13 additions and 9 deletions

View File

@@ -19,8 +19,10 @@ int update_GEL(UPDATE_FUNC_ARGS) {
int r, rx, ry;
float dx, dy;
char gel;
int absorbChanceDenom;
if (parts[i].tmp>100) parts[i].tmp = 100;
if (parts[i].tmp<0) parts[i].tmp = 0;
absorbChanceDenom = parts[i].tmp*10 + 500;
for (rx=-2; rx<3; rx++)
for (ry=-2; ry<3; ry++)
if (x+rx>=0 && y+ry>0 && x+rx<XRES && y+ry<YRES && (rx || ry))
@@ -30,17 +32,17 @@ int update_GEL(UPDATE_FUNC_ARGS) {
continue;
//Desaturation
if (((r&0xFF)==PT_WATR || (r&0xFF)==PT_DSTW || (r&0xFF)==PT_FRZW) && parts[i].tmp<100)
if (((r&0xFF)==PT_WATR || (r&0xFF)==PT_DSTW || (r&0xFF)==PT_FRZW) && parts[i].tmp<100 && 500>rand()%absorbChanceDenom)
{
parts[i].tmp++;
kill_part(r>>8);
}
if (((r&0xFF)==PT_PSTE) && parts[i].tmp<100)
if (((r&0xFF)==PT_PSTE) && parts[i].tmp<100 && 20>rand()%absorbChanceDenom)
{
parts[i].tmp++;
create_part(r>>8, x+rx, y+ry, PT_CLST);
}
if (((r&0xFF)==PT_SLTW) && parts[i].tmp<100)
if (((r&0xFF)==PT_SLTW) && parts[i].tmp<100 && 50>rand()%absorbChanceDenom)
{
parts[i].tmp++;
if (rand()%4)
@@ -48,7 +50,7 @@ int update_GEL(UPDATE_FUNC_ARGS) {
else
part_change_type(r>>8, x+rx, y+ry, PT_SALT);
}
if (((r&0xFF)==PT_CBNW) && parts[i].tmp<100)
if (((r&0xFF)==PT_CBNW) && parts[i].tmp<100 && 100>rand()%absorbChanceDenom)
{
parts[i].tmp++;
part_change_type(r>>8, x+rx, y+ry, PT_CO2);

View File

@@ -17,8 +17,10 @@
int update_SPNG(UPDATE_FUNC_ARGS) {
int r, trade, rx, ry, tmp, np;
if (pv[y/CELL][x/CELL]<=3&&pv[y/CELL][x/CELL]>=-3&&parts[i].temp<=374.0f)
int limit = 50;
if (parts[i].life<limit && pv[y/CELL][x/CELL]<=3&&pv[y/CELL][x/CELL]>=-3&&parts[i].temp<=374.0f)
{
int absorbChanceDenom = parts[i].life*1000/limit + 500;
for (rx=-1; rx<2; rx++)
for (ry=-1; ry<2; ry++)
if (x+rx>=0 && y+ry>0 && x+rx<XRES && y+ry<YRES && (rx || ry))
@@ -26,12 +28,12 @@ int update_SPNG(UPDATE_FUNC_ARGS) {
r = pmap[y+ry][x+rx];
if (!r)
continue;
if (((r&0xFF)==PT_WATR || (r&0xFF)==PT_DSTW || (r&0xFF)==PT_FRZW)&&33>=rand()/(RAND_MAX/100)+1)
if (((r&0xFF)==PT_WATR || (r&0xFF)==PT_DSTW || (r&0xFF)==PT_FRZW) && parts[i].life<limit && 500>rand()%absorbChanceDenom)
{
parts[i].life++;
kill_part(r>>8);
}
if ((r&0xFF)==PT_SLTW&&33>=rand()/(RAND_MAX/100)+1)
if ((r&0xFF)==PT_SLTW && parts[i].life<limit && 50>rand()%absorbChanceDenom)
{
parts[i].life++;
if (rand()%4)
@@ -39,12 +41,12 @@ int update_SPNG(UPDATE_FUNC_ARGS) {
else
part_change_type(r>>8, x+rx, y+ry, PT_SALT);
}
if ((r&0xFF)==PT_CBNW&&33>=rand()/(RAND_MAX/100)+1)
if ((r&0xFF)==PT_CBNW && parts[i].life<limit && 100>rand()%absorbChanceDenom)
{
parts[i].life++;
part_change_type(r>>8, x+rx, y+ry, PT_CO2);
}
if ((r&0xFF)==PT_PSTE&&33>=rand()/(RAND_MAX/100)+1)
if ((r&0xFF)==PT_PSTE && parts[i].life<limit && 20>rand()%absorbChanceDenom)
{
parts[i].life++;
create_part(r>>8, x+rx, y+ry, PT_CLST);