From bd58beb0eadbeba6faec8bc3b7f3a34cbe97adec Mon Sep 17 00:00:00 2001 From: Aviu00 <93730715+Aviu00@users.noreply.github.com> Date: Tue, 19 Sep 2023 19:02:08 +0900 Subject: [PATCH] Aspect tweaks (#418) * Aspect tweaks * Add DancingAspect * Remove jump --- .../Holiday/Christmas/RandomGiftSystem.cs | 8 ++- .../White/Animations/DancingComponent.cs | 9 ++++ .../White/Animations/DancingSystem.cs | 54 +++++++++++++++++++ .../AspectsSystem/Aspects/BombassAspect.cs | 4 +- .../Components/DancingAspectComponent.cs | 6 +++ .../AspectsSystem/Aspects/DancingAspect.cs | 45 ++++++++++++++++ .../AspectsSystem/Aspects/PresentAspect.cs | 2 +- .../AspectsSystem/Aspects/TraitoredAspect.cs | 2 +- .../White/Other/GiftIgnoreComponent.cs | 6 +++ .../Clothing/OuterClothing/hardsuits.yml | 2 +- .../Entities/Objects/Misc/land_mine.yml | 22 ++++++-- .../Prototypes/White/Aspects/Aspects.yml | 13 +++++ .../Prototypes/White/Fluff/centurion.yml | 9 ++++ Resources/Prototypes/White/Fluff/fluff.yml | 6 +++ Resources/Prototypes/White/Fluff/serbwo.yml | 11 ++++ 15 files changed, 189 insertions(+), 10 deletions(-) create mode 100644 Content.Server/White/Animations/DancingComponent.cs create mode 100644 Content.Server/White/Animations/DancingSystem.cs create mode 100644 Content.Server/White/AspectsSystem/Aspects/Components/DancingAspectComponent.cs create mode 100644 Content.Server/White/AspectsSystem/Aspects/DancingAspect.cs create mode 100644 Content.Server/White/Other/GiftIgnoreComponent.cs diff --git a/Content.Server/Holiday/Christmas/RandomGiftSystem.cs b/Content.Server/Holiday/Christmas/RandomGiftSystem.cs index 1505ae7b82..eea37da177 100644 --- a/Content.Server/Holiday/Christmas/RandomGiftSystem.cs +++ b/Content.Server/Holiday/Christmas/RandomGiftSystem.cs @@ -1,7 +1,9 @@ using Content.Server.Administration.Logs; using Content.Server.Hands.Systems; +using Content.Server.White.Other; using Content.Shared.Database; using Content.Shared.Examine; +using Content.Shared.Interaction.Components; using Content.Shared.Interaction.Events; using Content.Shared.Item; using Robust.Server.Audio; @@ -90,6 +92,8 @@ public sealed class RandomGiftSystem : EntitySystem var itemCompName = _componentFactory.GetComponentName(typeof(ItemComponent)); var mapGridCompName = _componentFactory.GetComponentName(typeof(MapGridComponent)); var physicsCompName = _componentFactory.GetComponentName(typeof(PhysicsComponent)); + var giftIgnoreCompName = _componentFactory.GetComponentName(typeof(GiftIgnoreComponent)); // WD + var unremovableCompName = _componentFactory.GetComponentName(typeof(UnremoveableComponent)); // WD foreach (var proto in _prototype.EnumeratePrototypes()) { @@ -98,7 +102,9 @@ public sealed class RandomGiftSystem : EntitySystem _possibleGiftsUnsafe.Add(proto.ID); - if (!proto.Components.ContainsKey(itemCompName) || proto.SetSuffix is "DEBUG" or "Admeme") // WD EDIT + if (!proto.Components.ContainsKey(itemCompName) || proto.Components.ContainsKey(giftIgnoreCompName) || + proto.Components.ContainsKey(unremovableCompName) || proto.SetSuffix != null && + (proto.SetSuffix.Contains("DEBUG") || proto.SetSuffix.Contains("Admeme"))) // WD EDIT continue; _possibleGiftsSafe.Add(proto.ID); diff --git a/Content.Server/White/Animations/DancingComponent.cs b/Content.Server/White/Animations/DancingComponent.cs new file mode 100644 index 0000000000..585bae13a4 --- /dev/null +++ b/Content.Server/White/Animations/DancingComponent.cs @@ -0,0 +1,9 @@ +namespace Content.Server.Animations; + +[RegisterComponent] +public sealed class DancingComponent : Component +{ + public float AccumulatedFrametime; + + public float NextDelay; +} diff --git a/Content.Server/White/Animations/DancingSystem.cs b/Content.Server/White/Animations/DancingSystem.cs new file mode 100644 index 0000000000..dc76e5fcbd --- /dev/null +++ b/Content.Server/White/Animations/DancingSystem.cs @@ -0,0 +1,54 @@ +using Content.Shared.Animations; +using Content.Shared.Bed.Sleep; +using Content.Shared.Mobs.Components; +using Content.Shared.Mobs.Systems; +using Robust.Shared.Random; + +namespace Content.Server.Animations; + +public sealed class DancingSystem : EntitySystem +{ + [Dependency] private readonly IRobustRandom _random = default!; + [Dependency] private readonly EmoteAnimationSystem _emoteAnimation = default!; + [Dependency] private readonly MobStateSystem _mobState = default!; + + private readonly string[] _emoteList = {"EmoteFlip", "EmoteTurn"}; + + public override void Initialize() + { + SubscribeLocalEvent(OnInit); + } + + private void OnInit(EntityUid uid, DancingComponent component, ComponentInit args) + { + ResetDelay(component); + } + + public override void Update(float frameTime) + { + base.Update(frameTime); + var query = EntityQueryEnumerator(); + + while (query.MoveNext(out var uid, out var dancing, out var emote, out var mobState)) + { + if (!_mobState.IsAlive(uid, mobState) || HasComp(uid)) + continue; + + dancing.AccumulatedFrametime += frameTime; + + if (dancing.AccumulatedFrametime < dancing.NextDelay) + continue; + + dancing.AccumulatedFrametime -= dancing.NextDelay; + + ResetDelay(dancing); + + _emoteAnimation.PlayEmoteAnimation(uid, emote, _random.Pick(_emoteList)); + } + } + + private void ResetDelay(DancingComponent component) + { + component.NextDelay = _random.NextFloat() + 0.2f; + } +} diff --git a/Content.Server/White/AspectsSystem/Aspects/BombassAspect.cs b/Content.Server/White/AspectsSystem/Aspects/BombassAspect.cs index f69a7926e2..ceb6eaff60 100644 --- a/Content.Server/White/AspectsSystem/Aspects/BombassAspect.cs +++ b/Content.Server/White/AspectsSystem/Aspects/BombassAspect.cs @@ -18,14 +18,14 @@ public sealed class BombassAspect : AspectSystem private void SpawnMines() { - var minMines = _random.Next(35, 100); + var minMines = _random.Next(30, 50); for (var i = 0; i < minMines; i++) { if (!TryFindRandomTile(out _, out _, out _, out var targetCoords)) break; - EntityManager.SpawnEntity("LandMineExplosive", targetCoords); + EntityManager.SpawnEntity("LandMineAspectExplosive", targetCoords); } } } diff --git a/Content.Server/White/AspectsSystem/Aspects/Components/DancingAspectComponent.cs b/Content.Server/White/AspectsSystem/Aspects/Components/DancingAspectComponent.cs new file mode 100644 index 0000000000..72107eefa6 --- /dev/null +++ b/Content.Server/White/AspectsSystem/Aspects/Components/DancingAspectComponent.cs @@ -0,0 +1,6 @@ +namespace Content.Server.White.AspectsSystem.Aspects.Components; + +[RegisterComponent] +public sealed class DancingAspectComponent : Component +{ +} diff --git a/Content.Server/White/AspectsSystem/Aspects/DancingAspect.cs b/Content.Server/White/AspectsSystem/Aspects/DancingAspect.cs new file mode 100644 index 0000000000..0e6c890462 --- /dev/null +++ b/Content.Server/White/AspectsSystem/Aspects/DancingAspect.cs @@ -0,0 +1,45 @@ +using Content.Server.Animations; +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.Shared.Animations; +using Content.Shared.Mobs.Components; + +namespace Content.Server.White.AspectsSystem.Aspects; + +public sealed class DancingAspect : AspectSystem +{ + public override void Initialize() + { + base.Initialize(); + SubscribeLocalEvent(HandleLateJoin); + } + + protected override void Started(EntityUid uid, DancingAspectComponent component, GameRuleComponent gameRule, GameRuleStartedEvent args) + { + base.Started(uid, component, gameRule, args); + var query = EntityQueryEnumerator(); + while (query.MoveNext(out var ent, out _, out _)) + { + EnsureComp(ent); + } + } + + private void HandleLateJoin(PlayerSpawnCompleteEvent ev) + { + var query = EntityQueryEnumerator(); + while (query.MoveNext(out var ruleEntity, out _, out var gameRule)) + { + if (!GameTicker.IsGameRuleAdded(ruleEntity, gameRule)) + continue; + + if (!ev.LateJoin) + return; + + var mob = ev.Mob; + + EnsureComp(mob); + } + } +} diff --git a/Content.Server/White/AspectsSystem/Aspects/PresentAspect.cs b/Content.Server/White/AspectsSystem/Aspects/PresentAspect.cs index d0cd06b064..e3b4acc871 100644 --- a/Content.Server/White/AspectsSystem/Aspects/PresentAspect.cs +++ b/Content.Server/White/AspectsSystem/Aspects/PresentAspect.cs @@ -18,7 +18,7 @@ public sealed class PresentAspect : AspectSystem private void SpawnPresents() { - var minPresents = _random.Next(70, 200); + var minPresents = _random.Next(150, 200); for (var i = 0; i < minPresents; i++) { diff --git a/Content.Server/White/AspectsSystem/Aspects/TraitoredAspect.cs b/Content.Server/White/AspectsSystem/Aspects/TraitoredAspect.cs index 4d42b58824..c184476a2c 100644 --- a/Content.Server/White/AspectsSystem/Aspects/TraitoredAspect.cs +++ b/Content.Server/White/AspectsSystem/Aspects/TraitoredAspect.cs @@ -107,7 +107,7 @@ namespace Content.Server.White.AspectsSystem.Aspects } } - _chatSystem.DispatchGlobalAnnouncement(msg, "Мяукиман Крысус"); + _chatSystem.DispatchGlobalAnnouncement(msg, "Мяукиман Крысус", colorOverride: Color.Aquamarine); ForceEndSelf(uid, rule); } diff --git a/Content.Server/White/Other/GiftIgnoreComponent.cs b/Content.Server/White/Other/GiftIgnoreComponent.cs new file mode 100644 index 0000000000..9c0b9fd564 --- /dev/null +++ b/Content.Server/White/Other/GiftIgnoreComponent.cs @@ -0,0 +1,6 @@ +namespace Content.Server.White.Other; + +[RegisterComponent] +public sealed class GiftIgnoreComponent : Component +{ +} diff --git a/Resources/Prototypes/Entities/Clothing/OuterClothing/hardsuits.yml b/Resources/Prototypes/Entities/Clothing/OuterClothing/hardsuits.yml index 1ac8769400..f4f6cdce5a 100644 --- a/Resources/Prototypes/Entities/Clothing/OuterClothing/hardsuits.yml +++ b/Resources/Prototypes/Entities/Clothing/OuterClothing/hardsuits.yml @@ -812,7 +812,7 @@ damageCoefficient: 0.2 - type: ToggleableClothing clothingPrototype: ClothingHeadHelmetHardsuitDeathsquad - + - type: GiftIgnore #CBURN Hardsuit - type: entity diff --git a/Resources/Prototypes/Entities/Objects/Misc/land_mine.yml b/Resources/Prototypes/Entities/Objects/Misc/land_mine.yml index de78268d57..be3426d3a1 100644 --- a/Resources/Prototypes/Entities/Objects/Misc/land_mine.yml +++ b/Resources/Prototypes/Entities/Objects/Misc/land_mine.yml @@ -1,4 +1,4 @@ -- type: entity +- type: entity id: BaseLandMine abstract: true components: @@ -67,8 +67,22 @@ - type: ExplodeOnTrigger - type: Explosive explosionType: Default - maxIntensity: 3 - intensitySlope: 1 - totalIntensity: 120 + maxIntensity: 10 + intensitySlope: 3 + totalIntensity: 120 # about a ~4 tile radius + canCreateVacuum: false + - type: DeleteOnTrigger + +- type: entity + name: мина аспекта + parent: BaseLandMine + id: LandMineAspectExplosive + components: + - type: ExplodeOnTrigger + - type: Explosive + explosionType: Default + maxIntensity: 4 + intensitySlope: 2 + totalIntensity: 25 canCreateVacuum: false - type: DeleteOnTrigger diff --git a/Resources/Prototypes/White/Aspects/Aspects.yml b/Resources/Prototypes/White/Aspects/Aspects.yml index 3c824501bb..0f01c33154 100644 --- a/Resources/Prototypes/White/Aspects/Aspects.yml +++ b/Resources/Prototypes/White/Aspects/Aspects.yml @@ -192,3 +192,16 @@ startAudio: path: /Audio/White/Aspects/accent.ogg - type: PresentAspect + +- type: entity + id: DancingAspect + parent: BaseGameRule + noSpawn: true + components: + - type: Aspect + name: "Dance" + description: "Танцуют все!" + weight: 3 + startAudio: + path: /Audio/White/Aspects/accent.ogg + - type: DancingAspect diff --git a/Resources/Prototypes/White/Fluff/centurion.yml b/Resources/Prototypes/White/Fluff/centurion.yml index 0c0ab70bc9..558352ec91 100644 --- a/Resources/Prototypes/White/Fluff/centurion.yml +++ b/Resources/Prototypes/White/Fluff/centurion.yml @@ -11,6 +11,7 @@ sprite: White/Fluff/centurion/deathsquad.rsi - type: ToggleableClothing clothingPrototype: ClothingHeadHelmetCapDeathSquadFluff + - type: GiftIgnore - type: entity parent: ClothingHeadHelmetHardsuitCap @@ -37,6 +38,7 @@ sprite: White/Fluff/centurion/deathsquad.rsi - type: ToggleableClothing clothingPrototype: ClothingHeadHelmetHardsuitEngineeringWhiteDeathSquadFluff + - type: GiftIgnore - type: entity parent: ClothingHeadHelmetHardsuitEngineeringWhite @@ -63,6 +65,7 @@ sprite: White/Fluff/centurion/deathsquad.rsi - type: ToggleableClothing clothingPrototype: ClothingHeadHelmetHardsuitMedicalDeathSquadFluff + - type: GiftIgnore - type: entity parent: ClothingHeadHelmetHardsuitMedical @@ -89,6 +92,7 @@ sprite: White/Fluff/centurion/deathsquad.rsi - type: ToggleableClothing clothingPrototype: ClothingHeadHelmetHardsuitSecurityRedDeathSquadFluff + - type: GiftIgnore - type: entity parent: ClothingHeadHelmetHardsuitSecurityRed @@ -115,6 +119,7 @@ sprite: White/Fluff/centurion/deathsquad.rsi - type: ToggleableClothing clothingPrototype: ClothingHeadHelmetHardsuitRdDeathSquadFluff + - type: GiftIgnore # Utilizator - type: entity @@ -129,6 +134,7 @@ sprite: White/Fluff/centurion/breacher.rsi - type: ToggleableClothing clothingPrototype: ClothingHeadHelmetHardsuitSalvageCenturion + - type: GiftIgnore - type: entity parent: ClothingHeadHelmetHardsuitSalvage @@ -140,6 +146,7 @@ sprite: White/Fluff/centurion/breacher-helmet.rsi - type: Clothing sprite: White/Fluff/centurion/breacher-helmet.rsi + - type: GiftIgnore # Security - type: entity @@ -154,6 +161,7 @@ sprite: White/Fluff/centurion/breacher.rsi - type: ToggleableClothing clothingPrototype: ClothingHeadHelmetHardsuitSecurityCenturion + - type: GiftIgnore # poxuy @@ -176,6 +184,7 @@ sprite: White/Fluff/centurion/breacher-helmet.rsi - type: Clothing sprite: White/Fluff/centurion/breacher-helmet.rsi + - type: GiftIgnore - type: entity parent: ClothingHeadHelmetHardsuitRd diff --git a/Resources/Prototypes/White/Fluff/fluff.yml b/Resources/Prototypes/White/Fluff/fluff.yml index f3047d2371..b62b8b6de1 100644 --- a/Resources/Prototypes/White/Fluff/fluff.yml +++ b/Resources/Prototypes/White/Fluff/fluff.yml @@ -19,6 +19,7 @@ - type: ContainerContainer containers: toggleable-clothing: !type:ContainerSlot {} + - type: GiftIgnore - type: entity parent: ClothingOuterHardsuitEVA @@ -35,6 +36,7 @@ - type: ContainerContainer containers: toggleable-clothing: !type:ContainerSlot { } + - type: GiftIgnore - type: entity parent: ClothingHeadHelmetEVA @@ -46,6 +48,7 @@ sprite: White/Fluff/DOOMMAX/helmetglamour.rsi - type: Clothing sprite: White/Fluff/DOOMMAX/helmetglamour.rsi + - type: GiftIgnore # Maury - type: entity @@ -134,6 +137,7 @@ sprite: White/Fluff/YouWellLeer/hoshardsuit.rsi - type: ToggleableClothing clothingPrototype: LeerHelmet + - type: GiftIgnore - type: entity parent: ClothingHeadHelmetHardsuitSecurityRed @@ -146,6 +150,7 @@ - type: Clothing sprite: White/Fluff/YouWellLeer/hoshelmet.rsi - type: PointLight + - type: GiftIgnore - type: entity parent: ClothingUniformJumpsuitHoS @@ -351,6 +356,7 @@ damageCoefficient: 0.90 - type: ToggleableClothing clothingPrototype: ClothingHeadHelmetHardsuitHskveezAtmos + - type: GiftIgnore #Hskveez Atmospherics Hardsuit diff --git a/Resources/Prototypes/White/Fluff/serbwo.yml b/Resources/Prototypes/White/Fluff/serbwo.yml index 5abb1b0414..0009b30192 100644 --- a/Resources/Prototypes/White/Fluff/serbwo.yml +++ b/Resources/Prototypes/White/Fluff/serbwo.yml @@ -18,6 +18,7 @@ - type: ContainerContainer containers: toggleable-clothing: !type:ContainerSlot {} + - type: GiftIgnore #CAP - type: entity @@ -32,6 +33,7 @@ sprite: Clothing/OuterClothing/Hardsuits/ERTSuits/ertleader.rsi - type: ToggleableClothing clothingPrototype: ClothingHeadHelmetHardsuitERTLeader + - type: GiftIgnore #CE - type: entity @@ -45,6 +47,7 @@ sprite: Clothing/OuterClothing/Hardsuits/ERTSuits/ertengineer.rsi - type: ToggleableClothing clothingPrototype: ClothingHeadHelmetHardsuitERTEngineer + - type: GiftIgnore #CMO - type: entity @@ -58,6 +61,7 @@ sprite: Clothing/OuterClothing/Hardsuits/ERTSuits/ertmedical.rsi - type: ToggleableClothing clothingPrototype: ClothingHeadHelmetHardsuitERTMedical + - type: GiftIgnore #SEC - type: entity @@ -71,6 +75,7 @@ sprite: Clothing/OuterClothing/Hardsuits/ERTSuits/ertsecurity.rsi - type: ToggleableClothing clothingPrototype: ClothingHeadHelmetHardsuitERTSecurity + - type: GiftIgnore # RD - type: entity @@ -84,6 +89,7 @@ sprite: Clothing/OuterClothing/Hardsuits/ERTSuits/ertjanitor.rsi - type: ToggleableClothing clothingPrototype: ClothingHeadHelmetHardsuitERTJanitor + - type: GiftIgnore # other - type: entity @@ -98,6 +104,7 @@ sprite: Clothing/OuterClothing/Hardsuits/wizard.rsi - type: ToggleableClothing clothingPrototype: ClothingHeadHelmetHardsuitWizard + - type: GiftIgnore # Penis @@ -114,6 +121,7 @@ sprite: White/Fluff/serbwo/suits/ertleader.rsi - type: ToggleableClothing clothingPrototype: ClothingOuterParamedicHelmetFluff + - type: GiftIgnore - type: entity parent: ClothingHeadHardsuitWithLightBase @@ -125,6 +133,7 @@ sprite: White/Fluff/serbwo/helmets/ertleader.rsi - type: Clothing sprite: White/Fluff/serbwo/helmets/ertleader.rsi + - type: GiftIgnore - type: entity @@ -139,6 +148,7 @@ sprite: White/Fluff/serbwo/suits/ertmedical.rsi - type: ToggleableClothing clothingPrototype: ClothingOuterCargoHelmetFluff + - type: GiftIgnore - type: entity parent: ClothingHeadHelmetHardsuitSalvage @@ -150,6 +160,7 @@ sprite: White/Fluff/serbwo/helmets/ertmedical.rsi - type: Clothing sprite: White/Fluff/serbwo/helmets/ertmedical.rsi + - type: GiftIgnore # KILL ME PLEASE