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);
}
}
+5 -5
View File
@@ -18,7 +18,7 @@ namespace Barotrauma
public enum ActionType
{
OnPicked, OnWearing, OnContaining, OnContained, OnActive, OnUse, OnFailure, OnBroken
OnPicked, OnWearing, OnContaining, OnContained, OnActive, OnUse, OnFailure, OnBroken, OnFire
}
class Item : MapEntity, IDamageable, IPropertyObject
@@ -148,10 +148,10 @@ namespace Barotrauma
}
}
//public override AITarget AiTarget
//{
// get { return aiTarget; }
//}
public bool FireProof
{
get { return prefab.FireProof; }
}
public bool Updated
{
+4
View File
@@ -31,6 +31,8 @@ namespace Barotrauma
//the construction can be Activated() by a Character inside the area
public List<Rectangle> Triggers;
public readonly bool FireProof;
public string ConfigFile
{
get { return configFile; }
@@ -171,6 +173,8 @@ namespace Barotrauma
offsetOnSelected = ToolBox.GetAttributeFloat(element, "offsetonselected", 0.0f);
FireProof = ToolBox.GetAttributeBool(element, "fireproof", false);
string spriteColorStr = ToolBox.GetAttributeString(element, "spritecolor", "1.0,1.0,1.0,1.0");
SpriteColor = new Color(ToolBox.ParseToVector4(spriteColorStr));