Add pointing (#1435)
* Add pointing keybind and simple message * Add turning the player when pointing * Add pointing arrow * Make the popup message appear on the pointing entity * Add pointing to tiles and space and proper grammar * Move pointing bind from HandsSystem to PointingSystem * Add more messages for pointing depending on the viewer perspective * Fix non nullable reference type * Serialize pointing arrow duration * Serialize pointing arrow step and add summaries * Make arrow speed serializable and make it depend on frame time * Add 0.2 second delay between pointings * Add pointing arrow yaml examples * Add the ability for pointing arrows to be rogue * Remove rogue package reference * Add point to verb https://cdn.discordapp.com/attachments/313107470031650816/735268651636228197/unknown.png * Add shift middle clicking an entity in the verb menu to point at it * Add VV to PointingArrowComponent * Increase pointing delay from 0.2 to 0.5 seconds * Address reviews * Fix nullability errors * Separate pointing and rogue pointing code * Fix rogue pointing arrow visuals * Made rogue pointing arrow rotation adjustment readable for mortals * Make rogue pointing arrows less destructive * Cleanup more of the rogue pointing arrow code
This commit is contained in:
@@ -0,0 +1,67 @@
|
||||
using System;
|
||||
using Content.Shared.GameObjects.Components.Mobs;
|
||||
using Content.Shared.GameObjects.Components.Pointing;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Client.Animations;
|
||||
using Robust.Client.GameObjects;
|
||||
using Robust.Client.GameObjects.Components.Animations;
|
||||
using Robust.Client.Interfaces.GameObjects.Components;
|
||||
using Robust.Shared.Animations;
|
||||
using Robust.Shared.Maths;
|
||||
|
||||
namespace Content.Client.GameObjects.Components.Pointing
|
||||
{
|
||||
[UsedImplicitly]
|
||||
public class RoguePointingArrowVisualizer : AppearanceVisualizer
|
||||
{
|
||||
public override void OnChangeData(AppearanceComponent component)
|
||||
{
|
||||
base.OnChangeData(component);
|
||||
|
||||
if (component.Deleted)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (component.TryGetData<double>(RoguePointingArrowVisuals.Rotation, out var degrees))
|
||||
{
|
||||
SetRotation(component, Angle.FromDegrees(degrees));
|
||||
}
|
||||
}
|
||||
|
||||
private void SetRotation(AppearanceComponent component, Angle rotation)
|
||||
{
|
||||
var sprite = component.Owner.GetComponent<ISpriteComponent>();
|
||||
|
||||
if (!sprite.Owner.TryGetComponent(out AnimationPlayerComponent animation))
|
||||
{
|
||||
sprite.Rotation = rotation;
|
||||
return;
|
||||
}
|
||||
|
||||
if (animation.HasRunningAnimation("rotate"))
|
||||
{
|
||||
animation.Stop("rotate");
|
||||
}
|
||||
|
||||
animation.Play(new Animation
|
||||
{
|
||||
Length = TimeSpan.FromSeconds(0.125),
|
||||
AnimationTracks =
|
||||
{
|
||||
new AnimationTrackComponentProperty
|
||||
{
|
||||
ComponentType = typeof(ISpriteComponent),
|
||||
Property = nameof(ISpriteComponent.Rotation),
|
||||
InterpolationMode = AnimationInterpolationMode.Linear,
|
||||
KeyFrames =
|
||||
{
|
||||
new AnimationTrackProperty.KeyFrame(sprite.Rotation, 0),
|
||||
new AnimationTrackProperty.KeyFrame(rotation, 0.125f)
|
||||
}
|
||||
}
|
||||
}
|
||||
}, "rotate");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user