Unstable 0.17.0.0
This commit is contained in:
@@ -4,10 +4,12 @@ namespace Barotrauma.Items.Components
|
||||
{
|
||||
class OxygenDetector : ItemComponent
|
||||
{
|
||||
public const int LowOxygenPercentage = 35;
|
||||
|
||||
private int prevSentOxygenValue;
|
||||
private string oxygenSignal;
|
||||
|
||||
public OxygenDetector(Item item, XElement element)
|
||||
public OxygenDetector(Item item, ContentXElement element)
|
||||
: base (item, element)
|
||||
{
|
||||
IsActive = true;
|
||||
@@ -17,13 +19,15 @@ namespace Barotrauma.Items.Components
|
||||
{
|
||||
if (item.CurrentHull == null) { return; }
|
||||
|
||||
if (prevSentOxygenValue != (int)item.CurrentHull.OxygenPercentage || oxygenSignal == null)
|
||||
int currOxygenPercentage = (int)item.CurrentHull.OxygenPercentage;
|
||||
if (prevSentOxygenValue != currOxygenPercentage || oxygenSignal == null)
|
||||
{
|
||||
prevSentOxygenValue = (int)item.CurrentHull.OxygenPercentage;
|
||||
prevSentOxygenValue = currOxygenPercentage;
|
||||
oxygenSignal = prevSentOxygenValue.ToString();
|
||||
}
|
||||
|
||||
item.SendSignal(oxygenSignal, "signal_out");
|
||||
item.SendSignal(oxygenSignal, "signal_out");
|
||||
item.SendSignal(currOxygenPercentage <= LowOxygenPercentage ? "1" : "0", "low_oxygen");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user