Reactor temperature has to stay above the meltdown temperature for 30 seconds before it explodes. The reactors now also have an output connection that sends out a signal when the temperature is critical. + Added reactor meltdown warning sirens & lights to vanilla subs. Closes #157
This commit is contained in:
@@ -11,6 +11,15 @@ namespace Barotrauma.Items.Components
|
||||
{
|
||||
private GUITickBox autoTempTickBox;
|
||||
|
||||
private const int GraphSize = 25;
|
||||
private float graphTimer;
|
||||
private int updateGraphInterval = 500;
|
||||
|
||||
private float[] fissionRateGraph = new float[GraphSize];
|
||||
private float[] coolingRateGraph = new float[GraphSize];
|
||||
private float[] tempGraph = new float[GraphSize];
|
||||
private float[] loadGraph = new float[GraphSize];
|
||||
|
||||
partial void InitProjSpecific()
|
||||
{
|
||||
var button = new GUIButton(new Rectangle(410, 70, 40, 40), "-", "", GuiFrame);
|
||||
|
||||
@@ -39,6 +39,7 @@
|
||||
<output name="power_out"/>
|
||||
<output name="temperature_out"/>
|
||||
<input name="shutdown"/>
|
||||
<output name="meltdown_warning"/>
|
||||
</ConnectionPanel>
|
||||
|
||||
<ItemContainer capacity="5" canbeselected="true">
|
||||
|
||||
@@ -32,22 +32,13 @@ namespace Barotrauma.Items.Components
|
||||
//turned down and cooling increased
|
||||
private float shutDownTemp;
|
||||
|
||||
private float fireTemp, meltDownTemp;
|
||||
private float fireTemp, meltDownTemp, meltDownDelay;
|
||||
|
||||
private float meltDownTimer;
|
||||
|
||||
//how much power is provided to the grid per 1 temperature unit
|
||||
private float powerPerTemp;
|
||||
|
||||
private int graphSize = 25;
|
||||
|
||||
private float graphTimer;
|
||||
|
||||
private int updateGraphInterval = 500;
|
||||
|
||||
private float[] fissionRateGraph;
|
||||
private float[] coolingRateGraph;
|
||||
private float[] tempGraph;
|
||||
private float[] loadGraph;
|
||||
|
||||
private float load;
|
||||
|
||||
private bool unsentChanges;
|
||||
@@ -67,6 +58,13 @@ namespace Barotrauma.Items.Components
|
||||
}
|
||||
}
|
||||
|
||||
[Serialize(30.0f, true)]
|
||||
public float MeltdownDelay
|
||||
{
|
||||
get { return meltDownDelay; }
|
||||
set { meltDownDelay = Math.Max(value, 0.0f); }
|
||||
}
|
||||
|
||||
[Editable(ToolTip = "The temperature at which the reactor catches fire."), Serialize(9000.0f, true)]
|
||||
public float FireTemp
|
||||
{
|
||||
@@ -155,17 +153,9 @@ namespace Barotrauma.Items.Components
|
||||
public Reactor(Item item, XElement element)
|
||||
: base(item, element)
|
||||
{
|
||||
fissionRateGraph = new float[graphSize];
|
||||
coolingRateGraph = new float[graphSize];
|
||||
tempGraph = new float[graphSize];
|
||||
loadGraph = new float[graphSize];
|
||||
|
||||
shutDownTemp = 500.0f;
|
||||
|
||||
powerPerTemp = 1.0f;
|
||||
|
||||
powerPerTemp = 1.0f;
|
||||
IsActive = true;
|
||||
|
||||
InitProjSpecific();
|
||||
}
|
||||
|
||||
@@ -227,8 +217,19 @@ namespace Barotrauma.Items.Components
|
||||
|
||||
if (temperature > meltDownTemp)
|
||||
{
|
||||
MeltDown();
|
||||
return;
|
||||
item.SendSignal(0, "1", "meltdown_warning", null);
|
||||
meltDownTimer += deltaTime;
|
||||
|
||||
if (meltDownTimer > MeltdownDelay)
|
||||
{
|
||||
MeltDown();
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
item.SendSignal(0, "0", "meltdown_warning", null);
|
||||
meltDownTimer = Math.Max(0.0f, meltDownTimer - deltaTime);
|
||||
}
|
||||
|
||||
load = 0.0f;
|
||||
@@ -326,28 +327,26 @@ namespace Barotrauma.Items.Components
|
||||
|
||||
private void MeltDown()
|
||||
{
|
||||
if (item.Condition <= 0.0f) return;
|
||||
if (item.Condition <= 0.0f || GameMain.Client != null) return;
|
||||
|
||||
GameServer.Log("Reactor meltdown!", ServerLog.MessageType.ItemInteraction);
|
||||
|
||||
|
||||
item.Condition = 0.0f;
|
||||
|
||||
var containedItems = item.ContainedItems;
|
||||
if (containedItems == null) return;
|
||||
|
||||
foreach (Item containedItem in item.ContainedItems)
|
||||
if (containedItems != null)
|
||||
{
|
||||
if (containedItem == null) continue;
|
||||
containedItem.Condition = 0.0f;
|
||||
}
|
||||
|
||||
if (GameMain.Server != null)
|
||||
{
|
||||
if (GameMain.Server.ConnectedClients.Contains(BlameOnBroken))
|
||||
foreach (Item containedItem in containedItems)
|
||||
{
|
||||
BlameOnBroken.Karma = 0.0f;
|
||||
if (containedItem == null) continue;
|
||||
containedItem.Condition = 0.0f;
|
||||
}
|
||||
}
|
||||
|
||||
if (GameMain.Server != null && GameMain.Server.ConnectedClients.Contains(BlameOnBroken))
|
||||
{
|
||||
BlameOnBroken.Karma = 0.0f;
|
||||
}
|
||||
}
|
||||
|
||||
public override bool Pick(Character picker)
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user