Basic burning properties
This commit is contained in:
parent
00fa5da4f2
commit
74c0467f6b
@ -195,6 +195,11 @@ int Element_FIRE_update(UPDATE_FUNC_ARGS)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// Make paper burn more reliably
|
||||||
|
if (rt==PT_PAPR)
|
||||||
|
{
|
||||||
|
parts[ID(r)].temp += 4;
|
||||||
|
}
|
||||||
|
|
||||||
if (t == PT_LAVA)
|
if (t == PT_LAVA)
|
||||||
{
|
{
|
||||||
|
@ -3,6 +3,15 @@
|
|||||||
static int update(UPDATE_FUNC_ARGS);
|
static int update(UPDATE_FUNC_ARGS);
|
||||||
static int graphics(GRAPHICS_FUNC_ARGS);
|
static int graphics(GRAPHICS_FUNC_ARGS);
|
||||||
|
|
||||||
|
// Element overview:
|
||||||
|
// PAPR (Paper) is a flammable solid element that can be colored by certain other elements.
|
||||||
|
// Additionally, it can be read and written to by ARAY.
|
||||||
|
|
||||||
|
// Property usage:
|
||||||
|
// life: Temporary read/write state for ARAY interaction
|
||||||
|
// tmp: Written color value. If dcolour is not black, it gets copied here. 1 bit alpha
|
||||||
|
// tmp2: Singe level
|
||||||
|
|
||||||
void Element::Element_PAPR()
|
void Element::Element_PAPR()
|
||||||
{
|
{
|
||||||
Identifier = "DEFAULT_PT_PAPR";
|
Identifier = "DEFAULT_PT_PAPR";
|
||||||
@ -14,7 +23,7 @@ void Element::Element_PAPR()
|
|||||||
|
|
||||||
Advection = 0.0f;
|
Advection = 0.0f;
|
||||||
AirDrag = 0.00f * CFDS;
|
AirDrag = 0.00f * CFDS;
|
||||||
AirLoss = 0.90f;
|
AirLoss = 0.995f;
|
||||||
Loss = 0.00f;
|
Loss = 0.00f;
|
||||||
Collision = 0.0f;
|
Collision = 0.0f;
|
||||||
Gravity = 0.0f;
|
Gravity = 0.0f;
|
||||||
@ -22,14 +31,14 @@ void Element::Element_PAPR()
|
|||||||
HotAir = 0.000f * CFDS;
|
HotAir = 0.000f * CFDS;
|
||||||
Falldown = 0;
|
Falldown = 0;
|
||||||
|
|
||||||
Flammable = 20;
|
Flammable = 0;
|
||||||
Explosive = 0;
|
Explosive = 0;
|
||||||
Meltable = 0;
|
Meltable = 0;
|
||||||
Hardness = 15;
|
Hardness = 15;
|
||||||
|
|
||||||
Weight = 100;
|
Weight = 100;
|
||||||
|
|
||||||
HeatConduct = 164;
|
HeatConduct = 80;
|
||||||
Description = "Paper. Flammable, readable, writable.";
|
Description = "Paper. Flammable, readable, writable.";
|
||||||
|
|
||||||
Properties = TYPE_SOLID | PROP_NEUTPENETRATE;
|
Properties = TYPE_SOLID | PROP_NEUTPENETRATE;
|
||||||
@ -40,8 +49,8 @@ void Element::Element_PAPR()
|
|||||||
HighPressureTransition = NT;
|
HighPressureTransition = NT;
|
||||||
LowTemperature = ITL;
|
LowTemperature = ITL;
|
||||||
LowTemperatureTransition = NT;
|
LowTemperatureTransition = NT;
|
||||||
HighTemperature = 873.0f;
|
HighTemperature = 700.0f;
|
||||||
HighTemperatureTransition = PT_FIRE;
|
HighTemperatureTransition = PT_NONE; // Add ash or broken paper element?
|
||||||
|
|
||||||
Update = &update;
|
Update = &update;
|
||||||
Graphics = &graphics;
|
Graphics = &graphics;
|
||||||
@ -49,33 +58,36 @@ void Element::Element_PAPR()
|
|||||||
|
|
||||||
static int update(UPDATE_FUNC_ARGS)
|
static int update(UPDATE_FUNC_ARGS)
|
||||||
{
|
{
|
||||||
if (parts[i].temp > 450 && parts[i].temp > parts[i].tmp)
|
if (parts[i].temp > 450 && parts[i].temp >= parts[i].tmp2)
|
||||||
parts[i].tmp = (int)parts[i].temp;
|
|
||||||
|
|
||||||
if (parts[i].temp > 773.0f && sim->pv[y/CELL][x/CELL] <= -10.0f)
|
|
||||||
{
|
{
|
||||||
float temp = parts[i].temp;
|
parts[i].tmp2 = (int)parts[i].temp;
|
||||||
sim->create_part(i, x, y, PT_BCOL);
|
|
||||||
parts[i].temp = temp;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Auto-ignition temperature
|
||||||
|
if (parts[i].temp > (451.0f - 32.f) / 1.8f + 273.15f)
|
||||||
|
{
|
||||||
|
parts[i].temp += 1;
|
||||||
|
if (sim->rng.chance((int)parts[i].temp-450,400))
|
||||||
|
{
|
||||||
|
int np = sim->create_part(-1, x + sim->rng.between(-1, 1), y + sim->rng.between(-1, 1), PT_FIRE);
|
||||||
|
if (np >= 0)
|
||||||
|
{
|
||||||
|
parts[np].life = 70;
|
||||||
|
// parts[np].temp = parts[i].temp;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int graphics(GRAPHICS_FUNC_ARGS)
|
static int graphics(GRAPHICS_FUNC_ARGS)
|
||||||
{
|
{
|
||||||
float maxtemp = std::max((float)cpart->tmp, cpart->temp);
|
float maxtemp = std::max((float)cpart->tmp2, cpart->temp);
|
||||||
if (maxtemp > 400)
|
if (maxtemp > 450)
|
||||||
{
|
{
|
||||||
*colr -= (int)restrict_flt((maxtemp-400)/3,0,172);
|
*colr -= (int)restrict_flt((maxtemp-450)*1.2f,0,230);
|
||||||
*colg -= (int)restrict_flt((maxtemp-400)/4,0,140);
|
*colg -= (int)restrict_flt((maxtemp-450)*1.4f,0,230);
|
||||||
*colb -= (int)restrict_flt((maxtemp-400)/20,0,44);
|
*colb -= (int)restrict_flt((maxtemp-450)*1.7f,0,197);
|
||||||
}
|
|
||||||
if (maxtemp < 273)
|
|
||||||
{
|
|
||||||
*colr -= (int)restrict_flt((273-maxtemp)/5,0,40);
|
|
||||||
*colg += (int)restrict_flt((273-maxtemp)/4,0,40);
|
|
||||||
*colb += (int)restrict_flt((273-maxtemp)/1.5,0,150);
|
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user