make TSNS not detect METL, some other sensor and CONV fixes

This commit is contained in:
jacob1 2012-12-18 14:55:10 -05:00
parent 771d71ea46
commit b236c75209
4 changed files with 14 additions and 22 deletions

View File

@ -2801,24 +2801,22 @@ int Simulation::create_part(int p, int x, int y, int tv)
{ {
if (pmap[y][x]) if (pmap[y][x])
{ {
int drawOn = pmap[y][x]&0xFF;
if (( if ((
((pmap[y][x]&0xFF)==PT_STOR&&!(elements[t].Properties&TYPE_SOLID))|| (drawOn == PT_STOR && !(elements[t].Properties&TYPE_SOLID)) ||
(pmap[y][x]&0xFF)==PT_CLNE|| drawOn==PT_CLNE ||
(pmap[y][x]&0xFF)==PT_BCLN|| drawOn==PT_BCLN ||
(pmap[y][x]&0xFF)==PT_CONV|| drawOn==PT_CONV ||
((pmap[y][x]&0xFF)==PT_PCLN&&t!=PT_PSCN&&t!=PT_NSCN)|| (drawOn==PT_PCLN&&t!=PT_PSCN&&t!=PT_NSCN) ||
((pmap[y][x]&0xFF)==PT_PBCN&&t!=PT_PSCN&&t!=PT_NSCN) (drawOn==PT_PBCN&&t!=PT_PSCN&&t!=PT_NSCN)
)&&( )&&(
t!=PT_CLNE&&t!=PT_PCLN&& t != PT_CLNE && t != PT_PCLN && t != PT_BCLN && t != PT_STKM && t != PT_STKM2 && t != PT_PBCN && t != PT_STOR && t != PT_FIGH && t != PT_CONV)
t!=PT_BCLN&&t!=PT_STKM&&
t!=PT_STKM2&&t!=PT_PBCN&&
t!=PT_STOR&&t!=PT_FIGH)
) )
{ {
parts[pmap[y][x]>>8].ctype = t; parts[pmap[y][x]>>8].ctype = t;
if (t==PT_LIFE && v<NGOLALT && (pmap[y][x]&0xFF)!=PT_STOR) parts[pmap[y][x]>>8].tmp = v; if (t == PT_LIFE && v < NGOLALT && drawOn != PT_STOR) parts[pmap[y][x]>>8].tmp = v;
} }
else if ((pmap[y][x]&0xFF) == PT_DTEC && (pmap[y][x]&0xFF) != t) else if (drawOn == PT_DTEC && drawOn != t)
{ {
parts[pmap[y][x]>>8].ctype = t; parts[pmap[y][x]>>8].ctype = t;
if (t==PT_LIFE && v<NGOLALT) if (t==PT_LIFE && v<NGOLALT)

View File

@ -28,7 +28,7 @@ Element_CONV::Element_CONV()
Temperature = R_TEMP+0.0f +273.15f; Temperature = R_TEMP+0.0f +273.15f;
HeatConduct = 251; HeatConduct = 251;
Description = "Solid. Converts whatever touches it into its ctype."; Description = "Solid. Converts everything into whatever it first touches.";
State = ST_NONE; State = ST_NONE;
Properties = TYPE_SOLID; Properties = TYPE_SOLID;

View File

@ -46,12 +46,6 @@ Element_DTEC::Element_DTEC()
} }
//#TPT-Directive ElementHeader Element_DTEC static int in_radius(int rd, int x, int y)
int Element_DTEC::in_radius(int rd, int x, int y)
{
return (pow((double)x,2)*pow((double)rd,2)+pow((double)y,2)*pow((double)rd,2)<=pow((double)rd,2)*pow((double)rd,2));
}
//#TPT-Directive ElementHeader Element_DTEC static int update(UPDATE_FUNC_ARGS) //#TPT-Directive ElementHeader Element_DTEC static int update(UPDATE_FUNC_ARGS)
int Element_DTEC::update(UPDATE_FUNC_ARGS) int Element_DTEC::update(UPDATE_FUNC_ARGS)
{ {
@ -70,7 +64,7 @@ int Element_DTEC::update(UPDATE_FUNC_ARGS)
rt = parts[r>>8].type; rt = parts[r>>8].type;
if (sim->parts_avg(i,r>>8,PT_INSL) != PT_INSL) if (sim->parts_avg(i,r>>8,PT_INSL) != PT_INSL)
{ {
if ((sim->elements[rt].Properties&PROP_CONDUCTS) && !(rt==PT_WATR||rt==PT_SLTW||rt==PT_NTCT||rt==PT_PTCT||rt==PT_INWR) && parts[r>>8].life==0 && in_radius(rd, rx, ry)) if ((sim->elements[rt].Properties&PROP_CONDUCTS) && !(rt==PT_WATR||rt==PT_SLTW||rt==PT_NTCT||rt==PT_PTCT||rt==PT_INWR) && parts[r>>8].life==0)
{ {
parts[r>>8].life = 4; parts[r>>8].life = 4;
parts[r>>8].ctype = rt; parts[r>>8].ctype = rt;

View File

@ -64,7 +64,7 @@ int Element_TSNS::update(UPDATE_FUNC_ARGS)
rt = parts[r>>8].type; rt = parts[r>>8].type;
if (sim->parts_avg(i,r>>8,PT_INSL) != PT_INSL) if (sim->parts_avg(i,r>>8,PT_INSL) != PT_INSL)
{ {
if ((sim->elements[rt].Properties&PROP_CONDUCTS) && !(rt==PT_WATR||rt==PT_SLTW||rt==PT_NTCT||rt==PT_PTCT||rt==PT_INWR) && parts[r>>8].life==0 && Element_DTEC::in_radius(rd, rx, ry)) if ((sim->elements[rt].Properties&PROP_CONDUCTS) && !(rt==PT_WATR||rt==PT_SLTW||rt==PT_NTCT||rt==PT_PTCT||rt==PT_INWR) && parts[r>>8].life==0)
{ {
parts[r>>8].life = 4; parts[r>>8].life = 4;
parts[r>>8].ctype = rt; parts[r>>8].ctype = rt;
@ -82,7 +82,7 @@ int Element_TSNS::update(UPDATE_FUNC_ARGS)
r = sim->photons[y+ry][x+rx]; r = sim->photons[y+ry][x+rx];
if(!r) if(!r)
continue; continue;
if (parts[r>>8].temp > parts[i].temp && parts[r>>8].type != PT_TSNS) if (parts[r>>8].temp > parts[i].temp && parts[r>>8].type != PT_TSNS && parts[i].type != PT_METL)
parts[i].life = 1; parts[i].life = 1;
} }
return 0; return 0;