VV support.

This commit is contained in:
PJB3005
2018-09-09 15:34:43 +02:00
parent 06ea07eca5
commit 1dabe49234
24 changed files with 91 additions and 9 deletions

View File

@@ -2,6 +2,7 @@ using Content.Shared.Construction;
using SS14.Shared.GameObjects;
using SS14.Shared.Interfaces.GameObjects;
using SS14.Shared.Interfaces.Network;
using SS14.Shared.ViewVariables;
namespace Content.Client.GameObjects.Components.Construction
{
@@ -9,11 +10,12 @@ namespace Content.Client.GameObjects.Components.Construction
{
public override string Name => "ConstructionGhost";
public ConstructionPrototype Prototype { get; set; }
public ConstructorComponent Master { get; set; }
public int GhostID { get; set; }
[ViewVariables] public ConstructionPrototype Prototype { get; set; }
[ViewVariables] public ConstructorComponent Master { get; set; }
[ViewVariables] public int GhostID { get; set; }
public override void HandleMessage(ComponentMessage message, INetChannel netChannel = null, IComponent component = null)
public override void HandleMessage(ComponentMessage message, INetChannel netChannel = null,
IComponent component = null)
{
base.HandleMessage(message, netChannel, component);

View File

@@ -6,12 +6,14 @@ using SS14.Shared.GameObjects;
using SS14.Shared.Interfaces.GameObjects;
using SS14.Shared.IoC;
using System.Collections.Generic;
using SS14.Shared.ViewVariables;
namespace Content.Client.GameObjects
{
public class HandsComponent : SharedHandsComponent, IHandsComponent
{
private readonly Dictionary<string, IEntity> hands = new Dictionary<string, IEntity>();
[ViewVariables]
public string ActiveIndex { get; private set; }
public IEntity GetEntity(string index)

View File

@@ -11,6 +11,7 @@ using SS14.Shared.GameObjects;
using SS14.Shared.Interfaces.GameObjects;
using SS14.Shared.Interfaces.GameObjects.Components;
using SS14.Shared.IoC;
using SS14.Shared.ViewVariables;
using static Content.Shared.Construction.ConstructionStepMaterial;
using static Content.Shared.Construction.ConstructionStepTool;
@@ -20,7 +21,9 @@ namespace Content.Server.GameObjects.Components.Construction
{
public override string Name => "Construction";
[ViewVariables]
public ConstructionPrototype Prototype { get; private set; }
[ViewVariables]
public int Stage { get; private set; }
SpriteComponent Sprite;

View File

@@ -8,6 +8,7 @@ using YamlDotNet.RepresentationModel;
using Content.Server.Interfaces;
using Content.Shared.GameObjects;
using SS14.Shared.Serialization;
using SS14.Shared.ViewVariables;
namespace Content.Server.GameObjects
{
@@ -29,6 +30,7 @@ namespace Content.Server.GameObjects
/// The resistance set of this object.
/// Affects receiving damage of various types.
/// </summary>
[ViewVariables]
public ResistanceSet Resistances { get; private set; }
Dictionary<DamageType, int> CurrentDamage = new Dictionary<DamageType, int>();

View File

@@ -7,6 +7,7 @@ using YamlDotNet.RepresentationModel;
using Content.Server.Interfaces;
using Content.Shared.GameObjects;
using SS14.Shared.Serialization;
using SS14.Shared.ViewVariables;
namespace Content.Server.GameObjects
{
@@ -25,6 +26,7 @@ namespace Content.Server.GameObjects
/// Damage threshold calculated from the values
/// given in the prototype declaration.
/// </summary>
[ViewVariables]
public DamageThreshold Threshold { get; private set; }

View File

@@ -11,12 +11,14 @@ using SS14.Shared.IoC;
using Content.Server.GameObjects.EntitySystems;
using SS14.Shared.Serialization;
using SS14.Shared.Interfaces.Network;
using SS14.Shared.ViewVariables;
namespace Content.Server.GameObjects
{
public class ServerDoorComponent : Component, IAttackHand
{
public override string Name => "Door";
[ViewVariables]
public bool Opened { get; private set; }
private float OpenTimeCounter;

View File

@@ -15,6 +15,7 @@ using SS14.Shared.Interfaces.Network;
using SS14.Shared.IoC;
using SS14.Shared.Map;
using SS14.Shared.Serialization;
using SS14.Shared.ViewVariables;
namespace Content.Server.GameObjects
{
@@ -22,6 +23,7 @@ namespace Content.Server.GameObjects
{
private string activeIndex;
[ViewVariables(VVAccess.ReadWrite)]
public string ActiveIndex
{
get => activeIndex;

View File

@@ -9,6 +9,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using SS14.Shared.ViewVariables;
namespace Content.Server.GameObjects.Components.Interactable
{
@@ -25,6 +26,7 @@ namespace Content.Server.GameObjects.Components.Interactable
/// <summary>
/// Status of light, whether or not it is emitting light.
/// </summary>
[ViewVariables]
public bool Activated { get; private set; } = false;
public override void Initialize()

View File

@@ -1,6 +1,7 @@
using SS14.Shared.GameObjects;
using SS14.Shared.Serialization;
using SS14.Shared.Utility;
using SS14.Shared.ViewVariables;
using YamlDotNet.RepresentationModel;
namespace Content.Server.GameObjects.Components.Interactable.Tools
@@ -10,6 +11,7 @@ namespace Content.Server.GameObjects.Components.Interactable.Tools
/// <summary>
/// For tool interactions that have a delay before action this will modify the rate, time to wait is divided by this value
/// </summary>
[ViewVariables(VVAccess.ReadWrite)]
public float SpeedModifier
{
get => _speedModifier;

View File

@@ -5,6 +5,7 @@ using YamlDotNet.RepresentationModel;
using SS14.Server.GameObjects;
using Content.Server.GameObjects.EntitySystems;
using SS14.Shared.Serialization;
using SS14.Shared.ViewVariables;
namespace Content.Server.GameObjects.Components.Interactable.Tools
{
@@ -20,6 +21,7 @@ namespace Content.Server.GameObjects.Components.Interactable.Tools
/// <summary>
/// Maximum fuel capacity the welder can hold
/// </summary>
[ViewVariables(VVAccess.ReadWrite)]
public float FuelCapacity
{
get => _fuelCapacity;
@@ -30,6 +32,7 @@ namespace Content.Server.GameObjects.Components.Interactable.Tools
/// <summary>
/// Fuel the welder has to do tasks
/// </summary>
[ViewVariables(VVAccess.ReadWrite)]
public float Fuel
{
get => _fuel;
@@ -50,6 +53,7 @@ namespace Content.Server.GameObjects.Components.Interactable.Tools
/// <summary>
/// Status of welder, whether it is ignited
/// </summary>
[ViewVariables]
public bool Activated { get; private set; } = false;
//private string OnSprite { get; set; }

View File

@@ -9,6 +9,7 @@ using SS14.Shared.GameObjects;
using SS14.Shared.Interfaces.GameObjects;
using SS14.Shared.Interfaces.Network;
using SS14.Shared.Log;
using SS14.Shared.ViewVariables;
namespace Content.Server.GameObjects.Components.Mobs
{
@@ -23,11 +24,13 @@ namespace Content.Server.GameObjects.Components.Mobs
/// <summary>
/// The mind controlling this mob. Can be null.
/// </summary>
[ViewVariables]
public Mind Mind { get; private set; }
/// <summary>
/// True if we have a mind, false otherwise.
/// </summary>
[ViewVariables]
public bool HasMind => Mind != null;
/// <summary>

View File

@@ -9,6 +9,7 @@ using SS14.Shared.Utility;
using System;
using System.Collections.Generic;
using System.Linq;
using SS14.Shared.ViewVariables;
using YamlDotNet.RepresentationModel;
namespace Content.Server.GameObjects.Components.Power
@@ -23,6 +24,7 @@ namespace Content.Server.GameObjects.Components.Power
/// <summary>
/// The method of draw we will try to use to place our load set via component parameter, defaults to using power providers
/// </summary>
[ViewVariables]
public virtual DrawTypes DrawType
{
get => _drawType;
@@ -33,14 +35,17 @@ namespace Content.Server.GameObjects.Components.Power
/// <summary>
/// The power draw method we are currently connected to and using
/// </summary>
[ViewVariables]
public DrawTypes Connected { get; protected set; } = DrawTypes.None;
[ViewVariables]
public bool Powered { get; private set; } = false;
/// <summary>
/// Is an external power source currently available?
/// </summary>
[ViewVariables]
public bool ExternalPowered
{
get => _externalPowered;
@@ -55,6 +60,7 @@ namespace Content.Server.GameObjects.Components.Power
/// <summary>
/// Is an internal power source currently available?
/// </summary>
[ViewVariables]
public bool InternalPowered
{
get => _internalPowered;
@@ -69,6 +75,7 @@ namespace Content.Server.GameObjects.Components.Power
/// <summary>
/// Priority for powernet draw, lower will draw first, defined in powernet.cs
/// </summary>
[ViewVariables]
public virtual Powernet.Priority Priority
{
get => _priority;
@@ -81,6 +88,7 @@ namespace Content.Server.GameObjects.Components.Power
/// Power load from this entity.
/// In Watts.
/// </summary>
[ViewVariables]
public float Load
{
get => _load;
@@ -98,6 +106,7 @@ namespace Content.Server.GameObjects.Components.Power
/// <summary>
/// A power provider that will handle our load, if we are linked to any
/// </summary>
[ViewVariables]
public PowerProviderComponent Provider
{
get => _provider;

View File

@@ -5,6 +5,7 @@ using SS14.Shared.Log;
using SS14.Shared.Serialization;
using SS14.Shared.Utility;
using System;
using SS14.Shared.ViewVariables;
using YamlDotNet.RepresentationModel;
namespace Content.Server.GameObjects.Components.Power
@@ -20,6 +21,7 @@ namespace Content.Server.GameObjects.Components.Power
/// Power supply from this entity
/// </summary>
private float _supply = 1000; //arbitrary initial magic number to start
[ViewVariables]
public float Supply
{
get => _supply;

View File

@@ -5,6 +5,7 @@ using SS14.Shared.Interfaces.GameObjects.Components;
using SS14.Shared.IoC;
using System;
using System.Linq;
using SS14.Shared.ViewVariables;
namespace Content.Server.GameObjects.Components.Power
{
@@ -18,7 +19,8 @@ namespace Content.Server.GameObjects.Components.Power
/// <summary>
/// The powernet this node is connected to
/// </summary>
public Powernet Parent;
[ViewVariables]
public Powernet Parent { get; set; }
/// <summary>
/// An event handling when this node connects to a powernet

View File

@@ -9,6 +9,7 @@ using SS14.Shared.Utility;
using System;
using System.Collections.Generic;
using System.Linq;
using SS14.Shared.ViewVariables;
using YamlDotNet.RepresentationModel;
namespace Content.Server.GameObjects.Components.Power
@@ -26,6 +27,7 @@ namespace Content.Server.GameObjects.Components.Power
/// <summary>
/// Variable that determines the range that the power provider will try to supply power to
/// </summary>
[ViewVariables]
public int PowerRange
{
get => _range;
@@ -51,6 +53,7 @@ namespace Content.Server.GameObjects.Components.Power
private bool _mainBreaker = true;
[ViewVariables(VVAccess.ReadWrite)]
public bool MainBreaker
{
get => _mainBreaker;
@@ -76,6 +79,7 @@ namespace Content.Server.GameObjects.Components.Power
private float _theoreticalLoad = 0f;
[ViewVariables]
public float TheoreticalLoad
{
get => _theoreticalLoad;

View File

@@ -5,6 +5,7 @@ using SS14.Shared.IoC;
using SS14.Shared.Serialization;
using SS14.Shared.Utility;
using System;
using SS14.Shared.ViewVariables;
using YamlDotNet.RepresentationModel;
namespace Content.Server.GameObjects.Components.Power
@@ -23,6 +24,7 @@ namespace Content.Server.GameObjects.Components.Power
/// Maximum amount of energy the internal battery can store.
/// In Joules.
/// </summary>
[ViewVariables]
public float Capacity => _capacity;
private float _capacity = 10000; // Arbitrary value, replace.
@@ -30,6 +32,7 @@ namespace Content.Server.GameObjects.Components.Power
/// Energy the battery is currently storing.
/// In Joules.
/// </summary>
[ViewVariables]
public float Charge => _charge;
private float _charge = 0;
@@ -37,6 +40,7 @@ namespace Content.Server.GameObjects.Components.Power
/// Rate at which energy will be taken to charge internal battery.
/// In Watts.
/// </summary>
[ViewVariables]
public float ChargeRate => _chargeRate;
private float _chargeRate = 1000;
@@ -44,9 +48,11 @@ namespace Content.Server.GameObjects.Components.Power
/// Rate at which energy will be distributed to the powernet if needed.
/// In Watts.
/// </summary>
[ViewVariables]
public float DistributionRate => _distributionRate;
private float _distributionRate = 1000;
[ViewVariables]
public bool Full => Charge >= Capacity;
private bool _chargepowernet = false;
@@ -54,6 +60,7 @@ namespace Content.Server.GameObjects.Components.Power
/// <summary>
/// Do we distribute power into the powernet from our stores if the powernet requires it?
/// </summary>
[ViewVariables(VVAccess.ReadWrite)]
public bool ChargePowernet
{
get => _chargepowernet;

View File

@@ -7,6 +7,7 @@ using System.Linq;
using SS14.Shared.Interfaces.GameObjects;
using Content.Server.GameObjects.Components.Interactable.Tools;
using SS14.Shared.Interfaces.GameObjects.Components;
using SS14.Shared.ViewVariables;
namespace Content.Server.GameObjects.Components.Power
{
@@ -20,8 +21,10 @@ namespace Content.Server.GameObjects.Components.Power
/// <summary>
/// The powernet this component is connected to
/// </summary>
public Powernet Parent;
[ViewVariables]
public Powernet Parent { get; set; }
[ViewVariables]
public bool Regenerating { get; set; } = false;
public override void Initialize()

View File

@@ -4,6 +4,7 @@ using SS14.Shared.IoC;
using SS14.Shared.Log;
using System;
using System.Collections.Generic;
using SS14.Shared.ViewVariables;
namespace Content.Server.GameObjects.Components.Power
{
@@ -23,6 +24,7 @@ namespace Content.Server.GameObjects.Components.Power
/// <summary>
/// Unique identifier per powernet, used for debugging mostly.
/// </summary>
[ViewVariables]
public int Uid { get; }
/// <summary>
@@ -41,6 +43,7 @@ namespace Content.Server.GameObjects.Components.Power
private readonly Dictionary<PowerGeneratorComponent, float> GeneratorList =
new Dictionary<PowerGeneratorComponent, float>();
[ViewVariables]
public int GeneratorCount => GeneratorList.Count;
/// <summary>
@@ -49,6 +52,7 @@ namespace Content.Server.GameObjects.Components.Power
private readonly SortedSet<PowerDeviceComponent> DeviceLoadList =
new SortedSet<PowerDeviceComponent>(new DevicePriorityCompare());
[ViewVariables]
public int DeviceCount => DeviceLoadList.Count;
/// <summary>
@@ -61,6 +65,7 @@ namespace Content.Server.GameObjects.Components.Power
/// </summary>
private readonly List<PowerStorageComponent> PowerStorageSupplierList = new List<PowerStorageComponent>();
[ViewVariables]
public int PowerStorageSupplierCount => PowerStorageSupplierList.Count;
/// <summary>
@@ -68,23 +73,27 @@ namespace Content.Server.GameObjects.Components.Power
/// </summary>
private readonly List<PowerStorageComponent> PowerStorageConsumerList = new List<PowerStorageComponent>();
[ViewVariables]
public int PowerStorageConsumerCount => PowerStorageConsumerList.Count;
/// <summary>
/// Static counter of all continuous load placed from devices on this power network.
/// In Watts.
/// </summary>
[ViewVariables]
public float Load { get; private set; } = 0;
/// <summary>
/// Static counter of all continuous supply from generators on this power network.
/// In Watts.
/// </summary>
[ViewVariables]
public float Supply { get; private set; } = 0;
/// <summary>
/// Variable that causes powernet to be regenerated from its wires during the next update cycle.
/// </summary>
[ViewVariables]
public bool Dirty { get; set; } = false;
// These are stats for power monitoring equipment such as APCs.
@@ -93,6 +102,7 @@ namespace Content.Server.GameObjects.Components.Power
/// The total supply that was available to us last tick.
/// This does not mean it was used.
/// </summary>
[ViewVariables]
public float LastTotalAvailable { get; private set; }
/// <summary>
@@ -102,6 +112,7 @@ namespace Content.Server.GameObjects.Components.Power
/// If avail &lt; demand, this will be just &lt;= than the actual avail
/// (e.g. if all machines need 100 W but there's 20 W excess, the 20 W will be avail but not drawn.)
/// </summary>
[ViewVariables]
public float LastTotalDraw { get; private set; }
/// <summary>
@@ -111,6 +122,7 @@ namespace Content.Server.GameObjects.Components.Power
/// As such, this will quite abruptly shoot up if available rises to cover supplier charge demand too.
/// </summary>
/// <seealso cref="LastTotalDemandWithSuppliers"/>
[ViewVariables]
public float LastTotalDemand { get; private set; }
/// <summary>
@@ -118,11 +130,13 @@ namespace Content.Server.GameObjects.Components.Power
/// This does not mean it was full filled in practice.
/// See <see cref="LastTotalDemand"/> for the difference.
/// </summary>
[ViewVariables]
public float LastTotalDemandWithSuppliers { get; private set; }
/// <summary>
/// The amount of power that we are lacking to properly power everything (excluding storage supplier charging).
/// </summary>
[ViewVariables]
public float Lack => Math.Max(0, LastTotalDemand - LastTotalAvailable);
/// <summary>
@@ -131,6 +145,7 @@ namespace Content.Server.GameObjects.Components.Power
/// It is ALSO not implied that if this is &gt; 0, that we have sufficient power for everything.
/// See the doc comment on <see cref="LastTotalDraw"/>.
/// </summary>
[ViewVariables]
public float Excess => Math.Max(0, LastTotalAvailable - LastTotalDraw);
public void Update(float frameTime)

View File

@@ -5,6 +5,7 @@ using SS14.Shared.Interfaces.GameObjects;
using SS14.Shared.Interfaces.Reflection;
using SS14.Shared.IoC;
using SS14.Shared.Serialization;
using SS14.Shared.ViewVariables;
namespace Content.Server.GameObjects.Components.Stack
{
@@ -17,6 +18,7 @@ namespace Content.Server.GameObjects.Components.Stack
public override string Name => "Stack";
[ViewVariables]
public int Count
{
get => _count;
@@ -29,9 +31,14 @@ namespace Content.Server.GameObjects.Components.Stack
}
}
}
[ViewVariables]
public int MaxCount { get => _maxCount; private set => _maxCount = value; }
[ViewVariables]
public int AvailableSpace => MaxCount - Count;
[ViewVariables]
public object StackType { get; private set; }
public void Add(int amount)

View File

@@ -6,6 +6,7 @@ using SS14.Shared.Utility;
using YamlDotNet.RepresentationModel;
using Content.Shared.GameObjects;
using SS14.Shared.Serialization;
using SS14.Shared.ViewVariables;
namespace Content.Server.GameObjects
{
@@ -23,6 +24,7 @@ namespace Content.Server.GameObjects
public override uint? NetID => ContentNetIDs.TEMPERATURE;
//TODO: should be programmatic instead of how it currently is
[ViewVariables]
public float CurrentTemperature { get; private set; } = PhysicalConstants.ZERO_CELCIUS;
float _fireDamageThreshold = 0;

View File

@@ -5,6 +5,7 @@ using SS14.Server.Interfaces.Player;
using SS14.Shared.Interfaces.GameObjects;
using SS14.Shared.IoC;
using SS14.Shared.Network;
using SS14.Shared.ViewVariables;
namespace Content.Server.Mobs
{

View File

@@ -1,6 +1,7 @@
using Content.Server.Mobs;
using SS14.Server.Interfaces.Player;
using SS14.Shared.Network;
using SS14.Shared.ViewVariables;
namespace Content.Server.Players
{
@@ -13,11 +14,13 @@ namespace Content.Server.Players
/// <summary>
/// The session ID of the player owning this data.
/// </summary>
[ViewVariables]
public NetSessionId SessionId { get; }
/// <summary>
/// The currently occupied mind of the player owning this data.
/// </summary>
[ViewVariables]
public Mind Mind { get; set; }
public PlayerData(NetSessionId sessionId)

View File

@@ -32,3 +32,4 @@
- whisper
- me
- ooc
CanViewVar: true

2
engine

Submodule engine updated: 6e95476156...523e4d8c49