From 9f00a90f2419efa0a7f7969e47206a7053961f44 Mon Sep 17 00:00:00 2001 From: Aviu00 <93730715+Aviu00@users.noreply.github.com> Date: Tue, 2 Apr 2024 23:19:33 +0900 Subject: [PATCH] Aspects (#266) * - add: Revive fast and furious aspect. * - add: Update accents. * - add: More buzzing for moth. * - tweak: Change desc. * - fix: Fixes. * - add: RandomItemAspect. * - fix: Fix arachnid socks. * - tweak: Update desc part 2. --- .../Changeling/ChangelingSystem.Abilities.cs | 4 + .../Holiday/Christmas/RandomGiftSystem.cs | 7 ++ .../Speech/EntitySystems/BarkAccentSystem.cs | 9 ++- .../Speech/EntitySystems/MothAccentSystem.cs | 12 ++- .../Components/RandomItemAspectComponent.cs | 8 ++ .../Aspects/FastAndFuriousAspect.cs | 18 ++--- .../Aspects/RandomAccentAspect.cs | 18 ++++- .../AspectsSystem/Aspects/RandomItemAspect.cs | 76 +++++++++++++++++++ .../FastAndFuriousComponent.cs | 11 +++ .../FastAndFuriousSystem.cs | 26 +++++++ .../Entities/Mobs/Species/arachnid.yml | 6 +- .../Prototypes/_White/Aspects/Aspects.yml | 42 ++++++---- .../Prototypes/_White/BodyTypes/normal.yml | 7 ++ .../Prototypes/_White/BodyTypes/slim.yml | 2 + 14 files changed, 213 insertions(+), 33 deletions(-) create mode 100644 Content.Server/_White/AspectsSystem/Aspects/Components/RandomItemAspectComponent.cs create mode 100644 Content.Server/_White/AspectsSystem/Aspects/RandomItemAspect.cs create mode 100644 Content.Server/_White/Other/FastAndFuriousSystem/FastAndFuriousComponent.cs create mode 100644 Content.Server/_White/Other/FastAndFuriousSystem/FastAndFuriousSystem.cs diff --git a/Content.Server/Changeling/ChangelingSystem.Abilities.cs b/Content.Server/Changeling/ChangelingSystem.Abilities.cs index 1943b28a67..6c02cf6684 100644 --- a/Content.Server/Changeling/ChangelingSystem.Abilities.cs +++ b/Content.Server/Changeling/ChangelingSystem.Abilities.cs @@ -1,6 +1,7 @@ using System.Linq; using Content.Server._White.Cult.GameRule; using Content.Server._White.Mood; +using Content.Server._White.Other.FastAndFuriousSystem; using Content.Server.Administration.Systems; using Content.Server.Bible.Components; using Content.Server.Body.Components; @@ -998,6 +999,9 @@ public sealed partial class ChangelingSystem private void TransferComponents(EntityUid from, EntityUid to) { + if (HasComp(from)) + EnsureComp(to); + if (HasComp(from)) EnsureComp(to); diff --git a/Content.Server/Holiday/Christmas/RandomGiftSystem.cs b/Content.Server/Holiday/Christmas/RandomGiftSystem.cs index e95649763a..83755c5e40 100644 --- a/Content.Server/Holiday/Christmas/RandomGiftSystem.cs +++ b/Content.Server/Holiday/Christmas/RandomGiftSystem.cs @@ -114,4 +114,11 @@ public sealed class RandomGiftSystem : EntitySystem _possibleGiftsSafe.Add(proto.ID); } } + + // WD START + public string? PickRandomItem() + { + return _possibleGiftsSafe.Count == 0 ? null : _random.Pick(_possibleGiftsSafe); + } + // WD END } diff --git a/Content.Server/Speech/EntitySystems/BarkAccentSystem.cs b/Content.Server/Speech/EntitySystems/BarkAccentSystem.cs index a6e5b68ffc..7d1cca20e6 100644 --- a/Content.Server/Speech/EntitySystems/BarkAccentSystem.cs +++ b/Content.Server/Speech/EntitySystems/BarkAccentSystem.cs @@ -1,3 +1,4 @@ +using System.Text.RegularExpressions; using Content.Server.Speech.Components; using Robust.Shared.Random; @@ -8,7 +9,7 @@ namespace Content.Server.Speech.EntitySystems [Dependency] private readonly IRobustRandom _random = default!; private static readonly IReadOnlyList Barks = new List{ - " Woof!", " WOOF", " wof-wof" + " Гав!", " ГАВ", " гав-гав" // WD EDIT }.AsReadOnly(); private static readonly IReadOnlyDictionary SpecialWords = new Dictionary() @@ -31,6 +32,12 @@ namespace Content.Server.Speech.EntitySystems message = message.Replace(word, repl); } + // WD EDIT START + message = Regex.Replace(message, "р{1,3}", "ррр"); + + message = Regex.Replace(message, "Р{1,3}", "РРР"); + // WD EDIT END + return message.Replace("!", _random.Pick(Barks)) .Replace("l", "r").Replace("L", "R"); } diff --git a/Content.Server/Speech/EntitySystems/MothAccentSystem.cs b/Content.Server/Speech/EntitySystems/MothAccentSystem.cs index 3de4651b4a..4fe299e150 100644 --- a/Content.Server/Speech/EntitySystems/MothAccentSystem.cs +++ b/Content.Server/Speech/EntitySystems/MothAccentSystem.cs @@ -19,7 +19,17 @@ public sealed class MothAccentSystem : EntitySystem message = Regex.Replace(message, "z{1,3}", "zzz"); // buZZZ message = Regex.Replace(message, "Z{1,3}", "ZZZ"); - + + // WD EDIT START + message = Regex.Replace(message, "з{1,3}", "ззз"); + + message = Regex.Replace(message, "З{1,3}", "ЗЗЗ"); + + message = Regex.Replace(message, "ж{1,3}", "жжж"); + + message = Regex.Replace(message, "Ж{1,3}", "ЖЖЖ"); + // WD EDIT END + args.Message = message; } } diff --git a/Content.Server/_White/AspectsSystem/Aspects/Components/RandomItemAspectComponent.cs b/Content.Server/_White/AspectsSystem/Aspects/Components/RandomItemAspectComponent.cs new file mode 100644 index 0000000000..9fe4e5230f --- /dev/null +++ b/Content.Server/_White/AspectsSystem/Aspects/Components/RandomItemAspectComponent.cs @@ -0,0 +1,8 @@ +namespace Content.Server._White.AspectsSystem.Aspects.Components; + +[RegisterComponent] +public sealed partial class RandomItemAspectComponent : Component +{ + [ViewVariables] + public string? Item; +} diff --git a/Content.Server/_White/AspectsSystem/Aspects/FastAndFuriousAspect.cs b/Content.Server/_White/AspectsSystem/Aspects/FastAndFuriousAspect.cs index 2ba9dbad84..79cbc76a7c 100644 --- a/Content.Server/_White/AspectsSystem/Aspects/FastAndFuriousAspect.cs +++ b/Content.Server/_White/AspectsSystem/Aspects/FastAndFuriousAspect.cs @@ -3,6 +3,7 @@ using Content.Server.GameTicking; using Content.Server.GameTicking.Rules.Components; using Content.Server._White.AspectsSystem.Aspects.Components; using Content.Server._White.AspectsSystem.Base; +using Content.Server._White.Other.FastAndFuriousSystem; using Content.Shared.Cloning; using Content.Shared.Movement.Components; using Content.Shared.Movement.Systems; @@ -11,8 +12,6 @@ namespace Content.Server._White.AspectsSystem.Aspects; public sealed class FastAndFuriousAspect : AspectSystem { - [Dependency] private readonly MovementSpeedModifierSystem _movementSystem = default!; - public override void Initialize() { base.Initialize(); @@ -25,10 +24,9 @@ public sealed class FastAndFuriousAspect : AspectSystem(); - while (query.MoveNext(out var ent, out var speedModifierComponent)) + while (query.MoveNext(out var ent, out _)) { - _movementSystem.ChangeBaseSpeed(ent, speedModifierComponent.BaseWalkSpeed, - speedModifierComponent.BaseSprintSpeed + 3, speedModifierComponent.Acceleration); + EnsureComp(ent); } } @@ -37,10 +35,9 @@ public sealed class FastAndFuriousAspect : AspectSystem(); - while (query.MoveNext(out var ent, out var speedModifierComponent)) + while (query.MoveNext(out var ent, out _)) { - _movementSystem.ChangeBaseSpeed(ent, speedModifierComponent.BaseWalkSpeed, - speedModifierComponent.BaseSprintSpeed, speedModifierComponent.Acceleration); + EnsureComp(ent); } } @@ -65,11 +62,10 @@ public sealed class FastAndFuriousAspect : AspectSystem(mob, out var speedModifierComponent)) + if (!HasComp(mob)) return; - _movementSystem.ChangeBaseSpeed(mob, speedModifierComponent.BaseWalkSpeed, - speedModifierComponent.BaseSprintSpeed + 3, speedModifierComponent.Acceleration); + EnsureComp(mob); } } } diff --git a/Content.Server/_White/AspectsSystem/Aspects/RandomAccentAspect.cs b/Content.Server/_White/AspectsSystem/Aspects/RandomAccentAspect.cs index 0a4a0f267d..7948b80e98 100644 --- a/Content.Server/_White/AspectsSystem/Aspects/RandomAccentAspect.cs +++ b/Content.Server/_White/AspectsSystem/Aspects/RandomAccentAspect.cs @@ -58,7 +58,10 @@ public sealed class RandomAccentAspect : AspectSystem(uid); break; + case AccentType.Bark: + EntityManager.EnsureComponent(uid); + break; + case AccentType.Anxiety: + var stutter = EntityManager.EnsureComponent(uid); + stutter.MatchRandomProb = 0.2f; + stutter.FourRandomProb = 0f; + stutter.ThreeRandomProb = 0.3f; + stutter.CutRandomProb = 0f; + break; + case AccentType.Moth: + EntityManager.EnsureComponent(uid); + break; } } diff --git a/Content.Server/_White/AspectsSystem/Aspects/RandomItemAspect.cs b/Content.Server/_White/AspectsSystem/Aspects/RandomItemAspect.cs new file mode 100644 index 0000000000..e8c0db100d --- /dev/null +++ b/Content.Server/_White/AspectsSystem/Aspects/RandomItemAspect.cs @@ -0,0 +1,76 @@ +using Content.Server.GameTicking; +using Content.Server.GameTicking.Rules.Components; +using Content.Server._White.AspectsSystem.Aspects.Components; +using Content.Server._White.AspectsSystem.Base; +using Content.Server.Holiday.Christmas; +using Content.Shared.Hands.Components; +using Content.Shared.Hands.EntitySystems; +using Content.Shared.Humanoid; + +namespace Content.Server._White.AspectsSystem.Aspects; + +public sealed class RandomItemAspect : AspectSystem +{ + [Dependency] private readonly SharedHandsSystem _handsSystem = default!; + [Dependency] private readonly RandomGiftSystem _giftSystem = default!; + + public override void Initialize() + { + base.Initialize(); + + SubscribeLocalEvent(HandleLateJoin); + } + + protected override void Started(EntityUid uid, RandomItemAspectComponent component, GameRuleComponent gameRule, GameRuleStartedEvent args) + { + base.Started(uid, component, gameRule, args); + + var query = EntityQueryEnumerator(); + while (query.MoveNext(out var ent, out _)) + { + GiveItem(ent, component); + } + + } + + private void HandleLateJoin(PlayerSpawnCompleteEvent ev) + { + var query = EntityQueryEnumerator(); + while (query.MoveNext(out var ruleEntity, out var component, out var gameRule)) + { + if (!GameTicker.IsGameRuleAdded(ruleEntity, gameRule)) + continue; + + if (!ev.LateJoin) + return; + + var mob = ev.Mob; + + GiveItem(mob, component); + } + } + + #region Helpers + + private void GiveItem(EntityUid player, RandomItemAspectComponent component) + { + component.Item ??= _giftSystem.PickRandomItem(); + + if (component.Item == null) + return; + + var transform = CompOrNull(player); + + if(transform == null) + return; + + if(!HasComp(player)) + return; + + var weaponEntity = EntityManager.SpawnEntity(component.Item, transform.Coordinates); + + _handsSystem.PickupOrDrop(player, weaponEntity); + } + + #endregion +} diff --git a/Content.Server/_White/Other/FastAndFuriousSystem/FastAndFuriousComponent.cs b/Content.Server/_White/Other/FastAndFuriousSystem/FastAndFuriousComponent.cs new file mode 100644 index 0000000000..28d9af7e0c --- /dev/null +++ b/Content.Server/_White/Other/FastAndFuriousSystem/FastAndFuriousComponent.cs @@ -0,0 +1,11 @@ +namespace Content.Server._White.Other.FastAndFuriousSystem; + +[RegisterComponent] +public sealed partial class FastAndFuriousComponent : Component +{ + [ViewVariables(VVAccess.ReadWrite)] + public float SprintModifier = 1.6f; + + [ViewVariables(VVAccess.ReadWrite)] + public float WalkModifier = 1; +} diff --git a/Content.Server/_White/Other/FastAndFuriousSystem/FastAndFuriousSystem.cs b/Content.Server/_White/Other/FastAndFuriousSystem/FastAndFuriousSystem.cs new file mode 100644 index 0000000000..b06bd0d367 --- /dev/null +++ b/Content.Server/_White/Other/FastAndFuriousSystem/FastAndFuriousSystem.cs @@ -0,0 +1,26 @@ +using Content.Shared.Movement.Systems; + +namespace Content.Server._White.Other.FastAndFuriousSystem; + +public sealed class FastAndFuriousSystem : EntitySystem +{ + [Dependency] private readonly MovementSpeedModifierSystem _movementSpeedModifierSystem = default!; + + public override void Initialize() + { + base.Initialize(); + + SubscribeLocalEvent(OnMapInit); + SubscribeLocalEvent(OnRefresh); + } + + private void OnRefresh(Entity ent, ref RefreshMovementSpeedModifiersEvent args) + { + args.ModifySpeed(ent.Comp.WalkModifier, ent.Comp.SprintModifier); + } + + private void OnMapInit(Entity ent, ref MapInitEvent args) + { + _movementSpeedModifierSystem.RefreshMovementSpeedModifiers(ent); + } +} diff --git a/Resources/Prototypes/Entities/Mobs/Species/arachnid.yml b/Resources/Prototypes/Entities/Mobs/Species/arachnid.yml index 8b97925248..3174710a21 100644 --- a/Resources/Prototypes/Entities/Mobs/Species/arachnid.yml +++ b/Resources/Prototypes/Entities/Mobs/Species/arachnid.yml @@ -76,8 +76,6 @@ - map: [ "enum.HumanoidVisualLayers.LArm" ] - map: [ "enum.HumanoidVisualLayers.RLeg" ] - map: [ "enum.HumanoidVisualLayers.LLeg" ] - - map: [ "underwearb" ] #White - - map: [ "underweart" ] #White - shader: StencilClear sprite: Mobs/Species/Human/parts.rsi #PJB on stencil clear being on the left leg: "...this is 'fine'" -https://github.com/space-wizards/space-station-14/pull/12217#issuecomment-1291677115 # its fine, but its still very stupid that it has to be done like this instead of allowing sprites to just directly insert a stencil clear. @@ -88,10 +86,12 @@ sprite: Mobs/Customization/masking_helpers.rsi state: unisex_full visible: false - - map: ["jumpsuit"] + - map: [ "underwearb" ] #White + - map: [ "underweart" ] #White - map: ["enum.HumanoidVisualLayers.LFoot"] - map: ["enum.HumanoidVisualLayers.RFoot"] - map: [ "socks" ] #White + - map: ["jumpsuit"] - map: ["enum.HumanoidVisualLayers.LHand"] - map: ["enum.HumanoidVisualLayers.RHand"] - map: [ "gloves" ] diff --git a/Resources/Prototypes/_White/Aspects/Aspects.yml b/Resources/Prototypes/_White/Aspects/Aspects.yml index 3c8a784b6b..2349b60ae4 100644 --- a/Resources/Prototypes/_White/Aspects/Aspects.yml +++ b/Resources/Prototypes/_White/Aspects/Aspects.yml @@ -11,19 +11,18 @@ path: /Audio/White/Aspects/accent.ogg - type: RandomAccentAspect -# Disabled this cause movement speed increase isn't predicted and it feels awful due to this -#- type: entity -# id: FastAndFuriousAspect -# parent: BaseGameRule -# noSpawn: true -# components: -# - type: Aspect -# name: "Fast and Furious" -# description: "Люди спешат и не важно куда." -# weight: 3 -# startAudio: -# path: /Audio/White/Aspects/accent.ogg -# - type: FastAndFuriousAspect +- type: entity + id: FastAndFuriousAspect + parent: BaseGameRule + noSpawn: true + components: + - type: Aspect + name: "Fast and Furious" + description: "Люди спешат и не важно куда." + weight: 3 + startAudio: + path: /Audio/White/Aspects/accent.ogg + - type: FastAndFuriousAspect - type: entity id: RandomAppearanceAspect @@ -307,7 +306,7 @@ components: - type: Aspect name: "Cat Ears And Tail" - description: "Мяукайте." + description: "Из-за ошибки в системе клонирования на ЦК все члены экипажа стали походить на фелинидов." weight: 3 startAudio: path: /Audio/White/Aspects/accent.ogg @@ -322,12 +321,23 @@ name: "Nothing" description: "Ничего." weight: 3 - startAudio: - path: /Audio/White/Aspects/accent.ogg forbidden: true hidden: true - type: NothingAspect +- type: entity + id: RandomItemAspect + parent: BaseGameRule + noSpawn: true + components: + - type: Aspect + name: "Random item" + description: "ЦК выдало каждому члену экипажа определённый предмет." + weight: 3 + startAudio: + path: /Audio/White/Aspects/accent.ogg + - type: RandomItemAspect + # Disabled this cause polymorph breaks stuff #- type: entity # id: SkeletonAspect diff --git a/Resources/Prototypes/_White/BodyTypes/normal.yml b/Resources/Prototypes/_White/BodyTypes/normal.yml index a023cb37fe..b548f81aaa 100644 --- a/Resources/Prototypes/_White/BodyTypes/normal.yml +++ b/Resources/Prototypes/_White/BodyTypes/normal.yml @@ -70,6 +70,8 @@ RLeg: MobSlimeRLeg LFoot: MobSlimeLFoot RFoot: MobSlimeRFoot + HeadTop: MobHumanoidAnyMarking + Tail: MobHumanoidAnyMarking - type: bodyType id: VoxNormal @@ -88,6 +90,8 @@ RLeg: MobVoxRLeg LFoot: MobVoxLFoot RFoot: MobVoxRFoot + HeadTop: MobHumanoidAnyMarking + Tail: MobHumanoidAnyMarking - type: bodyType id: SkrellNormal @@ -105,6 +109,8 @@ RLeg: MobSkrellRLeg LFoot: MobSkrellLFoot RFoot: MobSkrellRFoot + HeadTop: MobHumanoidAnyMarking + Tail: MobHumanoidAnyMarking - type: bodyType id: DionaNormal @@ -122,6 +128,7 @@ RLeg: MobDionaRLeg LFoot: MobDionaLFoot RFoot: MobDionaRFoot + Tail: MobHumanoidAnyMarking - type: bodyType id: ArachnidNormal diff --git a/Resources/Prototypes/_White/BodyTypes/slim.yml b/Resources/Prototypes/_White/BodyTypes/slim.yml index 48802968b4..99b2383da7 100644 --- a/Resources/Prototypes/_White/BodyTypes/slim.yml +++ b/Resources/Prototypes/_White/BodyTypes/slim.yml @@ -38,6 +38,8 @@ RLeg: MobSkrellSlimRLeg LFoot: MobSkrellSlimLFoot RFoot: MobSkrellSlimRFoot + HeadTop: MobHumanoidAnyMarking + Tail: MobHumanoidAnyMarking # - type: bodyType # id: ReptilianSlim