Data Rework Content Edition (#82)
* WiP Data Rework. * Convert stationstation to new map format. * stationstation.yml v2 * Update submodule
This commit is contained in:
committed by
GitHub
parent
8c874c76dc
commit
b34591ab59
@@ -7,13 +7,13 @@ using SS14.Client.UserInterface.Controls;
|
|||||||
using SS14.Client.UserInterface.CustomControls;
|
using SS14.Client.UserInterface.CustomControls;
|
||||||
using SS14.Shared.ContentPack;
|
using SS14.Shared.ContentPack;
|
||||||
using SS14.Shared.GameObjects;
|
using SS14.Shared.GameObjects;
|
||||||
using SS14.Shared.GameObjects.Serialization;
|
|
||||||
using SS14.Shared.Input;
|
using SS14.Shared.Input;
|
||||||
using SS14.Shared.Interfaces.GameObjects;
|
using SS14.Shared.Interfaces.GameObjects;
|
||||||
using SS14.Shared.Interfaces.Network;
|
using SS14.Shared.Interfaces.Network;
|
||||||
using SS14.Shared.IoC;
|
using SS14.Shared.IoC;
|
||||||
using SS14.Shared.Log;
|
using SS14.Shared.Log;
|
||||||
using SS14.Shared.Maths;
|
using SS14.Shared.Maths;
|
||||||
|
using SS14.Shared.Serialization;
|
||||||
using SS14.Shared.Utility;
|
using SS14.Shared.Utility;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
@@ -37,7 +37,7 @@ namespace Content.Client.GameObjects
|
|||||||
Window.Dispose();
|
Window.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void ExposeData(EntitySerializer serializer)
|
public override void ExposeData(ObjectSerializer serializer)
|
||||||
{
|
{
|
||||||
base.ExposeData(serializer);
|
base.ExposeData(serializer);
|
||||||
|
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ using SS14.Shared.Utility;
|
|||||||
using YamlDotNet.RepresentationModel;
|
using YamlDotNet.RepresentationModel;
|
||||||
using Content.Server.Interfaces;
|
using Content.Server.Interfaces;
|
||||||
using Content.Shared.GameObjects;
|
using Content.Shared.GameObjects;
|
||||||
|
using SS14.Shared.Serialization;
|
||||||
|
|
||||||
namespace Content.Server.GameObjects
|
namespace Content.Server.GameObjects
|
||||||
{
|
{
|
||||||
@@ -35,13 +36,16 @@ namespace Content.Server.GameObjects
|
|||||||
|
|
||||||
public event EventHandler<DamageThresholdPassedEventArgs> DamageThresholdPassed;
|
public event EventHandler<DamageThresholdPassedEventArgs> DamageThresholdPassed;
|
||||||
|
|
||||||
/// <inheritdoc />
|
|
||||||
public override void LoadParameters(YamlMappingNode mapping)
|
public override void ExposeData(ObjectSerializer serializer)
|
||||||
{
|
{
|
||||||
if (mapping.TryGetNode("resistanceset", out YamlNode node))
|
base.ExposeData(serializer);
|
||||||
|
|
||||||
|
// TODO: Writing.
|
||||||
|
serializer.DataReadFunction("resistanceset", "honk", name =>
|
||||||
{
|
{
|
||||||
Resistances = ResistanceSet.GetResistanceSet(node.AsString());
|
Resistances = ResistanceSet.GetResistanceSet(name);
|
||||||
}
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ using SS14.Shared.Utility;
|
|||||||
using YamlDotNet.RepresentationModel;
|
using YamlDotNet.RepresentationModel;
|
||||||
using Content.Server.Interfaces;
|
using Content.Server.Interfaces;
|
||||||
using Content.Shared.GameObjects;
|
using Content.Shared.GameObjects;
|
||||||
|
using SS14.Shared.Serialization;
|
||||||
|
|
||||||
namespace Content.Server.GameObjects
|
namespace Content.Server.GameObjects
|
||||||
{
|
{
|
||||||
@@ -27,27 +27,23 @@ namespace Content.Server.GameObjects
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public DamageThreshold Threshold { get; private set; }
|
public DamageThreshold Threshold { get; private set; }
|
||||||
|
|
||||||
/// <inheritdoc />
|
|
||||||
public override void LoadParameters(YamlMappingNode mapping)
|
public override void ExposeData(ObjectSerializer serializer)
|
||||||
{
|
{
|
||||||
//TODO currently only supports one threshold pair; gotta figure out YAML better
|
base.ExposeData(serializer);
|
||||||
|
|
||||||
YamlNode node;
|
|
||||||
|
|
||||||
|
// TODO: Writing
|
||||||
|
if (serializer.Reading)
|
||||||
|
{
|
||||||
DamageType damageType = DamageType.Total;
|
DamageType damageType = DamageType.Total;
|
||||||
int damageValue = 0;
|
int damageValue = 0;
|
||||||
|
|
||||||
if (mapping.TryGetNode("thresholdtype", out node))
|
serializer.DataReadFunction("thresholdtype", DamageType.Total, type => damageType = type);
|
||||||
{
|
serializer.DataReadFunction("thresholdvalue", 0, val => damageValue = val);
|
||||||
damageType = node.AsEnum<DamageType>();
|
|
||||||
}
|
|
||||||
if (mapping.TryGetNode("thresholdvalue", out node))
|
|
||||||
{
|
|
||||||
damageValue = node.AsInt();
|
|
||||||
}
|
|
||||||
|
|
||||||
Threshold = new DamageThreshold(damageType, damageValue);
|
Threshold = new DamageThreshold(damageType, damageValue);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
|
|||||||
@@ -3,13 +3,13 @@ using Content.Server.Interfaces.GameObjects;
|
|||||||
using Content.Shared.GameObjects;
|
using Content.Shared.GameObjects;
|
||||||
using SS14.Server.GameObjects;
|
using SS14.Server.GameObjects;
|
||||||
using SS14.Shared.GameObjects;
|
using SS14.Shared.GameObjects;
|
||||||
using SS14.Shared.GameObjects.Serialization;
|
|
||||||
using SS14.Shared.Interfaces.GameObjects;
|
using SS14.Shared.Interfaces.GameObjects;
|
||||||
using SS14.Shared.Interfaces.GameObjects.Components;
|
using SS14.Shared.Interfaces.GameObjects.Components;
|
||||||
using SS14.Shared.Log;
|
using SS14.Shared.Log;
|
||||||
using SS14.Shared.Maths;
|
using SS14.Shared.Maths;
|
||||||
using SS14.Shared.IoC;
|
using SS14.Shared.IoC;
|
||||||
using Content.Server.GameObjects.EntitySystems;
|
using Content.Server.GameObjects.EntitySystems;
|
||||||
|
using SS14.Shared.Serialization;
|
||||||
|
|
||||||
namespace Content.Server.GameObjects
|
namespace Content.Server.GameObjects
|
||||||
{
|
{
|
||||||
@@ -26,7 +26,7 @@ namespace Content.Server.GameObjects
|
|||||||
private string OpenSprite;
|
private string OpenSprite;
|
||||||
private string CloseSprite;
|
private string CloseSprite;
|
||||||
|
|
||||||
public override void ExposeData(EntitySerializer serializer)
|
public override void ExposeData(ObjectSerializer serializer)
|
||||||
{
|
{
|
||||||
base.ExposeData(serializer);
|
base.ExposeData(serializer);
|
||||||
|
|
||||||
|
|||||||
@@ -11,9 +11,9 @@ using static Content.Shared.GameObjects.SharedInventoryComponent.ClientInventory
|
|||||||
using static Content.Shared.GameObjects.SharedInventoryComponent.ServerInventoryMessage;
|
using static Content.Shared.GameObjects.SharedInventoryComponent.ServerInventoryMessage;
|
||||||
using SS14.Shared.IoC;
|
using SS14.Shared.IoC;
|
||||||
using SS14.Server.Interfaces.Player;
|
using SS14.Server.Interfaces.Player;
|
||||||
using SS14.Shared.GameObjects.Serialization;
|
|
||||||
using SS14.Shared.ContentPack;
|
using SS14.Shared.ContentPack;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using SS14.Shared.Serialization;
|
||||||
|
|
||||||
namespace Content.Server.GameObjects
|
namespace Content.Server.GameObjects
|
||||||
{
|
{
|
||||||
@@ -22,13 +22,16 @@ namespace Content.Server.GameObjects
|
|||||||
private Dictionary<Slots, ContainerSlot> SlotContainers = new Dictionary<Slots, ContainerSlot>();
|
private Dictionary<Slots, ContainerSlot> SlotContainers = new Dictionary<Slots, ContainerSlot>();
|
||||||
string TemplateName = "HumanInventory"; //stored for serialization purposes
|
string TemplateName = "HumanInventory"; //stored for serialization purposes
|
||||||
|
|
||||||
public override void ExposeData(EntitySerializer serializer)
|
public override void ExposeData(ObjectSerializer serializer)
|
||||||
{
|
{
|
||||||
base.ExposeData(serializer);
|
base.ExposeData(serializer);
|
||||||
|
|
||||||
serializer.DataField(ref TemplateName, "Template", "HumanInventory");
|
serializer.DataField(ref TemplateName, "Template", "HumanInventory");
|
||||||
|
if (serializer.Reading)
|
||||||
|
{
|
||||||
CreateInventory(TemplateName);
|
CreateInventory(TemplateName);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void CreateInventory(string TemplateName)
|
private void CreateInventory(string TemplateName)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -8,11 +8,11 @@ using SS14.Server.GameObjects;
|
|||||||
using SS14.Server.GameObjects.Components.Container;
|
using SS14.Server.GameObjects.Components.Container;
|
||||||
using SS14.Server.Interfaces.Player;
|
using SS14.Server.Interfaces.Player;
|
||||||
using SS14.Shared.GameObjects;
|
using SS14.Shared.GameObjects;
|
||||||
using SS14.Shared.GameObjects.Serialization;
|
|
||||||
using SS14.Shared.Input;
|
using SS14.Shared.Input;
|
||||||
using SS14.Shared.Interfaces.GameObjects;
|
using SS14.Shared.Interfaces.GameObjects;
|
||||||
using SS14.Shared.Interfaces.Network;
|
using SS14.Shared.Interfaces.Network;
|
||||||
using SS14.Shared.IoC;
|
using SS14.Shared.IoC;
|
||||||
|
using SS14.Shared.Serialization;
|
||||||
|
|
||||||
namespace Content.Server.GameObjects
|
namespace Content.Server.GameObjects
|
||||||
{
|
{
|
||||||
@@ -45,10 +45,11 @@ namespace Content.Server.GameObjects
|
|||||||
private InputCommand DropCommand;
|
private InputCommand DropCommand;
|
||||||
private InputCommand ActivateItemInHandCommand;
|
private InputCommand ActivateItemInHandCommand;
|
||||||
|
|
||||||
public override void ExposeData(EntitySerializer serializer)
|
public override void ExposeData(ObjectSerializer serializer)
|
||||||
{
|
{
|
||||||
base.ExposeData(serializer);
|
base.ExposeData(serializer);
|
||||||
|
|
||||||
|
// TODO: This does not serialize what objects are held.
|
||||||
serializer.DataField(ref orderedHands, "hands", new List<string>(0));
|
serializer.DataField(ref orderedHands, "hands", new List<string>(0));
|
||||||
if (serializer.Reading)
|
if (serializer.Reading)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using SS14.Shared.GameObjects;
|
using SS14.Shared.GameObjects;
|
||||||
|
using SS14.Shared.Serialization;
|
||||||
using SS14.Shared.Utility;
|
using SS14.Shared.Utility;
|
||||||
using YamlDotNet.RepresentationModel;
|
using YamlDotNet.RepresentationModel;
|
||||||
|
|
||||||
@@ -9,14 +10,18 @@ namespace Content.Server.GameObjects.Components.Interactable.Tools
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// For tool interactions that have a delay before action this will modify the rate, time to wait is divided by this value
|
/// For tool interactions that have a delay before action this will modify the rate, time to wait is divided by this value
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public float SpeedModifier { get; set; } = 1;
|
public float SpeedModifier
|
||||||
|
|
||||||
public override void LoadParameters(YamlMappingNode mapping)
|
|
||||||
{
|
{
|
||||||
if (mapping.TryGetNode("Speed", out YamlNode node))
|
get => _speedModifier;
|
||||||
{
|
set => _speedModifier = value;
|
||||||
SpeedModifier = node.AsFloat();
|
|
||||||
}
|
}
|
||||||
|
private float _speedModifier = 1;
|
||||||
|
|
||||||
|
public override void ExposeData(ObjectSerializer serializer)
|
||||||
|
{
|
||||||
|
base.ExposeData(serializer);
|
||||||
|
|
||||||
|
serializer.DataField(ref _speedModifier, "Speed", 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ using SS14.Shared.Utility;
|
|||||||
using YamlDotNet.RepresentationModel;
|
using YamlDotNet.RepresentationModel;
|
||||||
using SS14.Server.GameObjects;
|
using SS14.Server.GameObjects;
|
||||||
using Content.Server.GameObjects.EntitySystems;
|
using Content.Server.GameObjects.EntitySystems;
|
||||||
|
using SS14.Shared.Serialization;
|
||||||
|
|
||||||
namespace Content.Server.GameObjects.Components.Interactable.Tools
|
namespace Content.Server.GameObjects.Components.Interactable.Tools
|
||||||
{
|
{
|
||||||
@@ -19,12 +20,22 @@ namespace Content.Server.GameObjects.Components.Interactable.Tools
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Maximum fuel capacity the welder can hold
|
/// Maximum fuel capacity the welder can hold
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public float FuelCapacity { get; set; } = 50;
|
public float FuelCapacity
|
||||||
|
{
|
||||||
|
get => _fuelCapacity;
|
||||||
|
set => _fuelCapacity = value;
|
||||||
|
}
|
||||||
|
private float _fuelCapacity = 50;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Fuel the welder has to do tasks
|
/// Fuel the welder has to do tasks
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public float Fuel { get; set; } = 0;
|
public float Fuel
|
||||||
|
{
|
||||||
|
get => _fuel;
|
||||||
|
set => _fuel = value;
|
||||||
|
}
|
||||||
|
private float _fuel = 0;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Default Cost of using the welder fuel for an action
|
/// Default Cost of using the welder fuel for an action
|
||||||
@@ -51,33 +62,12 @@ namespace Content.Server.GameObjects.Components.Interactable.Tools
|
|||||||
spriteComponent = Owner.GetComponent<SpriteComponent>();
|
spriteComponent = Owner.GetComponent<SpriteComponent>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void LoadParameters(YamlMappingNode mapping)
|
public override void ExposeData(ObjectSerializer serializer)
|
||||||
{
|
{
|
||||||
base.LoadParameters(mapping);
|
base.ExposeData(serializer);
|
||||||
|
|
||||||
if (mapping.TryGetNode("Capacity", out YamlNode node))
|
serializer.DataField(ref _fuelCapacity, "Capacity", 50);
|
||||||
{
|
serializer.DataField(ref _fuel, "Fuel", FuelCapacity);
|
||||||
FuelCapacity = node.AsFloat();
|
|
||||||
}
|
|
||||||
|
|
||||||
//if (mapping.TryGetNode("On", out node))
|
|
||||||
//{
|
|
||||||
// OnSprite = node.AsString();
|
|
||||||
//}
|
|
||||||
|
|
||||||
//if (mapping.TryGetNode("Off", out node))
|
|
||||||
//{
|
|
||||||
// OffSprite = node.AsString();
|
|
||||||
//}
|
|
||||||
|
|
||||||
if (mapping.TryGetNode("Fuel", out node))
|
|
||||||
{
|
|
||||||
Fuel = node.AsFloat();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Fuel = FuelCapacity;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void OnUpdate(float frameTime)
|
public void OnUpdate(float frameTime)
|
||||||
@@ -142,7 +132,7 @@ namespace Content.Server.GameObjects.Components.Interactable.Tools
|
|||||||
|
|
||||||
string IExamine.Examine()
|
string IExamine.Examine()
|
||||||
{
|
{
|
||||||
if(Activated)
|
if (Activated)
|
||||||
{
|
{
|
||||||
return "The welding tool is currently lit";
|
return "The welding tool is currently lit";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
using SS14.Shared.GameObjects.Serialization;
|
using SS14.Shared.Serialization;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
@@ -14,16 +14,18 @@ namespace Content.Server.GameObjects
|
|||||||
public SlotFlags SlotFlags = SlotFlags.PREVENTEQUIP; //Different from None, NONE allows equips if no slot flags are required
|
public SlotFlags SlotFlags = SlotFlags.PREVENTEQUIP; //Different from None, NONE allows equips if no slot flags are required
|
||||||
private List<string> slotstrings = new List<string>(); //serialization
|
private List<string> slotstrings = new List<string>(); //serialization
|
||||||
|
|
||||||
public override void ExposeData(EntitySerializer serializer)
|
public override void ExposeData(ObjectSerializer serializer)
|
||||||
{
|
{
|
||||||
base.ExposeData(serializer);
|
base.ExposeData(serializer);
|
||||||
|
|
||||||
serializer.DataField(ref slotstrings, "Slots", new List<string>(0));
|
// TODO: Writing.
|
||||||
|
serializer.DataReadFunction("Slots", new List<string>(0), list =>
|
||||||
foreach(var slotflagsloaded in slotstrings)
|
{
|
||||||
|
foreach (var slotflagsloaded in slotstrings)
|
||||||
{
|
{
|
||||||
SlotFlags |= (SlotFlags)Enum.Parse(typeof(SlotFlags), slotflagsloaded.ToUpper());
|
SlotFlags |= (SlotFlags)Enum.Parse(typeof(SlotFlags), slotflagsloaded.ToUpper());
|
||||||
}
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,11 +7,11 @@ using SS14.Server.Interfaces.Player;
|
|||||||
using SS14.Server.Player;
|
using SS14.Server.Player;
|
||||||
using SS14.Shared.Enums;
|
using SS14.Shared.Enums;
|
||||||
using SS14.Shared.GameObjects;
|
using SS14.Shared.GameObjects;
|
||||||
using SS14.Shared.GameObjects.Serialization;
|
|
||||||
using SS14.Shared.Interfaces.GameObjects;
|
using SS14.Shared.Interfaces.GameObjects;
|
||||||
using SS14.Shared.Interfaces.Network;
|
using SS14.Shared.Interfaces.Network;
|
||||||
using SS14.Shared.IoC;
|
using SS14.Shared.IoC;
|
||||||
using SS14.Shared.Log;
|
using SS14.Shared.Log;
|
||||||
|
using SS14.Shared.Serialization;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace Content.Server.GameObjects
|
namespace Content.Server.GameObjects
|
||||||
@@ -34,7 +34,7 @@ namespace Content.Server.GameObjects
|
|||||||
storage = ContainerManagerComponent.Create<Container>("storagebase", Owner);
|
storage = ContainerManagerComponent.Create<Container>("storagebase", Owner);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void ExposeData(EntitySerializer serializer)
|
public override void ExposeData(ObjectSerializer serializer)
|
||||||
{
|
{
|
||||||
base.ExposeData(serializer);
|
base.ExposeData(serializer);
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
using SS14.Shared.GameObjects;
|
using SS14.Shared.GameObjects;
|
||||||
using SS14.Shared.GameObjects.Serialization;
|
using SS14.Shared.Serialization;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
@@ -14,7 +14,7 @@ namespace Content.Server.GameObjects
|
|||||||
|
|
||||||
public int ObjectSize = 0;
|
public int ObjectSize = 0;
|
||||||
|
|
||||||
public override void ExposeData(EntitySerializer serializer)
|
public override void ExposeData(ObjectSerializer serializer)
|
||||||
{
|
{
|
||||||
base.ExposeData(serializer);
|
base.ExposeData(serializer);
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ using SS14.Server.GameObjects;
|
|||||||
using SS14.Shared.GameObjects;
|
using SS14.Shared.GameObjects;
|
||||||
using SS14.Shared.Interfaces.GameObjects;
|
using SS14.Shared.Interfaces.GameObjects;
|
||||||
using SS14.Shared.IoC;
|
using SS14.Shared.IoC;
|
||||||
|
using SS14.Shared.Serialization;
|
||||||
using SS14.Shared.Utility;
|
using SS14.Shared.Utility;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
@@ -21,7 +22,12 @@ namespace Content.Server.GameObjects.Components.Power
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// The method of draw we will try to use to place our load set via component parameter, defaults to using power providers
|
/// The method of draw we will try to use to place our load set via component parameter, defaults to using power providers
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public virtual DrawTypes DrawType { get; protected set; } = DrawTypes.Provider;
|
public virtual DrawTypes DrawType
|
||||||
|
{
|
||||||
|
get => _drawType;
|
||||||
|
protected set => _drawType = value;
|
||||||
|
}
|
||||||
|
private DrawTypes _drawType = DrawTypes.Provider;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The power draw method we are currently connected to and using
|
/// The power draw method we are currently connected to and using
|
||||||
@@ -62,8 +68,12 @@ namespace Content.Server.GameObjects.Components.Power
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Priority for powernet draw, lower will draw first, defined in powernet.cs
|
/// Priority for powernet draw, lower will draw first, defined in powernet.cs
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public virtual Powernet.Priority Priority { get; protected set; } = Powernet.Priority.Medium;
|
public virtual Powernet.Priority Priority
|
||||||
|
{
|
||||||
|
get => _priority;
|
||||||
|
protected set => _priority = value;
|
||||||
|
}
|
||||||
|
private Powernet.Priority _priority = Powernet.Priority.Medium;
|
||||||
|
|
||||||
private float _load = 100; //arbitrary magic number to start
|
private float _load = 100; //arbitrary magic number to start
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -152,20 +162,13 @@ namespace Content.Server.GameObjects.Components.Power
|
|||||||
base.Shutdown();
|
base.Shutdown();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void LoadParameters(YamlMappingNode mapping)
|
public override void ExposeData(ObjectSerializer serializer)
|
||||||
{
|
{
|
||||||
if (mapping.TryGetNode("drawtype", out YamlNode node))
|
base.ExposeData(serializer);
|
||||||
{
|
|
||||||
DrawType = node.AsEnum<DrawTypes>();
|
serializer.DataField(ref _drawType, "drawtype", DrawTypes.Provider);
|
||||||
}
|
serializer.DataField(ref _load, "load", 100);
|
||||||
if (mapping.TryGetNode("load", out node))
|
serializer.DataField(ref _priority, "priority", Powernet.Priority.Medium);
|
||||||
{
|
|
||||||
Load = node.AsFloat();
|
|
||||||
}
|
|
||||||
if (mapping.TryGetNode("priority", out node))
|
|
||||||
{
|
|
||||||
Priority = node.AsEnum<Powernet.Priority>();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
string IExamine.Examine()
|
string IExamine.Examine()
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
using SS14.Shared.Interfaces.GameObjects;
|
using SS14.Shared.Interfaces.GameObjects;
|
||||||
using SS14.Shared.IoC;
|
using SS14.Shared.IoC;
|
||||||
using SS14.Shared.Log;
|
using SS14.Shared.Log;
|
||||||
|
using SS14.Shared.Serialization;
|
||||||
using SS14.Shared.Utility;
|
using SS14.Shared.Utility;
|
||||||
using System;
|
using System;
|
||||||
using YamlDotNet.RepresentationModel;
|
using YamlDotNet.RepresentationModel;
|
||||||
@@ -25,12 +26,11 @@ namespace Content.Server.GameObjects.Components.Power
|
|||||||
set { UpdateSupply(value); }
|
set { UpdateSupply(value); }
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void LoadParameters(YamlMappingNode mapping)
|
public override void ExposeData(ObjectSerializer serializer)
|
||||||
{
|
{
|
||||||
if (mapping.TryGetNode("supply", out YamlNode node))
|
base.ExposeData(serializer);
|
||||||
{
|
|
||||||
Supply = node.AsFloat();
|
serializer.DataField(ref _supply, "supply", 1000);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void OnAdd()
|
public override void OnAdd()
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ using SS14.Server.Interfaces.GameObjects;
|
|||||||
using SS14.Shared.Interfaces.GameObjects;
|
using SS14.Shared.Interfaces.GameObjects;
|
||||||
using SS14.Shared.IoC;
|
using SS14.Shared.IoC;
|
||||||
using SS14.Shared.Log;
|
using SS14.Shared.Log;
|
||||||
|
using SS14.Shared.Serialization;
|
||||||
using SS14.Shared.Utility;
|
using SS14.Shared.Utility;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
@@ -24,7 +25,12 @@ namespace Content.Server.GameObjects.Components.Power
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Variable that determines the range that the power provider will try to supply power to
|
/// Variable that determines the range that the power provider will try to supply power to
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int PowerRange { get; private set; } = 0;
|
public int PowerRange
|
||||||
|
{
|
||||||
|
get => _range;
|
||||||
|
private set => _range = value;
|
||||||
|
}
|
||||||
|
private int _range = 0;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// List storing all the power devices that we are currently providing power to
|
/// List storing all the power devices that we are currently providing power to
|
||||||
@@ -56,16 +62,11 @@ namespace Content.Server.GameObjects.Components.Power
|
|||||||
AdvertisedDevices.Clear();
|
AdvertisedDevices.Clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void LoadParameters(YamlMappingNode mapping)
|
public override void ExposeData(ObjectSerializer serializer)
|
||||||
{
|
{
|
||||||
if (mapping.TryGetNode("range", out YamlNode node))
|
base.ExposeData(serializer);
|
||||||
{
|
|
||||||
PowerRange = node.AsInt();
|
serializer.DataField(ref _range, "range", 0);
|
||||||
}
|
|
||||||
if (mapping.TryGetNode("priority", out node))
|
|
||||||
{
|
|
||||||
Priority = node.AsEnum<Powernet.Priority>();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
internal override void ProcessInternalPower(float frametime)
|
internal override void ProcessInternalPower(float frametime)
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
using SS14.Shared.GameObjects;
|
using SS14.Shared.GameObjects;
|
||||||
using SS14.Shared.Interfaces.GameObjects;
|
using SS14.Shared.Interfaces.GameObjects;
|
||||||
using SS14.Shared.IoC;
|
using SS14.Shared.IoC;
|
||||||
|
using SS14.Shared.Serialization;
|
||||||
using SS14.Shared.Utility;
|
using SS14.Shared.Utility;
|
||||||
using System;
|
using System;
|
||||||
using YamlDotNet.RepresentationModel;
|
using YamlDotNet.RepresentationModel;
|
||||||
@@ -22,25 +23,29 @@ namespace Content.Server.GameObjects.Components.Power
|
|||||||
/// Maximum amount of energy the internal battery can store.
|
/// Maximum amount of energy the internal battery can store.
|
||||||
/// In Joules.
|
/// In Joules.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public float Capacity { get; private set; } = 10000; //arbitrary value replace
|
public float Capacity => _capacity;
|
||||||
|
private float _capacity = 10000; // Arbitrary value, replace.
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Energy the battery is currently storing.
|
/// Energy the battery is currently storing.
|
||||||
/// In Joules.
|
/// In Joules.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public float Charge { get; private set; } = 0;
|
public float Charge => _charge;
|
||||||
|
private float _charge = 0;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Rate at which energy will be taken to charge internal battery.
|
/// Rate at which energy will be taken to charge internal battery.
|
||||||
/// In Watts.
|
/// In Watts.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public float ChargeRate { get; private set; } = 1000;
|
public float ChargeRate => _chargeRate;
|
||||||
|
private float _chargeRate = 1000;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Rate at which energy will be distributed to the powernet if needed.
|
/// Rate at which energy will be distributed to the powernet if needed.
|
||||||
/// In Watts.
|
/// In Watts.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public float DistributionRate { get; private set; } = 1000;
|
public float DistributionRate => _distributionRate;
|
||||||
|
private float _distributionRate = 1000;
|
||||||
|
|
||||||
public bool Full => Charge >= Capacity;
|
public bool Full => Charge >= Capacity;
|
||||||
|
|
||||||
@@ -63,29 +68,15 @@ namespace Content.Server.GameObjects.Components.Power
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override void ExposeData(ObjectSerializer serializer)
|
||||||
|
{
|
||||||
|
base.ExposeData(serializer);
|
||||||
|
|
||||||
public override void LoadParameters(YamlMappingNode mapping)
|
serializer.DataField(ref _capacity, "capacity", 10000);
|
||||||
{
|
serializer.DataField(ref _charge, "charge", 0);
|
||||||
if (mapping.TryGetNode("capacity", out YamlNode node))
|
serializer.DataField(ref _chargeRate, "chargerate", 1000);
|
||||||
{
|
serializer.DataField(ref _distributionRate, "distributionrate", 1000);
|
||||||
Capacity = node.AsFloat();
|
serializer.DataField(ref _chargepowernet, "chargepowernet", false);
|
||||||
}
|
|
||||||
if (mapping.TryGetNode("charge", out node))
|
|
||||||
{
|
|
||||||
Charge = node.AsFloat();
|
|
||||||
}
|
|
||||||
if (mapping.TryGetNode("chargerate", out node))
|
|
||||||
{
|
|
||||||
ChargeRate = node.AsFloat();
|
|
||||||
}
|
|
||||||
if (mapping.TryGetNode("distributionrate", out node))
|
|
||||||
{
|
|
||||||
DistributionRate = node.AsFloat();
|
|
||||||
}
|
|
||||||
if (mapping.TryGetNode("chargepowernet", out node))
|
|
||||||
{
|
|
||||||
_chargepowernet = node.AsBool();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void OnAdd()
|
public override void OnAdd()
|
||||||
@@ -134,14 +125,14 @@ namespace Content.Server.GameObjects.Components.Power
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public void DeductCharge(float todeduct)
|
public void DeductCharge(float todeduct)
|
||||||
{
|
{
|
||||||
Charge = Math.Max(0, Charge - todeduct);
|
_charge = Math.Max(0, Charge - todeduct);
|
||||||
LastChargeState = ChargeState.Discharging;
|
LastChargeState = ChargeState.Discharging;
|
||||||
LastChargeStateChange = DateTime.Now;
|
LastChargeStateChange = DateTime.Now;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AddCharge(float charge)
|
public void AddCharge(float charge)
|
||||||
{
|
{
|
||||||
Charge = Math.Min(Capacity, Charge + charge);
|
_charge = Math.Min(Capacity, Charge + charge);
|
||||||
LastChargeState = ChargeState.Charging;
|
LastChargeState = ChargeState.Charging;
|
||||||
LastChargeStateChange = DateTime.Now;
|
LastChargeStateChange = DateTime.Now;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ using SS14.Shared.GameObjects;
|
|||||||
using SS14.Shared.Utility;
|
using SS14.Shared.Utility;
|
||||||
using YamlDotNet.RepresentationModel;
|
using YamlDotNet.RepresentationModel;
|
||||||
using Content.Shared.GameObjects;
|
using Content.Shared.GameObjects;
|
||||||
|
using SS14.Shared.Serialization;
|
||||||
|
|
||||||
namespace Content.Server.GameObjects
|
namespace Content.Server.GameObjects
|
||||||
{
|
{
|
||||||
@@ -29,19 +30,12 @@ namespace Content.Server.GameObjects
|
|||||||
|
|
||||||
float _secondsSinceLastDamageUpdate = 0;
|
float _secondsSinceLastDamageUpdate = 0;
|
||||||
|
|
||||||
/// <inheritdoc />
|
public override void ExposeData(ObjectSerializer serializer)
|
||||||
public override void LoadParameters(YamlMappingNode mapping)
|
|
||||||
{
|
{
|
||||||
YamlNode node;
|
base.ExposeData(serializer);
|
||||||
|
|
||||||
if (mapping.TryGetNode("firedamagethreshold", out node))
|
serializer.DataField(ref _fireDamageThreshold, "firedamagethreshold", 0);
|
||||||
{
|
serializer.DataField(ref _fireDamageCoefficient, "firedamagecoefficient", 1);
|
||||||
_fireDamageThreshold = node.AsFloat();
|
|
||||||
}
|
|
||||||
if (mapping.TryGetNode("firedamagecoefficient", out node))
|
|
||||||
{
|
|
||||||
_fireDamageCoefficient = node.AsFloat();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
using System;
|
using System;
|
||||||
using SS14.Shared.GameObjects;
|
using SS14.Shared.GameObjects;
|
||||||
using SS14.Shared.GameObjects.Serialization;
|
|
||||||
using Content.Server.GameObjects.EntitySystems;
|
using Content.Server.GameObjects.EntitySystems;
|
||||||
using SS14.Shared.Interfaces.GameObjects;
|
using SS14.Shared.Interfaces.GameObjects;
|
||||||
using SS14.Shared.Map;
|
using SS14.Shared.Map;
|
||||||
@@ -10,6 +9,7 @@ using SS14.Shared.Maths;
|
|||||||
using SS14.Server.Interfaces.GameObjects;
|
using SS14.Server.Interfaces.GameObjects;
|
||||||
using SS14.Shared.Interfaces.Timing;
|
using SS14.Shared.Interfaces.Timing;
|
||||||
using SS14.Shared.GameObjects.EntitySystemMessages;
|
using SS14.Shared.GameObjects.EntitySystemMessages;
|
||||||
|
using SS14.Shared.Serialization;
|
||||||
|
|
||||||
namespace Content.Server.GameObjects.Components.Weapon.Melee
|
namespace Content.Server.GameObjects.Components.Weapon.Melee
|
||||||
{
|
{
|
||||||
@@ -21,14 +21,13 @@ namespace Content.Server.GameObjects.Components.Weapon.Melee
|
|||||||
public float Range = 1;
|
public float Range = 1;
|
||||||
public float ArcWidth = 90;
|
public float ArcWidth = 90;
|
||||||
|
|
||||||
public override void ExposeData(EntitySerializer serializer)
|
public override void ExposeData(ObjectSerializer serializer)
|
||||||
{
|
{
|
||||||
base.ExposeData(serializer);
|
base.ExposeData(serializer);
|
||||||
|
|
||||||
serializer.DataField(ref Damage, "damage", 5);
|
serializer.DataField(ref Damage, "damage", 5);
|
||||||
serializer.DataField(ref Range, "damage", 1);
|
serializer.DataField(ref Range, "range", 1);
|
||||||
serializer.DataField(ref ArcWidth, "damage", 90);
|
serializer.DataField(ref ArcWidth, "arcwidth", 90);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void IAfterAttack.Afterattack(IEntity user, GridLocalCoordinates clicklocation, IEntity attacked)
|
void IAfterAttack.Afterattack(IEntity user, GridLocalCoordinates clicklocation, IEntity attacked)
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
2
engine
2
engine
Submodule engine updated: 5c2bd4049c...bceda76bf8
Reference in New Issue
Block a user