Aspect fix (#411)

* Aspect fixes

* Update NonPeacefulRoundItems

* Add PresentAspect

* Fix

* Fix late join

* Change color
This commit is contained in:
Aviu00
2023-09-18 22:52:46 +09:00
committed by Aviu00
parent 4e4dc415bd
commit 2fce4b822b
11 changed files with 134 additions and 17 deletions

View File

@@ -98,7 +98,7 @@ public sealed class RandomGiftSystem : EntitySystem
_possibleGiftsUnsafe.Add(proto.ID); _possibleGiftsUnsafe.Add(proto.ID);
if (!proto.Components.ContainsKey(itemCompName)) if (!proto.Components.ContainsKey(itemCompName) || proto.SetSuffix is "DEBUG" or "Admeme") // WD EDIT
continue; continue;
_possibleGiftsSafe.Add(proto.ID); _possibleGiftsSafe.Add(proto.ID);

View File

@@ -2,11 +2,15 @@ using Content.Server.GameTicking.Rules.Components;
using Content.Server.White.AspectsSystem.Aspects.Components; using Content.Server.White.AspectsSystem.Aspects.Components;
using Content.Server.White.AspectsSystem.Base; using Content.Server.White.AspectsSystem.Base;
using Content.Server.White.Other; using Content.Server.White.Other;
using Content.Shared.Buckle;
using Content.Shared.Buckle.Components;
namespace Content.Server.White.AspectsSystem.Aspects; namespace Content.Server.White.AspectsSystem.Aspects;
public sealed class ChairLeakAspect : AspectSystem<ChairLeakAspectComponent> public sealed class ChairLeakAspect : AspectSystem<ChairLeakAspectComponent>
{ {
[Dependency] private readonly SharedBuckleSystem _buckle = default!;
protected override void Started(EntityUid uid, ChairLeakAspectComponent component, GameRuleComponent gameRule, GameRuleStartedEvent args) protected override void Started(EntityUid uid, ChairLeakAspectComponent component, GameRuleComponent gameRule, GameRuleStartedEvent args)
{ {
base.Started(uid, component, gameRule, args); base.Started(uid, component, gameRule, args);
@@ -14,6 +18,9 @@ public sealed class ChairLeakAspect : AspectSystem<ChairLeakAspectComponent>
var query = EntityQueryEnumerator<ChairMarkComponent>(); var query = EntityQueryEnumerator<ChairMarkComponent>();
while (query.MoveNext(out var ent, out _)) while (query.MoveNext(out var ent, out _))
{ {
if (TryComp(ent, out StrapComponent? strap))
_buckle.StrapRemoveAll(strap);
EntityManager.DeleteEntity(ent); EntityManager.DeleteEntity(ent);
} }
} }

View File

@@ -0,0 +1,6 @@
namespace Content.Server.White.AspectsSystem.Aspects.Components;
[RegisterComponent]
public sealed class PresentAspectComponent : Component
{
}

View File

@@ -23,7 +23,8 @@ public sealed class FastAndFuriousAspect : AspectSystem<FastAndFuriousAspectComp
var query = EntityQueryEnumerator<MovementSpeedModifierComponent>(); var query = EntityQueryEnumerator<MovementSpeedModifierComponent>();
while (query.MoveNext(out var ent, out var speedModifierComponent)) 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<FastAndFuriousAspectComp
var query = EntityQueryEnumerator<MovementSpeedModifierComponent>(); var query = EntityQueryEnumerator<MovementSpeedModifierComponent>();
while (query.MoveNext(out var ent, out var speedModifierComponent)) 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<FastAndFuriousAspectComp
if (!TryComp<MovementSpeedModifierComponent>(mob, out var speedModifierComponent)) if (!TryComp<MovementSpeedModifierComponent>(mob, out var speedModifierComponent))
return; return;
_movementSystem.ChangeBaseSpeed(mob, speedModifierComponent.BaseWalkSpeed + 2.5f, speedModifierComponent.BaseSprintSpeed + 4, speedModifierComponent.Acceleration); _movementSystem.ChangeBaseSpeed(mob, speedModifierComponent.BaseWalkSpeed,
speedModifierComponent.BaseSprintSpeed + 3, speedModifierComponent.Acceleration);
} }
} }
} }

View File

@@ -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<PresentAspectComponent>
{
[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);
}
}
}

View File

