diff --git a/Content.Server/_Sunrise/Flip/FlipSystem.cs b/Content.Server/_Sunrise/Flip/FlipSystem.cs index 40242fee633..b11b80cadb2 100644 --- a/Content.Server/_Sunrise/Flip/FlipSystem.cs +++ b/Content.Server/_Sunrise/Flip/FlipSystem.cs @@ -3,12 +3,14 @@ using Content.Shared.Chat.Prototypes; using Content.Shared.Mobs.Components; using Content.Shared.Weapons.Melee.Events; +using Robust.Shared.Random; namespace Content.Server._Sunrise.Flip; public sealed class FlipSystem : SharedFlipSystem { [Dependency] private readonly ChatSystem _chat = default!; + [Dependency] private readonly IRobustRandom _random = default!; [ValidatePrototypeId] private const string EmoteFlipProto = "Flip"; @@ -22,12 +24,14 @@ public override void Initialize() private void OnFlipOnAttack(EntityUid uid, FlipOnAttackComponent component, MeleeHitEvent args) { - Logger.Info("OnFlipOnAttack"); foreach (var entity in args.HitEntities) { if (!HasComp(entity)) continue; + if (!_random.Prob(component.Probability)) + continue; + PlayEmoteFlip(args.User); return; } diff --git a/Content.Shared/_Sunrise/Flip/FlipOnAttackComponent.cs b/Content.Shared/_Sunrise/Flip/FlipOnAttackComponent.cs index 237af09ab2a..f7a34b1cd06 100644 --- a/Content.Shared/_Sunrise/Flip/FlipOnAttackComponent.cs +++ b/Content.Shared/_Sunrise/Flip/FlipOnAttackComponent.cs @@ -3,5 +3,9 @@ namespace Content.Shared._Sunrise.Flip { [NetworkedComponent, RegisterComponent] - public sealed partial class FlipOnAttackComponent : Component; + public sealed partial class FlipOnAttackComponent : Component + { + [ViewVariables(VVAccess.ReadWrite), DataField("probability")] + public float Probability = 1.0f; + } } diff --git a/Resources/Prototypes/Entities/Objects/Weapons/Melee/e_sword.yml b/Resources/Prototypes/Entities/Objects/Weapons/Melee/e_sword.yml index 02f899a4e7b..078dbd12d84 100644 --- a/Resources/Prototypes/Entities/Objects/Weapons/Melee/e_sword.yml +++ b/Resources/Prototypes/Entities/Objects/Weapons/Melee/e_sword.yml @@ -346,6 +346,7 @@ spread: 75 needActiveHand: true # Sunrise-Edit - type: FlipOnAttack # Sunrise-Edit + probability: 0.5 # Sunrise-Edit - type: entity suffix: One-Handed, For Borgs