Shitty combat mode & animations. (#367)

* Combat mode UI & targeting zones.

* Fix inventory hud positioning.

* Crappy attack animations.

* Import TG combat sounds

* More work on arcs.

* Implement hit sounds.

* Lunging, hit effects, some more stuff.
This commit is contained in:
Pieter-Jan Briers
2019-09-26 22:32:32 +02:00
committed by GitHub
parent ac55ccf46e
commit 02d509fc5f
47 changed files with 1231 additions and 35 deletions

View File

@@ -0,0 +1,27 @@
using System;
using Robust.Shared.GameObjects;
using Robust.Shared.Serialization;
namespace Content.Shared.GameObjects.Components.Mobs
{
public abstract class SharedCombatModeComponent : Component
{
public sealed override uint? NetID => ContentNetIDs.COMBATMODE;
public override string Name => "CombatMode";
public sealed override Type StateType => typeof(CombatModeComponentState);
[Serializable, NetSerializable]
protected sealed class CombatModeComponentState : ComponentState
{
public bool IsInCombatMode { get; }
public TargetingZone TargetingZone { get; }
public CombatModeComponentState(bool isInCombatMode, TargetingZone targetingZone)
: base(ContentNetIDs.COMBATMODE)
{
IsInCombatMode = isInCombatMode;
TargetingZone = targetingZone;
}
}
}
}

View File

@@ -0,0 +1,27 @@
using System;
using Robust.Shared.Serialization;
namespace Content.Shared.GameObjects.Components.Mobs
{
/// <summary>
/// Zones the player can target for attacks.
/// </summary>
[Serializable, NetSerializable]
public enum TargetingZone
{
/// <summary>
/// Torso/arm area.
/// </summary>
Middle,
/// <summary>
/// Legs/groin area.
/// </summary>
Low,
/// <summary>
/// Go for the head.
/// </summary>
High
}
}

View File

@@ -0,0 +1,59 @@
using System;
using Robust.Shared.Maths;
using Robust.Shared.Prototypes;
using Robust.Shared.Serialization;
using Robust.Shared.ViewVariables;
using YamlDotNet.RepresentationModel;
namespace Content.Shared.GameObjects.Components.Weapons.Melee
{
[Prototype("MeleeWeaponAnimation")]
public sealed class MeleeWeaponAnimationPrototype : IPrototype, IIndexedPrototype
{
private string _state;
private string _id;
private Vector4 _colorDelta;
private Vector4 _color;
private TimeSpan _length;
private float _speed;
private float _width;
private WeaponArcType _arcType;
[ViewVariables] public string ID => _id;
[ViewVariables] public string State => _state;
[ViewVariables] public TimeSpan Length => _length;
[ViewVariables] public float Speed => _speed;
[ViewVariables] public Vector4 Color => _color;
[ViewVariables] public Vector4 ColorDelta => _colorDelta;
[ViewVariables] public WeaponArcType ArcType => _arcType;
[ViewVariables] public float Width => _width;
public void LoadFrom(YamlMappingNode mapping)
{
var serializer = YamlObjectSerializer.NewReader(mapping);
serializer.DataField(ref _state, "state", null);
serializer.DataField(ref _id, "id", null);
serializer.DataField(ref _colorDelta, "colorDelta", Vector4.Zero);
serializer.DataField(ref _color, "color", new Vector4(1, 1, 1, 1));
if (serializer.TryReadDataField("length", out float length))
{
_length = TimeSpan.FromSeconds(length);
}
else
{
_length = TimeSpan.FromSeconds(0.5f);
}
serializer.DataField(ref _speed, "speed", 1);
serializer.DataField(ref _arcType, "arcType", WeaponArcType.Slash);
serializer.DataField(ref _width, "width", 90);
}
}
public enum WeaponArcType
{
Slash,
Poke,
}
}