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)
|
||||
{
|
||||
|
@ -3,6 +3,15 @@
|
||||
static int update(UPDATE_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()
|
||||
{
|
||||
Identifier = "DEFAULT_PT_PAPR";
|
||||
@ -14,7 +23,7 @@ void Element::Element_PAPR()
|
||||
|
||||
Advection = 0.0f;
|
||||
AirDrag = 0.00f * CFDS;
|
||||
AirLoss = 0.90f;
|
||||
AirLoss = 0.995f;
|
||||
Loss = 0.00f;
|
||||
Collision = 0.0f;
|
||||
Gravity = 0.0f;
|
||||
@ -22,14 +31,14 @@ void Element::Element_PAPR()
|
||||
HotAir = 0.000f * CFDS;
|
||||
Falldown = 0;
|
||||
|
||||
Flammable = 20;
|
||||
Flammable = 0;
|
||||
Explosive = 0;
|
||||
Meltable = 0;
|
||||
Hardness = 15;
|
||||
|
||||
Weight = 100;
|
||||
|
||||
HeatConduct = 164;
|
||||
HeatConduct = 80;
|
||||
Description = "Paper. Flammable, readable, writable.";
|
||||
|
||||
Properties = TYPE_SOLID | PROP_NEUTPENETRATE;
|
||||
@ -40,8 +49,8 @@ void Element::Element_PAPR()
|
||||
HighPressureTransition = NT;
|
||||
LowTemperature = ITL;
|
||||
LowTemperatureTransition = NT;
|
||||
HighTemperature = 873.0f;
|
||||
HighTemperatureTransition = PT_FIRE;
|
||||
HighTemperature = 700.0f;
|
||||
HighTemperatureTransition = PT_NONE; // Add ash or broken paper element?
|
||||
|
||||
Update = &update;
|
||||
Graphics = &graphics;
|
||||
@ -49,33 +58,36 @@ void Element::Element_PAPR()
|
||||
|
||||
static int update(UPDATE_FUNC_ARGS)
|
||||
{
|
||||
if (parts[i].temp > 450 && parts[i].temp > parts[i].tmp)
|
||||
parts[i].tmp = (int)parts[i].temp;
|
||||
|
||||
if (parts[i].temp > 773.0f && sim->pv[y/CELL][x/CELL] <= -10.0f)
|
||||
if (parts[i].temp > 450 && parts[i].temp >= parts[i].tmp2)
|
||||
{
|
||||
float temp = parts[i].temp;
|
||||
sim->create_part(i, x, y, PT_BCOL);
|
||||
parts[i].temp = temp;
|
||||
parts[i].tmp2 = (int)parts[i].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;
|
||||
}
|
||||
|
||||
static int graphics(GRAPHICS_FUNC_ARGS)
|
||||
{
|
||||
float maxtemp = std::max((float)cpart->tmp, cpart->temp);
|
||||
if (maxtemp > 400)
|
||||
float maxtemp = std::max((float)cpart->tmp2, cpart->temp);
|
||||
if (maxtemp > 450)
|
||||
{
|
||||
*colr -= (int)restrict_flt((maxtemp-400)/3,0,172);
|
||||
*colg -= (int)restrict_flt((maxtemp-400)/4,0,140);
|
||||
*colb -= (int)restrict_flt((maxtemp-400)/20,0,44);
|
||||
}
|
||||
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);
|
||||
*colr -= (int)restrict_flt((maxtemp-450)*1.2f,0,230);
|
||||
*colg -= (int)restrict_flt((maxtemp-450)*1.4f,0,230);
|
||||
*colb -= (int)restrict_flt((maxtemp-450)*1.7f,0,197);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
Reference in New Issue
Block a user