Working on improving the serialization system and ObjectProperty/IPropertyObject (TODO: come up with better names). The plan is to:
- Add support for some of the most common types (vectors, colors, rects) so there's no need to parse the values in the setters of the serializable properties (see Holdable.HoldPos for example). - Make a generic version of the item editing HUD that can be used on any IPropertyObject. Should make it easier to implement things like the character editor, editing structure properties, particle editor, etc. - Improve the interface of the editing HUD. Instead of having to type in a string value into a textbox, there should be number input fields for numeric properties, sliders for properties that only accept a range of values, a color picker, etc. And tooltips.
This commit is contained in:
@@ -47,21 +47,21 @@ namespace Barotrauma.Items.Components
|
||||
set { dockingDir = value; }
|
||||
}
|
||||
|
||||
[HasDefaultValue("32.0,32.0", false)]
|
||||
public string DistanceTolerance
|
||||
[SerializableProperty("32.0,32.0", false)]
|
||||
public Vector2 DistanceTolerance
|
||||
{
|
||||
get { return XMLExtensions.Vector2ToString(distanceTolerance); }
|
||||
set { distanceTolerance = XMLExtensions.ParseToVector2(value); }
|
||||
get { return distanceTolerance; }
|
||||
set { distanceTolerance = value; }
|
||||
}
|
||||
|
||||
[HasDefaultValue(32.0f, false)]
|
||||
[SerializableProperty(32.0f, false)]
|
||||
public float DockedDistance
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
[HasDefaultValue(true, false)]
|
||||
[SerializableProperty(true, false)]
|
||||
public bool IsHorizontal
|
||||
{
|
||||
get;
|
||||
|
||||
@@ -111,7 +111,7 @@ namespace Barotrauma.Items.Components
|
||||
}
|
||||
}
|
||||
|
||||
[HasDefaultValue("0.0,0.0,0.0,0.0", false)]
|
||||
[SerializableProperty("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)); }
|
||||
@@ -130,7 +130,7 @@ namespace Barotrauma.Items.Components
|
||||
get { return window; }
|
||||
}
|
||||
|
||||
[Editable, HasDefaultValue(false, true)]
|
||||
[Editable, SerializableProperty(false, true)]
|
||||
public bool IsOpen
|
||||
{
|
||||
get { return isOpen; }
|
||||
|
||||
@@ -29,49 +29,49 @@ namespace Barotrauma.Items.Components
|
||||
//the angle in which the Character holds the item
|
||||
protected float holdAngle;
|
||||
|
||||
[HasDefaultValue(false, true)]
|
||||
[SerializableProperty(false, true)]
|
||||
public bool Attached
|
||||
{
|
||||
get { return attached && item.ParentInventory == null; }
|
||||
set { attached = value; }
|
||||
}
|
||||
|
||||
[HasDefaultValue(false, false)]
|
||||
[SerializableProperty(false, false)]
|
||||
public bool ControlPose
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
[HasDefaultValue(false, false)]
|
||||
[SerializableProperty(false, false)]
|
||||
public bool Attachable
|
||||
{
|
||||
get { return attachable; }
|
||||
set { attachable = value; }
|
||||
}
|
||||
|
||||
[HasDefaultValue(false, false)]
|
||||
[SerializableProperty(false, false)]
|
||||
public bool AttachedByDefault
|
||||
{
|
||||
get { return attachedByDefault; }
|
||||
set { attachedByDefault = value; }
|
||||
}
|
||||
|
||||
[HasDefaultValue("0.0,0.0", false)]
|
||||
public string HoldPos
|
||||
[SerializableProperty("0.0,0.0", false)]
|
||||
public Vector2 HoldPos
|
||||
{
|
||||
get { return XMLExtensions.Vector2ToString(ConvertUnits.ToDisplayUnits(holdPos)); }
|
||||
set { holdPos = ConvertUnits.ToSimUnits(XMLExtensions.ParseToVector2(value)); }
|
||||
get { return ConvertUnits.ToDisplayUnits(holdPos); }
|
||||
set { holdPos = ConvertUnits.ToSimUnits(value); }
|
||||
}
|
||||
|
||||
[HasDefaultValue("0.0,0.0", false)]
|
||||
public string AimPos
|
||||
[SerializableProperty("0.0,0.0", false)]
|
||||
public Vector2 AimPos
|
||||
{
|
||||
get { return XMLExtensions.Vector2ToString(ConvertUnits.ToDisplayUnits(aimPos)); }
|
||||
set { aimPos = ConvertUnits.ToSimUnits(XMLExtensions.ParseToVector2(value)); }
|
||||
get { return ConvertUnits.ToDisplayUnits(aimPos); }
|
||||
set { aimPos = ConvertUnits.ToSimUnits(value); }
|
||||
}
|
||||
|
||||
[HasDefaultValue(0.0f, false)]
|
||||
[SerializableProperty(0.0f, false)]
|
||||
public float HoldAngle
|
||||
{
|
||||
get { return MathHelper.ToDegrees(holdAngle); }
|
||||
|
||||
@@ -24,14 +24,14 @@ namespace Barotrauma.Items.Components
|
||||
|
||||
private float reloadTimer;
|
||||
|
||||
[HasDefaultValue(0.0f, false)]
|
||||
[SerializableProperty(0.0f, false)]
|
||||
public float Range
|
||||
{
|
||||
get { return ConvertUnits.ToDisplayUnits(range); }
|
||||
set { range = ConvertUnits.ToSimUnits(value); }
|
||||
}
|
||||
|
||||
[HasDefaultValue(0.5f, false)]
|
||||
[SerializableProperty(0.5f, false)]
|
||||
public float Reload
|
||||
{
|
||||
get { return reload; }
|
||||
|
||||
@@ -22,7 +22,7 @@ namespace Barotrauma.Items.Components
|
||||
|
||||
private UsableIn usableIn;
|
||||
|
||||
[HasDefaultValue(0.0f, false)]
|
||||
[SerializableProperty(0.0f, false)]
|
||||
public float Force
|
||||
{
|
||||
get { return force; }
|
||||
@@ -30,7 +30,7 @@ namespace Barotrauma.Items.Components
|
||||
}
|
||||
|
||||
#if CLIENT
|
||||
[HasDefaultValue("", false)]
|
||||
[SerializableProperty("", false)]
|
||||
public string Particles
|
||||
{
|
||||
get { return particles; }
|
||||
|
||||
@@ -13,28 +13,28 @@ namespace Barotrauma.Items.Components
|
||||
|
||||
private Vector2 barrelPos;
|
||||
|
||||
[HasDefaultValue("0.0,0.0", false)]
|
||||
[SerializableProperty("0.0,0.0", false)]
|
||||
public string BarrelPos
|
||||
{
|
||||
get { return XMLExtensions.Vector2ToString(ConvertUnits.ToDisplayUnits(barrelPos)); }
|
||||
set { barrelPos = ConvertUnits.ToSimUnits(XMLExtensions.ParseToVector2(value)); }
|
||||
}
|
||||
|
||||
[HasDefaultValue(1.0f, false)]
|
||||
[SerializableProperty(1.0f, false)]
|
||||
public float Reload
|
||||
{
|
||||
get { return reload; }
|
||||
set { reload = Math.Max(value, 0.0f); }
|
||||
}
|
||||
|
||||
[HasDefaultValue(0.0f, false)]
|
||||
[SerializableProperty(0.0f, false)]
|
||||
public float Spread
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
[HasDefaultValue(0.0f, false)]
|
||||
[SerializableProperty(0.0f, false)]
|
||||
public float UnskilledSpread
|
||||
{
|
||||
get;
|
||||
|
||||
@@ -21,48 +21,48 @@ namespace Barotrauma.Items.Components
|
||||
|
||||
private float activeTimer;
|
||||
|
||||
[HasDefaultValue(0.0f, false)]
|
||||
[SerializableProperty(0.0f, false)]
|
||||
public float Range
|
||||
{
|
||||
get { return range; }
|
||||
set { range = value; }
|
||||
}
|
||||
|
||||
[HasDefaultValue(0.0f, false)]
|
||||
[SerializableProperty(0.0f, false)]
|
||||
public float StructureFixAmount
|
||||
{
|
||||
get; set;
|
||||
}
|
||||
|
||||
[HasDefaultValue(0.0f, false)]
|
||||
[SerializableProperty(0.0f, false)]
|
||||
public float LimbFixAmount
|
||||
{
|
||||
get; set;
|
||||
}
|
||||
[HasDefaultValue(0.0f, false)]
|
||||
[SerializableProperty(0.0f, false)]
|
||||
public float ExtinquishAmount
|
||||
{
|
||||
get; set;
|
||||
}
|
||||
|
||||
[HasDefaultValue("", false)]
|
||||
[SerializableProperty("", false)]
|
||||
public string Particles
|
||||
{
|
||||
get { return particles; }
|
||||
set { particles = value; }
|
||||
}
|
||||
|
||||
[HasDefaultValue(0.0f, false)]
|
||||
[SerializableProperty(0.0f, false)]
|
||||
public float ParticleSpeed
|
||||
{
|
||||
get; set;
|
||||
}
|
||||
|
||||
[HasDefaultValue("0.0,0.0", false)]
|
||||
public string BarrelPos
|
||||
[SerializableProperty("0.0,0.0", false)]
|
||||
public Vector2 BarrelPos
|
||||
{
|
||||
get { return XMLExtensions.Vector2ToString(barrelPos); }
|
||||
set { barrelPos = XMLExtensions.ParseToVector2(value); }
|
||||
get { return barrelPos; }
|
||||
set { barrelPos = value; }
|
||||
}
|
||||
|
||||
public Vector2 TransformedBarrelPos
|
||||
|
||||
@@ -12,7 +12,7 @@ namespace Barotrauma.Items.Components
|
||||
|
||||
bool throwing;
|
||||
|
||||
[HasDefaultValue(1.0f, false)]
|
||||
[SerializableProperty(1.0f, false)]
|
||||
public float ThrowForce
|
||||
{
|
||||
get { return throwForce; }
|
||||
|
||||
@@ -47,7 +47,7 @@ namespace Barotrauma.Items.Components
|
||||
|
||||
private string msg;
|
||||
|
||||
[HasDefaultValue(0.0f, false)]
|
||||
[SerializableProperty(0.0f, false)]
|
||||
public float PickingTime
|
||||
{
|
||||
get;
|
||||
@@ -103,21 +103,21 @@ namespace Barotrauma.Items.Components
|
||||
}
|
||||
}
|
||||
|
||||
[HasDefaultValue(false, false)]
|
||||
[SerializableProperty(false, false)]
|
||||
public bool CanBePicked
|
||||
{
|
||||
get { return canBePicked; }
|
||||
set { canBePicked = value; }
|
||||
}
|
||||
|
||||
[HasDefaultValue(false, false)]
|
||||
[SerializableProperty(false, false)]
|
||||
public bool DrawHudWhenEquipped
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
}
|
||||
|
||||
[HasDefaultValue(false, false)]
|
||||
[SerializableProperty(false, false)]
|
||||
public bool CanBeSelected
|
||||
{
|
||||
get { return canBeSelected; }
|
||||
@@ -136,7 +136,7 @@ namespace Barotrauma.Items.Components
|
||||
protected set;
|
||||
}
|
||||
|
||||
[HasDefaultValue(false, false)]
|
||||
[SerializableProperty(false, false)]
|
||||
public bool DeleteOnUse
|
||||
{
|
||||
get;
|
||||
@@ -153,7 +153,7 @@ namespace Barotrauma.Items.Components
|
||||
get { return name; }
|
||||
}
|
||||
|
||||
[HasDefaultValue("", false)]
|
||||
[SerializableProperty("", false)]
|
||||
public string Msg
|
||||
{
|
||||
get { return msg; }
|
||||
@@ -205,7 +205,7 @@ namespace Barotrauma.Items.Components
|
||||
DebugConsole.ThrowError("Invalid pick key in " + element + "!", e);
|
||||
}
|
||||
|
||||
properties = ObjectProperty.InitProperties(this, element);
|
||||
properties = ObjectProperty.DeserializeProperties(this, element);
|
||||
|
||||
foreach (XElement subElement in element.Elements())
|
||||
{
|
||||
@@ -586,7 +586,7 @@ namespace Barotrauma.Items.Components
|
||||
componentElement.Add(newElement);
|
||||
}
|
||||
|
||||
ObjectProperty.SaveProperties(this, componentElement);
|
||||
ObjectProperty.SerializeProperties(this, componentElement);
|
||||
|
||||
parentElement.Add(componentElement);
|
||||
return componentElement;
|
||||
|
||||
@@ -18,7 +18,7 @@ namespace Barotrauma.Items.Components
|
||||
private ushort[] itemIds;
|
||||
|
||||
//how many items can be contained
|
||||
[HasDefaultValue(5, false)]
|
||||
[SerializableProperty(5, false)]
|
||||
public int Capacity
|
||||
{
|
||||
get { return capacity; }
|
||||
@@ -26,7 +26,7 @@ namespace Barotrauma.Items.Components
|
||||
}
|
||||
private int capacity;
|
||||
|
||||
[HasDefaultValue(true, false)]
|
||||
[SerializableProperty(true, false)]
|
||||
public bool HideItems
|
||||
{
|
||||
get { return hideItems; }
|
||||
@@ -38,7 +38,7 @@ namespace Barotrauma.Items.Components
|
||||
}
|
||||
private bool hideItems;
|
||||
|
||||
[HasDefaultValue(false, false)]
|
||||
[SerializableProperty(false, false)]
|
||||
public bool DrawInventory
|
||||
{
|
||||
get { return drawInventory; }
|
||||
@@ -47,24 +47,24 @@ namespace Barotrauma.Items.Components
|
||||
private bool drawInventory;
|
||||
|
||||
//the position of the first item in the container
|
||||
[HasDefaultValue("0.0,0.0", false)]
|
||||
public string ItemPos
|
||||
[SerializableProperty("0.0,0.0", false)]
|
||||
public Vector2 ItemPos
|
||||
{
|
||||
get { return XMLExtensions.Vector2ToString(itemPos); }
|
||||
set { itemPos = XMLExtensions.ParseToVector2(value); }
|
||||
get { return itemPos; }
|
||||
set { itemPos = value; }
|
||||
}
|
||||
private Vector2 itemPos;
|
||||
|
||||
//item[i].Pos = itemPos + itemInterval*i
|
||||
[HasDefaultValue("0.0,0.0", false)]
|
||||
public string ItemInterval
|
||||
[SerializableProperty("0.0,0.0", false)]
|
||||
public Vector2 ItemInterval
|
||||
{
|
||||
get { return XMLExtensions.Vector2ToString(itemInterval); }
|
||||
set { itemInterval = XMLExtensions.ParseToVector2(value); }
|
||||
get { return itemInterval; }
|
||||
set { itemInterval = value; }
|
||||
}
|
||||
private Vector2 itemInterval;
|
||||
|
||||
[HasDefaultValue(0.0f, false)]
|
||||
[SerializableProperty(0.0f, false)]
|
||||
public float ItemRotation
|
||||
{
|
||||
get { return MathHelper.ToDegrees(itemRotation); }
|
||||
@@ -73,19 +73,18 @@ namespace Barotrauma.Items.Components
|
||||
private float itemRotation;
|
||||
|
||||
|
||||
[HasDefaultValue("0.5,0.9", false)]
|
||||
public string HudPos
|
||||
[SerializableProperty("0.5,0.9", false)]
|
||||
public Vector2 HudPos
|
||||
{
|
||||
get { return XMLExtensions.Vector2ToString(hudPos); }
|
||||
get { return hudPos; }
|
||||
set
|
||||
{
|
||||
hudPos = XMLExtensions.ParseToVector2(value);
|
||||
//inventory.CenterPos = hudPos;
|
||||
hudPos = value;
|
||||
}
|
||||
}
|
||||
private Vector2 hudPos;
|
||||
|
||||
[HasDefaultValue(5, false)]
|
||||
[SerializableProperty(5, false)]
|
||||
public int SlotsPerRow
|
||||
{
|
||||
get { return slotsPerRow; }
|
||||
|
||||
@@ -23,7 +23,7 @@ namespace Barotrauma.Items.Components
|
||||
// }
|
||||
//}
|
||||
|
||||
[Editable, HasDefaultValue(2000.0f, true)]
|
||||
[Editable, SerializableProperty(2000.0f, true)]
|
||||
public float MaxForce
|
||||
{
|
||||
get { return maxForce; }
|
||||
|
||||
@@ -16,21 +16,21 @@ namespace Barotrauma.Items.Components
|
||||
|
||||
bool hasPower;
|
||||
|
||||
[Editable, HasDefaultValue(false, true)]
|
||||
[Editable, SerializableProperty(false, true)]
|
||||
public bool RequireWaterDetectors
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
[Editable, HasDefaultValue(true, true)]
|
||||
[Editable, SerializableProperty(true, true)]
|
||||
public bool RequireOxygenDetectors
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
[Editable, HasDefaultValue(false, true)]
|
||||
[Editable, SerializableProperty(false, true)]
|
||||
public bool ShowHullIntegrity
|
||||
{
|
||||
get;
|
||||
|
||||
@@ -29,7 +29,7 @@ namespace Barotrauma.Items.Components
|
||||
private set;
|
||||
}
|
||||
|
||||
[Editable, HasDefaultValue(100.0f, true)]
|
||||
[Editable, SerializableProperty(100.0f, true)]
|
||||
public float GeneratedAmount
|
||||
{
|
||||
get { return generatedAmount; }
|
||||
|
||||
@@ -15,7 +15,7 @@ namespace Barotrauma.Items.Components
|
||||
|
||||
public Hull hull1;
|
||||
|
||||
[HasDefaultValue(0.0f, true)]
|
||||
[SerializableProperty(0.0f, true)]
|
||||
public float FlowPercentage
|
||||
{
|
||||
get { return flowPercentage; }
|
||||
@@ -27,7 +27,7 @@ namespace Barotrauma.Items.Components
|
||||
}
|
||||
}
|
||||
|
||||
[HasDefaultValue(80.0f, false)]
|
||||
[SerializableProperty(80.0f, false)]
|
||||
public float MaxFlow
|
||||
{
|
||||
get { return maxFlow; }
|
||||
|
||||
@@ -26,14 +26,14 @@ namespace Barotrauma.Items.Components
|
||||
|
||||
private float displayBorderSize;
|
||||
|
||||
[HasDefaultValue(10000.0f, false)]
|
||||
[SerializableProperty(10000.0f, false)]
|
||||
public float Range
|
||||
{
|
||||
get { return range; }
|
||||
set { range = MathHelper.Clamp(value, 0.0f, 100000.0f); }
|
||||
}
|
||||
|
||||
[HasDefaultValue(false, false)]
|
||||
[SerializableProperty(false, false)]
|
||||
public bool DetectSubmarineWalls
|
||||
{
|
||||
get;
|
||||
|
||||
@@ -54,7 +54,7 @@ namespace Barotrauma.Items.Components
|
||||
private float? nextServerLogWriteTime;
|
||||
private float lastServerLogWriteTime;
|
||||
|
||||
[Editable, HasDefaultValue(9500.0f, true)]
|
||||
[Editable, SerializableProperty(9500.0f, true)]
|
||||
public float MeltDownTemp
|
||||
{
|
||||
get { return meltDownTemp; }
|
||||
@@ -64,7 +64,7 @@ namespace Barotrauma.Items.Components
|
||||
}
|
||||
}
|
||||
|
||||
[Editable, HasDefaultValue(9000.0f, true)]
|
||||
[Editable, SerializableProperty(9000.0f, true)]
|
||||
public float FireTemp
|
||||
{
|
||||
get { return fireTemp; }
|
||||
@@ -74,7 +74,7 @@ namespace Barotrauma.Items.Components
|
||||
}
|
||||
}
|
||||
|
||||
[Editable, HasDefaultValue(1.0f, true)]
|
||||
[Editable, SerializableProperty(1.0f, true)]
|
||||
public float PowerPerTemp
|
||||
{
|
||||
get { return powerPerTemp; }
|
||||
@@ -84,7 +84,7 @@ namespace Barotrauma.Items.Components
|
||||
}
|
||||
}
|
||||
|
||||
[HasDefaultValue(0.0f, true)]
|
||||
[SerializableProperty(0.0f, true)]
|
||||
public float FissionRate
|
||||
{
|
||||
get { return fissionRate; }
|
||||
@@ -95,7 +95,7 @@ namespace Barotrauma.Items.Components
|
||||
}
|
||||
}
|
||||
|
||||
[HasDefaultValue(0.0f, true)]
|
||||
[SerializableProperty(0.0f, true)]
|
||||
public float CoolingRate
|
||||
{
|
||||
get { return coolingRate; }
|
||||
@@ -106,7 +106,7 @@ namespace Barotrauma.Items.Components
|
||||
}
|
||||
}
|
||||
|
||||
[HasDefaultValue(0.0f, true)]
|
||||
[SerializableProperty(0.0f, true)]
|
||||
public float Temperature
|
||||
{
|
||||
get { return temperature; }
|
||||
@@ -122,7 +122,7 @@ namespace Barotrauma.Items.Components
|
||||
return (temperature > 0.0f);
|
||||
}
|
||||
|
||||
[HasDefaultValue(false, true)]
|
||||
[SerializableProperty(false, true)]
|
||||
public bool AutoTemp
|
||||
{
|
||||
get { return autoTemp; }
|
||||
@@ -139,7 +139,7 @@ namespace Barotrauma.Items.Components
|
||||
|
||||
public float AvailableFuel { get; set; }
|
||||
|
||||
[HasDefaultValue(500.0f, true)]
|
||||
[SerializableProperty(500.0f, true)]
|
||||
public float ShutDownTemp
|
||||
{
|
||||
get { return shutDownTemp; }
|
||||
|
||||
@@ -67,7 +67,7 @@ namespace Barotrauma.Items.Components
|
||||
}
|
||||
}
|
||||
|
||||
[Editable, HasDefaultValue(0.5f, true)]
|
||||
[Editable, SerializableProperty(0.5f, true)]
|
||||
public float NeutralBallastLevel
|
||||
{
|
||||
get { return neutralBallastLevel; }
|
||||
|
||||
@@ -32,21 +32,21 @@ namespace Barotrauma.Items.Components
|
||||
private set;
|
||||
}
|
||||
|
||||
[Editable, HasDefaultValue(10.0f, true)]
|
||||
[Editable, SerializableProperty(10.0f, true)]
|
||||
public float MaxOutPut
|
||||
{
|
||||
set { maxOutput = value; }
|
||||
get { return maxOutput; }
|
||||
}
|
||||
|
||||
[HasDefaultValue(10.0f, true), Editable]
|
||||
[SerializableProperty(10.0f, true), Editable]
|
||||
public float Capacity
|
||||
{
|
||||
get { return capacity; }
|
||||
set { capacity = Math.Max(value, 1.0f); }
|
||||
}
|
||||
|
||||
[Editable, HasDefaultValue(0.0f, true)]
|
||||
[Editable, SerializableProperty(0.0f, true)]
|
||||
public float Charge
|
||||
{
|
||||
get { return charge; }
|
||||
@@ -63,7 +63,7 @@ namespace Barotrauma.Items.Components
|
||||
}
|
||||
}
|
||||
|
||||
[HasDefaultValue(10.0f, true), Editable]
|
||||
[SerializableProperty(10.0f, true), Editable]
|
||||
public float RechargeSpeed
|
||||
{
|
||||
get { return rechargeSpeed; }
|
||||
@@ -75,7 +75,7 @@ namespace Barotrauma.Items.Components
|
||||
}
|
||||
}
|
||||
|
||||
[HasDefaultValue(10.0f, false), Editable]
|
||||
[SerializableProperty(10.0f, false), Editable]
|
||||
public float MaxRechargeSpeed
|
||||
{
|
||||
get { return maxRechargeSpeed; }
|
||||
|
||||
@@ -18,14 +18,14 @@ namespace Barotrauma.Items.Components
|
||||
//the maximum amount of power the item can draw from connected items
|
||||
protected float powerConsumption;
|
||||
|
||||
[Editable, HasDefaultValue(0.5f, true)]
|
||||
[Editable, SerializableProperty(0.5f, true)]
|
||||
public float MinVoltage
|
||||
{
|
||||
get { return minVoltage; }
|
||||
set { minVoltage = value; }
|
||||
}
|
||||
|
||||
[Editable, HasDefaultValue(0.0f, true)]
|
||||
[Editable, SerializableProperty(0.0f, true)]
|
||||
public float PowerConsumption
|
||||
{
|
||||
get { return powerConsumption; }
|
||||
@@ -33,7 +33,7 @@ namespace Barotrauma.Items.Components
|
||||
}
|
||||
|
||||
|
||||
[HasDefaultValue(false,true)]
|
||||
[SerializableProperty(false,true)]
|
||||
public override bool IsActive
|
||||
{
|
||||
get { return base.IsActive; }
|
||||
@@ -44,14 +44,14 @@ namespace Barotrauma.Items.Components
|
||||
}
|
||||
}
|
||||
|
||||
[HasDefaultValue(0.0f, true)]
|
||||
[SerializableProperty(0.0f, true)]
|
||||
public float CurrPowerConsumption
|
||||
{
|
||||
get {return currPowerConsumption; }
|
||||
set { currPowerConsumption = value; }
|
||||
}
|
||||
|
||||
[HasDefaultValue(0.0f, true)]
|
||||
[SerializableProperty(0.0f, true)]
|
||||
public float Voltage
|
||||
{
|
||||
get { return voltage; }
|
||||
|
||||
@@ -23,35 +23,35 @@ namespace Barotrauma.Items.Components
|
||||
|
||||
public Character User;
|
||||
|
||||
[HasDefaultValue(10.0f, false)]
|
||||
[SerializableProperty(10.0f, false)]
|
||||
public float LaunchImpulse
|
||||
{
|
||||
get { return launchImpulse; }
|
||||
set { launchImpulse = value; }
|
||||
}
|
||||
|
||||
[HasDefaultValue(false, false)]
|
||||
[SerializableProperty(false, false)]
|
||||
public bool CharacterUsable
|
||||
{
|
||||
get { return characterUsable; }
|
||||
set { characterUsable = value; }
|
||||
}
|
||||
|
||||
[HasDefaultValue(false, false)]
|
||||
[SerializableProperty(false, false)]
|
||||
public bool DoesStick
|
||||
{
|
||||
get { return doesStick; }
|
||||
set { doesStick = value; }
|
||||
}
|
||||
|
||||
[HasDefaultValue(false, false)]
|
||||
[SerializableProperty(false, false)]
|
||||
public bool Hitscan
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
[HasDefaultValue(false, false)]
|
||||
[SerializableProperty(false, false)]
|
||||
public bool RemoveOnHit
|
||||
{
|
||||
get;
|
||||
|
||||
@@ -13,7 +13,7 @@ namespace Barotrauma.Items.Components
|
||||
//the output is sent if both inputs have received a signal within the timeframe
|
||||
protected float timeFrame;
|
||||
|
||||
[InGameEditable, HasDefaultValue(0.0f, true)]
|
||||
[InGameEditable, SerializableProperty(0.0f, true)]
|
||||
public float TimeFrame
|
||||
{
|
||||
get { return timeFrame; }
|
||||
@@ -23,14 +23,14 @@ namespace Barotrauma.Items.Components
|
||||
}
|
||||
}
|
||||
|
||||
[InGameEditable, HasDefaultValue("1", true)]
|
||||
[InGameEditable, SerializableProperty("1", true)]
|
||||
public string Output
|
||||
{
|
||||
get { return output; }
|
||||
set { output = value; }
|
||||
}
|
||||
|
||||
[InGameEditable, HasDefaultValue("", true)]
|
||||
[InGameEditable, SerializableProperty("", true)]
|
||||
public string FalseOutput
|
||||
{
|
||||
get { return falseOutput; }
|
||||
|
||||
@@ -15,7 +15,7 @@ namespace Barotrauma.Items.Components
|
||||
|
||||
private Queue<Tuple<string, DateTime>> signalQueue;
|
||||
|
||||
[InGameEditable, HasDefaultValue(1.0f, true)]
|
||||
[InGameEditable, SerializableProperty(1.0f, true)]
|
||||
public float Delay
|
||||
{
|
||||
get { return (float)delay.TotalSeconds; }
|
||||
|
||||
@@ -21,7 +21,7 @@ namespace Barotrauma.Items.Components
|
||||
|
||||
private bool castShadows;
|
||||
|
||||
[Editable, HasDefaultValue(100.0f, true)]
|
||||
[Editable, SerializableProperty(100.0f, true)]
|
||||
public float Range
|
||||
{
|
||||
get { return range; }
|
||||
@@ -31,7 +31,7 @@ namespace Barotrauma.Items.Components
|
||||
}
|
||||
}
|
||||
|
||||
[Editable, HasDefaultValue(true, true)]
|
||||
[Editable, SerializableProperty(true, true)]
|
||||
public bool CastShadows
|
||||
{
|
||||
get { return castShadows; }
|
||||
@@ -44,7 +44,7 @@ namespace Barotrauma.Items.Components
|
||||
}
|
||||
}
|
||||
|
||||
[Editable, HasDefaultValue(false, true)]
|
||||
[Editable, SerializableProperty(false, true)]
|
||||
public bool IsOn
|
||||
{
|
||||
get { return IsActive; }
|
||||
@@ -57,7 +57,7 @@ namespace Barotrauma.Items.Components
|
||||
}
|
||||
}
|
||||
|
||||
[HasDefaultValue(0.0f, false)]
|
||||
[SerializableProperty(0.0f, false)]
|
||||
public float Flicker
|
||||
{
|
||||
get { return flicker; }
|
||||
@@ -67,19 +67,11 @@ namespace Barotrauma.Items.Components
|
||||
}
|
||||
}
|
||||
|
||||
[InGameEditable, HasDefaultValue("1.0,1.0,1.0,1.0", true)]
|
||||
public string LightColor
|
||||
[InGameEditable, SerializableProperty("1.0,1.0,1.0,1.0", true)]
|
||||
public Color LightColor
|
||||
{
|
||||
get { return XMLExtensions.Vector4ToString(lightColor.ToVector4(), "0.00"); }
|
||||
set
|
||||
{
|
||||
Vector4 newColor = XMLExtensions.ParseToVector4(value, false);
|
||||
newColor.X = MathHelper.Clamp(newColor.X, 0.0f, 1.0f);
|
||||
newColor.Y = MathHelper.Clamp(newColor.Y, 0.0f, 1.0f);
|
||||
newColor.Z = MathHelper.Clamp(newColor.Z, 0.0f, 1.0f);
|
||||
newColor.W = MathHelper.Clamp(newColor.W, 0.0f, 1.0f);
|
||||
lightColor = new Color(newColor);
|
||||
}
|
||||
get { return lightColor; }
|
||||
set { lightColor = value; }
|
||||
}
|
||||
|
||||
public override void Move(Vector2 amount)
|
||||
@@ -215,7 +207,7 @@ namespace Barotrauma.Items.Components
|
||||
IsActive = (signal != "0");
|
||||
break;
|
||||
case "set_color":
|
||||
LightColor = signal;
|
||||
LightColor = XMLExtensions.ParseToColor(signal, false);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ namespace Barotrauma.Items.Components
|
||||
|
||||
private float updateTimer;
|
||||
|
||||
[InGameEditable, HasDefaultValue(0.0f, true)]
|
||||
[InGameEditable, SerializableProperty(0.0f, true)]
|
||||
public float Range
|
||||
{
|
||||
get { return range; }
|
||||
@@ -27,14 +27,14 @@ namespace Barotrauma.Items.Components
|
||||
}
|
||||
}
|
||||
|
||||
[InGameEditable, HasDefaultValue("1", true)]
|
||||
[InGameEditable, SerializableProperty("1", true)]
|
||||
public string Output
|
||||
{
|
||||
get { return output; }
|
||||
set { output = value; }
|
||||
}
|
||||
|
||||
[InGameEditable, HasDefaultValue("", true)]
|
||||
[InGameEditable, SerializableProperty("", true)]
|
||||
public string FalseOutput
|
||||
{
|
||||
get { return falseOutput; }
|
||||
|
||||
@@ -20,14 +20,14 @@ namespace Barotrauma.Items.Components
|
||||
|
||||
private float phase;
|
||||
|
||||
[InGameEditable, HasDefaultValue(WaveType.Pulse, true)]
|
||||
[InGameEditable, SerializableProperty(WaveType.Pulse, true)]
|
||||
public WaveType OutputType
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
[InGameEditable, HasDefaultValue(1.0f, true)]
|
||||
[InGameEditable, SerializableProperty(1.0f, true)]
|
||||
public float Frequency
|
||||
{
|
||||
get { return frequency; }
|
||||
|
||||
@@ -16,14 +16,14 @@ namespace Barotrauma.Items.Components
|
||||
|
||||
private Regex regex;
|
||||
|
||||
[InGameEditable, HasDefaultValue("1", true)]
|
||||
[InGameEditable, SerializableProperty("1", true)]
|
||||
public string Output
|
||||
{
|
||||
get { return output; }
|
||||
set { output = value; }
|
||||
}
|
||||
|
||||
[InGameEditable, HasDefaultValue("", true)]
|
||||
[InGameEditable, SerializableProperty("", true)]
|
||||
public string Expression
|
||||
{
|
||||
get { return expression; }
|
||||
|
||||
@@ -11,7 +11,7 @@ namespace Barotrauma.Items.Components
|
||||
|
||||
private bool isOn;
|
||||
|
||||
[Editable, HasDefaultValue(1000.0f, true)]
|
||||
[Editable, SerializableProperty(1000.0f, true)]
|
||||
public float MaxPower
|
||||
{
|
||||
get { return maxPower; }
|
||||
@@ -21,7 +21,7 @@ namespace Barotrauma.Items.Components
|
||||
}
|
||||
}
|
||||
|
||||
[Editable, HasDefaultValue(false, true)]
|
||||
[Editable, SerializableProperty(false, true)]
|
||||
public bool IsOn
|
||||
{
|
||||
get
|
||||
|
||||
@@ -8,20 +8,20 @@ namespace Barotrauma.Items.Components
|
||||
|
||||
private string targetSignal;
|
||||
|
||||
[InGameEditable, HasDefaultValue("1", true)]
|
||||
[InGameEditable, SerializableProperty("1", true)]
|
||||
public string Output
|
||||
{
|
||||
get { return output; }
|
||||
set { output = value; }
|
||||
}
|
||||
[InGameEditable, HasDefaultValue("0", true)]
|
||||
[InGameEditable, SerializableProperty("0", true)]
|
||||
public string FalseOutput
|
||||
{
|
||||
get { return falseOutput; }
|
||||
set { falseOutput = value; }
|
||||
}
|
||||
|
||||
[InGameEditable, HasDefaultValue("", true)]
|
||||
[InGameEditable, SerializableProperty("", true)]
|
||||
public string TargetSignal
|
||||
{
|
||||
get { return targetSignal; }
|
||||
|
||||
@@ -14,14 +14,14 @@ namespace Barotrauma.Items.Components
|
||||
|
||||
private int channel;
|
||||
|
||||
[HasDefaultValue(20000.0f, false)]
|
||||
[SerializableProperty(20000.0f, false)]
|
||||
public float Range
|
||||
{
|
||||
get { return range; }
|
||||
set { range = Math.Max(value, 0.0f); }
|
||||
}
|
||||
|
||||
[InGameEditable, HasDefaultValue(1, true)]
|
||||
[InGameEditable, SerializableProperty(1, true)]
|
||||
public int Channel
|
||||
{
|
||||
get { return channel; }
|
||||
@@ -31,7 +31,7 @@ namespace Barotrauma.Items.Components
|
||||
}
|
||||
}
|
||||
|
||||
[Editable, HasDefaultValue(false, false)]
|
||||
[Editable, SerializableProperty(false, false)]
|
||||
public bool LinkToChat
|
||||
{
|
||||
get;
|
||||
|
||||
@@ -26,49 +26,44 @@ namespace Barotrauma.Items.Components
|
||||
|
||||
Camera cam;
|
||||
|
||||
[HasDefaultValue("0,0", false)]
|
||||
public string BarrelPos
|
||||
[SerializableProperty("0,0", false)]
|
||||
public Vector2 BarrelPos
|
||||
{
|
||||
get
|
||||
{
|
||||
return XMLExtensions.Vector2ToString(barrelPos);
|
||||
return barrelPos;
|
||||
}
|
||||
set
|
||||
{
|
||||
barrelPos = XMLExtensions.ParseToVector2(value);
|
||||
barrelPos = value;
|
||||
}
|
||||
}
|
||||
|
||||
[HasDefaultValue(0.0f, false)]
|
||||
[SerializableProperty(0.0f, false)]
|
||||
public float LaunchImpulse
|
||||
{
|
||||
get { return launchImpulse; }
|
||||
set { launchImpulse = value; }
|
||||
}
|
||||
|
||||
[HasDefaultValue(5.0f, false)]
|
||||
[SerializableProperty(5.0f, false)]
|
||||
public float Reload
|
||||
{
|
||||
get { return reloadTime; }
|
||||
set { reloadTime = value; }
|
||||
}
|
||||
|
||||
[HasDefaultValue("0.0,0.0", true), Editable]
|
||||
public string RotationLimits
|
||||
[SerializableProperty("0.0,0.0", true), Editable]
|
||||
public Vector2 RotationLimits
|
||||
{
|
||||
get
|
||||
{
|
||||
Vector2 limits = new Vector2(minRotation, maxRotation);
|
||||
limits.X = MathHelper.ToDegrees(limits.X);
|
||||
limits.Y = MathHelper.ToDegrees(limits.Y);
|
||||
|
||||
return XMLExtensions.Vector2ToString(limits);
|
||||
return new Vector2(MathHelper.ToDegrees(minRotation), MathHelper.ToDegrees(maxRotation));
|
||||
}
|
||||
set
|
||||
{
|
||||
Vector2 vector = XMLExtensions.ParseToVector2(value);
|
||||
minRotation = MathHelper.ToRadians(vector.X);
|
||||
maxRotation = MathHelper.ToRadians(vector.Y);
|
||||
minRotation = MathHelper.ToRadians(value.X);
|
||||
maxRotation = MathHelper.ToRadians(value.Y);
|
||||
|
||||
rotation = (minRotation + maxRotation) / 2;
|
||||
}
|
||||
|
||||
@@ -35,22 +35,21 @@ namespace Barotrauma.Items.Components
|
||||
|
||||
private Vector2 armorSector;
|
||||
|
||||
[HasDefaultValue(0.0f, false)]
|
||||
[SerializableProperty(0.0f, false)]
|
||||
public float ArmorValue
|
||||
{
|
||||
get { return armorValue; }
|
||||
set { armorValue = MathHelper.Clamp(value, 0.0f, 100.0f); }
|
||||
}
|
||||
|
||||
[HasDefaultValue("0.0,360.0", false)]
|
||||
public string ArmorSector
|
||||
[SerializableProperty("0.0,360.0", false)]
|
||||
public Vector2 ArmorSector
|
||||
{
|
||||
get { return XMLExtensions.Vector2ToString(armorSector); }
|
||||
get { return armorSector; }
|
||||
set
|
||||
{
|
||||
armorSector = XMLExtensions.ParseToVector2(value);
|
||||
armorSector.X = MathHelper.ToRadians(armorSector.X);
|
||||
armorSector.Y = MathHelper.ToRadians(armorSector.Y);
|
||||
armorSector.X = MathHelper.ToRadians(value.X);
|
||||
armorSector.Y = MathHelper.ToRadians(value.Y);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user