Esword stuff (#329)
* - fix: Fix black RGB. * - add: Toy sword update. * - add: FlipOnHitSystem. * - tweak: Price reduction.
This commit is contained in:
@@ -207,6 +207,8 @@ namespace Content.Client.Light
|
||||
|
||||
public static Color GetCurrentRgbColor(TimeSpan curTime, TimeSpan offset, Entity<RgbLightControllerComponent> rgb)
|
||||
{
|
||||
offset = TimeSpan.Zero; // WD EDIT, Fix black RGB
|
||||
|
||||
return Color.FromHsv(new Vector4(
|
||||
(float) (((curTime.TotalSeconds - offset.TotalSeconds) * rgb.Comp.CycleRate + Math.Abs(rgb.Owner.Id * 0.1)) % 1),
|
||||
1.0f,
|
||||
|
||||
@@ -14,7 +14,7 @@ public sealed class EmoteAnimationSystem : EntitySystem
|
||||
|
||||
private readonly Dictionary<string, Action<EntityUid>> _emoteList = new();
|
||||
|
||||
private const string AnimationKey = "emoteAnimationKeyId";
|
||||
public const string AnimationKey = "emoteAnimationKeyId";
|
||||
private const string AnimationKeyTurn = "emoteAnimationKeyId_rotate";
|
||||
|
||||
//OnVerbsResponse?.Invoke(msg);
|
||||
|
||||
91
Content.Client/_White/Animations/FlipOnHitSystem.cs
Normal file
91
Content.Client/_White/Animations/FlipOnHitSystem.cs
Normal file
@@ -0,0 +1,91 @@
|
||||
using Content.Shared._White.Animations;
|
||||
using Content.Shared.Item.ItemToggle.Components;
|
||||
using Content.Shared.Weapons.Melee.Events;
|
||||
using Robust.Client.Animations;
|
||||
using Robust.Client.GameObjects;
|
||||
using Robust.Shared.Animations;
|
||||
using Robust.Shared.Timing;
|
||||
|
||||
namespace Content.Client._White.Animations;
|
||||
|
||||
public sealed class FlipOnHitSystem : EntitySystem
|
||||
{
|
||||
[Dependency] private readonly AnimationPlayerSystem _animationSystem = default!;
|
||||
[Dependency] private readonly IGameTiming _timing = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
SubscribeLocalEvent<FlipOnHitComponent, MeleeHitEvent>(OnHit);
|
||||
SubscribeLocalEvent<FlippingComponent, AnimationCompletedEvent>(OnAnimationComplete);
|
||||
}
|
||||
|
||||
private void OnAnimationComplete(Entity<FlippingComponent> ent, ref AnimationCompletedEvent args)
|
||||
{
|
||||
if (args.Key != EmoteAnimationSystem.AnimationKey)
|
||||
return;
|
||||
|
||||
PlayAnimation(ent);
|
||||
}
|
||||
|
||||
private void OnHit(Entity<FlipOnHitComponent> ent, ref MeleeHitEvent args)
|
||||
{
|
||||
if (!_timing.IsFirstTimePredicted)
|
||||
return;
|
||||
|
||||
if (args.HitEntities.Count == 0)
|
||||
return;
|
||||
|
||||
if (TryComp(ent, out ItemToggleComponent? itemToggle) && !itemToggle.Activated)
|
||||
return;
|
||||
|
||||
if (_animationSystem.HasRunningAnimation(args.User, EmoteAnimationSystem.AnimationKey))
|
||||
{
|
||||
EnsureComp<FlippingComponent>(args.User);
|
||||
return;
|
||||
}
|
||||
|
||||
PlayAnimation(args.User);
|
||||
}
|
||||
|
||||
private void PlayAnimation(EntityUid user)
|
||||
{
|
||||
RemComp<FlippingComponent>(user);
|
||||
|
||||
var baseAngle = Angle.Zero;
|
||||
if (EntityManager.TryGetComponent(user, out SpriteComponent? sprite))
|
||||
baseAngle = sprite.Rotation;
|
||||
|
||||
var degrees = baseAngle.Degrees;
|
||||
|
||||
var animation = new Animation
|
||||
{
|
||||
Length = TimeSpan.FromMilliseconds(1600),
|
||||
AnimationTracks =
|
||||
{
|
||||
new AnimationTrackComponentProperty
|
||||
{
|
||||
ComponentType = typeof(SpriteComponent),
|
||||
Property = nameof(SpriteComponent.Rotation),
|
||||
InterpolationMode = AnimationInterpolationMode.Linear,
|
||||
KeyFrames =
|
||||
{
|
||||
new AnimationTrackProperty.KeyFrame(Angle.FromDegrees(degrees - 10), 0f),
|
||||
new AnimationTrackProperty.KeyFrame(Angle.FromDegrees(degrees + 180), 0.2f),
|
||||
new AnimationTrackProperty.KeyFrame(Angle.FromDegrees(degrees + 360), 0.2f),
|
||||
new AnimationTrackProperty.KeyFrame(Angle.FromDegrees(degrees + 540), 0.2f),
|
||||
new AnimationTrackProperty.KeyFrame(Angle.FromDegrees(degrees + 720), 0.2f),
|
||||
new AnimationTrackProperty.KeyFrame(Angle.FromDegrees(degrees + 900), 0.2f),
|
||||
new AnimationTrackProperty.KeyFrame(Angle.FromDegrees(degrees + 1080), 0.2f),
|
||||
new AnimationTrackProperty.KeyFrame(Angle.FromDegrees(degrees + 1260), 0.2f),
|
||||
new AnimationTrackProperty.KeyFrame(Angle.FromDegrees(degrees + 1440), 0.2f),
|
||||
new AnimationTrackProperty.KeyFrame(Angle.FromDegrees(degrees), 0f)
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
_animationSystem.Play(user, animation, EmoteAnimationSystem.AnimationKey);
|
||||
}
|
||||
}
|
||||
6
Content.Client/_White/Animations/FlippingComponent.cs
Normal file
6
Content.Client/_White/Animations/FlippingComponent.cs
Normal file
@@ -0,0 +1,6 @@
|
||||
namespace Content.Client._White.Animations;
|
||||
|
||||
[RegisterComponent]
|
||||
public sealed partial class FlippingComponent : Component
|
||||
{
|
||||
}
|
||||
8
Content.Shared/_White/Animations/FlipOnHitComponent.cs
Normal file
8
Content.Shared/_White/Animations/FlipOnHitComponent.cs
Normal file
@@ -0,0 +1,8 @@
|
||||
using Robust.Shared.GameStates;
|
||||
|
||||
namespace Content.Shared._White.Animations;
|
||||
|
||||
[RegisterComponent, NetworkedComponent]
|
||||
public sealed partial class FlipOnHitComponent : Component
|
||||
{
|
||||
}
|
||||
@@ -150,6 +150,8 @@ ent-PonderingOrb = шар размышлений
|
||||
.suffix = { "" }
|
||||
ent-ToySword = игрушечный меч
|
||||
.desc = Новый пластиковый меч от Sandy-Cat! Имеет реалистичный звук и насыщенный цвет! Почти как настоящий!
|
||||
ent-ToySwordDouble = двойной игрушечный меч
|
||||
.desc = Новый пластиковый меч от Sandy-Cat! Имеет реалистичный звук и насыщенный цвет! Почти как настоящий!
|
||||
.suffix = { "" }
|
||||
ent-ToyAmongPequeno = маленький амонг
|
||||
.desc = сас!
|
||||
|
||||
@@ -53,7 +53,7 @@
|
||||
icon: { sprite: /Textures/Objects/Weapons/Melee/e_sword.rsi, state: icon }
|
||||
productEntity: EnergySword
|
||||
cost:
|
||||
Telecrystal: 8
|
||||
Telecrystal: 7
|
||||
categories:
|
||||
- UplinkWeaponry
|
||||
saleLimit: 2
|
||||
|
||||
@@ -1173,13 +1173,14 @@
|
||||
|
||||
- type: entity
|
||||
parent: BaseItem
|
||||
id: ToySword
|
||||
id: ToySwordBase
|
||||
name: toy sword
|
||||
description: New Sandy-Cat plastic sword! Comes with realistic sound and full color! Looks almost like the real thing!
|
||||
abstract: true
|
||||
components:
|
||||
- type: EnergySword
|
||||
colorOptions:
|
||||
- DodgerBlue
|
||||
#colorOptions:
|
||||
# - DodgerBlue
|
||||
- type: ItemToggle
|
||||
soundActivate:
|
||||
path: /Audio/Weapons/ebladeon.ogg
|
||||
@@ -1189,7 +1190,8 @@
|
||||
activeSound:
|
||||
path: /Audio/Weapons/ebladehum.ogg
|
||||
- type: Sprite
|
||||
sprite: Objects/Fun/toy_sword.rsi
|
||||
#sprite: Objects/Fun/toy_sword.rsi
|
||||
sprite: Objects/Weapons/Melee/e_sword.rsi
|
||||
layers:
|
||||
- state: e_sword
|
||||
- state: e_sword_blade
|
||||
@@ -1199,7 +1201,8 @@
|
||||
map: [ "blade" ]
|
||||
- type: Item
|
||||
size: Small
|
||||
sprite: Objects/Fun/toy_sword.rsi
|
||||
#sprite: Objects/Fun/toy_sword.rsi
|
||||
sprite: Objects/Weapons/Melee/e_sword-inhands.rsi
|
||||
- type: UseDelay
|
||||
delay: 1.0
|
||||
- type: PointLight
|
||||
@@ -1223,6 +1226,7 @@
|
||||
- type: StaminaDamageOnHit
|
||||
damage: 8
|
||||
- type: MeleeWeapon
|
||||
wideAnimationRotation: -135
|
||||
damage:
|
||||
types:
|
||||
Blunt: 0
|
||||
@@ -1235,10 +1239,55 @@
|
||||
path: /Audio/Weapons/eblade1.ogg
|
||||
params:
|
||||
variation: 0.250
|
||||
volume: -10
|
||||
activatedSoundOnSwing:
|
||||
path: /Audio/Weapons/eblademiss.ogg
|
||||
params:
|
||||
variation: 0.125
|
||||
- type: ItemToggleSize
|
||||
activatedSize: Huge
|
||||
|
||||
- type: entity
|
||||
name: toy sword
|
||||
description: New Sandy-Cat plastic sword! Comes with realistic sound and full color! Looks almost like the real thing!
|
||||
parent: ToySwordBase
|
||||
id: ToySword
|
||||
components:
|
||||
- type: Construction
|
||||
deconstructionTarget: null
|
||||
graph: ToyDoubleSwordGraph
|
||||
node: esword
|
||||
- type: Tag
|
||||
tags:
|
||||
- ToySword
|
||||
|
||||
- type: entity
|
||||
name: double toy sword
|
||||
description: New Sandy-Cat plastic sword! Comes with realistic sound and full color! Looks almost like the real thing!
|
||||
parent: ToySwordBase
|
||||
id: ToySwordDouble
|
||||
components:
|
||||
- type: Sprite
|
||||
sprite: Objects/Weapons/Melee/double_esword.rsi
|
||||
layers:
|
||||
- state: e_sword_double
|
||||
- state: e_sword_double_blade
|
||||
color: "#FFFFFF"
|
||||
visible: false
|
||||
shader: unshaded
|
||||
map: [ "blade" ]
|
||||
- type: Item
|
||||
size: Small
|
||||
sprite: Objects/Weapons/Melee/double_esword.rsi
|
||||
- type: Wieldable
|
||||
- type: ToggleableWielded
|
||||
- type: StaminaDamageOnHit
|
||||
damage: 16
|
||||
- type: FlipOnHit
|
||||
- type: Construction
|
||||
deconstructionTarget: null
|
||||
graph: ToyDoubleSwordGraph
|
||||
node: desword
|
||||
|
||||
- type: entity
|
||||
parent: BasePlushie
|
||||
|
||||
@@ -256,14 +256,13 @@
|
||||
types:
|
||||
Slash: 15
|
||||
Heat: 15
|
||||
- type: MeleeWeapon
|
||||
attackRate: 1
|
||||
- type: Reflect
|
||||
reflectProb: 1
|
||||
enabled: false
|
||||
reflects:
|
||||
- Energy
|
||||
- type: ToggleableWielded
|
||||
- type: FlipOnHit
|
||||
- type: Construction
|
||||
deconstructionTarget: null
|
||||
graph: EnergyDoubleSwordGraph
|
||||
|
||||
@@ -10,6 +10,18 @@
|
||||
- node: desword
|
||||
entity: EnergySwordDouble
|
||||
|
||||
- type: constructionGraph
|
||||
id: ToyDoubleSwordGraph
|
||||
start: esword
|
||||
graph:
|
||||
- node: esword
|
||||
edges:
|
||||
- to: desword
|
||||
steps:
|
||||
- tag: ToySword
|
||||
- node: desword
|
||||
entity: ToySwordDouble
|
||||
|
||||
- type: constructionGraph
|
||||
id: WeaponFlamethrowerGraph
|
||||
start: welder
|
||||
|
||||
@@ -4,6 +4,9 @@
|
||||
- type: Tag
|
||||
id: EnergySword
|
||||
|
||||
- type: Tag
|
||||
id: ToySword
|
||||
|
||||
- type: Tag
|
||||
id: CrossbowBolt
|
||||
|
||||
|
||||
Reference in New Issue
Block a user