Fix RSST/RSSS not respecting the CarriesCtypeIn field. Reset GEL's tmp field when it turns into RSST.

This commit is contained in:
Saveliy Skresanov 2024-04-04 22:10:58 +07:00
parent 51f714de0f
commit f8873debc6
4 changed files with 19 additions and 2 deletions

View File

@ -59,17 +59,21 @@ static int update(UPDATE_FUNC_ARGS)
auto r = pmap[y+ry][x+rx];
if (!r)
continue;
if (TYP(r)==PT_WATR && sim->rng.chance(1, 400))
{
sim->kill_part(i);
sim->part_change_type(ID(r),x+rx,y+ry,PT_DEUT);
parts[ID(r)].life = 10;
return 1;
}
else if (TYP(r) == PT_GEL) //GLOW + GEL = RSST
{
sim->kill_part(i);
sim->part_change_type(ID(r),x+rx,y+ry,PT_RSST);
parts[ID(r)].tmp = 0;
return 1;
}
}

View File

@ -54,6 +54,8 @@ void Element::Element_NEUT()
static int update(UPDATE_FUNC_ARGS)
{
auto &sd = SimulationData::CRef();
auto &elements = sd.elements;
unsigned int pressureFactor = 3 + (int)sim->pv[y/CELL][x/CELL];
for (int rx = -1; rx <= 1; rx++)
{
@ -178,7 +180,7 @@ static int update(UPDATE_FUNC_ARGS)
sim->create_part(ID(r), x, y, ct_under);
//If there's a correct tmp set, use it for ctype
if(tmp_under > 0 && ct_under < PT_NUM)
if((tmp_under > 0) && (tmp_under < PT_NUM) && (elements[ct_under].CarriesTypeIn & (1U << FIELD_CTYPE)))
parts[ID(r)].ctype = tmp_under;
}
else

View File

@ -57,6 +57,9 @@ void Element::Element_PHOT()
static int update(UPDATE_FUNC_ARGS)
{
auto &sd = SimulationData::CRef();
auto &elements = sd.elements;
if (!(parts[i].ctype&0x3FFFFFFF)) {
sim->kill_part(i);
return 1;
@ -121,7 +124,7 @@ static int update(UPDATE_FUNC_ARGS)
sim->create_part(ID(r), x, y, ct_under);
//If there's a correct tmp set, use it for ctype
if(tmp_under > 0 && ct_under < PT_NUM)
if((tmp_under > 0) && (tmp_under < PT_NUM) && (elements[ct_under].CarriesTypeIn & (1U << FIELD_CTYPE)))
parts[ID(r)].ctype = tmp_under;
}
else

View File

@ -33,6 +33,7 @@ void Element::Element_RSST()
Description = "Resist. Solidifies on contact with photons, is destroyed by electrons and spark.";
Properties = TYPE_LIQUID|PROP_CONDUCTS|PROP_LIFE_DEC|PROP_NEUTPASS;
CarriesTypeIn = (1U << FIELD_CTYPE) | (1U << FIELD_TMP);
LowPressure = IPL;
LowPressureTransition = NT;
@ -80,6 +81,13 @@ int update(UPDATE_FUNC_ARGS)
if(parts[ID(r)].ctype != PT_RSST)
parts[i].ctype = parts[ID(r)].ctype;
}
// Set RSST tmp from nearby breakable clone
if((TYP(r) == PT_BCLN) || (TYP(r) == PT_PBCN))
{
if(parts[ID(r)].ctype != PT_RSST)
parts[i].tmp = parts[ID(r)].ctype;
}
}
}