- Input field for rects.

- Input fields for ItemComponent requiredItems.
- Added tooltips to a bunch of editable ItemComponent properties.
- Misc fixes.
This commit is contained in:
Joonas Rikkonen
2017-11-13 20:55:07 +02:00
parent f7298c241e
commit b3769b383a
17 changed files with 176 additions and 230 deletions
@@ -112,24 +112,12 @@ namespace Barotrauma.Items.Components
}
[Serialize("0.0,0.0,0.0,0.0", false)]
public string Window
{
get { return XMLExtensions.Vector4ToString(new Vector4(window.X, window.Y, window.Width, window.Height)); }
set
{
Vector4 vector = XMLExtensions.ParseVector4(value);
if (vector.Z != 0.0f || vector.W != 0.0f)
{
window = new Rectangle((int)vector.X, (int)vector.Y, (int)vector.Z, (int)vector.W);
}
}
}
public Rectangle WindowRect
public Rectangle Window
{
get { return window; }
set { window = value; }
}
[Editable, Serialize(false, true)]
public bool IsOpen
{
@@ -12,18 +12,9 @@ namespace Barotrauma.Items.Components
private float targetForce;
private float maxForce;
//[Editable, HasDefaultValue(1.0f, true)]
//public float PowerPerForce
//{
// get { return powerPerForce; }
// set
// {
// powerPerForce = Math.Max(0.0f, value);
// }
//}
[Editable, Serialize(2000.0f, true)]
[Editable(0.0f, 10000000.0f, ToolTip = "The amount of force exerted on the submarine when the engine is operating at full power."),
Serialize(2000.0f, true)]
public float MaxForce
{
get { return maxForce; }
@@ -16,21 +16,21 @@ namespace Barotrauma.Items.Components
bool hasPower;
[Editable, Serialize(false, true)]
[Editable(ToolTip = "Does the machine require inputs from water detectors in order to show the water levels inside rooms."), Serialize(false, true)]
public bool RequireWaterDetectors
{
get;
set;
}
[Editable, Serialize(true, true)]
[Editable(ToolTip = "Does the machine require inputs from oxygen detectors in order to show the oxygen levels inside rooms."), Serialize(true, true)]
public bool RequireOxygenDetectors
{
get;
set;
}
[Editable, Serialize(false, true)]
[Editable(ToolTip = "Should damaged walls be displayed by the machine."), Serialize(false, true)]
public bool ShowHullIntegrity
{
get;
@@ -8,28 +8,23 @@ namespace Barotrauma.Items.Components
{
class OxygenGenerator : Powered
{
float powerDownTimer;
private float powerDownTimer;
bool running;
private bool running;
private float generatedAmount;
List<Vent> ventList;
private List<Vent> ventList;
private float totalHullVolume;
public bool IsRunning()
{
return (running && item.Condition>0.0f);
}
public float CurrFlow
{
get;
private set;
}
[Editable, Serialize(100.0f, true)]
[Editable(ToolTip = "How much oxygen the machine generates when operating at full power."), Serialize(100.0f, true)]
public float GeneratedAmount
{
get { return generatedAmount; }
@@ -40,8 +35,6 @@ namespace Barotrauma.Items.Components
: base(item, element)
{
IsActive = true;
//item.linkedTo.CollectionChanged += delegate { GetVents(); };
}
public override void Update(float deltaTime, Camera cam)
@@ -66,7 +59,7 @@ namespace Barotrauma.Items.Components
running = true;
CurrFlow = Math.Min(voltage, 1.0f) * generatedAmount*100.0f;
CurrFlow = Math.Min(voltage, 1.0f) * generatedAmount * 100.0f;
//item.CurrentHull.Oxygen += CurrFlow * deltaTime;
UpdateVents(CurrFlow);
@@ -54,7 +54,7 @@ namespace Barotrauma.Items.Components
private float? nextServerLogWriteTime;
private float lastServerLogWriteTime;
[Editable, Serialize(9500.0f, true)]
[Editable(ToolTip = "The temperature at which the reactor melts down."), Serialize(9500.0f, true)]
public float MeltDownTemp
{
get { return meltDownTemp; }
@@ -64,7 +64,7 @@ namespace Barotrauma.Items.Components
}
}
[Editable, Serialize(9000.0f, true)]
[Editable(ToolTip = "The temperature at which the reactor catches fire."), Serialize(9000.0f, true)]
public float FireTemp
{
get { return fireTemp; }
@@ -74,7 +74,7 @@ namespace Barotrauma.Items.Components
}
}
[Editable, Serialize(1.0f, true)]
[Editable(0.0f, float.MaxValue, ToolTip = "How much power (kW) the reactor generates relative to it's operating temperature (kW per one degree Celsius)."), Serialize(1.0f, true)]
public float PowerPerTemp
{
get { return powerPerTemp; }
@@ -67,7 +67,8 @@ namespace Barotrauma.Items.Components
}
}
[Editable, Serialize(0.5f, true)]
[Editable(0.0f, 1.0f, ToolTip = "How full the ballast tanks should be when the submarine is not being steered upwards/downwards."
+" Can be used to compensate if the ballast tanks are too large/small relative to the size of the submarine."), Serialize(0.5f, true)]
public float NeutralBallastLevel
{
get { return neutralBallastLevel; }
@@ -32,14 +32,15 @@ namespace Barotrauma.Items.Components
private set;
}
[Editable, Serialize(10.0f, true)]
[Editable(ToolTip = "Maximum output of the device when fully charged (kW)."), Serialize(10.0f, true)]
public float MaxOutPut
{
set { maxOutput = value; }
get { return maxOutput; }
}
[Serialize(10.0f, true), Editable]
[Serialize(10.0f, true), Editable(ToolTip = "The maximum capacity of the device (kW * min). "+
"For example, a value of 1000 means the device can output 100 kilowatts of power for 10 minutes, or 1000 kilowatts for 1 minute.")]
public float Capacity
{
get { return capacity; }
@@ -75,7 +76,8 @@ namespace Barotrauma.Items.Components
}
}
[Serialize(10.0f, false), Editable]
[Serialize(10.0f, false), Editable(ToolTip = "How fast the device can be recharged. "+
"For example, a recharge speed of 100 kW and a capacity of 1000 kW*min would mean it takes 10 minutes to fully charge the device.")]
public float MaxRechargeSpeed
{
get { return maxRechargeSpeed; }
@@ -18,14 +18,16 @@ namespace Barotrauma.Items.Components
//the maximum amount of power the item can draw from connected items
protected float powerConsumption;
[Editable, Serialize(0.5f, true)]
[Serialize(0.5f, true), Editable(ToolTip = "The minimum voltage required for the device to function. "+
"The voltage is calculated as power / powerconsumption, meaning that a device "+
"with a power consumption of 1000 kW would need at least 500 kW of power to work if the minimum voltage is set to 0.5.")]
public float MinVoltage
{
get { return minVoltage; }
set { minVoltage = value; }
}
[Editable, Serialize(0.0f, true)]
[Editable(ToolTip = "How much power the device draws (or attempts to draw) from the electrical grid."), Serialize(0.0f, true)]
public float PowerConsumption
{
get { return powerConsumption; }
@@ -33,12 +35,12 @@ namespace Barotrauma.Items.Components
}
[Serialize(false,true)]
[Serialize(false, true)]
public override bool IsActive
{
get { return base.IsActive; }
set
{
set
{
base.IsActive = value;
if (!value) currPowerConsumption = 0.0f;
}
@@ -21,7 +21,7 @@ namespace Barotrauma.Items.Components
private bool castShadows;
[Editable, Serialize(100.0f, true)]
[Editable(0.0f, 2048.0f), Serialize(100.0f, true)]
public float Range
{
get { return range; }
@@ -31,7 +31,8 @@ namespace Barotrauma.Items.Components
}
}
[Editable, Serialize(true, true)]
[Editable(ToolTip = "Should structures cast shadows when light from this light source hits them. "+
"Disabling shadows increases the performance of the game, and is recommended for lights with a short range."), Serialize(true, true)]
public bool CastShadows
{
get { return castShadows; }
@@ -31,7 +31,7 @@ namespace Barotrauma.Items.Components
}
}
[Editable, Serialize(false, false)]
[Editable(ToolTip = "If enabled, any signals received by the item are displayed as chat messages in the chatbox of the player holding the item."), Serialize(false, false)]
public bool LinkToChat
{
get;
@@ -49,20 +49,7 @@ namespace Barotrauma.Items.Components
{
return HasRequiredContainedItems(true);
}
/*public void Transmit(string signal)
{
if (!CanTransmit()) return;
var receivers = GetReceiversInRange();
foreach (WifiComponent w in receivers)
{
var connections = w.item.Connections;
w.ReceiveSignal(1, signal, connections == null ? null : connections.Find(c => c.Name == "signal_in"), item, null);
}
}*/
private List<WifiComponent> GetReceiversInRange()
{
return list.FindAll(w => w != this && w.CanReceive(this));