@@ -5,12 +5,15 @@ using Content.Server.GameTicking.Rules.Components;
using Content.Server.White.AspectsSystem.Aspects.Components; using Content.Server.White.AspectsSystem.Aspects.Components;
using Content.Server.White.AspectsSystem.Base; using Content.Server.White.AspectsSystem.Base;
using Content.Server.White.Other; using Content.Server.White.Other;
using Content.Shared.Damage;
namespace Content.Server.White.AspectsSystem.Aspects; namespace Content.Server.White.AspectsSystem.Aspects;
public sealed class WeakWallsAspect : AspectSystem<WeakWallsAspectComponent> public sealed class WeakWallsAspect : AspectSystem<WeakWallsAspectComponent>
{ {
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) protected override void Started(EntityUid uid, WeakWallsAspectComponent component, GameRuleComponent gameRule, GameRuleStartedEvent args)
{ {
@@ -19,16 +22,19 @@ public sealed class WeakWallsAspect : AspectSystem<WeakWallsAspectComponent>
var query = EntityQueryEnumerator<WallMarkComponent>(); var query = EntityQueryEnumerator<WallMarkComponent>();
while (query.MoveNext(out var ent, out _)) while (query.MoveNext(out var ent, out _))
{ {
if (!TryComp<DestructibleComponent>(ent, out var destructible)) if (!TryComp<DestructibleComponent>(ent, out var destructible) ||
!TryComp<DamageableComponent>(ent, out var damageable))
continue; continue;
_damageable.SetDamageModifierSetId(ent, null, damageable);
var trigger = (DamageTrigger?) destructible.Thresholds var trigger = (DamageTrigger?) destructible.Thresholds
.LastOrDefault(threshold => threshold.Trigger is DamageTrigger)?.Trigger; .LastOrDefault(threshold => threshold.Trigger is DamageTrigger)?.Trigger;
if (trigger == null) if (trigger == null)
continue; continue;
trigger.Damage = (trigger.Damage == DamageToSet) ? trigger.Damage : DamageToSet; trigger.Damage = (int) (trigger.Damage * DamageMultiplier);
} }
} }

View File

@@ -1,4 +1,5 @@
using System.Diagnostics.CodeAnalysis; using System.Diagnostics.CodeAnalysis;
using System.Linq;
using Content.Server.Administration.Logs; using Content.Server.Administration.Logs;
using Content.Server.Atmos.EntitySystems; using Content.Server.Atmos.EntitySystems;
using Content.Server.Chat.Systems; using Content.Server.Chat.Systems;
@@ -6,11 +7,14 @@ using Content.Server.GameTicking.Rules;
using Content.Server.GameTicking.Rules.Components; using Content.Server.GameTicking.Rules.Components;
using Content.Server.Station.Components; using Content.Server.Station.Components;
using Content.Shared.Database; using Content.Shared.Database;
using Content.Shared.Physics;
using Robust.Server.GameObjects; using Robust.Server.GameObjects;
using Robust.Shared.Audio.Systems; using Robust.Shared.Audio.Systems;
using Robust.Shared.Collections; using Robust.Shared.Collections;
using Robust.Shared.Map; using Robust.Shared.Map;
using Robust.Shared.Map.Components; using Robust.Shared.Map.Components;
using Robust.Shared.Physics;
using Robust.Shared.Physics.Components;
using Robust.Shared.Player; using Robust.Shared.Player;
using Robust.Shared.Random; using Robust.Shared.Random;
using Robust.Shared.Timing; using Robust.Shared.Timing;
@@ -74,7 +78,7 @@ namespace Content.Server.White.AspectsSystem.Base
if (aspect is { Description: not null, IsHidden: false }) 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); _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 }) 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); _audio.PlayGlobal(aspect.EndAudio, Filter.Broadcast(), true);
@@ -175,20 +179,24 @@ namespace Content.Server.White.AspectsSystem.Base
} }
targetGrid = _robustRandom.Pick(possibleTargets); targetGrid = _robustRandom.Pick(possibleTargets);
foreach (var target in possibleTargets.Where(HasComp<BecomesStationComponent>))
{
targetGrid = target;
break;
}
if (!TryComp<MapGridComponent>(targetGrid, out var gridComp)) if (!TryComp<MapGridComponent>(targetGrid, out var gridComp))
return false; return false;
var found = false; var found = false;
var (gridPos, _, gridMatrix) = _transform.GetWorldPositionRotationMatrix(targetGrid); var gridBounds = gridComp.LocalAABB.Scale(0.6f);
var gridBounds = gridMatrix.TransformBox(gridComp.LocalAABB);
for (var i = 0; i < 10; i++) for (var i = 0; i < 10; i++)
{ {
var randomX = _robustRandom.Next((int) gridBounds.Left, (int) gridBounds.Right); var randomX = _robustRandom.Next((int) gridBounds.Left, (int) gridBounds.Right);
var randomY = _robustRandom.Next((int) gridBounds.Bottom, (int) gridBounds.Top); 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, if (_atmosphere.IsTileSpace(targetGrid, Transform(targetGrid).MapUid, tile,
mapGridComp: gridComp) mapGridComp: gridComp)
|| _atmosphere.IsTileAirBlocked(targetGrid, tile, mapGridComp: gridComp)) || _atmosphere.IsTileAirBlocked(targetGrid, tile, mapGridComp: gridComp))
@@ -196,6 +204,24 @@ namespace Content.Server.White.AspectsSystem.Base
continue; continue;
} }
var physQuery = GetEntityQuery<PhysicsComponent>();
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; found = true;
targetCoords = gridComp.GridTileToLocal(tile); targetCoords = gridComp.GridTileToLocal(tile);
break; break;

