From 2fce4b822bf61cbad37291563d264c1a183b2776 Mon Sep 17 00:00:00 2001 From: Aviu00 <93730715+Aviu00@users.noreply.github.com> Date: Mon, 18 Sep 2023 22:52:46 +0900 Subject: [PATCH] Aspect fix (#411) * Aspect fixes * Update NonPeacefulRoundItems * Add PresentAspect * Fix * Fix late join * Change color --- .../Holiday/Christmas/RandomGiftSystem.cs | 2 +- .../AspectsSystem/Aspects/ChairLeakAspect.cs | 7 ++++ .../Components/PresentAspectComponent.cs | 6 ++++ .../Aspects/FastAndFuriousAspect.cs | 9 +++-- .../AspectsSystem/Aspects/PresentAspect.cs | 31 ++++++++++++++++ .../AspectsSystem/Aspects/WeakWallsAspect.cs | 12 +++++-- .../White/AspectsSystem/Base/AspectSystem.cs | 36 ++++++++++++++++--- .../Buckle/SharedBuckleSystem.Strap.cs | 2 +- .../Damage/Systems/DamageableSystem.cs | 2 +- .../Prototypes/White/Aspects/Aspects.yml | 13 +++++++ .../NonPeacefulRoundItems.yml | 31 ++++++++++++++-- 11 files changed, 134 insertions(+), 17 deletions(-) create mode 100644 Content.Server/White/AspectsSystem/Aspects/Components/PresentAspectComponent.cs create mode 100644 Content.Server/White/AspectsSystem/Aspects/PresentAspect.cs diff --git a/Content.Server/Holiday/Christmas/RandomGiftSystem.cs b/Content.Server/Holiday/Christmas/RandomGiftSystem.cs index 9e56d0a493..1505ae7b82 100644 --- a/Content.Server/Holiday/Christmas/RandomGiftSystem.cs +++ b/Content.Server/Holiday/Christmas/RandomGiftSystem.cs @@ -98,7 +98,7 @@ public sealed class RandomGiftSystem : EntitySystem _possibleGiftsUnsafe.Add(proto.ID); - if (!proto.Components.ContainsKey(itemCompName)) + if (!proto.Components.ContainsKey(itemCompName) || proto.SetSuffix is "DEBUG" or "Admeme") // WD EDIT continue; _possibleGiftsSafe.Add(proto.ID); diff --git a/Content.Server/White/AspectsSystem/Aspects/ChairLeakAspect.cs b/Content.Server/White/AspectsSystem/Aspects/ChairLeakAspect.cs index b54995eb85..746bed9de5 100644 --- a/Content.Server/White/AspectsSystem/Aspects/ChairLeakAspect.cs +++ b/Content.Server/White/AspectsSystem/Aspects/ChairLeakAspect.cs @@ -2,11 +2,15 @@ using Content.Server.GameTicking.Rules.Components; using Content.Server.White.AspectsSystem.Aspects.Components; using Content.Server.White.AspectsSystem.Base; using Content.Server.White.Other; +using Content.Shared.Buckle; +using Content.Shared.Buckle.Components; namespace Content.Server.White.AspectsSystem.Aspects; public sealed class ChairLeakAspect : AspectSystem { + [Dependency] private readonly SharedBuckleSystem _buckle = default!; + protected override void Started(EntityUid uid, ChairLeakAspectComponent component, GameRuleComponent gameRule, GameRuleStartedEvent args) { base.Started(uid, component, gameRule, args); @@ -14,6 +18,9 @@ public sealed class ChairLeakAspect : AspectSystem var query = EntityQueryEnumerator(); while (query.MoveNext(out var ent, out _)) { + if (TryComp(ent, out StrapComponent? strap)) + _buckle.StrapRemoveAll(strap); + EntityManager.DeleteEntity(ent); } } diff --git a/Content.Server/White/AspectsSystem/Aspects/Components/PresentAspectComponent.cs b/Content.Server/White/AspectsSystem/Aspects/Components/PresentAspectComponent.cs new file mode 100644 index 0000000000..840c198d4e --- /dev/null +++ b/Content.Server/White/AspectsSystem/Aspects/Components/PresentAspectComponent.cs @@ -0,0 +1,6 @@ +namespace Content.Server.White.AspectsSystem.Aspects.Components; + +[RegisterComponent] +public sealed class PresentAspectComponent : Component +{ +} diff --git a/Content.Server/White/AspectsSystem/Aspects/FastAndFuriousAspect.cs b/Content.Server/White/AspectsSystem/Aspects/FastAndFuriousAspect.cs index e76a0cac87..e77abdee5d 100644 --- a/Content.Server/White/AspectsSystem/Aspects/FastAndFuriousAspect.cs +++ b/Content.Server/White/AspectsSystem/Aspects/FastAndFuriousAspect.cs @@ -23,7 +23,8 @@ public sealed class FastAndFuriousAspect : AspectSystem(); while (query.MoveNext(out var ent, out var speedModifierComponent)) { - _movementSystem.ChangeBaseSpeed(ent, speedModifierComponent.BaseWalkSpeed + 2.5f, speedModifierComponent.BaseSprintSpeed + 4, speedModifierComponent.Acceleration); + _movementSystem.ChangeBaseSpeed(ent, speedModifierComponent.BaseWalkSpeed, + speedModifierComponent.BaseSprintSpeed + 3, speedModifierComponent.Acceleration); } } @@ -33,7 +34,8 @@ public sealed class FastAndFuriousAspect : AspectSystem(); while (query.MoveNext(out var ent, out var speedModifierComponent)) { - _movementSystem.ChangeBaseSpeed(ent, 2.5f, 4.5f, speedModifierComponent.Acceleration); + _movementSystem.ChangeBaseSpeed(ent, speedModifierComponent.BaseWalkSpeed, + speedModifierComponent.BaseSprintSpeed, speedModifierComponent.Acceleration); } } @@ -53,7 +55,8 @@ public sealed class FastAndFuriousAspect : AspectSystem(mob, out var speedModifierComponent)) return; - _movementSystem.ChangeBaseSpeed(mob, speedModifierComponent.BaseWalkSpeed + 2.5f, speedModifierComponent.BaseSprintSpeed + 4, speedModifierComponent.Acceleration); + _movementSystem.ChangeBaseSpeed(mob, speedModifierComponent.BaseWalkSpeed, + speedModifierComponent.BaseSprintSpeed + 3, speedModifierComponent.Acceleration); } } } diff --git a/Content.Server/White/AspectsSystem/Aspects/PresentAspect.cs b/Content.Server/White/AspectsSystem/Aspects/PresentAspect.cs new file mode 100644 index 0000000000..d0cd06b064 --- /dev/null +++ b/Content.Server/White/AspectsSystem/Aspects/PresentAspect.cs @@ -0,0 +1,31 @@ +using Content.Server.GameTicking.Rules.Components; +using Content.Server.White.AspectsSystem.Aspects.Components; +using Content.Server.White.AspectsSystem.Base; +using Robust.Shared.Random; + +namespace Content.Server.White.AspectsSystem.Aspects; + +public sealed class PresentAspect : AspectSystem +{ + [Dependency] private readonly IRobustRandom _random = default!; + + protected override void Added(EntityUid uid, PresentAspectComponent component, GameRuleComponent gameRule, GameRuleAddedEvent args) + { + base.Added(uid, component, gameRule, args); + + SpawnPresents(); + } + + private void SpawnPresents() + { + var minPresents = _random.Next(70, 200); + + for (var i = 0; i < minPresents; i++) + { + if (!TryFindRandomTile(out _, out _, out _, out var targetCoords)) + break; + + EntityManager.SpawnEntity("PresentRandomUnsafe", targetCoords); + } + } +} diff --git a/Content.Server/White/AspectsSystem/Aspects/WeakWallsAspect.cs b/Content.Server/White/AspectsSystem/Aspects/WeakWallsAspect.cs index c3b948d09b..355f35e670 100644 --- a/Content.Server/White/AspectsSystem/Aspects/WeakWallsAspect.cs +++ b/Content.Server/White/AspectsSystem/Aspects/WeakWallsAspect.cs @@ -5,12 +5,15 @@ using Content.Server.GameTicking.Rules.Components; using Content.Server.White.AspectsSystem.Aspects.Components; using Content.Server.White.AspectsSystem.Base; using Content.Server.White.Other; +using Content.Shared.Damage; namespace Content.Server.White.AspectsSystem.Aspects; public sealed class WeakWallsAspect : AspectSystem { - private const int DamageToSet = 100; + [Dependency] private readonly DamageableSystem _damageable = default!; + + private const float DamageMultiplier = 0.15f; protected override void Started(EntityUid uid, WeakWallsAspectComponent component, GameRuleComponent gameRule, GameRuleStartedEvent args) { @@ -19,16 +22,19 @@ public sealed class WeakWallsAspect : AspectSystem var query = EntityQueryEnumerator(); while (query.MoveNext(out var ent, out _)) { - if (!TryComp(ent, out var destructible)) + if (!TryComp(ent, out var destructible) || + !TryComp(ent, out var damageable)) continue; + _damageable.SetDamageModifierSetId(ent, null, damageable); + var trigger = (DamageTrigger?) destructible.Thresholds .LastOrDefault(threshold => threshold.Trigger is DamageTrigger)?.Trigger; if (trigger == null) continue; - trigger.Damage = (trigger.Damage == DamageToSet) ? trigger.Damage : DamageToSet; + trigger.Damage = (int) (trigger.Damage * DamageMultiplier); } } diff --git a/Content.Server/White/AspectsSystem/Base/AspectSystem.cs b/Content.Server/White/AspectsSystem/Base/AspectSystem.cs index 16e2b39978..32e2494b5a 100644 --- a/Content.Server/White/AspectsSystem/Base/AspectSystem.cs +++ b/Content.Server/White/AspectsSystem/Base/AspectSystem.cs @@ -1,4 +1,5 @@ using System.Diagnostics.CodeAnalysis; +using System.Linq; using Content.Server.Administration.Logs; using Content.Server.Atmos.EntitySystems; using Content.Server.Chat.Systems; @@ -6,11 +7,14 @@ using Content.Server.GameTicking.Rules; using Content.Server.GameTicking.Rules.Components; using Content.Server.Station.Components; using Content.Shared.Database; +using Content.Shared.Physics; using Robust.Server.GameObjects; using Robust.Shared.Audio.Systems; using Robust.Shared.Collections; using Robust.Shared.Map; using Robust.Shared.Map.Components; +using Robust.Shared.Physics; +using Robust.Shared.Physics.Components; using Robust.Shared.Player; using Robust.Shared.Random; using Robust.Shared.Timing; @@ -74,7 +78,7 @@ namespace Content.Server.White.AspectsSystem.Base if (aspect is { Description: not null, IsHidden: false }) { - _chatSystem.DispatchGlobalAnnouncement(aspect.Description, playSound: false, colorOverride: Color.LimeGreen); + _chatSystem.DispatchGlobalAnnouncement(aspect.Description, playSound: false, colorOverride: Color.Aquamarine); } _audio.PlayGlobal(aspect.StartAudio, Filter.Broadcast(), true); @@ -108,7 +112,7 @@ namespace Content.Server.White.AspectsSystem.Base if (aspect is { Name: not null, IsHidden: false }) { - _chatSystem.DispatchGlobalAnnouncement($"Именем аспекта являлось: {aspect.Name}", playSound: false, colorOverride: Color.LimeGreen); + _chatSystem.DispatchGlobalAnnouncement($"Именем аспекта являлось: {aspect.Name}", playSound: false, colorOverride: Color.Aquamarine); } _audio.PlayGlobal(aspect.EndAudio, Filter.Broadcast(), true); @@ -175,20 +179,24 @@ namespace Content.Server.White.AspectsSystem.Base } targetGrid = _robustRandom.Pick(possibleTargets); + foreach (var target in possibleTargets.Where(HasComp)) + { + targetGrid = target; + break; + } if (!TryComp(targetGrid, out var gridComp)) return false; var found = false; - var (gridPos, _, gridMatrix) = _transform.GetWorldPositionRotationMatrix(targetGrid); - var gridBounds = gridMatrix.TransformBox(gridComp.LocalAABB); + var gridBounds = gridComp.LocalAABB.Scale(0.6f); for (var i = 0; i < 10; i++) { var randomX = _robustRandom.Next((int) gridBounds.Left, (int) gridBounds.Right); var randomY = _robustRandom.Next((int) gridBounds.Bottom, (int) gridBounds.Top); - tile = new Vector2i(randomX - (int) gridPos.X, randomY - (int) gridPos.Y); + tile = new Vector2i(randomX, randomY); if (_atmosphere.IsTileSpace(targetGrid, Transform(targetGrid).MapUid, tile, mapGridComp: gridComp) || _atmosphere.IsTileAirBlocked(targetGrid, tile, mapGridComp: gridComp)) @@ -196,6 +204,24 @@ namespace Content.Server.White.AspectsSystem.Base continue; } + var physQuery = GetEntityQuery(); + var valid = true; + foreach (var ent in gridComp.GetAnchoredEntities(tile)) + { + if (!physQuery.TryGetComponent(ent, out var body)) + continue; + if (body.BodyType != BodyType.Static || + !body.Hard || + (body.CollisionLayer & (int) CollisionGroup.Impassable) == 0) + continue; + + valid = false; + break; + } + + if (!valid) + continue; + found = true; targetCoords = gridComp.GridTileToLocal(tile); break; diff --git a/Content.Shared/Buckle/SharedBuckleSystem.Strap.cs b/Content.Shared/Buckle/SharedBuckleSystem.Strap.cs index 7be5436074..bccca299bc 100644 --- a/Content.Shared/Buckle/SharedBuckleSystem.Strap.cs +++ b/Content.Shared/Buckle/SharedBuckleSystem.Strap.cs @@ -258,7 +258,7 @@ public abstract partial class SharedBuckleSystem /// /// Remove everything attached to the strap /// - private void StrapRemoveAll(StrapComponent strapComp) + public void StrapRemoveAll(StrapComponent strapComp) // WD EDIT { foreach (var entity in strapComp.BuckledEntities.ToArray()) { diff --git a/Content.Shared/Damage/Systems/DamageableSystem.cs b/Content.Shared/Damage/Systems/DamageableSystem.cs index 21718e6fd6..9a08d9f3a9 100644 --- a/Content.Shared/Damage/Systems/DamageableSystem.cs +++ b/Content.Shared/Damage/Systems/DamageableSystem.cs @@ -228,7 +228,7 @@ namespace Content.Shared.Damage DamageChanged(uid, component, new DamageSpecifier()); } - public void SetDamageModifierSetId(EntityUid uid, string damageModifierSetId, DamageableComponent? comp = null) + public void SetDamageModifierSetId(EntityUid uid, string? damageModifierSetId, DamageableComponent? comp = null) // WD EDIT { if (!_damageableQuery.Resolve(uid, ref comp)) return; diff --git a/Resources/Prototypes/White/Aspects/Aspects.yml b/Resources/Prototypes/White/Aspects/Aspects.yml index a67efd753d..3c824501bb 100644 --- a/Resources/Prototypes/White/Aspects/Aspects.yml +++ b/Resources/Prototypes/White/Aspects/Aspects.yml @@ -179,3 +179,16 @@ startAudio: path: /Audio/White/Aspects/accent.ogg - type: ChairLeakAspect + +- type: entity + id: PresentAspect + parent: BaseGameRule + noSpawn: true + components: + - type: Aspect + name: "Presents" + description: "А вы верите в Деда Мороза?" + weight: 2 + startAudio: + path: /Audio/White/Aspects/accent.ogg + - type: PresentAspect diff --git a/Resources/Prototypes/White/NonPeacefulRound/NonPeacefulRoundItems.yml b/Resources/Prototypes/White/NonPeacefulRound/NonPeacefulRoundItems.yml index f91cd49bdd..5f5cc281b1 100644 --- a/Resources/Prototypes/White/NonPeacefulRound/NonPeacefulRoundItems.yml +++ b/Resources/Prototypes/White/NonPeacefulRound/NonPeacefulRoundItems.yml @@ -5,11 +5,14 @@ - WeaponSubMachineGunWt550 - WeaponSubMachineGunC20r - WeaponSubMachineGunAtreides + - WeaponSubMachineGunDrozd - WeaponShotgunBulldog - WeaponShotgunDoubleBarreled - WeaponShotgunEnforcer - WeaponShotgunKammerer - WeaponShotgunSawn + - WeaponShotgunBlunderbuss + - WeaponShotgunImprovisedLoaded - WeaponRifleAk - WeaponRifleM90GrenadeLauncher - WeaponRifleLecter @@ -18,9 +21,24 @@ - WeaponRevolverMateba - WeaponRevolverPython - WeaponRevolverPirate + - RevolverCapGunFake - WeaponLightMachineGunL6 - - WeaponFlareGun - - Stunbaton + - WeaponSniperMosin + - Musket + - EnergyCrossbowMini + - WeaponLauncherRocket + - WeaponLauncherPirateCannon + - WeaponPistolViper + - WeaponPistolCobra + - WeaponPistolMk58 + - WeaponPistolFlintlock + - WeaponLaserCannon + - WeaponLaserCarbine + - WeaponLaserGun + - WeaponAdvancedLaser + - WeaponMakeshiftLaser + - WeaponXrayCannon + - WeaponEgun - type: nonPeacefulRoundEndItems id: nonPeacefulRoundEndMelee @@ -31,13 +49,20 @@ - Machete - Claymore - Stunbaton - - ClothingBackpackDuffelSyndicateC4tBundle - Spear + - SpearReinforced + - SpearPlasma + - SpearUranium - ButchCleaver - CombatKnife - SurvivalKnife - EnergyDagger - EnergySword + - EnergyDoubleSword + - EnergyCutlass + - Cutlass - UnholyHalberd - EldritchBlade - BaseBallBat + - BloodSuckerDagger + - Truncheon