- Renamed a bunch of ObjectProperty-related stuff (ObjectProperty -> SerializableProperty, IPropertyObject -> ISerializableEntity, the "SerializableProperty" attribute -> Serialize).
- Rectangle serialization. - Option to restrict numeric properties to a range of values. - WIP generic ISerializableEntity editor.
This commit is contained in:
@@ -10,7 +10,7 @@ using Barotrauma.Items.Components;
|
||||
|
||||
namespace Barotrauma
|
||||
{
|
||||
partial class Character : Entity, IDamageable, IPropertyObject, IClientSerializable, IServerSerializable
|
||||
partial class Character : Entity, IDamageable, ISerializableEntity, IClientSerializable, IServerSerializable
|
||||
{
|
||||
public static List<Character> CharacterList = new List<Character>();
|
||||
|
||||
@@ -61,8 +61,8 @@ namespace Barotrauma
|
||||
|
||||
protected float lastRecvPositionUpdateTime;
|
||||
|
||||
public readonly Dictionary<string, ObjectProperty> Properties;
|
||||
public Dictionary<string, ObjectProperty> ObjectProperties
|
||||
public readonly Dictionary<string, SerializableProperty> Properties;
|
||||
public Dictionary<string, SerializableProperty> SerializableProperties
|
||||
{
|
||||
get { return Properties; }
|
||||
}
|
||||
@@ -545,7 +545,7 @@ namespace Barotrauma
|
||||
|
||||
lowPassMultiplier = 1.0f;
|
||||
|
||||
Properties = ObjectProperty.GetProperties(this);
|
||||
Properties = SerializableProperty.GetProperties(this);
|
||||
|
||||
Info = characterInfo;
|
||||
if (file == humanConfigFile && characterInfo == null)
|
||||
|
||||
@@ -13,7 +13,7 @@ namespace Barotrauma
|
||||
|
||||
private Entity entity;
|
||||
|
||||
private List<IPropertyObject> targets;
|
||||
private List<ISerializableEntity> targets;
|
||||
|
||||
public float StartTimer
|
||||
{
|
||||
@@ -26,7 +26,7 @@ namespace Barotrauma
|
||||
delay = element.GetAttributeFloat("delay", 1.0f);
|
||||
}
|
||||
|
||||
public override void Apply(ActionType type, float deltaTime, Entity entity, List<IPropertyObject> targets)
|
||||
public override void Apply(ActionType type, float deltaTime, Entity entity, List<ISerializableEntity> targets)
|
||||
{
|
||||
if (this.type != type) return;
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ namespace Barotrauma
|
||||
var levelString = element.GetAttributeString("level", "");
|
||||
if (levelString.Contains(","))
|
||||
{
|
||||
levelRange = XMLExtensions.ParseToVector2(levelString, false);
|
||||
levelRange = XMLExtensions.ParseVector2(levelString, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -209,26 +209,26 @@ namespace Barotrauma
|
||||
return true;
|
||||
}
|
||||
|
||||
public virtual void Apply(ActionType type, float deltaTime, Entity entity, IPropertyObject target)
|
||||
public virtual void Apply(ActionType type, float deltaTime, Entity entity, ISerializableEntity target)
|
||||
{
|
||||
if (this.type != type || !HasRequiredItems(entity)) return;
|
||||
|
||||
if (targetNames != null && !targetNames.Contains(target.Name)) return;
|
||||
|
||||
List<IPropertyObject> targets = new List<IPropertyObject>();
|
||||
List<ISerializableEntity> targets = new List<ISerializableEntity>();
|
||||
targets.Add(target);
|
||||
|
||||
Apply(deltaTime, entity, targets);
|
||||
}
|
||||
|
||||
public virtual void Apply(ActionType type, float deltaTime, Entity entity, List<IPropertyObject> targets)
|
||||
public virtual void Apply(ActionType type, float deltaTime, Entity entity, List<ISerializableEntity> targets)
|
||||
{
|
||||
if (this.type != type || !HasRequiredItems(entity)) return;
|
||||
|
||||
Apply(deltaTime, entity, targets);
|
||||
}
|
||||
|
||||
protected void Apply(float deltaTime, Entity entity, List<IPropertyObject> targets)
|
||||
protected void Apply(float deltaTime, Entity entity, List<ISerializableEntity> targets)
|
||||
{
|
||||
#if CLIENT
|
||||
if (sound != null)
|
||||
@@ -259,13 +259,13 @@ namespace Barotrauma
|
||||
}
|
||||
}
|
||||
|
||||
foreach (IPropertyObject target in targets)
|
||||
foreach (ISerializableEntity target in targets)
|
||||
{
|
||||
for (int i = 0; i < propertyNames.Length; i++)
|
||||
{
|
||||
ObjectProperty property;
|
||||
SerializableProperty property;
|
||||
|
||||
if (!target.ObjectProperties.TryGetValue(propertyNames[i], out property)) continue;
|
||||
if (!target.SerializableProperties.TryGetValue(propertyNames[i], out property)) continue;
|
||||
|
||||
if (duration > 0.0f)
|
||||
{
|
||||
@@ -308,7 +308,7 @@ namespace Barotrauma
|
||||
#endif
|
||||
}
|
||||
|
||||
private IEnumerable<object> ApplyToPropertyOverDuration(float duration, ObjectProperty property, object value)
|
||||
private IEnumerable<object> ApplyToPropertyOverDuration(float duration, SerializableProperty property, object value)
|
||||
{
|
||||
float timer = duration;
|
||||
while (timer > 0.0f)
|
||||
@@ -323,7 +323,7 @@ namespace Barotrauma
|
||||
yield return CoroutineStatus.Success;
|
||||
}
|
||||
|
||||
private void ApplyToProperty(ObjectProperty property, object value, float deltaTime)
|
||||
private void ApplyToProperty(SerializableProperty property, object value, float deltaTime)
|
||||
{
|
||||
if (disableDeltaTime || setValue) deltaTime = 1.0f;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user