Add reactions of resist with other elements.

This commit is contained in:
Saveliy Skresanov 2023-10-01 21:00:53 +07:00
parent 93cbb065dd
commit b000abcdd8
3 changed files with 38 additions and 1 deletions

View File

@ -66,6 +66,12 @@ static int update(UPDATE_FUNC_ARGS)
parts[ID(r)].life = 10; parts[ID(r)].life = 10;
return 1; return 1;
} }
else if (TYP(r) == PT_GEL)
{
sim->kill_part(i);
sim->part_change_type(ID(r),x+rx,y+ry,PT_RSST);
return 1;
}
} }
} }
} }

View File

@ -236,6 +236,10 @@ static int update(UPDATE_FUNC_ARGS)
case PT_SMKE: // SMKE -> CO2 case PT_SMKE: // SMKE -> CO2
sim->part_change_type(ID(r), x + rx, y + ry, PT_CO2); sim->part_change_type(ID(r), x + rx, y + ry, PT_CO2);
break; break;
case PT_RSST: // RSST -> BIZR
sim->part_change_type(ID(r), x + rx, y + ry, PT_BIZR);
break;
} }
} }
} }

View File

@ -1,5 +1,7 @@
#include "simulation/ElementCommon.h" #include "simulation/ElementCommon.h"
int update(UPDATE_FUNC_ARGS);
void Element::Element_RSST() void Element::Element_RSST()
{ {
Identifier = "DEFAULT_PT_RSST"; Identifier = "DEFAULT_PT_RSST";
@ -24,7 +26,7 @@ void Element::Element_RSST()
Meltable = 0; Meltable = 0;
Hardness = 50; Hardness = 50;
Weight = 40; Weight = 34;
DefaultProperties.temp = R_TEMP + 20.0f + 273.15f; DefaultProperties.temp = R_TEMP + 20.0f + 273.15f;
HeatConduct = 44; HeatConduct = 44;
@ -40,4 +42,29 @@ void Element::Element_RSST()
LowTemperatureTransition = NT; LowTemperatureTransition = NT;
HighTemperature = ITH; HighTemperature = ITH;
HighTemperatureTransition = NT; HighTemperatureTransition = NT;
Update = &update;
}
int update(UPDATE_FUNC_ARGS)
{
for(int rx = -1; rx < 2; rx++)
{
for(int ry = -1; ry < 2; ry++)
{
auto r = pmap[y+ry][x+rx];
if (!r)
continue;
if(TYP(r) == PT_GUNP)
{
sim->part_change_type(i, x, y, PT_FIRW);
sim->kill_part(ID(r));
return 1;
}
}
}
return 0;
} }