Merge branch 'master' of github.com:FacialTurd/The-Powder-Toy
This commit is contained in:
commit
b4564f212a
@ -1141,6 +1141,13 @@ void LuaScriptInterface::initElementsAPI()
|
||||
{
|
||||
lua_pushinteger(l, i);
|
||||
lua_setfield(l, elementsAPI, luacon_sim->elements[i].Identifier);
|
||||
char realIdentifier[20];
|
||||
sprintf(realIdentifier, "DEFAULT_PT_%s", luacon_sim->elements[i].Name);
|
||||
if (i != 0 && i != PT_NBHL && i != PT_NWHL && strcmp(luacon_sim->elements[i].Identifier, realIdentifier))
|
||||
{
|
||||
lua_pushinteger(l, i);
|
||||
lua_setfield(l, elementsAPI, realIdentifier);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3016,7 +3016,7 @@ int Simulation::create_part(int p, int x, int y, int tv)
|
||||
case PT_PLSM:
|
||||
parts[i].life = rand()%150+50;
|
||||
break;
|
||||
case PT_HFLM:
|
||||
case PT_CFLM:
|
||||
parts[i].life = rand()%150+50;
|
||||
break;
|
||||
case PT_LAVA:
|
||||
@ -3678,7 +3678,7 @@ void Simulation::update_particles_i(int start, int inc)
|
||||
(bmap[y/CELL][x/CELL]==WL_DESTROYALL) ||
|
||||
(bmap[y/CELL][x/CELL]==WL_ALLOWLIQUID && elements[t].Falldown!=2) ||
|
||||
(bmap[y/CELL][x/CELL]==WL_ALLOWSOLID && elements[t].Falldown!=1) ||
|
||||
(bmap[y/CELL][x/CELL]==WL_ALLOWGAS && !(elements[t].Properties&TYPE_GAS)) || //&& elements[t].Falldown!=0 && parts[i].type!=PT_FIRE && parts[i].type!=PT_SMKE && parts[i].type!=PT_HFLM) ||
|
||||
(bmap[y/CELL][x/CELL]==WL_ALLOWGAS && !(elements[t].Properties&TYPE_GAS)) || //&& elements[t].Falldown!=0 && parts[i].type!=PT_FIRE && parts[i].type!=PT_SMKE && parts[i].type!=PT_CFLM) ||
|
||||
(bmap[y/CELL][x/CELL]==WL_ALLOWENERGY && !(elements[t].Properties&TYPE_ENERGY)) ||
|
||||
(bmap[y/CELL][x/CELL]==WL_DETECT && (t==PT_METL || t==PT_SPRK)) ||
|
||||
(bmap[y/CELL][x/CELL]==WL_EWALL && !emap[y/CELL][x/CELL])) && (t!=PT_STKM) && (t!=PT_STKM2) && (t!=PT_FIGH)))
|
||||
@ -4038,7 +4038,7 @@ void Simulation::update_particles_i(int start, int inc)
|
||||
if (elements[t].State==ST_GAS&&elements[parts[i].type].State!=ST_GAS)
|
||||
pv[y/CELL][x/CELL] += 0.50f;
|
||||
part_change_type(i,x,y,t);
|
||||
if (t==PT_FIRE||t==PT_PLSM||t==PT_HFLM)
|
||||
if (t==PT_FIRE||t==PT_PLSM||t==PT_CFLM)
|
||||
parts[i].life = rand()%50+120;
|
||||
if (t==PT_LAVA) {
|
||||
if (parts[i].ctype==PT_BRMT) parts[i].ctype = PT_BMTL;
|
||||
|
@ -53,16 +53,16 @@ int Element_ANAR::update(UPDATE_FUNC_ARGS)
|
||||
|
||||
//if (parts[i].temp >= 0.23)
|
||||
// parts[i].temp --;
|
||||
for (rx=-2; rx<3; rx++)
|
||||
for (ry=-2; ry<3; ry++)
|
||||
for (rx=-1; rx<2; rx++)
|
||||
for (ry=-1; ry<2; ry++)
|
||||
if (BOUNDS_CHECK && (rx || ry))
|
||||
{
|
||||
r = pmap[y+ry][x+rx];
|
||||
if (!r)
|
||||
continue;
|
||||
if ((r&0xFF)==PT_HFLM && !(rand()%22))
|
||||
if ((r&0xFF)==PT_CFLM && !(rand()%7))
|
||||
{
|
||||
sim->part_change_type(i,x,y,PT_HFLM);
|
||||
sim->part_change_type(i,x,y,PT_CFLM);
|
||||
parts[i].life = rand()%150+50;
|
||||
parts[r>>8].temp = parts[i].temp = 0;
|
||||
sim->pv[y/CELL][x/CELL] -= 0.5;
|
||||
|
@ -57,29 +57,6 @@ int Element_BCOL::update(UPDATE_FUNC_ARGS)
|
||||
parts[i].life--;
|
||||
sim->create_part(-1, x+rand()%3-1, y+rand()%3-1, PT_FIRE);
|
||||
}
|
||||
|
||||
for (rx=-2; rx<3; rx++)
|
||||
for (ry=-2; ry<3; ry++)
|
||||
if (BOUNDS_CHECK && (rx || ry))
|
||||
{
|
||||
r = pmap[y+ry][x+rx];
|
||||
if (!r)
|
||||
continue;
|
||||
if (((r&0xFF)==PT_FIRE || (r&0xFF)==PT_PLSM))
|
||||
{
|
||||
if (parts[i].life>100 && !(rand()%500)) {
|
||||
parts[i].life = 99;
|
||||
}
|
||||
}
|
||||
else if ((r&0xFF)==PT_LAVA)
|
||||
{
|
||||
if (parts[r>>8].ctype == PT_IRON && !(rand()%500)) {
|
||||
parts[r>>8].ctype = PT_METL;
|
||||
sim->kill_part(i);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
/*if(100-parts[i].life > parts[i].tmp2)
|
||||
parts[i].tmp2 = 100-parts[i].life;
|
||||
if(parts[i].tmp2 < 0) parts[i].tmp2 = 0;
|
||||
|
@ -51,8 +51,8 @@ int Element_BOMB::update(UPDATE_FUNC_ARGS)
|
||||
{
|
||||
int r, rx, ry, nb;
|
||||
|
||||
for (rx=-2; rx<3; rx++)
|
||||
for (ry=-2; ry<3; ry++)
|
||||
for (rx=-1; rx<2; rx++)
|
||||
for (ry=-1; ry<2; ry++)
|
||||
if (BOUNDS_CHECK && (rx || ry))
|
||||
{
|
||||
r = pmap[y+ry][x+rx];
|
||||
|
@ -57,11 +57,11 @@ int Element_C5::update(UPDATE_FUNC_ARGS)
|
||||
r = pmap[y+ry][x+rx];
|
||||
if (!r)
|
||||
continue;
|
||||
if (((r&0xFF)!=PT_C5 && parts[r>>8].temp<100 && sim->elements[r&0xFF].HeatConduct && ((r&0xFF)!=PT_HSWC||parts[r>>8].life==10)) || (r&0xFF)==PT_HFLM)
|
||||
if (((r&0xFF)!=PT_C5 && parts[r>>8].temp<100 && sim->elements[r&0xFF].HeatConduct && ((r&0xFF)!=PT_HSWC||parts[r>>8].life==10)) || (r&0xFF)==PT_CFLM)
|
||||
{
|
||||
if (!(rand()%6))
|
||||
{
|
||||
sim->part_change_type(i,x,y,PT_HFLM);
|
||||
sim->part_change_type(i,x,y,PT_CFLM);
|
||||
parts[r>>8].temp = parts[i].temp = 0;
|
||||
parts[i].life = rand()%150+50;
|
||||
sim->pv[y/CELL][x/CELL] += 1.5;
|
||||
|
@ -84,19 +84,19 @@ int Element_CBNW::update(UPDATE_FUNC_ARGS)
|
||||
}
|
||||
parts[i].tmp--;
|
||||
}
|
||||
for (rx=-2; rx<3; rx++)
|
||||
for (ry=-2; ry<3; ry++)
|
||||
for (rx=-1; rx<2; rx++)
|
||||
for (ry=-1; ry<2; ry++)
|
||||
if (BOUNDS_CHECK && (rx || ry))
|
||||
{
|
||||
r = pmap[y+ry][x+rx];
|
||||
if (!r)
|
||||
continue;
|
||||
if ((sim->elements[r&0xFF].Properties&TYPE_PART) && parts[i].tmp == 0 && !(rand()%250))
|
||||
if ((sim->elements[r&0xFF].Properties&TYPE_PART) && parts[i].tmp == 0 && !(rand()%83))
|
||||
{
|
||||
//Start explode
|
||||
parts[i].tmp = rand()%25;//(rand()%100)+50;
|
||||
}
|
||||
else if((sim->elements[r&0xFF].Properties&TYPE_SOLID) && (r&0xFF)!=PT_DMND && (r&0xFF)!=PT_GLAS && parts[i].tmp == 0 && (2-sim->pv[y/CELL][x/CELL])>(rand()%40000))
|
||||
else if((sim->elements[r&0xFF].Properties&TYPE_SOLID) && (r&0xFF)!=PT_DMND && (r&0xFF)!=PT_GLAS && parts[i].tmp == 0 && (2-sim->pv[y/CELL][x/CELL])>(rand()%13333))
|
||||
{
|
||||
sim->part_change_type(i,x,y,PT_CO2);
|
||||
parts[i].ctype = 5;
|
||||
@ -122,7 +122,7 @@ int Element_CBNW::update(UPDATE_FUNC_ARGS)
|
||||
}
|
||||
else if ((r&0xFF)==PT_RBDM||(r&0xFF)==PT_LRBD)
|
||||
{
|
||||
if ((sim->legacy_enable||parts[i].temp>(273.15f+12.0f)) && !(rand()%500))
|
||||
if ((sim->legacy_enable||parts[i].temp>(273.15f+12.0f)) && !(rand()%166))
|
||||
{
|
||||
sim->part_change_type(i,x,y,PT_FIRE);
|
||||
parts[i].life = 4;
|
||||
@ -131,7 +131,7 @@ int Element_CBNW::update(UPDATE_FUNC_ARGS)
|
||||
}
|
||||
else if ((r&0xFF)==PT_FIRE && parts[r>>8].ctype!=PT_WATR){
|
||||
sim->kill_part(r>>8);
|
||||
if(1>(rand()%150)){
|
||||
if(1>(rand()%50)){
|
||||
sim->kill_part(i);
|
||||
return 1;
|
||||
}
|
||||
|
@ -4,8 +4,8 @@ extern "C"
|
||||
#include "hmap.h"
|
||||
}
|
||||
|
||||
//#TPT-Directive ElementClass Element_HFLM PT_HFLM 68
|
||||
Element_HFLM::Element_HFLM()
|
||||
//#TPT-Directive ElementClass Element_CFLM PT_CFLM 68
|
||||
Element_CFLM::Element_CFLM()
|
||||
{
|
||||
Identifier = "DEFAULT_PT_HFLM";
|
||||
Name = "CFLM";
|
||||
@ -48,11 +48,11 @@ Element_HFLM::Element_HFLM()
|
||||
HighTemperatureTransition = NT;
|
||||
|
||||
Update = NULL;
|
||||
Graphics = &Element_HFLM::graphics;
|
||||
Graphics = &Element_CFLM::graphics;
|
||||
}
|
||||
|
||||
//#TPT-Directive ElementHeader Element_HFLM static int graphics(GRAPHICS_FUNC_ARGS)
|
||||
int Element_HFLM::graphics(GRAPHICS_FUNC_ARGS)
|
||||
//#TPT-Directive ElementHeader Element_CFLM static int graphics(GRAPHICS_FUNC_ARGS)
|
||||
int Element_CFLM::graphics(GRAPHICS_FUNC_ARGS)
|
||||
|
||||
{
|
||||
int caddress = restrict_flt(restrict_flt((float)((int)(cpart->life/2)), 0.0f, 200.0f)*3, 0.0f, (200.0f*3)-3);
|
||||
@ -72,4 +72,4 @@ int Element_HFLM::graphics(GRAPHICS_FUNC_ARGS)
|
||||
}
|
||||
|
||||
|
||||
Element_HFLM::~Element_HFLM() {}
|
||||
Element_CFLM::~Element_CFLM() {}
|
@ -50,14 +50,14 @@ Element_CO2::Element_CO2()
|
||||
int Element_CO2::update(UPDATE_FUNC_ARGS)
|
||||
{
|
||||
int r, rx, ry;
|
||||
for (rx=-2; rx<3; rx++)
|
||||
for (ry=-2; ry<3; ry++)
|
||||
for (rx=-1; rx<2; rx++)
|
||||
for (ry=-1; ry<2; ry++)
|
||||
if (BOUNDS_CHECK && (rx || ry))
|
||||
{
|
||||
r = pmap[y+ry][x+rx];
|
||||
if (!r)
|
||||
{
|
||||
if (parts[i].ctype==5 && !(rand()%83))
|
||||
if (parts[i].ctype==5 && !(rand()%27))
|
||||
{
|
||||
if (sim->create_part(-1, x+rx, y+ry, PT_WATR)>=0)
|
||||
parts[i].ctype = 0;
|
||||
@ -66,12 +66,12 @@ int Element_CO2::update(UPDATE_FUNC_ARGS)
|
||||
}
|
||||
if ((r&0xFF)==PT_FIRE){
|
||||
sim->kill_part(r>>8);
|
||||
if(!(rand()%150)){
|
||||
if(!(rand()%50)){
|
||||
sim->kill_part(i);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
else if (((r&0xFF)==PT_WATR || (r&0xFF)==PT_DSTW) && !(rand()%250))
|
||||
else if (((r&0xFF)==PT_WATR || (r&0xFF)==PT_DSTW) && !(rand()%83))
|
||||
{
|
||||
sim->part_change_type(r>>8, x+rx, y+ry, PT_CBNW);
|
||||
if (parts[i].ctype==5) //conserve number of water particles - ctype=5 means this CO2 hasn't released the water particle from BUBW yet
|
||||
|
@ -65,28 +65,6 @@ int Element_COAL::update(UPDATE_FUNC_ARGS)
|
||||
sim->create_part(i, x, y, PT_BCOL);
|
||||
return 1;
|
||||
}
|
||||
for (rx=-2; rx<3; rx++)
|
||||
for (ry=-2; ry<3; ry++)
|
||||
if (BOUNDS_CHECK && (rx || ry))
|
||||
{
|
||||
r = pmap[y+ry][x+rx];
|
||||
if (!r)
|
||||
continue;
|
||||
if (((r&0xFF)==PT_FIRE || (r&0xFF)==PT_PLSM))
|
||||
{
|
||||
if (parts[i].life>100 && !(rand()%500)) {
|
||||
parts[i].life = 99;
|
||||
}
|
||||
}
|
||||
else if ((r&0xFF)==PT_LAVA)
|
||||
{
|
||||
if (parts[r>>8].ctype == PT_IRON && !(rand()%500)) {
|
||||
parts[r>>8].ctype = PT_METL;
|
||||
sim->kill_part(i);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
/*if(100-parts[i].life > parts[i].tmp2)
|
||||
parts[i].tmp2 = 100-parts[i].life;
|
||||
if(parts[i].tmp2 < 0) parts[i].tmp2 = 0;
|
||||
|
@ -53,8 +53,8 @@ int Element_DMG::update(UPDATE_FUNC_ARGS)
|
||||
int rad = 25;
|
||||
float angle, fx, fy;
|
||||
|
||||
for (rx=-2; rx<3; rx++)
|
||||
for (ry=-2; ry<3; ry++)
|
||||
for (rx=-1; rx<2; rx++)
|
||||
for (ry=-1; ry<2; ry++)
|
||||
if (BOUNDS_CHECK && (rx || ry))
|
||||
{
|
||||
r = pmap[y+ry][x+rx];
|
||||
|
@ -50,15 +50,15 @@ Element_DSTW::Element_DSTW()
|
||||
int Element_DSTW::update(UPDATE_FUNC_ARGS)
|
||||
{
|
||||
int r, rx, ry, rt;
|
||||
for (rx=-2; rx<3; rx++)
|
||||
for (ry=-2; ry<3; ry++)
|
||||
for (rx=-1; rx<2; rx++)
|
||||
for (ry=-1; ry<2; ry++)
|
||||
if (BOUNDS_CHECK && (rx || ry))
|
||||
{
|
||||
r = pmap[y+ry][x+rx];
|
||||
switch (r&0xFF)
|
||||
{
|
||||
case PT_SALT:
|
||||
if (!(rand()%250))
|
||||
if (!(rand()%83))
|
||||
{
|
||||
sim->part_change_type(i,x,y,PT_SLTW);
|
||||
// on average, convert 3 DSTW to SLTW before SALT turns into SLTW
|
||||
@ -67,20 +67,20 @@ int Element_DSTW::update(UPDATE_FUNC_ARGS)
|
||||
}
|
||||
break;
|
||||
case PT_SLTW:
|
||||
if (!(rand()%10000))
|
||||
if (!(rand()%3333))
|
||||
{
|
||||
sim->part_change_type(i,x,y,PT_SLTW);
|
||||
break;
|
||||
}
|
||||
case PT_WATR:
|
||||
if (!(rand()%500))
|
||||
if (!(rand()%166))
|
||||
{
|
||||
sim->part_change_type(i,x,y,PT_WATR);
|
||||
}
|
||||
break;
|
||||
case PT_RBDM:
|
||||
case PT_LRBD:
|
||||
if ((sim->legacy_enable||parts[i].temp>12.0f) && !(rand()%500))
|
||||
if ((sim->legacy_enable||parts[i].temp>12.0f) && !(rand()%166))
|
||||
{
|
||||
sim->part_change_type(i,x,y,PT_FIRE);
|
||||
parts[i].life = 4;
|
||||
@ -88,7 +88,7 @@ int Element_DSTW::update(UPDATE_FUNC_ARGS)
|
||||
break;
|
||||
case PT_FIRE:
|
||||
sim->kill_part(r>>8);
|
||||
if(!(rand()%150)){
|
||||
if(!(rand()%50)){
|
||||
sim->kill_part(i);
|
||||
return 1;
|
||||
}
|
||||
|
@ -95,6 +95,42 @@ int Element_FIRE::update(UPDATE_FUNC_ARGS)
|
||||
if (sim->bmap[(y+ry)/CELL][(x+rx)/CELL] && sim->bmap[(y+ry)/CELL][(x+rx)/CELL]!=WL_STREAM)
|
||||
continue;
|
||||
rt = r&0xFF;
|
||||
|
||||
//THRM burning
|
||||
if (rt==PT_THRM && (t==PT_FIRE || t==PT_PLSM || t==PT_LAVA))
|
||||
{
|
||||
if (!(rand()%500)) {
|
||||
sim->part_change_type(r>>8,x+rx,y+ry,PT_LAVA);
|
||||
parts[r>>8].ctype = PT_BMTL;
|
||||
parts[r>>8].temp = 3500.0f;
|
||||
sim->pv[(y+ry)/CELL][(x+rx)/CELL] += 50.0f;
|
||||
} else {
|
||||
sim->part_change_type(r>>8,x+rx,y+ry,PT_LAVA);
|
||||
parts[r>>8].life = 400;
|
||||
parts[r>>8].ctype = PT_THRM;
|
||||
parts[r>>8].temp = 3500.0f;
|
||||
parts[r>>8].tmp = 20;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
if ((rt==PT_COAL) || (rt==PT_BCOL))
|
||||
{
|
||||
if ((t==PT_FIRE || t==PT_PLSM))
|
||||
{
|
||||
if (parts[r>>8].life>100 && !(rand()%500)) {
|
||||
parts[r>>8].life = 99;
|
||||
}
|
||||
}
|
||||
else if (t==PT_LAVA)
|
||||
{
|
||||
if (parts[i].ctype == PT_IRON && !(rand()%500)) {
|
||||
parts[i].ctype = PT_METL;
|
||||
sim->kill_part(r>>8);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ((surround_space || sim->elements[rt].Explosive) &&
|
||||
(t!=PT_SPRK || (rt!=PT_RBDM && rt!=PT_LRBD && rt!=PT_INSL)) &&
|
||||
(t!=PT_PHOT || rt!=PT_INSL) &&
|
||||
@ -126,6 +162,7 @@ int Element_FIRE::updateLegacy(UPDATE_FUNC_ARGS) {
|
||||
if (sim->bmap[(y+ry)/CELL][(x+rx)/CELL] && sim->bmap[(y+ry)/CELL][(x+rx)/CELL]!=WL_STREAM)
|
||||
continue;
|
||||
rt = r&0xFF;
|
||||
|
||||
lpv = (int)sim->pv[(y+ry)/CELL][(x+rx)/CELL];
|
||||
if (lpv < 1) lpv = 1;
|
||||
if (t!=PT_SPRK && sim->elements[rt].Meltable && ((rt!=PT_RBDM && rt!=PT_LRBD) || t!=PT_SPRK) && ((t!=PT_FIRE&&t!=PT_PLSM) || (rt!=PT_METL && rt!=PT_IRON && rt!=PT_ETRD && rt!=PT_PSCN && rt!=PT_NSCN && rt!=PT_NTCT && rt!=PT_PTCT && rt!=PT_BMTL && rt!=PT_BRMT && rt!=PT_SALT && rt!=PT_INWR)) &&sim->elements[rt].Meltable*lpv>(rand()%1000))
|
||||
|
@ -52,8 +52,8 @@ int Element_GBMB::update(UPDATE_FUNC_ARGS)
|
||||
int rx,ry,r;
|
||||
if (parts[i].life<=0)
|
||||
{
|
||||
for (rx=-2; rx<3; rx++)
|
||||
for (ry=-2; ry<3; ry++)
|
||||
for (rx=-1; rx<2; rx++)
|
||||
for (ry=-1; ry<2; ry++)
|
||||
{
|
||||
if (BOUNDS_CHECK)
|
||||
{
|
||||
|
@ -54,8 +54,8 @@ int Element_ICEI::update(UPDATE_FUNC_ARGS)
|
||||
{
|
||||
parts[i].temp = restrict_flt(parts[i].temp-1.0f, MIN_TEMP, MAX_TEMP);
|
||||
}
|
||||
for (rx=-2; rx<3; rx++)
|
||||
for (ry=-2; ry<3; ry++)
|
||||
for (rx=-1; rx<2; rx++)
|
||||
for (ry=-1; ry<2; ry++)
|
||||
if (BOUNDS_CHECK && (rx || ry))
|
||||
{
|
||||
r = pmap[y+ry][x+rx];
|
||||
@ -63,14 +63,14 @@ int Element_ICEI::update(UPDATE_FUNC_ARGS)
|
||||
continue;
|
||||
if ((r&0xFF)==PT_SALT || (r&0xFF)==PT_SLTW)
|
||||
{
|
||||
if (parts[i].temp > sim->elements[PT_SLTW].LowTemperature && !(rand()%1000))
|
||||
if (parts[i].temp > sim->elements[PT_SLTW].LowTemperature && !(rand()%333))
|
||||
{
|
||||
sim->part_change_type(i,x,y,PT_SLTW);
|
||||
sim->part_change_type(r>>8,x+rx,y+ry,PT_SLTW);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
else if (((r&0xFF)==PT_FRZZ) && (parts[i].ctype=PT_FRZW) && !(rand()%1000))
|
||||
else if (((r&0xFF)==PT_FRZZ) && (parts[i].ctype=PT_FRZW) && !(rand()%333))
|
||||
sim->part_change_type(r>>8,x+rx,y+ry,PT_ICEI);
|
||||
}
|
||||
return 0;
|
||||
|
@ -50,15 +50,15 @@ Element_PLNT::Element_PLNT()
|
||||
int Element_PLNT::update(UPDATE_FUNC_ARGS)
|
||||
{
|
||||
int r, rx, ry, np;
|
||||
for (rx=-2; rx<3; rx++)
|
||||
for (ry=-2; ry<3; ry++)
|
||||
for (rx=-1; rx<2; rx++)
|
||||
for (ry=-1; ry<2; ry++)
|
||||
if (BOUNDS_CHECK && (rx || ry))
|
||||
{
|
||||
r = pmap[y+ry][x+rx];
|
||||
switch (r&0xFF)
|
||||
{
|
||||
case PT_WATR:
|
||||
if (!(rand()%250))
|
||||
if (!(rand()%83))
|
||||
{
|
||||
np = sim->create_part(r>>8,x+rx,y+ry,PT_PLNT);
|
||||
if (np<0) continue;
|
||||
@ -66,7 +66,7 @@ int Element_PLNT::update(UPDATE_FUNC_ARGS)
|
||||
}
|
||||
break;
|
||||
case PT_LAVA:
|
||||
if (!(rand()%250))
|
||||
if (!(rand()%83))
|
||||
{
|
||||
sim->part_change_type(i,x,y,PT_FIRE);
|
||||
parts[i].life = 4;
|
||||
@ -74,14 +74,14 @@ int Element_PLNT::update(UPDATE_FUNC_ARGS)
|
||||
break;
|
||||
case PT_SMKE:
|
||||
case PT_CO2:
|
||||
if (!(rand()%250))
|
||||
if (!(rand()%83))
|
||||
{
|
||||
sim->kill_part(r>>8);
|
||||
parts[i].life = rand()%60 + 60;
|
||||
}
|
||||
break;
|
||||
case PT_WOOD:
|
||||
if (surround_space && !(rand()%20) && (abs(rx+ry)<=2) && (sim->VINE_MODE || parts[i].tmp==1))
|
||||
if (surround_space && !(rand()%7) && (abs(rx+ry)<=2) && (sim->VINE_MODE || parts[i].tmp==1))
|
||||
{
|
||||
int nnx = rand()%3 -1;
|
||||
int nny = rand()%3 -1;
|
||||
|
@ -52,14 +52,14 @@ int Element_PQRT::update(UPDATE_FUNC_ARGS)
|
||||
int r, tmp, trade, rx, ry, np;
|
||||
// absorb SLTW
|
||||
if (parts[i].ctype!=-1)
|
||||
for (rx=-2; rx<3; rx++)
|
||||
for (ry=-2; ry<3; ry++)
|
||||
for (rx=-1; rx<2; rx++)
|
||||
for (ry=-1; ry<2; ry++)
|
||||
if (BOUNDS_CHECK && (rx || ry))
|
||||
{
|
||||
r = pmap[y+ry][x+rx];
|
||||
if (!r)
|
||||
continue;
|
||||
else if ((r&0xFF)==PT_SLTW && !(rand()%2500))
|
||||
else if ((r&0xFF)==PT_SLTW && !(rand()%833))
|
||||
{
|
||||
sim->kill_part(r>>8);
|
||||
parts[i].ctype ++;
|
||||
|
@ -50,24 +50,24 @@ Element_SLTW::Element_SLTW()
|
||||
int Element_SLTW::update(UPDATE_FUNC_ARGS)
|
||||
{
|
||||
int r, rx, ry;
|
||||
for (rx=-2; rx<3; rx++)
|
||||
for (ry=-2; ry<3; ry++)
|
||||
for (rx=-1; rx<2; rx++)
|
||||
for (ry=-1; ry<2; ry++)
|
||||
if (BOUNDS_CHECK && (rx || ry))
|
||||
{
|
||||
r = pmap[y+ry][x+rx];
|
||||
switch (r&0xFF)
|
||||
{
|
||||
case PT_SALT:
|
||||
if (!(rand()%10000))
|
||||
if (!(rand()%3333))
|
||||
sim->part_change_type(r>>8,x+rx,y+ry,PT_SLTW);
|
||||
break;
|
||||
case PT_PLNT:
|
||||
if (!(rand()%200))
|
||||
if (!(rand()%66))
|
||||
sim->kill_part(r>>8);
|
||||
break;
|
||||
case PT_RBDM:
|
||||
case PT_LRBD:
|
||||
if ((sim->legacy_enable||parts[i].temp>(273.15f+12.0f)) && !(rand()%500))
|
||||
if ((sim->legacy_enable||parts[i].temp>(273.15f+12.0f)) && !(rand()%166))
|
||||
{
|
||||
sim->part_change_type(i,x,y,PT_FIRE);
|
||||
parts[i].life = 4;
|
||||
|
@ -54,14 +54,14 @@ int Element_SNOW::update(UPDATE_FUNC_ARGS)
|
||||
{
|
||||
parts[i].temp = restrict_flt(parts[i].temp-1.0f, MIN_TEMP, MAX_TEMP);
|
||||
}
|
||||
for (rx=-2; rx<3; rx++)
|
||||
for (ry=-2; ry<3; ry++)
|
||||
for (rx=-1; rx<2; rx++)
|
||||
for (ry=-1; ry<2; ry++)
|
||||
if (BOUNDS_CHECK && (rx || ry))
|
||||
{
|
||||
r = pmap[y+ry][x+rx];
|
||||
if (!r)
|
||||
continue;
|
||||
if (((r&0xFF)==PT_SALT || (r&0xFF)==PT_SLTW) && !(rand()%1000))
|
||||
if (((r&0xFF)==PT_SALT || (r&0xFF)==PT_SLTW) && !(rand()%333))
|
||||
{
|
||||
sim->part_change_type(i,x,y,PT_SLTW);
|
||||
sim->part_change_type(r>>8,x+rx,y+ry,PT_SLTW);
|
||||
|
@ -42,39 +42,8 @@ Element_THRM::Element_THRM()
|
||||
HighTemperature = ITH;
|
||||
HighTemperatureTransition = NT;
|
||||
|
||||
Update = &Element_THRM::update;
|
||||
Update = NULL;
|
||||
|
||||
}
|
||||
|
||||
//#TPT-Directive ElementHeader Element_THRM static int update(UPDATE_FUNC_ARGS)
|
||||
int Element_THRM::update(UPDATE_FUNC_ARGS)
|
||||
{
|
||||
int r, rx, ry;
|
||||
for (rx=-2; rx<3; rx++)
|
||||
for (ry=-2; ry<3; ry++)
|
||||
if (BOUNDS_CHECK && (rx || ry))
|
||||
{
|
||||
r = pmap[y+ry][x+rx];
|
||||
if (!r)
|
||||
continue;
|
||||
if (((r&0xFF)==PT_FIRE || (r&0xFF)==PT_PLSM || (r&0xFF)==PT_LAVA)) // TODO: could this go in update_PYRO?
|
||||
{
|
||||
if (!(rand()%500)) {
|
||||
sim->part_change_type(i,x,y,PT_LAVA);
|
||||
parts[i].ctype = PT_BMTL;
|
||||
parts[i].temp = 3500.0f;
|
||||
sim->pv[y/CELL][x/CELL] += 50.0f;
|
||||
} else {
|
||||
sim->part_change_type(i,x,y,PT_LAVA);
|
||||
parts[i].life = 400;
|
||||
parts[i].ctype = PT_THRM;
|
||||
parts[i].temp = 3500.0f;
|
||||
parts[i].tmp = 20;
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Element_THRM::~Element_THRM() {}
|
||||
|
@ -131,8 +131,8 @@ int Element_VIBR::update(UPDATE_FUNC_ARGS) {
|
||||
}
|
||||
}
|
||||
//Neighbor check loop
|
||||
for (rx=-2; rx<3; rx++)
|
||||
for (ry=-2; ry<3; ry++)
|
||||
for (rx=-1; rx<2; rx++)
|
||||
for (ry=-1; ry<2; ry++)
|
||||
if (BOUNDS_CHECK && (rx || ry))
|
||||
{
|
||||
r = pmap[y+ry][x+rx];
|
||||
@ -141,7 +141,7 @@ int Element_VIBR::update(UPDATE_FUNC_ARGS) {
|
||||
if (!r)
|
||||
continue;
|
||||
//Melts into EXOT
|
||||
if ((r&0xFF) == PT_EXOT && !(rand()%250) && !parts[i].life)
|
||||
if ((r&0xFF) == PT_EXOT && !(rand()%83) && !parts[i].life)
|
||||
{
|
||||
sim->create_part(i, x, y, PT_EXOT);
|
||||
}
|
||||
|
@ -50,21 +50,21 @@ Element_WATR::Element_WATR()
|
||||
int Element_WATR::update(UPDATE_FUNC_ARGS)
|
||||
{
|
||||
int r, rx, ry;
|
||||
for (rx=-2; rx<3; rx++)
|
||||
for (ry=-2; ry<3; ry++)
|
||||
for (rx=-1; rx<2; rx++)
|
||||
for (ry=-1; ry<2; ry++)
|
||||
if (BOUNDS_CHECK && (rx || ry))
|
||||
{
|
||||
r = pmap[y+ry][x+rx];
|
||||
if (!r)
|
||||
continue;
|
||||
if ((r&0xFF)==PT_SALT && !(rand()%250))
|
||||
if ((r&0xFF)==PT_SALT && !(rand()%83))
|
||||
{
|
||||
sim->part_change_type(i,x,y,PT_SLTW);
|
||||
// on average, convert 3 WATR to SLTW before SALT turns into SLTW
|
||||
if (!(rand()%3))
|
||||
sim->part_change_type(r>>8,x+rx,y+ry,PT_SLTW);
|
||||
}
|
||||
else if (((r&0xFF)==PT_RBDM||(r&0xFF)==PT_LRBD) && (sim->legacy_enable||parts[i].temp>(273.15f+12.0f)) && !(rand()%500))
|
||||
else if (((r&0xFF)==PT_RBDM||(r&0xFF)==PT_LRBD) && (sim->legacy_enable||parts[i].temp>(273.15f+12.0f)) && !(rand()%166))
|
||||
{
|
||||
sim->part_change_type(i,x,y,PT_FIRE);
|
||||
parts[i].life = 4;
|
||||
@ -72,7 +72,7 @@ int Element_WATR::update(UPDATE_FUNC_ARGS)
|
||||
}
|
||||
else if ((r&0xFF)==PT_FIRE && parts[r>>8].ctype!=PT_WATR){
|
||||
sim->kill_part(r>>8);
|
||||
if(!(rand()%150)){
|
||||
if(!(rand()%50)){
|
||||
sim->kill_part(i);
|
||||
return 1;
|
||||
}
|
||||
|
@ -50,14 +50,14 @@ Element_WTRV::Element_WTRV()
|
||||
int Element_WTRV::update(UPDATE_FUNC_ARGS)
|
||||
{
|
||||
int r, rx, ry;
|
||||
for (rx=-2; rx<3; rx++)
|
||||
for (ry=-2; ry<3; ry++)
|
||||
for (rx=-1; rx<2; rx++)
|
||||
for (ry=-1; ry<2; ry++)
|
||||
if (BOUNDS_CHECK && (rx || ry))
|
||||
{
|
||||
r = pmap[y+ry][x+rx];
|
||||
if (!r)
|
||||
continue;
|
||||
if (((r&0xFF)==PT_RBDM||(r&0xFF)==PT_LRBD) && !sim->legacy_enable && parts[i].temp>(273.15f+12.0f) && !(rand()%500))
|
||||
if (((r&0xFF)==PT_RBDM||(r&0xFF)==PT_LRBD) && !sim->legacy_enable && parts[i].temp>(273.15f+12.0f) && !(rand()%166))
|
||||
{
|
||||
sim->part_change_type(i,x,y,PT_FIRE);
|
||||
parts[i].life = 4;
|
||||
|
@ -50,14 +50,14 @@ Element_YEST::Element_YEST()
|
||||
int Element_YEST::update(UPDATE_FUNC_ARGS)
|
||||
{
|
||||
int r, rx, ry;
|
||||
for (rx=-2; rx<3; rx++)
|
||||
for (ry=-2; ry<3; ry++)
|
||||
for (rx=-1; rx<2; rx++)
|
||||
for (ry=-1; ry<2; ry++)
|
||||
if (BOUNDS_CHECK && (rx || ry))
|
||||
{
|
||||
r = pmap[y+ry][x+rx];
|
||||
if (!r)
|
||||
continue;
|
||||
if ((r&0xFF)==PT_DYST && !(rand()%30) && !sim->legacy_enable)
|
||||
if ((r&0xFF)==PT_DYST && !(rand()%10) && !sim->legacy_enable)
|
||||
{
|
||||
sim->part_change_type(i,x,y,PT_DYST);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user