Fire improvements

This commit is contained in:
Regalis
2015-11-11 07:33:17 +02:00
parent 4d949e3be1
commit 9c2aec4c8e
18 changed files with 145 additions and 21 deletions
@@ -28,7 +28,7 @@ namespace Barotrauma.Items.Components
//turned down and cooling increased
private float shutDownTemp;
private float meltDownTemp;
private float fireTemp, meltDownTemp;
//how much power is provided to the grid per 1 temperature unit
private float powerPerTemp;
@@ -58,6 +58,16 @@ namespace Barotrauma.Items.Components
}
}
[Editable, HasDefaultValue(9000.0f, true)]
public float FireTemp
{
get { return fireTemp; }
set
{
fireTemp = Math.Max(0.0f, value);
}
}
[Editable, HasDefaultValue(1.0f, true)]
public float PowerPerTemp
{
@@ -127,8 +137,6 @@ namespace Barotrauma.Items.Components
tempGraph = new float[graphSize];
loadGraph = new float[graphSize];
meltDownTemp = 9000.0f;
shutDownTemp = 500.0f;
powerPerTemp = 1.0f;
@@ -148,6 +156,20 @@ namespace Barotrauma.Items.Components
float deltaTemp = (((heat - heatDissipation) * 5) - temperature) / 10000.0f;
Temperature = temperature + deltaTemp;
if (temperature>fireTemp && temperature-deltaTemp<fireTemp)
{
Vector2 baseVel = Rand.Vector(300.0f);
for (int i = 0; i < 10; i++)
{
var particle = GameMain.ParticleManager.CreateParticle("spark", item.Position,
baseVel + Rand.Vector(100.0f), 0.0f);
if (particle != null) particle.Size *= Rand.Range(0.5f, 1.0f);
}
new FireSource(item.Position);
}
if (temperature > meltDownTemp)
{
MeltDown();
@@ -60,7 +60,7 @@ namespace Barotrauma.Items.Components
if (pt.item.Condition<=0.0f && prevCondition > 0.0f)
{
sparkSounds[Rand.Int(sparkSounds.Length)].Play(1.0f, 600.0f, item.Position);
sparkSounds[Rand.Int(sparkSounds.Length)].Play(1.0f, 600.0f, pt.item.Position);
Vector2 baseVel = Rand.Vector(300.0f);
for (int i = 0; i < 10; i++)
@@ -70,6 +70,8 @@ namespace Barotrauma.Items.Components
if (particle != null) particle.Size *= Rand.Range(0.5f, 1.0f);
}
new FireSource(pt.item.Position);
}
}