Add CRMC from my mod 3dd3fb2f7801 92f0301295f6

This commit is contained in:
jacob1 2015-08-30 18:29:21 -04:00
parent 4af4ae3656
commit 48dbc4182d
3 changed files with 101 additions and 0 deletions

View File

@ -3063,6 +3063,9 @@ int Simulation::create_part(int p, int x, int y, int tv)
case PT_VRSG: case PT_VRSG:
parts[i].pavg[1] = 250; parts[i].pavg[1] = 250;
break; break;
case PT_CRMC:
parts[i].tmp2 = (rand() % 5);
break;
case PT_STKM: case PT_STKM:
{ {
if (player.spwn == 0) if (player.spwn == 0)
@ -3716,6 +3719,14 @@ void Simulation::UpdateParticles(int start, int end)
else else
s = 0; s = 0;
} }
else if (t == PT_CRMC)
{
float pres = std::max((pv[y/CELL][x/CELL]+pv[(y-2)/CELL][x/CELL]+pv[(y+2)/CELL][x/CELL]+pv[y/CELL][(x-2)/CELL]+pv[y/CELL][(x+2)/CELL])*2.0f, 0.0f);
if (ctemph < pres+elements[PT_CRMC].HighTemperature)
s = 0;
else
t = PT_LAVA;
}
else else
s = 0; s = 0;
} }
@ -3763,6 +3774,12 @@ void Simulation::UpdateParticles(int start, int end)
if (pt>=elements[parts[i].ctype].HighTemperature) if (pt>=elements[parts[i].ctype].HighTemperature)
s = 0; s = 0;
} }
else if (parts[i].ctype == PT_CRMC)
{
float pres = std::max((pv[y/CELL][x/CELL]+pv[(y-2)/CELL][x/CELL]+pv[(y+2)/CELL][x/CELL]+pv[y/CELL][(x-2)/CELL]+pv[y/CELL][(x+2)/CELL])*2.0f, 0.0f);
if (ctemph >= pres+elements[PT_CRMC].HighTemperature)
s = 0;
}
else if (elements[parts[i].ctype].HighTemperatureTransition == PT_LAVA) else if (elements[parts[i].ctype].HighTemperatureTransition == PT_LAVA)
{ {
if (pt >= elements[parts[i].ctype].HighTemperature) if (pt >= elements[parts[i].ctype].HighTemperature)

View File

@ -62,6 +62,22 @@ int Element_BREC::update(UPDATE_FUNC_ARGS)
} }
} }
for (int rx = -1; rx <= 1; rx++)
for (int ry = -1; ry <= 1; ry++)
{
if (rx || ry)
{
int r = pmap[y+ry][x+rx];
if (!r)
continue;
if (parts[r>>8].type == PT_LAVA && parts[r>>8].ctype == PT_CLST)
{
float pres = std::max(sim->pv[y/CELL][x/CELL]*10.0f, 0.0f);
if (parts[r>>8].temp >= pres+sim->elements[PT_CRMC].HighTemperature+50.0f)
parts[r>>8].ctype = PT_CRMC;
}
}
}
return 0; return 0;
} }

View File

@ -0,0 +1,68 @@
#include "simulation/Elements.h"
//#TPT-Directive ElementClass Element_CRMC PT_CRMC 179
Element_CRMC::Element_CRMC()
{
Identifier = "DEFAULT_PT_CRMC";
Name = "CRMC";
Colour = PIXPACK(0xD6D1D4);
MenuVisible = 1;
MenuSection = SC_SOLIDS;
Enabled = 1;
Advection = 0.0f;
AirDrag = 0.00f * CFDS;
AirLoss = 0.00f;
Loss = 0.00f;
Collision = 0.0f;
Gravity = 0.0f;
Diffusion = 0.00f;
HotAir = 0.000f * CFDS;
Falldown = 0;
Flammable = 0;
Explosive = 0;
Meltable = 0;
Hardness = 5;
Weight = 100;
Temperature = R_TEMP+273.15f;
HeatConduct = 35;
Description = "Ceramic. Gets stronger under pressure.";
State = ST_SOLID;
Properties = TYPE_SOLID | PROP_NEUTPASS;
LowPressure = IPL;
LowPressureTransition = NT;
HighPressure = IPH;
HighPressureTransition = NT;
LowTemperature = ITL;
LowTemperatureTransition = NT;
HighTemperature = 2887.15f;
HighTemperatureTransition = ST;
Update = &Element_CRMC::update;
Graphics = &Element_CRMC::graphics;
}
//#TPT-Directive ElementHeader Element_CRMC static int update(UPDATE_FUNC_ARGS)
int Element_CRMC::update(UPDATE_FUNC_ARGS)
{
if (sim->pv[y/CELL][x/CELL] < -30.0f)
sim->create_part(i, x, y, PT_CLST);
return 0;
}
//#TPT-Directive ElementHeader Element_CRMC static int graphics(GRAPHICS_FUNC_ARGS)
int Element_CRMC::graphics(GRAPHICS_FUNC_ARGS)
{
int z = cpart->tmp2 - 2;
*colr += z * 8;
*colg += z * 8;
*colb += z * 8;
return 0;
}
Element_CRMC::~Element_CRMC() {}