View File

@@ -258,7 +258,7 @@ public abstract partial class SharedBuckleSystem
/// <summary> /// <summary>
/// Remove everything attached to the strap /// Remove everything attached to the strap
/// </summary> /// </summary>
private void StrapRemoveAll(StrapComponent strapComp) public void StrapRemoveAll(StrapComponent strapComp) // WD EDIT
{ {
foreach (var entity in strapComp.BuckledEntities.ToArray()) foreach (var entity in strapComp.BuckledEntities.ToArray())
{ {

View File

@@ -228,7 +228,7 @@ namespace Content.Shared.Damage
DamageChanged(uid, component, new DamageSpecifier()); 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)) if (!_damageableQuery.Resolve(uid, ref comp))
return; return;

View File

@@ -179,3 +179,16 @@
startAudio: startAudio:
path: /Audio/White/Aspects/accent.ogg path: /Audio/White/Aspects/accent.ogg
- type: ChairLeakAspect - 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

View File

@@ -5,11 +5,14 @@
- WeaponSubMachineGunWt550 - WeaponSubMachineGunWt550
- WeaponSubMachineGunC20r - WeaponSubMachineGunC20r
- WeaponSubMachineGunAtreides - WeaponSubMachineGunAtreides
- WeaponSubMachineGunDrozd
- WeaponShotgunBulldog - WeaponShotgunBulldog
- WeaponShotgunDoubleBarreled - WeaponShotgunDoubleBarreled
- WeaponShotgunEnforcer - WeaponShotgunEnforcer
- WeaponShotgunKammerer - WeaponShotgunKammerer
- WeaponShotgunSawn - WeaponShotgunSawn
- WeaponShotgunBlunderbuss
- WeaponShotgunImprovisedLoaded
- WeaponRifleAk - WeaponRifleAk
- WeaponRifleM90GrenadeLauncher - WeaponRifleM90GrenadeLauncher
- WeaponRifleLecter - WeaponRifleLecter
@@ -18,9 +21,24 @@
- WeaponRevolverMateba - WeaponRevolverMateba
- WeaponRevolverPython - WeaponRevolverPython
- WeaponRevolverPirate - WeaponRevolverPirate
- RevolverCapGunFake
- WeaponLightMachineGunL6 - WeaponLightMachineGunL6
- WeaponFlareGun - WeaponSniperMosin
- Stunbaton - Musket
- EnergyCrossbowMini
- WeaponLauncherRocket
- WeaponLauncherPirateCannon
- WeaponPistolViper
- WeaponPistolCobra
- WeaponPistolMk58
- WeaponPistolFlintlock
- WeaponLaserCannon
- WeaponLaserCarbine
- WeaponLaserGun
- WeaponAdvancedLaser
- WeaponMakeshiftLaser
- WeaponXrayCannon
- WeaponEgun
- type: nonPeacefulRoundEndItems - type: nonPeacefulRoundEndItems
id: nonPeacefulRoundEndMelee id: nonPeacefulRoundEndMelee
@@ -31,13 +49,20 @@
- Machete - Machete
- Claymore - Claymore
- Stunbaton - Stunbaton
- ClothingBackpackDuffelSyndicateC4tBundle
- Spear - Spear
- SpearReinforced
- SpearPlasma
- SpearUranium
- ButchCleaver - ButchCleaver
- CombatKnife - CombatKnife
- SurvivalKnife - SurvivalKnife
- EnergyDagger - EnergyDagger
- EnergySword - EnergySword
- EnergyDoubleSword
- EnergyCutlass
- Cutlass
- UnholyHalberd - UnholyHalberd
- EldritchBlade - EldritchBlade
- BaseBallBat - BaseBallBat
- BloodSuckerDagger
- Truncheon