Merge branch 'master' into 2021-12-03-remove-IEntity-komm-süsser-todd
# Conflicts: # Content.Client/Crayon/CrayonDecalVisualizer.cs # Content.Client/Tabletop/TabletopSystem.cs # Content.IntegrationTests/Tests/InventoryHelpersTest.cs # Content.Server/AI/EntitySystems/AiSystem.cs # Content.Server/AI/Utility/AiLogic/UtilityAI.cs # Content.Server/AME/AMENodeGroup.cs # Content.Server/Administration/AdminVerbSystem.cs # Content.Server/Body/Systems/RespiratorSystem.cs # Content.Server/Chemistry/Components/InjectorComponent.cs # Content.Server/Chemistry/TileReactions/CleanTileReaction.cs # Content.Server/Chemistry/TileReactions/SpillTileReaction.cs # Content.Server/Crayon/CrayonComponent.cs # Content.Server/Doors/Components/ServerDoorComponent.cs # Content.Server/Explosion/EntitySystems/TriggerSystem.cs # Content.Server/Fluids/Components/MopComponent.cs # Content.Server/Fluids/Components/SpillExtensions.cs # Content.Server/Fluids/EntitySystems/PuddleSystem.cs # Content.Server/Instruments/InstrumentSystem.cs # Content.Server/Nutrition/EntitySystems/DrinkSystem.cs # Content.Server/Nutrition/EntitySystems/FoodSystem.cs # Content.Server/PneumaticCannon/PneumaticCannonSystem.cs # Content.Server/Storage/Components/EntityStorageComponent.cs # Content.Server/Storage/Components/StorageFillComponent.cs # Content.Server/Stunnable/StunbatonSystem.cs # Content.Server/Throwing/ThrowHelper.cs # Content.Server/Weapon/Ranged/Barrels/BarrelSystem.cs # Content.Server/Weapon/Ranged/Barrels/Components/ServerBatteryBarrelComponent.cs # Content.Server/Weapon/Ranged/ServerRangedWeaponComponent.cs # Content.Shared/Containers/ItemSlot/ItemSlotsSystem.cs # Content.Shared/Damage/Components/DamageableComponent.cs # Content.Shared/Damage/Systems/DamageableSystem.cs # Content.Shared/MobState/Components/MobStateComponent.cs # Content.Shared/Slippery/SharedSlipperySystem.cs
This commit is contained in:
@@ -1,10 +1,14 @@
|
||||
using System;
|
||||
using Content.Server.Administration.Logs;
|
||||
using Content.Server.Doors.Components;
|
||||
using Content.Server.Explosion.Components;
|
||||
using Content.Server.Flash;
|
||||
using Content.Server.Flash.Components;
|
||||
using Content.Server.Projectiles.Components;
|
||||
using Content.Shared.Audio;
|
||||
using Content.Shared.Database;
|
||||
using Content.Shared.Doors;
|
||||
using Content.Shared.Throwing;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Shared.Audio;
|
||||
using Robust.Shared.GameObjects;
|
||||
@@ -21,9 +25,9 @@ namespace Content.Server.Explosion.EntitySystems
|
||||
public class TriggerEvent : HandledEntityEventArgs
|
||||
{
|
||||
public EntityUid Triggered { get; }
|
||||
public EntityUid User { get; }
|
||||
public EntityUid? User { get; }
|
||||
|
||||
public TriggerEvent(EntityUid triggered, EntityUid user = default)
|
||||
public TriggerEvent(EntityUid triggered, EntityUid? user = null)
|
||||
{
|
||||
Triggered = triggered;
|
||||
User = user;
|
||||
@@ -35,6 +39,7 @@ namespace Content.Server.Explosion.EntitySystems
|
||||
{
|
||||
[Dependency] private readonly ExplosionSystem _explosions = default!;
|
||||
[Dependency] private readonly FlashSystem _flashSystem = default!;
|
||||
[Dependency] private readonly AdminLogSystem _logSystem = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
@@ -53,11 +58,11 @@ namespace Content.Server.Explosion.EntitySystems
|
||||
{
|
||||
if (!EntityManager.TryGetComponent(uid, out ExplosiveComponent? explosiveComponent)) return;
|
||||
|
||||
Explode(uid, explosiveComponent);
|
||||
Explode(uid, explosiveComponent, args.User);
|
||||
}
|
||||
|
||||
// You really shouldn't call this directly (TODO Change that when ExplosionHelper gets changed).
|
||||
public void Explode(EntityUid uid, ExplosiveComponent component)
|
||||
public void Explode(EntityUid uid, ExplosiveComponent component, EntityUid? user = null)
|
||||
{
|
||||
if (component.Exploding)
|
||||
{
|
||||
@@ -65,7 +70,12 @@ namespace Content.Server.Explosion.EntitySystems
|
||||
}
|
||||
|
||||
component.Exploding = true;
|
||||
_explosions.SpawnExplosion(uid, component.DevastationRange, component.HeavyImpactRange, component.LightImpactRange, component.FlashRange);
|
||||
_explosions.SpawnExplosion(uid,
|
||||
component.DevastationRange,
|
||||
component.HeavyImpactRange,
|
||||
component.LightImpactRange,
|
||||
component.FlashRange,
|
||||
user);
|
||||
EntityManager.QueueDeleteEntity(uid);
|
||||
}
|
||||
#endregion
|
||||
@@ -113,16 +123,23 @@ namespace Content.Server.Explosion.EntitySystems
|
||||
|
||||
private void HandleCollide(EntityUid uid, TriggerOnCollideComponent component, StartCollideEvent args)
|
||||
{
|
||||
Trigger(component.Owner);
|
||||
EntityUid? user = null;
|
||||
if (EntityManager.TryGetComponent(uid, out ProjectileComponent projectile))
|
||||
user = projectile.Shooter;
|
||||
else if (EntityManager.TryGetComponent(uid, out ThrownItemComponent thrown))
|
||||
user = thrown.Thrower;
|
||||
|
||||
Trigger(component.Owner, user);
|
||||
}
|
||||
|
||||
public void Trigger(EntityUid trigger, EntityUid user = default)
|
||||
|
||||
public void Trigger(EntityUid trigger, EntityUid? user = null)
|
||||
{
|
||||
var triggerEvent = new TriggerEvent(trigger, user);
|
||||
EntityManager.EventBus.RaiseLocalEvent(trigger, triggerEvent);
|
||||
}
|
||||
|
||||
public void HandleTimerTrigger(TimeSpan delay, EntityUid triggered, EntityUid user = default)
|
||||
public void HandleTimerTrigger(TimeSpan delay, EntityUid triggered, EntityUid? user = null)
|
||||
{
|
||||
if (delay.TotalSeconds <= 0)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user